You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.7 KiB

From 15ab83e02b07018c3ffd4952a2623393187659e0 Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <evangelos@foutrelis.com>
Date: Wed, 2 Mar 2022 19:50:02 +0200
Subject: [PATCH] Fix build with poppler 22.03.0
PDFDoc's constructor now takes an std::unique_ptr as the filename and
the rest of the parameters are std::optional and can be left out.
Also, remove an obsolete comment regarding special handling on win32;
the "ifndef _WIN32" it was referring to has been removed by commit
ad8effaa6ec3 ("Fix PDF import with non-ASCII filename on Windows").
---
src/extension/internal/pdfinput/pdf-input.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index 3dabc94ba2..63742d8c6d 100644
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -686,10 +686,12 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
// PDFDoc is from poppler. PDFDoc is used for preview and for native import.
std::shared_ptr<PDFDoc> pdf_doc;
- // poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from
- // glib gstdio.c
+#if POPPLER_CHECK_VERSION(22, 3, 0)
+ pdf_doc = std::make_shared<PDFDoc>(std::make_unique<GooString>(uri)); // TODO: Could ask for password
+#else
GooString *filename_goo = new GooString(uri);
- pdf_doc = std::make_shared<PDFDoc>(filename_goo, nullptr, nullptr, nullptr); // TODO: Could ask for password
+ pdf_doc = std::make_shared<PDFDoc>(filename_goo, nullptr, nullptr, nullptr); // TODO: Could ask for password
+#endif
if (!pdf_doc->isOk()) {
int error = pdf_doc->getErrorCode();
--
GitLab