Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app-text/poppler-22.03-fixes #24441

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions app-office/scribus/files/scribus-1.5.8-poppler-22.03.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From f19410ac3b27e33dd62105746784e61e85b90a1d Mon Sep 17 00:00:00 2001
From: Jean Ghali <jghali@libertysurf.fr>
Date: Wed, 2 Mar 2022 22:22:53 +0000
Subject: [PATCH] #16764: Build break with poppler 22.03.0

git-svn-id: svn://scribus.net/trunk/Scribus@24982 11d20701-8431-0410-a711-e3c959e3b870
---
scribus/plugins/import/pdf/importpdf.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
index 154e58a3f0..392dcd9e64 100644
--- a/scribus/plugins/import/pdf/importpdf.cpp
+++ b/scribus/plugins/import/pdf/importpdf.cpp
@@ -89,7 +89,11 @@ QImage PdfPlug::readThumbnail(const QString& fName)
#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 @@ bool PdfPlug::convert(const QString& fn)
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 @@ bool PdfPlug::convert(const QString& fn)
#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))
1 change: 1 addition & 0 deletions app-office/scribus/scribus-1.5.8.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-1.5.6-findhyphen.patch
"${FILESDIR}"/${PN}-1.5.8-poppler-22.2.0-1.patch
"${FILESDIR}"/${PN}-1.5.8-poppler-22.2.0-2.patch
"${FILESDIR}"/${PN}-1.5.8-poppler-22.03.0.patch # bug 834537
)

CMAKE_BUILD_TYPE="Release"
Expand Down
54 changes: 54 additions & 0 deletions sci-libs/gdal/files/gdal-3.4.1-poppler-22.03.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
From 17e98757e78969a199d1d6318f53d088da192191 Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Fri, 18 Feb 2022 22:47:01 +0100
Subject: [PATCH] PDF: fix build against Poppler > 22.2

---
frmts/pdf/pdfdataset.cpp | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/frmts/pdf/pdfdataset.cpp b/frmts/pdf/pdfdataset.cpp
index 22238bd74822..08f8e31c86a7 100644
--- a/frmts/pdf/pdfdataset.cpp
+++ b/frmts/pdf/pdfdataset.cpp
@@ -4241,8 +4241,6 @@ PDFDataset *PDFDataset::Open( GDALOpenInfo * poOpenInfo )
#ifdef HAVE_POPPLER
if(bUseLib.test(PDFLIB_POPPLER))
{
- GooString* poUserPwd = nullptr;
-
static bool globalParamsCreatedByGDAL = false;
{
CPLMutexHolderD(&hGlobalParamsMutex);
@@ -4310,9 +4308,6 @@ PDFDataset *PDFDataset::Open( GDALOpenInfo * poOpenInfo )
while( true )
{
VSIFSeekL(fp, 0, SEEK_SET);
- if (pszUserPwd)
- poUserPwd = new GooString(pszUserPwd);
-
g_nPopplerErrors = 0;
if( globalParamsCreatedByGDAL )
registerErrorCallback();
@@ -4322,10 +4317,20 @@ PDFDataset *PDFDataset::Open( GDALOpenInfo * poOpenInfo )
oObj.getObj()->initNull();
auto poStream = new VSIPDFFileStream(fp, pszFilename, oObj.getObj());
#endif
+#if POPPLER_MAJOR_VERSION > 22 || (POPPLER_MAJOR_VERSION == 22 && POPPLER_MINOR_VERSION > 2)
+ std::optional<GooString> osUserPwd;
+ if (pszUserPwd)
+ osUserPwd = std::optional<GooString>(pszUserPwd);
+ poDocPoppler = new PDFDoc(poStream, std::optional<GooString>(), osUserPwd);
+#else
+ GooString* poUserPwd = nullptr;
+ if (pszUserPwd)
+ poUserPwd = new GooString(pszUserPwd);
poDocPoppler = new PDFDoc(poStream, nullptr, poUserPwd);
+ delete poUserPwd;
+#endif
if( globalParamsCreatedByGDAL )
registerErrorCallback();
- delete poUserPwd;
if( g_nPopplerErrors >= MAX_POPPLER_ERRORS )
{
PDFFreeDoc(poDocPoppler);
4 changes: 2 additions & 2 deletions sci-libs/gdal/gdal-3.4.1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ DESCRIPTION="Translator library for raster geospatial data formats (includes OGR
HOMEPAGE="https://gdal.org/"
SRC_URI="https://download.osgeo.org/${PN}/${PV}/${P}.tar.gz"

# subslot is libgdal.so.<SONAME>
SLOT="0/30"
LICENSE="BSD Info-ZIP MIT"
SLOT="0/30" # subslot is libgdal.so.<SONAME>
KEYWORDS="amd64 ~arm arm64 ~ia64 ppc ppc64 ~riscv x86 ~amd64-linux ~x86-linux ~ppc-macos"
IUSE="armadillo +aux-xml curl cpu_flags_x86_avx cpu_flags_x86_sse cpu_flags_x86_ssse3 debug doc fits geos gif gml hdf5 heif java jpeg jpeg2k lzma mdb mysql netcdf odbc ogdi opencl oracle pdf perl png postgres python spatialite sqlite threads webp xls zstd"

Expand Down Expand Up @@ -92,6 +91,7 @@ PATCHES=(
"${FILESDIR}/${PN}-2.3.0-curl.patch" # bug 659840
"${FILESDIR}/${PN}-3.3.0-libdir.patch"
"${FILESDIR}/${P}-poppler-22.01.0-c++17.patch"
"${FILESDIR}/${P}-poppler-22.03.0.patch" # bug 834536
)

src_prepare() {
Expand Down