graphics/pdf2dvju: fix for new poppler

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

graphics/pdf2dvju: fix for new poppler

Matthias Kilian
Hi,

this fixes the build with poppler-0.86.*

ok? (noe, we really don't need a REVISION bump here)

Ciao,
        Kili

Index: patches/patch-pdf2djvu_cc
===================================================================
RCS file: patches/patch-pdf2djvu_cc
diff -N patches/patch-pdf2djvu_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-pdf2djvu_cc 8 Mar 2020 21:03:09 -0000
@@ -0,0 +1,54 @@
+$OpenBSD$
+
+From upstream version 0.9.17.
+
+Index: pdf2djvu.cc
+--- pdf2djvu.cc.orig
++++ pdf2djvu.cc
+@@ -81,7 +81,11 @@ static int get_page_for_goto_link(pdf::link::GoTo *got
+ #endif
+   pdf::link::Destination *orig_dest = goto_link->getDest();
+   if (orig_dest == nullptr)
++#if POPPLER_VERSION >= 8600
++    dest = catalog->findDest(goto_link->getNamedDest());
++#else
+     dest.reset(catalog->findDest(goto_link->getNamedDest()));
++#endif
+   else
+     dest.reset(orig_dest->copy());
+   if (dest.get() != nullptr)
+@@ -469,7 +473,11 @@ class MutedRenderer: public pdf::Renderer (public)
+     switch (link_action->getKind())
+     {
+     case actionURI:
++#if POPPLER_VERSION >= 8600
++      uri = dynamic_cast<pdf::link::URI*>(link_action)->getURI();
++#else
+       uri += pdf::get_c_string(dynamic_cast<pdf::link::URI*>(link_action)->getURI());
++#endif
+       break;
+     case actionGoTo:
+     {
+@@ -707,11 +715,19 @@ static void pdf_outline_to_djvu_outline(pdf::Object *n
+       {
+         pdf::OwnedObject destination;
+         std::unique_ptr<pdf::link::Action> link_action;
+-        if (!pdf::dict_lookup(current, "Dest", &destination)->isNull())
++        if (!pdf::dict_lookup(current, "Dest", &destination)->isNull()) {
++#if POPPLER_VERSION >= 8600
++          link_action = pdf::link::Action::parseDest(&destination);
++#else
+           link_action.reset(pdf::link::Action::parseDest(&destination));
+-        else if (!pdf::dict_lookup(current, "A", &destination)->isNull())
++#endif
++        } else if (!pdf::dict_lookup(current, "A", &destination)->isNull()) {
++#if POPPLER_VERSION >= 8600
++          link_action = pdf::link::Action::parseAction(&destination);
++#else
+           link_action.reset(pdf::link::Action::parseAction(&destination));
+-        else
++#endif
++        } else
+           throw NoPageForBookmark();
+         if (link_action.get() == nullptr || link_action->getKind() != actionGoTo)
+           throw NoPageForBookmark();