r22538 by craig - More nullptr and other conversions

scribus-commit scribus-commit at lists.scribus.net
Sat May 12 20:40:22 UTC 2018


Author: craig
Date: Sat May 12 20:40:22 2018
New Revision: 22538

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

Modified:
    trunk/Scribus/scribus/old/mspinbox.cpp
    trunk/Scribus/scribus/plugins/scripter/api_document.cpp
    trunk/Scribus/scribus/plugins/scripter/api_imageitem.cpp
    trunk/Scribus/scribus/plugins/scripter/api_item.cpp
    trunk/Scribus/scribus/plugins/scripter/api_printer.cpp
    trunk/Scribus/scribus/plugins/scripter/api_textitem.cpp
    trunk/Scribus/scribus/plugins/scripter/pythonize.cpp
    trunk/Scribus/scribus/plugins/scripter/scripterimpl.cpp

Modified: trunk/Scribus/scribus/old/mspinbox.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22538&path=/trunk/Scribus/scribus/old/mspinbox.cpp
==============================================================================
--- trunk/Scribus/scribus/old/mspinbox.cpp	(original)
+++ trunk/Scribus/scribus/old/mspinbox.cpp	Sat May 12 20:40:22 2018
@@ -303,7 +303,7 @@
 	int ret = fp.Parse(ts.latin1(), "", true);
 	if (ret >= 0)
 		return 0;
-	double erg = fp.Eval(NULL);
+	double erg = fp.Eval(nullptr);
 	return qRound(erg*Decimals);
 }
 

Modified: trunk/Scribus/scribus/plugins/scripter/api_document.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22538&path=/trunk/Scribus/scribus/plugins/scripter/api_document.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/api_document.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scripter/api_document.cpp	Sat May 12 20:40:22 2018
@@ -38,7 +38,7 @@
  */
 QString DocumentAPI::getName()
 {
-	if (!check()) return NULL;
+	if (!check()) return nullptr;
 	if (! ScCore->primaryMainWindow()->doc->hasName)
 	{
 		return QString("");
@@ -91,7 +91,7 @@
 
 bool DocumentAPI::modified()
 {
-	if (!check()) return NULL;
+	if (!check()) return nullptr;
 	return ScCore->primaryMainWindow()->doc->isModified();
 }
 
@@ -123,7 +123,7 @@
  */
 bool DocumentAPI::close()
 {
-	if (!check()) return NULL;
+	if (!check()) return nullptr;
 	setModified(false);
 	bool ret = ScCore->primaryMainWindow()->slotFileClose();
 	qApp->processEvents();
@@ -137,7 +137,7 @@
  */
 bool DocumentAPI::save()
 {
-	if (!check()) return NULL;
+	if (!check()) return nullptr;
 	bool ret = ScCore->primaryMainWindow()->slotFileSave();
 	qApp->processEvents();
 	return ret;
@@ -150,12 +150,12 @@
  */
 bool DocumentAPI::saveAs(QString name)
 {
-	if (!check()) return NULL;
+	if (!check()) return nullptr;
 	bool ret = ScCore->primaryMainWindow()->DoFileSave(name);
 	if (!ret)
 	{
 		RAISE("Failed to save document.");
-		return NULL;
+		return nullptr;
 	}
 	return true;
 }
@@ -191,7 +191,7 @@
 QObject *DocumentAPI::activeItem()
 {
 	if (ScCore->primaryMainWindow()->doc->m_Selection->count() == 0)
-		return NULL;
+		return nullptr;
 	else
 	{
 		PageItem* item = ScCore->primaryMainWindow()->doc->m_Selection->itemAt(0);
@@ -375,7 +375,7 @@
 			return new LayerAPI(L);
 		}
 	}
-	return NULL;
+	return nullptr;
 }
 
 QString DocumentAPI::getActiveLayerName()
@@ -587,7 +587,7 @@
 	if (!check())
 		RAISE("No document open");
 	PageItem *i = GetUniqueItem(name);
-	if (i == NULL)
+	if (i == nullptr)
 	{
 		RAISE("No item with this name");
 	}
@@ -605,7 +605,7 @@
 	if (!check())
 		return;
 	PageItem *i = GetUniqueItem(name);
-	if (i == NULL)
+	if (i == nullptr)
 	{
 		RAISE("Unable to find the item.");
 		return;
@@ -674,10 +674,10 @@
 			// so anyway.
 			name = list[i].toString();
 			PageItem *ic = GetUniqueItem(name);
-			if (ic == NULL)
+			if (ic == nullptr)
 			{
 				delete tempSelection;
-				return NULL;
+				return nullptr;
 			}
 			tempSelection->addItem(ic, true);
 		}
@@ -691,14 +691,14 @@
 		RAISE("Cannot group less than two items");
 		finalSelection=0;
 		delete tempSelection;
-		return NULL;
+		return nullptr;
 	}
 
 	const PageItem* group = ScCore->primaryMainWindow()->doc->itemSelection_GroupObjects(false, false, finalSelection);
 	finalSelection=0;
 	delete tempSelection;
 
-	return (group ? group->itemName() : NULL);
+	return (group ? group->itemName() : nullptr);
 }
 
 void DocumentAPI::unGroupItems(QString name)
@@ -706,7 +706,7 @@
 	if (!check())
 		RAISE("No document open");
 	PageItem *i = GetUniqueItem(name);
-	if (i == NULL)
+	if (i == nullptr)
 		RAISE("Item not found.");
 	ScCore->primaryMainWindow()->view->Deselect();
 	ScCore->primaryMainWindow()->view->SelectItem(i);
@@ -723,7 +723,7 @@
 		return;
 	}
 	PageItem *i = GetUniqueItem(name);
-	if (i == NULL)
+	if (i == nullptr)
 		return;
 	ScCore->primaryMainWindow()->view->Deselect();
 	ScCore->primaryMainWindow()->view->SelectItem(i);

Modified: trunk/Scribus/scribus/plugins/scripter/api_imageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22538&path=/trunk/Scribus/scribus/plugins/scripter/api_imageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/api_imageitem.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scripter/api_imageitem.cpp	Sat May 12 20:40:22 2018
@@ -68,7 +68,7 @@
 {
     if (!checkHaveDocument())
         RAISE("No document open");
-    if (item == NULL)
+	if (item == nullptr)
         return;
     if (! item->asImageFrame())
     {
@@ -89,7 +89,7 @@
 {
 	if (!checkHaveDocument())
 		RAISE("No document open");
-	if (item == NULL)
+	if (item == nullptr)
 		return;
 	if (!item->asImageFrame())
 	{
@@ -103,7 +103,7 @@
 {
 	if (!checkHaveDocument())
 		RAISE("No document open");
-	if (item == NULL)
+	if (item == nullptr)
 		return;
 	if (! item->asImageFrame())
 	{
@@ -131,7 +131,7 @@
 {
 	if (!checkHaveDocument())
 		RAISE("No document open");
-	if (item == NULL)
+	if (item == nullptr)
 		return;
 	if (! item->asImageFrame())
 	{
@@ -166,7 +166,7 @@
 {
 	if (!checkHaveDocument())
 		RAISE("No document open");
-	if (item == NULL)
+	if (item == nullptr)
 		return ;
 	if (! item->asImageFrame())
 	{
@@ -189,7 +189,7 @@
 {
 	if (!checkHaveDocument())
 		RAISE("No document open.");
-	if (item == NULL)
+	if (item == nullptr)
 		return;
 	if (! item->asImageFrame())
 	{

Modified: trunk/Scribus/scribus/plugins/scripter/api_item.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22538&path=/trunk/Scribus/scribus/plugins/scripter/api_item.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/api_item.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scripter/api_item.cpp	Sat May 12 20:40:22 2018
@@ -291,7 +291,7 @@
 {
 	if (!checkHaveDocument())
 		return;
-	if (item==NULL)
+	if (item==nullptr)
 		return;
 	// Grab the old selection - but use it only where is there any
 	Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
@@ -325,7 +325,7 @@
 {
 	if (!checkHaveDocument())
 		return;
-	if (item == NULL)
+	if (item == nullptr)
 		return;
 	// Grab the old selection - but use it only where is there any
 	Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
@@ -357,7 +357,7 @@
 {
 	if (!checkHaveDocument())
 		return;
-	if (item == NULL)
+	if (item == nullptr)
 		return;
 	ScCore->primaryMainWindow()->doc->sizeItem(ValueToPoint(width), ValueToPoint(height), item);
 }
@@ -366,7 +366,7 @@
 {
 	if (!checkHaveDocument())
 		return;
-	if (item == NULL)
+	if (item == nullptr)
 		return;
 	ScCore->primaryMainWindow()->doc->rotateItem(item->rotation() - rot, item);
 
@@ -375,7 +375,7 @@
 {
 	if (!checkHaveDocument())
 		return;
-	if (item == NULL)
+	if (item == nullptr)
 		return;
 	ScCore->primaryMainWindow()->doc->rotateItem(rot * -1.0, item);
 }

Modified: trunk/Scribus/scribus/plugins/scripter/api_printer.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22538&path=/trunk/Scribus/scribus/plugins/scripter/api_printer.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/api_printer.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scripter/api_printer.cpp	Sat May 12 20:40:22 2018
@@ -129,7 +129,7 @@
 #endif
 
 	PSLib *dd = new PSLib(options, true, prefsManager->appPrefs.fontPrefs.AvailFonts, ReallyUsed, ScCore->primaryMainWindow()->doc->PageColors, false, true);
-	if (dd != NULL)
+	if (dd != nullptr)
 	{
 		if (!fil)
 			fna = QDir::toNativeSeparators(ScPaths::tempFileDir()+"/tmp.ps");

Modified: trunk/Scribus/scribus/plugins/scripter/api_textitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22538&path=/trunk/Scribus/scribus/plugins/scripter/api_textitem.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/api_textitem.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scripter/api_textitem.cpp	Sat May 12 20:40:22 2018
@@ -56,7 +56,7 @@
 		for (int b = 0; b < item->itemText.length(); b++)
 			if (item->itemText.selected(b))
 				return item->itemText.charStyle(b).font().scName();
-		return NULL;
+		return nullptr;
 	}
 	else
 		return item->currentCharStyle().font().scName();
@@ -89,7 +89,7 @@
 		for (int b = 0; b < item->itemText.length(); b++)
 			if (item->itemText.selected(b))
 				return item->itemText.charStyle(b).fontSize() / 10.0;
-		return NULL;
+		return nullptr;
 	}
 	else
 	{
@@ -392,7 +392,7 @@
 		RAISE("No document open");
 
 	PageItem *toitem = GetUniqueItem(name2);
-	if (toitem == NULL)
+	if (toitem == nullptr)
 		return;
 	if (!(toitem->asTextFrame()))
 	{

Modified: trunk/Scribus/scribus/plugins/scripter/pythonize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22538&path=/trunk/Scribus/scribus/plugins/scripter/pythonize.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/pythonize.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scripter/pythonize.cpp	Sat May 12 20:40:22 2018
@@ -36,7 +36,7 @@
 Pythonize::Pythonize ()
 {
     pythonInit  = 1;
-    objects    = NULL;
+	objects    = nullptr;
 
     if (debug) printf ("\n\nPythonize constructor -- pid = %i\n", getpid ());
 
@@ -64,10 +64,10 @@
 
     if (debug) printf ("Running script: %s\n", scriptPath);
 
-    if (scriptPath == NULL || strlen (scriptPath) == 0) return false;
+	if (scriptPath == nullptr || strlen (scriptPath) == 0) return false;
 
     f = fopen (scriptPath, "r");
-    if (f == NULL) return false;
+	if (f == nullptr) return false;
 
     res = PyRun_SimpleFile (f, scriptPath);
 
@@ -80,7 +80,7 @@
 {
 
     if (!PyCallable_Check (object))
-        return NULL;
+		return nullptr;
 
     PyObject *res = PyObject_CallObject (object, args ? args : PyTuple_New (0));
     Py_XINCREF (res);
@@ -92,7 +92,7 @@
 {
 
     if (!PyCallable_Check (object))
-        return NULL;
+		return nullptr;
 
     PyObject *pyRes = PyObject_CallObject (object, args ? args : PyTuple_New (0));
     void *res = PyLong_AsVoidPtr (pyRes);
@@ -102,7 +102,7 @@
 
 bool Pythonize::runString (char *str)
 {
-    if (str == NULL || strlen (str) == 0) return false;
+	if (str == nullptr || strlen (str) == 0) return false;
 
     int res = PyRun_SimpleString (str);
 
@@ -111,7 +111,7 @@
 
 bool Pythonize::appendToSysPath (const char* newPath)
 {
-    if (newPath == NULL || strlen (newPath) == 0) return false;
+	if (newPath == nullptr || strlen (newPath) == 0) return false;
 
     char *fmtString = "import sys\nif not '%s' in sys.path:\n\tsys.path.append ('%s')\n"; //print sys.path\n";
     int length      = strlen (fmtString) + 2*strlen (newPath) + 1;
@@ -127,12 +127,12 @@
 
 PyObject *Pythonize::importModule (char *moduleName)
 {
-    if (moduleName == NULL || strlen (moduleName) == 0) return NULL;
+	if (moduleName == nullptr || strlen (moduleName) == 0) return nullptr;
 
     PyObject *module = PyImport_ImportModule (moduleName);
 
     objects = new ObjectRef (objects, module);
-    if (!objects) return NULL;
+	if (!objects) return nullptr;
 
     return module;
 }
@@ -173,7 +173,7 @@
         if (!_pythonize || !_pythonize->getPythonInit ())
         {
             if (_pythonize) delete _pythonize;
-            return NULL;
+			return nullptr;
         }
 
         return _pythonize;
@@ -197,14 +197,14 @@
     // or gets a PyObject for an already loaded module
     PyObject *importModule (char *moduleName)
     {
-        return _pythonize ? _pythonize->importModule (moduleName) : NULL;
+		return _pythonize ? _pythonize->importModule (moduleName) : nullptr;
     }
 
     // returns an object from a loaded module
     // you must decref the object returned when done with it (new reference returned)
     PyObject *getNewObjectRef (PyObject *module, char *object)
     {
-        return _pythonize ? _pythonize->getNewObjectRef (module, object) : NULL;
+		return _pythonize ? _pythonize->getNewObjectRef (module, object) : nullptr;
     }
 
     bool getPythonInit ()
@@ -233,6 +233,6 @@
     // runs a callable Python object
     PyObject *runFunction (PyObject *object, PyObject *args)
     {
-        return _pythonize ? _pythonize->runFunction (object, args) : NULL;
-    }
-}
+		return _pythonize ? _pythonize->runFunction (object, args) : nullptr;
+    }
+}

Modified: trunk/Scribus/scribus/plugins/scripter/scripterimpl.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22538&path=/trunk/Scribus/scribus/plugins/scripter/scripterimpl.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/scripterimpl.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scripter/scripterimpl.cpp	Sat May 12 20:40:22 2018
@@ -31,7 +31,7 @@
 	delete python;
 	//Q_ASSERT(collected);
 	//delete collected;
-	_instance = NULL;
+	_instance = nullptr;
 	qDebug() << "Scripter deleted";
 };
 
@@ -118,7 +118,7 @@
 	if (!ret)
 	{
 		RAISE("Failed to open " + filename);
-		return NULL;
+		return nullptr;
 	}
 	return activeDocument();
 }
@@ -135,7 +135,7 @@
 	if (ScCore->primaryMainWindow()->HaveDoc)
 		return new DocumentAPI();
 	else
-		return NULL;
+		return nullptr;
 }
 
 
@@ -149,7 +149,7 @@
 	if (ScCore->primaryMainWindow()->HaveDoc)
 		return new WindowAPI();
 	else
-		return NULL;
+		return nullptr;
 }
 
 /**
@@ -252,7 +252,7 @@
 	if (pagesType < firstPageOrder)
 	{
 		RAISE("firstPageOrder is bigger than allowed.");
-		return NULL;
+		return nullptr;
 	}
 	if (orientation == 1)
 	{
@@ -272,7 +272,7 @@
 	if (!ret)
 	{
 		RAISE("Page creation failed");
-		return NULL;
+		return nullptr;
 	}
 	ScCore->primaryMainWindow()->doc->setPageSetFirstPage(pagesType, firstPageOrder);
 	return activeDocument();




More information about the scribus-commit mailing list