r22519 by craig - More nullptr and other conversions

scribus-commit scribus-commit at lists.scribus.net
Thu May 3 21:45:13 UTC 2018


Author: craig
Date: Thu May  3 21:45:13 2018
New Revision: 22519

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22519
Log:
More nullptr and other conversions

Modified:
    trunk/Scribus/scribus/canvasmode_editpolygon.cpp
    trunk/Scribus/scribus/canvasmode_framelinks.cpp
    trunk/Scribus/scribus/collect4output.cpp
    trunk/Scribus/scribus/desaxe/digester.cpp
    trunk/Scribus/scribus/desaxe/digester.h
    trunk/Scribus/scribus/hyphenator.cpp
    trunk/Scribus/scribus/marks.h
    trunk/Scribus/scribus/pdf_analyzer.cpp
    trunk/Scribus/scribus/scpage.cpp
    trunk/Scribus/scribus/scpageoutput.cpp
    trunk/Scribus/scribus/scpainter.cpp
    trunk/Scribus/scribus/scprintengine_gdi.cpp
    trunk/Scribus/scribus/styles/cellstyle.cpp
    trunk/Scribus/scribus/styles/charstyle.cpp
    trunk/Scribus/scribus/styles/linestyle.cpp
    trunk/Scribus/scribus/styles/paragraphstyle.cpp
    trunk/Scribus/scribus/styles/style.cpp
    trunk/Scribus/scribus/styles/tablestyle.cpp
    trunk/Scribus/scribus/util_text.cpp

Modified: trunk/Scribus/scribus/canvasmode_editpolygon.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/canvasmode_editpolygon.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editpolygon.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_editpolygon.cpp	Thu May  3 21:45:13 2018
@@ -71,7 +71,7 @@
 inline bool CanvasMode_EditPolygon::GetItem(PageItem** pi)
 { 
 	*pi = m_doc->m_Selection->itemAt(0);
-	return (*pi) != NULL;
+	return (*pi) != nullptr;
 }
 
 void CanvasMode_EditPolygon::drawControls(QPainter* p)

Modified: trunk/Scribus/scribus/canvasmode_framelinks.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/canvasmode_framelinks.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_framelinks.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_framelinks.cpp	Thu May  3 21:45:13 2018
@@ -62,7 +62,7 @@
 inline bool CanvasMode_FrameLinks::GetItem(PageItem** pi)
 { 
 	*pi = m_doc->m_Selection->itemAt(0); 
-	return (*pi) != NULL; 
+	return (*pi) != nullptr;
 }
 
 void CanvasMode_FrameLinks::drawControls(QPainter* p)
@@ -96,8 +96,8 @@
 			{
 				PageItem* item1 = m_doc->m_Selection->itemAt(i);
 				PageItem* item2 = m_doc->m_Selection->itemAt(i+1);
-				if ((item1 != NULL && item1->asTextFrame()) &&
-				    (item2 != NULL && item2->asTextFrame()) &&
+				if ((item1 != nullptr && item1->asTextFrame()) &&
+					(item2 != nullptr && item2->asTextFrame()) &&
 				     item1->testLinkCandidate(item2))
 				{
 					item1->link(item2);
@@ -185,14 +185,14 @@
 			m_view->DrawNew();
 		return;
 	}
-	PageItem *currItem=NULL, *bb=NULL;
+	PageItem *currItem=nullptr, *bb=nullptr;
 	switch (m_doc->appMode)
 	{
 		case modeLinkFrames:
 			if (m->button() != Qt::LeftButton)
 				break;
 			currItem = m_doc->ElemToLink;
-			if (currItem==NULL)
+			if (currItem==nullptr)
 				break;
 			// #14334: delay selection signals so that (un)link actions get properly enabled/disabled
 			m_doc->m_Selection->delaySignalsOn();
@@ -203,9 +203,9 @@
 				while (bblast->nextInChain())
 					bblast = bblast->nextInChain();
 				
-				if (currItem->nextInChain() == NULL && currItem != bblast) //possibility to insert empty frames into chain
+				if (currItem->nextInChain() == nullptr && currItem != bblast) //possibility to insert empty frames into chain
 				{
-					if (bb->prevInChain() != NULL)
+					if (bb->prevInChain() != nullptr)
 					{
 						ScMessageBox msgBox(QMessageBox::Question, tr("Linking Text Frames"),
 										   "<qt>" + tr("You are trying to insert a frame into an existing text chain, where would you like to insert it?") + "<qt>");
@@ -226,7 +226,7 @@
 						}
 						else if ((QPushButton *) msgBox.clickedButton() == afterButton)
 						{
-							if (bb->nextInChain() != NULL)
+							if (bb->nextInChain() != nullptr)
 							{
 								if (currItem->prevInChain())
 									currItem->prevInChain()->unlink();
@@ -286,7 +286,7 @@
 				}
 			}
 			else
-				m_doc->ElemToLink = NULL;
+				m_doc->ElemToLink = nullptr;
 			m_doc->m_Selection->delaySignalsOff();
 			break;
 		case modeUnlinkFrames:
@@ -436,7 +436,7 @@
 		m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
 	}
 	
-	currItem = NULL;
+	currItem = nullptr;
 	if ((m->modifiers() & SELECT_BENEATH) != 0)
 	{
 		for (int i=0; i < m_doc->m_Selection->count(); ++i)
@@ -509,11 +509,11 @@
 
 void CanvasMode_FrameLinks::createContextMenu(PageItem* currItem, double mx, double my)
 {
-	ContextMenu* cmen=NULL;
+	ContextMenu* cmen=nullptr;
 	m_view->setObjectUndoMode();
 	m_Mxp = mx;
 	m_Myp = my;
-	if(currItem!=NULL)
+	if(currItem!=nullptr)
 	{
 		cmen = new ContextMenu(*(m_doc->m_Selection), m_ScMW, m_doc);
 		cmen->exec(QCursor::pos());

Modified: trunk/Scribus/scribus/collect4output.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/collect4output.cpp
==============================================================================
--- trunk/Scribus/scribus/collect4output.cpp	(original)
+++ trunk/Scribus/scribus/collect4output.cpp	Thu May  3 21:45:13 2018
@@ -192,7 +192,7 @@
 	uint counter = 0;
 	int c=0;
 	QList<PageItem*> allItems;
-	PageItem* ite = NULL;
+	PageItem* ite = nullptr;
 	for (uint lc = 0; lc < 2; ++lc)
 	{
 		switch (lc)

Modified: trunk/Scribus/scribus/desaxe/digester.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/desaxe/digester.cpp
==============================================================================
--- trunk/Scribus/scribus/desaxe/digester.cpp	(original)
+++ trunk/Scribus/scribus/desaxe/digester.cpp	Thu May  3 21:45:13 2018
@@ -95,7 +95,7 @@
 Digester::Digester() : m_objects(), m_storage(), m_errors() 
 { 
 	m_state = new RuleState();
-	m_result_.ptr = NULL;
+	m_result_.ptr = nullptr;
 	m_result_.type = "";
 }
 
@@ -139,7 +139,7 @@
 {
 	m_objects.clear();
 	m_storage.clear();
-	m_result_.ptr = NULL;
+	m_result_.ptr = nullptr;
 	m_result_.type = "";
 	m_errors.clear();
 }
@@ -214,10 +214,10 @@
 }
 
 
-RuleState::RuleState() : rules(), dfa(NULL), stateStack(), valid(false)
+RuleState::RuleState() : rules(), dfa(nullptr), stateStack(), valid(false)
 {}
 
-RuleState::RuleState(const RuleState& other) : rules(other.rules), dfa(NULL), stateStack(), valid(false)
+RuleState::RuleState(const RuleState& other) : rules(other.rules), dfa(nullptr), stateStack(), valid(false)
 {}
 
 RuleState::~RuleState()
@@ -290,7 +290,7 @@
 void RuleState::open(const Xml_string& tag)
 {
 	dfa_state_t nstate = dfa->next(stateStack.back(), tokens[tag]);
-	assert(nstate != NULL);
+	assert(nstate != nullptr);
 #ifdef DESAXE_DEBUG
 	std::cerr << "to state " << nstate->ID << "\n"; 	
 #endif

Modified: trunk/Scribus/scribus/desaxe/digester.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/desaxe/digester.h
==============================================================================
--- trunk/Scribus/scribus/desaxe/digester.h	(original)
+++ trunk/Scribus/scribus/desaxe/digester.h	Thu May  3 21:45:13 2018
@@ -54,9 +54,9 @@
 
 	template<class ObjType>
 	inline
-	void chkcell(const VarPtr& cell, std::vector<VarPtr>* stack = NULL)
-	{
-		ObjType* dummy = NULL;
+	void chkcell(const VarPtr& cell, std::vector<VarPtr>* stack = nullptr)
+	{
+		ObjType* dummy = nullptr;
 		if( cell.type != typeid(dummy).name() )
 		{
 			std::cerr << "requested type '" << typeid(dummy).name() << "' doesn't match cell type '" << cell.type << "'\n";
@@ -213,9 +213,9 @@
 inline
 ObjType*  Digester::result() 
 { 
-	ObjType* dummy = NULL;
+	ObjType* dummy = nullptr;
 	if (m_result_.type != typeid(dummy).name())
-		return NULL;
+		return nullptr;
 #ifdef DESAXE_DEBUG
 	std::cerr << "result-> " << static_cast<ObjType*>(result_.ptr) << "\n";
 #endif
@@ -271,7 +271,7 @@
 		typedef void (*FunType1)(LinkType*);
 		FunType1 fun;
 
-		Patch1(FunType1 fn, Patch* nxt = NULL) : Patch(nxt), fun(fn) {}
+		Patch1(FunType1 fn, Patch* nxt = nullptr) : Patch(nxt), fun(fn) {}
 
 		void run(VarPtr link) 
 		{ 
@@ -287,7 +287,7 @@
 		ObjType* obj;
 		FunType2 fun;
 		
-		Patch2(ObjType* ob, FunType2 fn, Patch* nxt = NULL) : Patch(nxt), obj(ob), fun(fn) {}
+		Patch2(ObjType* ob, FunType2 fn, Patch* nxt = nullptr) : Patch(nxt), obj(ob), fun(fn) {}
 
 		void run(VarPtr link)
 		{
@@ -343,9 +343,9 @@
 	if (cell == m_storage.end())
 	{
 #ifdef DESAXE_DEBUG
-		std::cerr << "lookup[" << idref << "]-> NULL\n";
-#endif
-		return NULL;
+		std::cerr << "lookup[" << idref << "]-> nullptr\n";
+#endif
+		return nullptr;
 	}
 	else
 	{

Modified: trunk/Scribus/scribus/hyphenator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/hyphenator.cpp
==============================================================================
--- trunk/Scribus/scribus/hyphenator.cpp	(original)
+++ trunk/Scribus/scribus/hyphenator.cpp	Thu May  3 21:45:13 2018
@@ -39,8 +39,8 @@
 
 Hyphenator::Hyphenator(QWidget* parent, ScribusDoc *dok) : QObject( parent ),
 	m_doc(dok),
-	m_hdict(NULL),
-	m_codec(NULL),
+	m_hdict(nullptr),
+	m_codec(nullptr),
 	m_automatic(m_doc->hyphAutomatic()),
 	AutoCheck(m_doc->hyphAutoCheck())
 {
@@ -67,7 +67,7 @@
 
 		QFile file(LanguageManager::instance()->getHyphFilename(m_language));
 		
-		if (m_hdict != NULL)
+		if (m_hdict != nullptr)
 			hnj_hyphen_free(m_hdict);
 
 		if (file.open(QIODevice::ReadOnly))
@@ -79,7 +79,7 @@
 		}
 		else
 		{
-			m_hdict = NULL;
+			m_hdict = nullptr;
 			return false;
 		}
 	}
@@ -109,13 +109,13 @@
 
 	QByteArray te = m_codec->fromUnicode(text);
 	char *buffer = static_cast<char*>(malloc(te.length() + 5));
-	if (buffer == NULL)
-		return;
-	char **rep = NULL;
-	int *pos = NULL;
-	int *cut = NULL;
+	if (buffer == nullptr)
+		return;
+	char **rep = nullptr;
+	int *pos = nullptr;
+	int *cut = nullptr;
 	// TODO: support non-standard hyphenation, see hnj_hyphen_hyphenate2 docs
-	if (!hnj_hyphen_hyphenate2(m_hdict, te.data(), te.length(), buffer, NULL, &rep, &pos, &cut))
+	if (!hnj_hyphen_hyphenate2(m_hdict, te.data(), te.length(), buffer, nullptr, &rep, &pos, &cut))
 	{
 		buffer[te.length()] = '\0';
 		it->itemText.hyphenateWord(firstC, text.length(), buffer);
@@ -176,14 +176,14 @@
 
 			QByteArray te = m_codec->fromUnicode(wordLower);
 			char *buffer = static_cast<char*>(malloc(te.length() + 5));
-			if (buffer == NULL)
+			if (buffer == nullptr)
 				break;
 
-			char **rep = NULL;
-			int *pos = NULL;
-			int *cut = NULL;
+			char **rep = nullptr;
+			int *pos = nullptr;
+			int *cut = nullptr;
 			// TODO: support non-standard hyphenation, see hnj_hyphen_hyphenate2 docs
-			if (!hnj_hyphen_hyphenate2(m_hdict, te.data(), te.length(), buffer, NULL, &rep, &pos, &cut))
+			if (!hnj_hyphen_hyphenate2(m_hdict, te.data(), te.length(), buffer, nullptr, &rep, &pos, &cut))
 			{
 	  			int i = 0;
 				buffer[te.length()] = '\0';
@@ -210,7 +210,7 @@
 				if (!ignoredWords.contains(word))
 				{
 					if (!hasHyphen)
-						it->itemText.hyphenateWord(startC + firstC, wordLower.length(), NULL);
+						it->itemText.hyphenateWord(startC + firstC, wordLower.length(), nullptr);
 					else if (m_automatic)
 					{
 						if (specialWords.contains(word))
@@ -308,7 +308,7 @@
 							else
 							{
 								free(buffer);
-								buffer = NULL;
+								buffer = nullptr;
 								prefs->set("Xposition", dia->xpos);
 								prefs->set("Yposition", dia->ypos);
 								delete dia;
@@ -345,11 +345,11 @@
 
 	if (it->itemText.lengthOfSelection() > 0)
 	{
-		it->itemText.hyphenateWord(it->itemText.startOfSelection(), it->itemText.lengthOfSelection(), NULL);
+		it->itemText.hyphenateWord(it->itemText.startOfSelection(), it->itemText.lengthOfSelection(), nullptr);
 	}
 	else {
 		uint a = it->itemText.length();
-		it->itemText.hyphenateWord(0, a, NULL);
+		it->itemText.hyphenateWord(0, a, nullptr);
 	}
 	m_doc->DoDrawing = true;
 }

Modified: trunk/Scribus/scribus/marks.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/marks.h
==============================================================================
--- trunk/Scribus/scribus/marks.h	(original)
+++ trunk/Scribus/scribus/marks.h	Thu May  3 21:45:13 2018
@@ -34,7 +34,7 @@
 	QString itemName;
 	MarkType markTyp;
 	
-	MarkData() : itemPtr(NULL), destmarkType(MARKNoType), notePtr(NULL), markTyp(MARKNoType) {}
+	MarkData() : itemPtr(nullptr), destmarkType(MARKNoType), notePtr(nullptr), markTyp(MARKNoType) {}
 };
 
 class SCRIBUS_API Mark
@@ -66,7 +66,7 @@
 	//for marks to marks - set label and type of target mark from mark pointer
 	void setMark(Mark* mP)
 	{
-		if (mP == NULL)
+		if (mP == nullptr)
 		{
 			data.destmarkName = "";
 			data.destmarkType = MARKNoType;

Modified: trunk/Scribus/scribus/pdf_analyzer.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/pdf_analyzer.cpp
==============================================================================
--- trunk/Scribus/scribus/pdf_analyzer.cpp	(original)
+++ trunk/Scribus/scribus/pdf_analyzer.cpp	Thu May  3 21:45:13 2018
@@ -183,13 +183,13 @@
 		{
 			resources = par->GetIndirectKey("Resources");
 		}
-		colorSpaceRes = resources?resources->GetIndirectKey("ColorSpace"):NULL;
-		xObjects = resources?resources->GetIndirectKey("XObject"):NULL;
-		extGState = resources?resources->GetIndirectKey("ExtGState"):NULL;
-		fontRes = resources?resources->GetIndirectKey("Font"):NULL;
+		colorSpaceRes = resources?resources->GetIndirectKey("ColorSpace"):nullptr;
+		xObjects = resources?resources->GetIndirectKey("XObject"):nullptr;
+		extGState = resources?resources->GetIndirectKey("ExtGState"):nullptr;
+		fontRes = resources?resources->GetIndirectKey("Font"):nullptr;
 
 		// getting the transparency group of this content stream (if available)
-		transGroup = canvasObject?canvasObject->GetIndirectKey("Group"):NULL;
+		transGroup = canvasObject?canvasObject->GetIndirectKey("Group"):nullptr;
 		if (transGroup)
 		{
 			PdfObject* subtype = transGroup->GetIndirectKey("S");
@@ -499,7 +499,7 @@
 						if (args.size() == 1 && args[0].IsName() && xObjects)
 						{
 							PdfObject* xObject = xObjects->GetIndirectKey(args[0].GetName());
-							PdfObject* subtypeObject = xObject?xObject->GetIndirectKey("Subtype"):NULL;
+							PdfObject* subtypeObject = xObject?xObject->GetIndirectKey("Subtype"):nullptr;
 							if (subtypeObject && subtypeObject->IsName())
 							{
 								if (subtypeObject->GetName() == "Image")
@@ -774,7 +774,7 @@
 		{
 			currFont.fontType = F_Type3;
 			currFont.isEmbedded = true;
-			fontDesc = NULL;
+			fontDesc = nullptr;
 		}
 		else if (subtype->GetName() == "Type0")
 		{

Modified: trunk/Scribus/scribus/scpage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/scpage.cpp
==============================================================================
--- trunk/Scribus/scribus/scpage.cpp	(original)
+++ trunk/Scribus/scribus/scpage.cpp	Thu May  3 21:45:13 2018
@@ -38,7 +38,7 @@
 
 ScPage::ScPage(const double x, const double y, const double b, const double h) :
 	UndoObject(QObject::tr("Page")),
-	SingleObservable<ScPage>(NULL),
+	SingleObservable<ScPage>(nullptr),
 	Margins(40,40,40,40),
 	initialMargins(40,40,40,40),
 	LeftPg(0),
@@ -52,7 +52,7 @@
 	m_initialWidth(b),
 	m_initialHeight(h),
 	m_PageName(""),
-	m_Doc(NULL)
+	m_Doc(nullptr)
 {
 	guides.setPage(this);
 	marginPreset = 0;
@@ -81,7 +81,7 @@
 void ScPage::setDocument(ScribusDoc *doc)
 {
 	m_Doc=doc;
-	setMassObservable(doc? doc->pagesChanged() : NULL);
+	setMassObservable(doc? doc->pagesChanged() : nullptr);
 }
 
 void ScPage::setPageNr(int pageNr)
@@ -492,7 +492,7 @@
 
 void ScPage::copySizingProperties(ScPage* sourcePage, const MarginStruct& pageMargins)
 {
-	if (sourcePage==NULL)
+	if (sourcePage==nullptr)
 		return;
 	m_pageSize = sourcePage->m_pageSize;
 	m_orientation = sourcePage->m_orientation;

Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp	(original)
+++ trunk/Scribus/scribus/scpageoutput.cpp	Thu May  3 21:45:13 2018
@@ -760,7 +760,7 @@
 		else
 		{
 			ScImage scImg;
-			ScImage* pImage = NULL;
+			ScImage* pImage = nullptr;
 			double imScaleX = item->imageXScale();
 			double imScaleY = item->imageYScale();
 			if (m_reloadImages)

Modified: trunk/Scribus/scribus/scpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/scpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainter.cpp	(original)
+++ trunk/Scribus/scribus/scpainter.cpp	Thu May  3 21:45:13 2018
@@ -26,9 +26,9 @@
 {
 	Q_ASSERT(w>=0);
 	Q_ASSERT(h>=0);
-	m_maskPattern = NULL;
-	m_pattern = NULL;
-	m_imageMask = NULL;
+	m_maskPattern = nullptr;
+	m_pattern = nullptr;
+	m_imageMask = nullptr;
 	m_image = target;
 	m_layerTransparency = transparency;
 	m_blendMode = blendmode;
@@ -125,7 +125,7 @@
 	la.mask_gradientSkew = m_mask_gradientSkew;
 	la.mask_gradient = mask_gradient;
 	la.maskPattern = m_maskPattern;
-	if (clipArray != NULL)
+	if (clipArray != nullptr)
 		la.groupClip = *clipArray;
 	la.data = cairo_get_group_target(m_cr);
 	la.fillRule = m_fillRule;
@@ -752,10 +752,10 @@
 	}
 	else if (m_fillMode == 2)
 	{
-		cairo_pattern_t *pat = NULL;
-		cairo_surface_t *img = NULL;
-		cairo_t *cr = NULL;
-		cairo_pattern_t *mpat = NULL;
+		cairo_pattern_t *pat = nullptr;
+		cairo_surface_t *img = nullptr;
+		cairo_t *cr = nullptr;
+		cairo_pattern_t *mpat = nullptr;
 		if (fill_gradient.type() == VGradient::fourcolor)
 		{
 			double p1x = gradPatchP1.x();
@@ -1297,7 +1297,7 @@
 	if( m_array.count() > 0 )
 		cairo_set_dash( m_cr, m_array.data(), m_array.count(), m_offset);
 	else
-		cairo_set_dash( m_cr, NULL, 0, 0 );
+		cairo_set_dash( m_cr, nullptr, 0, 0 );
 	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
 	if( PLineEnd == Qt::RoundCap )
 		cairo_set_line_cap (m_cr, CAIRO_LINE_CAP_ROUND);
@@ -1664,10 +1664,10 @@
 	assert(!m_font.isNone());
 
 #if CAIRO_HAS_FC_FONT
-	FcPattern *pattern = FcPatternBuild(NULL,
+	FcPattern *pattern = FcPatternBuild(nullptr,
 										FC_FILE, FcTypeString, QFile::encodeName(m_font.fontFilePath()).data(),
 										FC_INDEX, FcTypeInteger, m_font.faceIndex(),
-										NULL);
+										nullptr);
 	cairo_font_face_t *cairo_face = cairo_ft_font_face_create_for_pattern(pattern);
 	FcPatternDestroy(pattern);
 

Modified: trunk/Scribus/scribus/scprintengine_gdi.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/scprintengine_gdi.cpp
==============================================================================
--- trunk/Scribus/scribus/scprintengine_gdi.cpp	(original)
+++ trunk/Scribus/scribus/scprintengine_gdi.cpp	Thu May  3 21:45:13 2018
@@ -124,7 +124,7 @@
 	setDeviceParams(&doc, options, (DEVMODEW*) devMode.data());
 		
 	// Create the device context
-	printerDC = CreateDCW(NULL, (LPCWSTR) printerName.utf16(), NULL, (DEVMODEW*) devMode.data());
+	printerDC = CreateDCW(nullptr, (LPCWSTR) printerName.utf16(), nullptr, (DEVMODEW*) devMode.data());
 	if (printerDC)
 	{
 		success = printPages(&doc, options, printerDC, (DEVMODEW*) devMode.data(), fileName);
@@ -142,7 +142,7 @@
 bool ScPrintEngine_GDI::gdiPrintPreview(ScribusDoc* doc, ScPage* page, QImage* image, PrintOptions& options, double scale)
 {
 	bool success = true;
-	HCOLORSPACE hColorSpace  = NULL;
+	HCOLORSPACE hColorSpace  = nullptr;
 	int imagew, imageh;
 	double scalex = 1, scaley = 1;
 	bool rotate = false;
@@ -206,7 +206,7 @@
 {
 	int  jobId;
 	QScopedPointer<MultiProgressDialog> progress;
-	PrintPageFunc printPageFunc = NULL;
+	PrintPageFunc printPageFunc = nullptr;
 	bool  success = true;
 	WCHAR docName[512];
 	DOCINFOW docInfo;
@@ -223,12 +223,12 @@
 	ZeroMemory(&docInfo, sizeof(docInfo));
 	docInfo.cbSize = sizeof(docInfo);
 	docInfo.lpszDocName = docName;
-	docInfo.lpszOutput  = (LPCWSTR) (fileName.length() > 0 ? fileName.utf16() : NULL);
-	docInfo.lpszDatatype = NULL;
+	docInfo.lpszOutput  = (LPCWSTR) (fileName.length() > 0 ? fileName.utf16() : nullptr);
+	docInfo.lpszDatatype = nullptr;
 	docInfo.fwType = 0;
 
-	cairo_surface_t* prnSurface = NULL;
-	cairo_t* context            = NULL;
+	cairo_surface_t* prnSurface = nullptr;
+	cairo_t* context            = nullptr;
 	if (printPageFunc == &ScPrintEngine_GDI::printPage_GDI)
 	{
 		prnSurface = cairo_win32_printing_surface_create(printerDC);
@@ -300,7 +300,7 @@
 	bool success = true;
 	QString inputProfile;
 	QString printerProfile;
-	HCOLORSPACE hColorSpace = NULL;
+	HCOLORSPACE hColorSpace = nullptr;
 	double scalex = 1, scaley = 1;
 	bool rotate = false;
 
@@ -531,7 +531,7 @@
 	scaley = -logPixelsY / 72.0;
 	sprintf((char*) sps.data, "%0.3f %0.3f scale\n", scalex, scaley);
 	sps.numBytes = strlen((char*) sps.data);
-	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0)
+	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, nullptr) <= 0)
 		return false;
 
 	// Set some necessary stuff for embedding ps into ps
@@ -550,13 +550,13 @@
 	eBegin += "} if } if\n";
 	sprintf((char*) sps.data, "%s", eBegin.toLatin1().data());
 	sps.numBytes = strlen((char*) sps.data);
-	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0)
+	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, nullptr) <= 0)
 		return false;
 
 	// Match Postscript and GDI coordinate system
 	sprintf((char*) sps.data, "0 %0.3f neg translate\n", (double) physicalHeight);
 	sps.numBytes = strlen((char*) sps.data);
-	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0)
+	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, nullptr) <= 0)
 		return false;
 
 	// In case of landscape printing, pslib will rotate the page
@@ -565,7 +565,7 @@
 	{
 		sprintf((char*) sps.data, "-90 rotate %0.3f %0.3f translate\n", (double) -pageHeight, 0.0);
 		sps.numBytes = strlen((char*) sps.data);
-		if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0)
+		if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, nullptr) <= 0)
 			return false;
 		transx = (physicalHeight - pageHeight) / -2.0;
 		transy = (physicalWidth  - pageWidth) / 2.0;
@@ -579,12 +579,12 @@
 	// Center the printed page in paper zone
 	sprintf((char*) sps.data, "%0.3f %0.3f translate\n", transx, transy);
 	sps.numBytes = strlen((char*) sps.data);
-	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0)
+	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, nullptr) <= 0)
 		return false;
 
 	sprintf((char*) sps.data, "%s: %s\n", "%%BeginDocument", file.fileName().toLocal8Bit().data());
 	sps.numBytes = strlen((char*) sps.data);
-	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0)
+	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, nullptr) <= 0)
 		return false;
 
 	if (!file.open(QIODevice::ReadOnly))
@@ -595,7 +595,7 @@
 	while (br > 0)
 	{
 		sps.numBytes = br;
-		if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0)
+		if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, nullptr) <= 0)
 			break;
 		bw += br;
 		br = file.read((char*) sps.data, sizeof(sps.data));
@@ -604,7 +604,7 @@
 
 	sprintf((char*) sps.data, "%s", "\n%%EndDocument\n");
 	sps.numBytes = strlen((char*) sps.data);
-	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0)
+	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, nullptr) <= 0)
 		return false;
 
 	// Set some necessary stuff for embedding ps into ps
@@ -613,7 +613,7 @@
 	eEnd += "b4_Inc_state restore\n";
 	sprintf((char*) sps.data, "%s", eEnd.toLatin1().data());
 	sps.numBytes = strlen((char*) sps.data);
-	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0)
+	if (ExtEscape(printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, nullptr) <= 0)
 		return false;
 
 	return ((fileSize == bw) && (br >= 0));
@@ -635,7 +635,7 @@
 		devMode->dmFields |= DM_DITHERTYPE;
 	}
 
-	OpenPrinterW((LPWSTR) printer.utf16(), &handle, NULL);
+	OpenPrinterW((LPWSTR) printer.utf16(), &handle, nullptr);
 	DocumentPropertiesW((HWND) doc->scMW()->winId(), handle, (LPWSTR) printer.utf16(), devMode, devMode, DM_IN_BUFFER | DM_OUT_BUFFER);
 	ClosePrinter(handle);
 }
@@ -671,10 +671,10 @@
 	else
 	{
 		DWORD numPrinters;
-		PRINTER_INFO_2W* printerInfos = NULL;
-		EnumPrintersW (PRINTER_ENUM_DEFAULT, NULL, 2, NULL, 0, &buffSize, &numPrinters);
+		PRINTER_INFO_2W* printerInfos = nullptr;
+		EnumPrintersW (PRINTER_ENUM_DEFAULT, nullptr, 2, nullptr, 0, &buffSize, &numPrinters);
 		printerInfos = (PRINTER_INFO_2W*) malloc(buffSize);
-		if (EnumPrintersW (PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE) printerInfos, buffSize, &buffSize, &returned))
+		if (EnumPrintersW (PRINTER_ENUM_LOCAL, nullptr, 2, (LPBYTE) printerInfos, buffSize, &buffSize, &returned))
 		{
 			if (returned > 0)
 			{
@@ -696,18 +696,18 @@
 	
 	// Test printer support for the POSTSCRIPT_PASSTHROUGH escape (available since win2k)
 	escapeCode = POSTSCRIPT_PASSTHROUGH;
-	if (ExtEscape(dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, NULL) > 0)
+	if (ExtEscape(dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, nullptr) > 0)
 		return true;
 	// Test printer support  for the POSTSCRIPT_DATA escape (available since win95)
 	escapeCode = POSTSCRIPT_DATA;
-	if (ExtEscape(dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, NULL) > 0)
+	if (ExtEscape(dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, nullptr) > 0)
 		return true;
 	// Test the printer technology
 	escapeCode = GETTECHNOLOGY;
-	if (ExtEscape(dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, NULL) > 0)
+	if (ExtEscape(dc, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, nullptr) > 0)
 	{
 		// If GETTECHNOLOGY is supported, then ... get technology
-		if (ExtEscape(dc, GETTECHNOLOGY, 0, NULL, MAX_PATH, (LPSTR) technology) > 0)
+		if (ExtEscape(dc, GETTECHNOLOGY, 0, nullptr, MAX_PATH, (LPSTR) technology) > 0)
 		{
 			// Check technology string for postscript word
 			strupr(technology);
@@ -726,15 +726,15 @@
 		return 0;
 	// Test printer support for the POSTSCRIPT_PASSTHROUGH escape (available since win2k)
 	escapeCode = POSTSCRIPT_PASSTHROUGH;
-	if (ExtEscape(printerDC, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, NULL) > 0)
+	if (ExtEscape(printerDC, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, nullptr) > 0)
 		return POSTSCRIPT_PASSTHROUGH;
 	// Test printer support for the POSTSCRIPT_DATA escape (available since win95)
 	escapeCode = POSTSCRIPT_DATA;
-	if (ExtEscape(printerDC, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, NULL) > 0)
+	if (ExtEscape(printerDC, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, nullptr) > 0)
 		return POSTSCRIPT_DATA;
 	// Test printer support for the PASSTHROUGH escape
 	escapeCode = PASSTHROUGH;
-	if (ExtEscape(printerDC, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, NULL) > 0)
+	if (ExtEscape(printerDC, QUERYESCSUPPORT, sizeof(int), (LPCSTR) &escapeCode, 0, nullptr) > 0)
 		return PASSTHROUGH;
 	return 0;
 }
@@ -746,12 +746,12 @@
  HANDLE prnHandle;
  DWORD size = 0;
 
-	done = OpenPrinterW((LPWSTR) printerName.utf16(), &prnHandle, NULL);
+    done = OpenPrinterW((LPWSTR) printerName.utf16(), &prnHandle, nullptr);
 	if (!done)
 		return false;
 	
 	// Get buffer size for the PRINTER_INFO_2 structure
-	GetPrinterW(prnHandle, 2, NULL, 0, &size);
+	GetPrinterW(prnHandle, 2, nullptr, 0, &size);
 	if (size > 0)
 	{
 		PRINTER_INFO_2W* pInfos = (PRINTER_INFO_2W*) malloc(size);

Modified: trunk/Scribus/scribus/styles/cellstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/styles/cellstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/cellstyle.cpp	(original)
+++ trunk/Scribus/scribus/styles/cellstyle.cpp	Thu May  3 21:45:13 2018
@@ -64,7 +64,7 @@
 
 void CellStyle::getNamedResources(ResourceCollection& lists) const
 {
-	for (const BaseStyle* style = parentStyle(); style != NULL; style = style->parentStyle())
+	for (const BaseStyle* style = parentStyle(); style != nullptr; style = style->parentStyle())
 		lists.collectCellStyle(style->name());
 	lists.collectColor(fillColor());
 	// TODO: Collect border colors.

Modified: trunk/Scribus/scribus/styles/charstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/styles/charstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/charstyle.cpp	(original)
+++ trunk/Scribus/scribus/styles/charstyle.cpp	Thu May  3 21:45:13 2018
@@ -395,7 +395,7 @@
 
 void CharStyle::getNamedResources(ResourceCollection& lists) const
 {
-	for (const BaseStyle* sty = parentStyle(); sty != NULL; sty = sty->parentStyle())
+	for (const BaseStyle* sty = parentStyle(); sty != nullptr; sty = sty->parentStyle())
 		lists.collectCharStyle(sty->name());
 	lists.collectColor(fillColor());
 	lists.collectFontfeatures(fontFeatures());
@@ -424,7 +424,7 @@
 		setParent(it.value());
 
 	if (!inh_Font && (it = newNames.fonts().find(font().scName())) != newNames.fonts().end())
-		setFont(newNames.availableFonts->findFont(it.value(), NULL));
+		setFont(newNames.availableFonts->findFont(it.value(), nullptr));
 	updateFeatures();
 }
 

Modified: trunk/Scribus/scribus/styles/linestyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/styles/linestyle.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/linestyle.cpp	(original)
+++ trunk/Scribus/scribus/styles/linestyle.cpp	Thu May  3 21:45:13 2018
@@ -129,7 +129,7 @@
 	QList<LineStyle>::const_iterator it, itend = m_Sublines.constEnd();
 
 	lists.collectColor(color());
-	for (const BaseStyle* sty = parentStyle(); sty != NULL; sty = sty->parentStyle())
+	for (const BaseStyle* sty = parentStyle(); sty != nullptr; sty = sty->parentStyle())
 		lists.collectLineStyle(sty->name());
 	for (it = m_Sublines.begin(); it != itend; ++it)
 		(*it).getNamedResources(lists);

Modified: trunk/Scribus/scribus/styles/paragraphstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/styles/paragraphstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/paragraphstyle.cpp	(original)
+++ trunk/Scribus/scribus/styles/paragraphstyle.cpp	Thu May  3 21:45:13 2018
@@ -27,7 +27,7 @@
 	return isequiv(tabPosition, other.tabPosition) && tabType==other.tabType && tabFillChar == other.tabFillChar;
 }
 
-ParagraphStyle::ParagraphStyle() : BaseStyle(), m_cstyleContext(NULL), m_cstyleContextIsInh(true), m_cstyle()
+ParagraphStyle::ParagraphStyle() : BaseStyle(), m_cstyleContext(nullptr), m_cstyleContextIsInh(true), m_cstyle()
 {
 	setParent("");
 	m_cstyleContext.setDefaultStyle( &m_cstyle );
@@ -42,10 +42,10 @@
 }
 
 
-ParagraphStyle::ParagraphStyle(const ParagraphStyle& other) : BaseStyle(other), m_cstyleContext(NULL), m_cstyleContextIsInh(other.m_cstyleContextIsInh), m_cstyle(other.charStyle())
+ParagraphStyle::ParagraphStyle(const ParagraphStyle& other) : BaseStyle(other), m_cstyleContext(nullptr), m_cstyleContextIsInh(other.m_cstyleContextIsInh), m_cstyle(other.charStyle())
 {
 	if (m_cstyleContextIsInh)
-		m_cstyle.setContext(NULL);
+		m_cstyle.setContext(nullptr);
 	else
 		m_cstyle.setContext(other.charStyle().context());
 	m_cstyleContext.setDefaultStyle( &m_cstyle );
@@ -124,7 +124,7 @@
 	if (m_cstyleContextIsInh)
 	{
 		const ParagraphStyle * parent = reinterpret_cast<const ParagraphStyle*> ( parentStyle() );
-		m_cstyle.setContext(parent ? parent->charStyleContext() : NULL);
+		m_cstyle.setContext(parent ? parent->charStyleContext() : nullptr);
 	}
 	else
 	{
@@ -151,7 +151,7 @@
 {
 	if (m_cstyleContextIsInh) {
 		const ParagraphStyle * newParent = reinterpret_cast<const ParagraphStyle*> ( parentStyle() );
-		m_cstyle.setContext(newParent ? newParent->charStyleContext() : NULL);
+		m_cstyle.setContext(newParent ? newParent->charStyleContext() : nullptr);
 	}
 }
 
@@ -233,7 +233,7 @@
 
 void ParagraphStyle::getNamedResources(ResourceCollection& lists) const
 {
-	for (const BaseStyle *sty = parentStyle(); sty != NULL; sty = sty->parentStyle())
+	for (const BaseStyle *sty = parentStyle(); sty != nullptr; sty = sty->parentStyle())
 		lists.collectStyle(sty->name());
 	charStyle().getNamedResources(lists);
 

Modified: trunk/Scribus/scribus/styles/style.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/styles/style.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/style.cpp	(original)
+++ trunk/Scribus/scribus/styles/style.cpp	Thu May  3 21:45:13 2018
@@ -63,9 +63,9 @@
 { 
 	//qDebug() << QString("follow %1").arg(reinterpret_cast<uint>(m_context),16);
 	if (m_isDefaultStyle)
-		return NULL;
-	const BaseStyle * par = m_context ? m_context->resolve(m_parent) : NULL;
-	if (par == this) return NULL; else return par;
+		return nullptr;
+	const BaseStyle * par = m_context ? m_context->resolve(m_parent) : nullptr;
+	if (par == this) return nullptr; else return par;
 }
 
 bool BaseStyle::canInherit(const QString& parentName) const
@@ -89,7 +89,7 @@
 			parentLoop = true;
 			break;
 		}
-		pStyle = pStyle->hasParent() ? pStyle->parentStyle() : NULL;
+		pStyle = pStyle->hasParent() ? pStyle->parentStyle() : nullptr;
 	}
 
 	return (!parentLoop);

Modified: trunk/Scribus/scribus/styles/tablestyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/styles/tablestyle.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/tablestyle.cpp	(original)
+++ trunk/Scribus/scribus/styles/tablestyle.cpp	Thu May  3 21:45:13 2018
@@ -63,7 +63,7 @@
 
 void TableStyle::getNamedResources(ResourceCollection& lists) const
 {
-	for (const BaseStyle* style = parentStyle(); style != NULL; style = style->parentStyle())
+	for (const BaseStyle* style = parentStyle(); style != nullptr; style = style->parentStyle())
 		lists.collectCellStyle(style->name());
 	lists.collectColor(fillColor());
 	// TODO: Collect colors of borders.

Modified: trunk/Scribus/scribus/util_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22519&path=/trunk/Scribus/scribus/util_text.cpp
==============================================================================
--- trunk/Scribus/scribus/util_text.cpp	(original)
+++ trunk/Scribus/scribus/util_text.cpp	Thu May  3 21:45:13 2018
@@ -62,7 +62,7 @@
 	dig->parseMemory(saxedString);
 
 	StoryText* story = dig->result<StoryText>();
-	assert (story != NULL);
+	assert (story != nullptr);
 
 	StoryText res = *story;
 	res.setDoc(doc);




More information about the scribus-commit mailing list