r24982 by jghali - #16764: Build break with poppler 22.03.0

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 2 22:22:53 UTC 2022


Author: jghali
Date: Wed Mar  2 22:22:53 2022
New Revision: 24982

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24982
Log:
#16764: Build break with poppler 22.03.0


Modified:
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24982&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp	Wed Mar  2 22:22:53 2022
@@ -89,7 +89,11 @@
 #endif
 	globalParams->setErrQuiet(gTrue);
 
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
+	PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };
+#else
 	PDFDoc pdfDoc{fname, nullptr, nullptr, nullptr};
+#endif
 	if (!pdfDoc.isOk() || pdfDoc.getErrorCode() == errEncrypted)
 		return QImage();
 
@@ -342,7 +346,11 @@
 	globalParams->setErrQuiet(gTrue);
 //	globalParams->setPrintCommands(gTrue);
 	QList<OptionalContentGroup*> ocgGroups;
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
+	auto pdfDoc = std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));
+#else
 	auto pdfDoc = std::unique_ptr<PDFDoc>(new PDFDoc(fname, nullptr, nullptr, nullptr));
+#endif
 	if (pdfDoc)
 	{
 		if (pdfDoc->getErrorCode() == errEncrypted)
@@ -361,8 +369,13 @@
 #else
 				auto fname = new GooString(QFile::encodeName(fn).data());
 #endif
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
+				std::optional<GooString> userPW(std::in_place, text.toLocal8Bit().data());
+				pdfDoc.reset(new PDFDoc(std::make_unique<GooString>(fname), userPW, userPW, nullptr));
+#else
 				auto userPW = new GooString(text.toLocal8Bit().data());
 				pdfDoc.reset(new PDFDoc(fname, userPW, userPW, nullptr));
+#endif
 				qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
 			}
 			if ((!pdfDoc) || (pdfDoc->getErrorCode() != errNone))




More information about the scribus-commit mailing list