r24093 by jghali - Reduce warnings when compiling with C++ standards >= C++11

scribus-commit scribus-commit at lists.scribus.net
Fri Oct 23 23:24:01 UTC 2020


Author: jghali
Date: Fri Oct 23 23:24:01 2020
New Revision: 24093

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24093
Log:
Reduce warnings when compiling with C++ standards >= C++11

Modified:
    branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
    branches/Version14x/Scribus/scribus/scimage.cpp
    branches/Version14x/Scribus/scribus/sclistboxpixmap.h
    branches/Version14x/Scribus/scribus/scprintengine_gdi.cpp
    branches/Version14x/Scribus/scribus/scribusdoc.cpp
    branches/Version14x/Scribus/scribus/scslainforeader.cpp

Modified: branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24093&path=/branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp	(original)
+++ branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp	Fri Oct 23 23:24:01 2020
@@ -27,10 +27,12 @@
 #include "util_color.h"
 #include "scgzfile.h"
 #include "scpattern.h"
+
 #include <QCursor>
+#include <QDataStream>
 #include <QFileInfo>
 #include <QList>
-#include <QDataStream>
+#include <QScopedPointer>
 
 #include "scxmlstreamwriter.h"
 
@@ -60,7 +62,7 @@
 	if (QFile::exists(tmpFileName))
 		return false;
 
-	std::auto_ptr<QIODevice> outputFile;
+	QScopedPointer<QIODevice> outputFile;
 	if (fileName.toLower().right(2) == "gz")
 		outputFile.reset( new ScGzFile(tmpFileName) );
 	else
@@ -71,7 +73,7 @@
 
 	ScXmlStreamWriter docu;
 	docu.setAutoFormatting(true);
-	docu.setDevice(outputFile.get());
+	docu.setDevice(outputFile.data());
 	docu.writeStartDocument();
 	docu.writeStartElement("SCRIBUSUTF8NEW");
 	docu.writeAttribute("Version", QString(VERSION));
@@ -256,8 +258,8 @@
 	docu.writeEndDocument();
 	
 	bool  writeSucceed = false;
-	const QFile* qFile = dynamic_cast<QFile*>(outputFile.get());
-	const ScGzFile* gzFile = dynamic_cast<ScGzFile*>(outputFile.get());
+	const QFile* qFile = dynamic_cast<QFile*>(outputFile.data());
+	const ScGzFile* gzFile = dynamic_cast<ScGzFile*>(outputFile.data());
 	if (qFile)
 		writeSucceed = (qFile->error() == QFile::NoError);
 	else if (gzFile)

Modified: branches/Version14x/Scribus/scribus/scimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24093&path=/branches/Version14x/Scribus/scribus/scimage.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scimage.cpp	(original)
+++ branches/Version14x/Scribus/scribus/scimage.cpp	Fri Oct 23 23:24:01 2020
@@ -22,6 +22,7 @@
 #include <QMessageBox>
 #include <QList>
 #include <QByteArray>
+#include <QScopedPointer>
 #include <cassert>
 #include <cmath>
 #include <cstdlib>
@@ -1981,7 +1982,7 @@
 bool ScImage::getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes, int scaleXSize, int scaleYSize)
 {
 	bool gotAlpha = false;
-	auto_ptr<ScImgDataLoader> pDataLoader;
+	QScopedPointer<ScImgDataLoader> pDataLoader;
 	imgInfo.valid = false;
 	imgInfo.clipPath = "";
 	imgInfo.PDSpathData.clear();
@@ -2005,13 +2006,13 @@
 	else if (extensionIndicatesTIFF(ext))
 	{
 		pDataLoader.reset( new ScImgDataLoader_TIFF() );
-		if	(pDataLoader.get())
+		if	(pDataLoader.data())
 			pDataLoader->setRequest(imgInfo.isRequest, imgInfo.RequestProps);
 	}
 	else if (extensionIndicatesPSD(ext))
 	{
 		pDataLoader.reset( new ScImgDataLoader_PSD() );
-		if	(pDataLoader.get())
+		if	(pDataLoader.data())
 			pDataLoader->setRequest(imgInfo.isRequest, imgInfo.RequestProps);
 	}
 	else if (ext == "pat")
@@ -2019,7 +2020,7 @@
 	else
 		pDataLoader.reset( new ScImgDataLoader_QT() );
 
-	if	(pDataLoader.get())
+	if	(pDataLoader.data())
 	{
 		bool hasAlpha    = false;
 		bool alphaLoaded = pDataLoader->preloadAlphaChannel(fn, page, gsRes, hasAlpha);
@@ -2159,7 +2160,7 @@
 	ScColorProfile   inputProf = 0;
 	int cmsFlags = 0;
 	int cmsProofFlags = 0;
-	auto_ptr<ScImgDataLoader> pDataLoader;
+	QScopedPointer<ScImgDataLoader> pDataLoader;
 	QFileInfo fi = QFileInfo(fn);
 	if (!fi.exists())
 		return ret;

Modified: branches/Version14x/Scribus/scribus/sclistboxpixmap.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24093&path=/branches/Version14x/Scribus/scribus/sclistboxpixmap.h
==============================================================================
--- branches/Version14x/Scribus/scribus/sclistboxpixmap.h	(original)
+++ branches/Version14x/Scribus/scribus/sclistboxpixmap.h	Fri Oct 23 23:24:01 2020
@@ -32,17 +32,27 @@
 {
 public:
 	ScListBoxPixmap(void);
+
 	virtual QSize sizeHint (const QStyleOptionViewItem & option, const QModelIndex & index ) const;
 	virtual void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
+
 protected:
+#if __cplusplus >= 201103L
+	static std::unique_ptr<QPixmap> pmap;
+#else
 	static std::auto_ptr<QPixmap> pmap;
+#endif
 	// The drawPixmap function must not modify pixmap size
 	virtual void redraw(const QVariant&) const = 0;
 };
 
+#if __cplusplus >= 201103L
+template<unsigned int pixWidth, unsigned int pixHeight> 
+std::unique_ptr<QPixmap> ScListBoxPixmap<pixWidth, pixHeight>::pmap;
+#else
 template<unsigned int pixWidth, unsigned int pixHeight> 
 std::auto_ptr<QPixmap> ScListBoxPixmap<pixWidth, pixHeight>::pmap;
-
+#endif
 
 template<unsigned int pixWidth, unsigned int pixHeight>
 ScListBoxPixmap<pixWidth, pixHeight>::ScListBoxPixmap(void) : QAbstractItemDelegate()
@@ -52,7 +62,6 @@
 		pmap.reset( new QPixmap(pixWidth, pixHeight) );
 	}
 };
-
 
 template<unsigned int pixWidth, unsigned int pixHeight>
 QSize ScListBoxPixmap<pixWidth, pixHeight>::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const

Modified: branches/Version14x/Scribus/scribus/scprintengine_gdi.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24093&path=/branches/Version14x/Scribus/scribus/scprintengine_gdi.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scprintengine_gdi.cpp	(original)
+++ branches/Version14x/Scribus/scribus/scprintengine_gdi.cpp	Fri Oct 23 23:24:01 2020
@@ -17,6 +17,7 @@
 #include <valarray>
 #include <windows.h>
 #include <QByteArray>
+#include <QScopedPointer>
 using namespace ::std;
 
 #include "scconfig.h"
@@ -206,7 +207,7 @@
 bool ScPrintEngine_GDI::printPages( ScribusDoc* doc, PrintOptions& options, HDC printerDC, DEVMODEW* devMode, QString& fileName )
 {
 	int  jobId;
-	auto_ptr<MultiProgressDialog> progress;
+	QScopedPointer<MultiProgressDialog> progress;
 	PrintPageFunc printPageFunc = NULL;
 	bool  success = true;
 	WCHAR docName[512];
@@ -258,7 +259,7 @@
 		progress.reset( new MultiProgressDialog( QObject::tr("Printing..."), CommonStrings::tr_Cancel, doc->scMW()) );
 		progress->setOverallTotalSteps( options.pageNumbers.size() );
 		progress->setOverallProgress(0);
-		connect(progress.get(), SIGNAL(canceled()), this, SLOT(cancelRequested()));
+		connect(progress.data(), SIGNAL(canceled()), this, SLOT(cancelRequested()));
 		progress->show();
 	}
 

Modified: branches/Version14x/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24093&path=/branches/Version14x/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scribusdoc.cpp	(original)
+++ branches/Version14x/Scribus/scribus/scribusdoc.cpp	Fri Oct 23 23:24:01 2020
@@ -35,6 +35,7 @@
 #include <QPainter>
 #include <QPixmap>
 #include <QProgressBar>
+#include <QScopedPointer>
 
 #include "canvas.h"
 #include "cmserrorhandling.h"
@@ -10123,7 +10124,7 @@
 		newY = qMax(newY, 1);
 	}
 	*/
-	std::auto_ptr<UndoTransaction> activeTransaction;
+	QScopedPointer<UndoTransaction> activeTransaction;
 	if (UndoManager::undoEnabled())
 	{
 		QString transacDesc = QString(Um::ResizeFromTo).arg(currItem->oldWidth).arg(currItem->oldHeight).arg(newX).arg(newY);
@@ -10181,7 +10182,7 @@
 
 		if (currItem->FrameType == 0 || currItem->asLine())
 		{
-			if (activeTransaction.get())
+			if (activeTransaction.data())
 			{
 				currItem->checkChanges();
 				activeTransaction->commit();
@@ -10192,7 +10193,7 @@
 		currItem->updateClip();
 //		currItem->updateGradientVectors();
 
-		if (activeTransaction.get())
+		if (activeTransaction.data())
 		{
 			currItem->checkChanges();
 			activeTransaction->commit();
@@ -10244,7 +10245,7 @@
 		}
 	}
 	currItem->setCornerRadius(qMin(currItem->cornerRadius(), qMin(currItem->width(),currItem->height())/2));
-	if (activeTransaction.get())
+	if (activeTransaction.data())
 	{
 		currItem->checkChanges();
 		activeTransaction->commit();

Modified: branches/Version14x/Scribus/scribus/scslainforeader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24093&path=/branches/Version14x/Scribus/scribus/scslainforeader.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scslainforeader.cpp	(original)
+++ branches/Version14x/Scribus/scribus/scslainforeader.cpp	Fri Oct 23 23:24:01 2020
@@ -9,6 +9,7 @@
 #include <memory>
 
 #include <QFile>
+#include <QScopedPointer>
 #include <QXmlStreamReader>
 #include "scgzfile.h"
 
@@ -24,7 +25,7 @@
 	bool isScribusDocument = false;
 	bool readInfoSuccess   = false;
 	bool firstStartElement = true;
-	std::auto_ptr<QIODevice> file;
+	QScopedPointer<QIODevice> file;
 
 	resetFileInfos();
 
@@ -33,7 +34,7 @@
 	else
 		file.reset( new QFile(fileName) );
 
-	if (!file.get() || !file->open(QIODevice::ReadOnly))
+	if (file.isNull() || !file->open(QIODevice::ReadOnly))
 		return false;
 
 	QByteArray bytes = file->read(512);
@@ -44,7 +45,7 @@
 	}
 	file->reset();
 
-	QXmlStreamReader reader(file.get());
+	QXmlStreamReader reader(file.data());
 	while (!reader.atEnd() && !reader.hasError())
 	{
 		QXmlStreamReader::TokenType ttype = reader.readNext();




More information about the scribus-commit mailing list