Fix build with poppler-25.10.0.

ok robert@
This commit is contained in:
kili
2025-10-30 20:53:46 +00:00
parent c522e21628
commit 24f96355f9
@@ -0,0 +1,44 @@
Fix build with poppler-25.10.0.
From upstream commits ae83e577501c504f89b434606f05ff1d555729c9 and
89841fc69446a597b24b978344cd3c8d656aae09.
Index: sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
--- sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx.orig
+++ sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
@@ -203,6 +203,22 @@ int main(int argc, char **argv)
// PDFDoc takes over ownership for all strings below
GooString* pFileName = new GooString(myStringToStdString(argv[1]));
+#if POPPLER_CHECK_VERSION(22, 6, 0)
+ std::optional<GooString> ownerPasswordStr = {};
+ if (aPwBuf[0] != 0) {
+ ownerPasswordStr = std::make_optional<GooString>(aPwBuf);
+ } else if (ownerPassword) {
+ ownerPasswordStr = std::make_optional<GooString>(myStringToStdString(ownerPassword));
+ }
+ std::optional<GooString> userPasswordStr = {};
+ if (aPwBuf[0] != 0) {
+ userPasswordStr = std::make_optional<GooString>(aPwBuf);
+ } else if (userPassword) {
+ userPasswordStr = std::make_optional<GooString>(myStringToStdString(userPassword));
+ }
+ pDocUnique = std::make_unique<PDFDoc>(
+ std::unique_ptr<GooString>(pFileName), ownerPasswordStr, userPasswordStr);
+#else
// check for password string(s)
GooString* pOwnerPasswordStr(aPwBuf[0] != 0
? new GooString(aPwBuf)
@@ -214,12 +230,6 @@ int main(int argc, char **argv)
: (userPassword
? new GooString(myStringToStdString(userPassword))
: nullptr));
-#if POPPLER_CHECK_VERSION(22, 6, 0)
- pDocUnique = std::unique_ptr<PDFDoc>(
- new PDFDoc(std::make_unique<GooString>(pFileName),
- std::optional<GooString>(pOwnerPasswordStr),
- std::optional<GooString>(pUserPasswordStr)));
-#else
pDocUnique = std::unique_ptr<PDFDoc>(
new PDFDoc(pFileName, pOwnerPasswordStr, pUserPasswordStr));
#endif