Hi,

looks like the poppler people decided that their API is now stable,
and replaced POPPLER_VERSION with what was formerly known as
POPPLER_VERSION_STRING. Starting with poppler-20.x, poppler-config.h
defines POPPLER_VERSION like this:

#define POPPLER_VERSION "20.09.0"

Of course, this breaks all the #if POPPLER_VERSION < 666, so I just
patched out all those preprocessor conditionals.

No intended package change, so no bump.

ok?

Ciao,
        Kili

ps: while waiting for my partial bulk to finish, i expect more
fallout similar to this shit.

Index: patches/patch-pdf-backend_cc
===================================================================
RCS file: patches/patch-pdf-backend_cc
diff -N patches/patch-pdf-backend_cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-pdf-backend_cc        3 Sep 2020 20:38:55 -0000
@@ -0,0 +1,98 @@
+$OpenBSD$
+
+Starting with poppler-20, POPPLER_VERSION no longer is numeric -- it's
+what POPPLER_VERSION_STRING was in earlier releases.
+
+Index: pdf-backend.cc
+--- pdf-backend.cc.orig
++++ pdf-backend.cc
+@@ -48,11 +48,7 @@
+  * ======================
+  */
+ 
+-#if POPPLER_VERSION >= 8500
+ static void poppler_error_handler(ErrorCategory category, pdf::Offset pos, 
const char *message)
+-#else
+-static void poppler_error_handler(void *data, ErrorCategory category, 
pdf::Offset pos, const char *message)
+-#endif
+ {
+   std::string format;
+   const char *category_name = _("PDF error");
+@@ -98,25 +94,10 @@ static void poppler_error_handler(void *data, ErrorCat
+   error_log << std::endl;
+ }
+ 
+-#if POPPLER_VERSION < 7000
+-static void poppler_error_handler(void *data, ErrorCategory category, 
pdf::Offset pos, char *message)
+-{
+-  poppler_error_handler(data, category, pos, const_cast<const char 
*>(message));
+-}
+-#endif
+-
+ pdf::Environment::Environment()
+ {
+-#if POPPLER_VERSION >= 8300
+   globalParams = std::unique_ptr<GlobalParams>(new GlobalParams);
+-#else
+-  globalParams = new GlobalParams;
+-#endif
+-#if POPPLER_VERSION >= 8500
+   setErrorCallback(poppler_error_handler);
+-#else
+-  setErrorCallback(poppler_error_handler, nullptr);
+-#endif
+ }
+ 
+ void pdf::Environment::set_antialias(bool value)
+@@ -572,12 +553,8 @@ double pdf::get_path_area(splash::Path &path)
+ 
+ pdf::Object *pdf::dict_lookup(pdf::Object &dict, const char *key, pdf::Object 
*object)
+ {
+-#if POPPLER_VERSION < 5800
+-  return dict.dictLookup(const_cast<char*>(key), object);
+-#else
+   *object = dict.dictLookup(const_cast<char*>(key));
+   return object;
+-#endif
+ }
+ 
+ pdf::Object *pdf::dict_lookup(pdf::Object *dict, const char *key, pdf::Object 
*object)
+@@ -587,12 +564,8 @@ pdf::Object *pdf::dict_lookup(pdf::Object *dict, const
+ 
+ pdf::Object *pdf::dict_lookup(pdf::Dict *dict, const char *key, pdf::Object 
*object)
+ {
+-#if POPPLER_VERSION < 5800
+-  return dict->lookup(const_cast<char*>(key), object);
+-#else
+   *object = dict->lookup(const_cast<char*>(key));
+   return object;
+-#endif
+ }
+ 
+ 
+@@ -626,25 +599,14 @@ namespace pdf
+   }
+ }
+ 
+-#if POPPLER_VERSION >= 7200
+ const char * pdf::get_c_string(const pdf::String *str)
+ {
+   return str->c_str();
+ }
+-#else
+-const char * pdf::get_c_string(const pdf::String *str)
+-{
+-  return str->getCString();
+-}
+-#endif
+ 
+ int pdf::find_page(pdf::Catalog *catalog, pdf::Ref pgref)
+ {
+-#if POPPLER_VERSION >= 7600
+   return catalog->findPage(pgref);
+-#else
+-  return catalog->findPage(pgref.num, pgref.gen);
+-#endif
+ }
+ 
+ // vim:ts=2 sts=2 sw=2 et
Index: patches/patch-pdf-backend_hh
===================================================================
RCS file: patches/patch-pdf-backend_hh
diff -N patches/patch-pdf-backend_hh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-pdf-backend_hh        3 Sep 2020 20:38:55 -0000
@@ -0,0 +1,39 @@
+$OpenBSD$
+
+Starting with poppler-20, POPPLER_VERSION no longer is numeric -- it's
+what POPPLER_VERSION_STRING was in earlier releases.
+
+Index: pdf-backend.hh
+--- pdf-backend.hh.orig
++++ pdf-backend.hh
+@@ -261,18 +261,7 @@ namespace pdf
+  * ====================================
+  */
+ 
+-#if POPPLER_VERSION < 5800
+-  class OwnedObject : public Object
+-  {
+-  public:
+-    ~OwnedObject()
+-    {
+-      this->free();
+-    }
+-  };
+-#else
+   typedef ::Object OwnedObject;
+-#endif
+ 
+ 
+ /* class pdf::Environment
+@@ -308,11 +297,7 @@ namespace pdf
+     const std::string get_xmp();
+     void get_doc_info(pdf::OwnedObject &info)
+     {
+-#if POPPLER_VERSION < 5800
+-      this->getDocInfo(&info);
+-#else
+       info = this->getDocInfo();
+-#endif
+     }
+     class LoadError : public std::runtime_error
+     {
Index: patches/patch-pdf-dpi_cc
===================================================================
RCS file: patches/patch-pdf-dpi_cc
diff -N patches/patch-pdf-dpi_cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-pdf-dpi_cc    3 Sep 2020 20:38:55 -0000
@@ -0,0 +1,22 @@
+$OpenBSD$
+
+Starting with poppler-20, POPPLER_VERSION no longer is numeric -- it's
+what POPPLER_VERSION_STRING was in earlier releases.
+
+Index: pdf-dpi.cc
+--- pdf-dpi.cc.orig
++++ pdf-dpi.cc
+@@ -33,13 +33,8 @@ class DpiGuessDevice : public pdf::OutputDevice (prote
+     this->process_image(state, width, height);
+   }
+ 
+-#if POPPLER_VERSION >= 8200
+   virtual void drawImage(pdf::gfx::State *state, pdf::Object *object, 
pdf::Stream *stream, int width, int height,
+     pdf::gfx::ImageColorMap *color_map, bool interpolate, const int 
*mask_colors, bool inline_image)
+-#else
+-  virtual void drawImage(pdf::gfx::State *state, pdf::Object *object, 
pdf::Stream *stream, int width, int height,
+-    pdf::gfx::ImageColorMap *color_map, bool interpolate, int *mask_colors, 
bool inline_image)
+-#endif
+   {
+     this->process_image(state, width, height);
+   }
Index: patches/patch-pdf-unicode_cc
===================================================================
RCS file: patches/patch-pdf-unicode_cc
diff -N patches/patch-pdf-unicode_cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-pdf-unicode_cc        3 Sep 2020 20:38:55 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+
+Starting with poppler-20, POPPLER_VERSION no longer is numeric -- it's
+what POPPLER_VERSION_STRING was in earlier releases.
+
+Index: pdf-unicode.cc
+--- pdf-unicode.cc.orig
++++ pdf-unicode.cc
+@@ -24,11 +24,7 @@
+ 
+ #include <CharTypes.h>
+ #include <PDFDocEncoding.h>
+-#if POPPLER_VERSION < 6200
+-#include <UTF8.h>
+-#else
+ #include <UnicodeMapFuncs.h>
+-#endif
+ #include <UTF.h>
+ #include <UnicodeTypeTable.h>
+ 
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   3 Sep 2020 20:38:55 -0000
@@ -0,0 +1,111 @@
+$OpenBSD$
+
+Starting with poppler-20, POPPLER_VERSION no longer is numeric -- it's
+what POPPLER_VERSION_STRING was in earlier releases.
+
+Index: pdf2djvu.cc
+--- pdf2djvu.cc.orig
++++ pdf2djvu.cc
+@@ -76,17 +76,11 @@ class NoLinkDestination : public std::runtime_error (p
+ static int get_page_for_goto_link(pdf::link::GoTo *goto_link, pdf::Catalog 
*catalog)
+ {
+   std::unique_ptr<pdf::link::Destination> dest;
+-#if POPPLER_VERSION >= 6400
+   const
+-#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());
+@@ -341,13 +335,8 @@ class MutedRenderer: public pdf::Renderer (public)
+     return;
+   }
+ 
+-#if POPPLER_VERSION >= 8200
+   void drawImage(pdf::gfx::State *state, pdf::Object *object, pdf::Stream 
*stream, int width, int height,
+     pdf::gfx::ImageColorMap *color_map, bool interpolate, const int 
*mask_colors, bool inline_image)
+-#else
+-  void drawImage(pdf::gfx::State *state, pdf::Object *object, pdf::Stream 
*stream, int width, int height,
+-    pdf::gfx::ImageColorMap *color_map, bool interpolate, int *mask_colors, 
bool inline_image)
+-#endif
+   {
+     if (is_foreground_color_map(color_map) || config.no_render)
+     {
+@@ -389,13 +378,8 @@ class MutedRenderer: public pdf::Renderer (public)
+ 
+   bool interpretType3Chars() { return false; }
+ 
+-#if POPPLER_VERSION >= 8200
+   void drawChar(pdf::gfx::State *state, double x, double y, double dx, double 
dy, double origin_x, double origin_y,
+     CharCode code, int n_bytes, const Unicode *unistr, int length)
+-#else
+-  void drawChar(pdf::gfx::State *state, double x, double y, double dx, double 
dy, double origin_x, double origin_y,
+-    CharCode code, int n_bytes, Unicode *unistr, int length)
+-#endif
+   {
+     double pox, poy, pdx, pdy, px, py, pw, ph;
+     x -= origin_x; y -= origin_y;
+@@ -475,11 +459,7 @@ 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:
+     {
+@@ -519,11 +499,9 @@ class MutedRenderer: public pdf::Renderer (public)
+       // L10N: OCG stands for “Optional Content Group” (see PDF Reference 
v1.7, §4.10.1)
+       debug(1) << _("Warning: Unable to convert link with a set-OCG-state 
action") << std::endl;
+       return;
+-#if POPPLER_VERSION >= 6400
+     case actionHide:
+       debug(1) << _("Warning: Unable to convert link with a hide action") << 
std::endl;
+       return;
+-#endif
+     case actionUnknown:
+     default:
+       debug(1) << _("Warning: Unknown link action") << std::endl;
+@@ -719,19 +697,11 @@ static void pdf_outline_to_djvu_outline(pdf::Object *n
+         std::unique_ptr<pdf::link::Action> link_action;
+         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));
+-#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));
+-#endif
+         }
+         else
+           throw NoPageForBookmark();
+@@ -763,12 +733,7 @@ static void pdf_outline_to_djvu_outline(pdf::Object *n
+     }
+ 
+     pdf::dict_lookup(current, "Next", &next);
+-#if POPPLER_VERSION < 5800
+-    current.free();
+-    current = next;
+-#else
+     current = std::move(next);
+-#endif
+   }
+ }
+ 

Reply via email to