View | Details | Raw Unified | Return to bug 244822
Collapse All | Expand All

(-)converters/pdf2djvu/Makefile (-2 / +1 lines)
Lines 1-8 Link Here
1
# $FreeBSD$
1
# $FreeBSD$
2
2
3
PORTNAME=	pdf2djvu
3
PORTNAME=	pdf2djvu
4
PORTVERSION=	0.9.13
4
DISTVERSION=	0.9.17
5
PORTREVISION=	4
6
CATEGORIES=	converters
5
CATEGORIES=	converters
7
MASTER_SITES=	https://github.com/jwilk/${PORTNAME}/releases/download/${PORTVERSION}/
6
MASTER_SITES=	https://github.com/jwilk/${PORTNAME}/releases/download/${PORTVERSION}/
8
7
(-)converters/pdf2djvu/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1571734947
1
TIMESTAMP = 1584261683
2
SHA256 (pdf2djvu-0.9.13.tar.xz) = e0ab16d83129625c86df7c121eddf286458f63cb81ae791e5a76df10a3ab4c63
2
SHA256 (pdf2djvu-0.9.17.tar.xz) = 2976a15344e569d7ba6a694f002e9970d0859edc2ad1b2726692e6c46969cfc4
3
SIZE (pdf2djvu-0.9.13.tar.xz) = 296420
3
SIZE (pdf2djvu-0.9.17.tar.xz) = 295280
(-)converters/pdf2djvu/files/patch-gentoo_pdf2djvu-0.9.12-poppler-0.82-4.patch (-26 lines)
Lines 1-26 Link Here
1
This patch doesn't come from Gentoo, but because there are already
2
three unrelated patches that touch the same file, I'm following the
3
naming convention so that it gets applied in the right order.
4
5
Chase constness changes in the poppler API.
6
7
--- pdf2djvu.cc.orig	2019-10-27 19:16:30.654895000 +0000
8
+++ pdf2djvu.cc	2019-10-27 19:16:47.450786000 +0000
9
@@ -333,7 +333,7 @@
10
   }
11
 
12
   void drawImage(pdf::gfx::State *state, pdf::Object *object, pdf::Stream *stream, int width, int height,
13
-    pdf::gfx::ImageColorMap *color_map, bool interpolate, int *mask_colors, bool inline_image)
14
+    pdf::gfx::ImageColorMap *color_map, bool interpolate, const int *mask_colors, bool inline_image)
15
   {
16
     if (is_foreground_color_map(color_map) || config.no_render)
17
     {
18
@@ -376,7 +376,7 @@
19
   bool interpretType3Chars() { return false; }
20
 
21
   void drawChar(pdf::gfx::State *state, double x, double y, double dx, double dy, double origin_x, double origin_y,
22
-    CharCode code, int n_bytes, Unicode *unistr, int length)
23
+    CharCode code, int n_bytes, const Unicode *unistr, int length)
24
   {
25
     double pox, poy, pdx, pdy, px, py, pw, ph;
26
     x -= origin_x; y -= origin_y;
(-)converters/pdf2djvu/files/patch-pdf-backend.cc (-66 lines)
Lines 1-66 Link Here
1
--- pdf-backend.cc.orig	2019-06-10 17:06:44 UTC
2
+++ pdf-backend.cc
3
@@ -48,7 +48,7 @@
4
  * ======================
5
  */
6
 
7
-static void poppler_error_handler(void *data, ErrorCategory category, pdf::Offset pos, const char *message)
8
+static void poppler_error_handler_new(ErrorCategory category, pdf::Offset pos, const char *message)
9
 {
10
   std::string format;
11
   const char *category_name = _("PDF error");
12
@@ -94,6 +94,11 @@ static void poppler_error_handler(void *data, ErrorCat
13
   error_log << std::endl;
14
 }
15
 
16
+static void poppler_error_handler(void *data, ErrorCategory category, pdf::Offset pos, const char *message)
17
+{
18
+	  poppler_error_handler_new(category, pos, message);
19
+}
20
+
21
 #if POPPLER_VERSION < 7000
22
 static void poppler_error_handler(void *data, ErrorCategory category, pdf::Offset pos, char *message)
23
 {
24
@@ -101,10 +106,26 @@ static void poppler_error_handler(void *data, ErrorCat
25
 }
26
 #endif
27
 
28
+// for POPPLER_VERSION >= 8500:
29
+template <typename T1, typename T2> static auto set_error_callback(T1 callback1, T2 callback2) -> decltype(setErrorCallback(callback2))
30
+{
31
+	  setErrorCallback(callback2);
32
+}
33
+
34
+// for POPPLER_VERSION < 8500:
35
+template <typename T1, typename T2> static auto set_error_callback(T1 callback1, T2 callback2) -> decltype(setErrorCallback(callback1, nullptr))
36
+{
37
+	  setErrorCallback(callback1, nullptr);
38
+}
39
+
40
 pdf::Environment::Environment()
41
 {
42
-  globalParams = new GlobalParams();
43
+  globalParams = std::unique_ptr<GlobalParams>(new GlobalParams);
44
+#if POPPLER_VERSION >= 7000
45
+    set_error_callback(poppler_error_handler, poppler_error_handler_new);
46
+#else
47
   setErrorCallback(poppler_error_handler, nullptr);
48
+#endif
49
 }
50
 
51
 void pdf::Environment::set_antialias(bool value)
52
@@ -499,12 +520,11 @@ bool pdf::get_glyph(splash::Splash *splash, splash::Fo
53
 void pdf::Renderer::convert_path(pdf::gfx::State *state, splash::Path &splash_path)
54
 {
55
   /* Source was copied from <poppler/SplashOutputDev.c>. */
56
-  pdf::gfx::Subpath *subpath;
57
-  pdf::gfx::Path *path = state->getPath();
58
+  auto path = state->getPath();
59
   int n_subpaths = path->getNumSubpaths();
60
   for (int i = 0; i < n_subpaths; i++)
61
   {
62
-    subpath = path->getSubpath(i);
63
+    auto subpath = path->getSubpath(i);
64
     if (subpath->getNumPoints() > 0)
65
     {
66
       double x1, y1, x2, y2, x3, y3;
(-)converters/pdf2djvu/files/patch-pdf-dpi.cc (-11 lines)
Lines 1-11 Link Here
1
--- pdf-dpi.cc.orig	2019-10-27 19:10:07 UTC
2
+++ pdf-dpi.cc
3
@@ -34,7 +34,7 @@ class DpiGuessDevice : public pdf::OutputDevice (prote
4
   }
5
 
6
   virtual void drawImage(pdf::gfx::State *state, pdf::Object *object, pdf::Stream *stream, int width, int height,
7
-    pdf::gfx::ImageColorMap *color_map, bool interpolate, int *mask_colors, bool inline_image)
8
+    pdf::gfx::ImageColorMap *color_map, bool interpolate, const int *mask_colors, bool inline_image)
9
   {
10
     this->process_image(state, width, height);
11
   }
(-)converters/pdf2djvu/files/patch-pdf-unicode.cc (-25 lines)
Lines 1-25 Link Here
1
--- pdf-unicode.cc.orig	2019-10-27 19:19:18.837645000 +0000
2
+++ pdf-unicode.cc	2019-10-27 19:20:31.405700000 +0000
3
@@ -125,11 +125,11 @@
4
  * ===================
5
  */
6
 
7
-pdf::FullNFKC::FullNFKC(Unicode *unistr, int length)
8
+pdf::FullNFKC::FullNFKC(const Unicode *unistr, int length)
9
 : data(nullptr), length_(0)
10
 {
11
     assert(length >= 0);
12
-    this->data = unicodeNormalizeNFKC(unistr, length, &this->length_, nullptr);
13
+    this->data = unicodeNormalizeNFKC(const_cast<Unicode*>(unistr), length, &this->length_, nullptr);
14
 }
15
 
16
 pdf::FullNFKC::~FullNFKC()
17
@@ -141,7 +141,7 @@
18
  * ======================
19
  */
20
 
21
-pdf::MinimalNFKC::MinimalNFKC(Unicode *unistr, int length)
22
+pdf::MinimalNFKC::MinimalNFKC(const Unicode *unistr, int length)
23
 {
24
     this->string.append(unistr, length);
25
 }
(-)converters/pdf2djvu/files/patch-pdf-unicode.hh (-20 lines)
Lines 1-20 Link Here
1
--- pdf-unicode.hh.orig	2019-10-27 19:18:36.768779000 +0000
2
+++ pdf-unicode.hh	2019-10-27 19:19:00.052652000 +0000
3
@@ -58,7 +58,7 @@
4
         Unicode* data;
5
         int length_;
6
     public:
7
-        explicit FullNFKC(Unicode *, int length);
8
+        explicit FullNFKC(const Unicode *, int length);
9
         ~FullNFKC();
10
         int length() const
11
         {
12
@@ -79,7 +79,7 @@
13
     protected:
14
         std::basic_string<Unicode> string;
15
     public:
16
-        explicit MinimalNFKC(Unicode *, int length);
17
+        explicit MinimalNFKC(const Unicode *, int length);
18
         int length() const;
19
         operator const Unicode*() const;
20
     };

Return to bug 244822