converters/pdf2djvu: update to 0.9.17

- Preparation for Poppler upgrade to 0.86.1

PR:		244822
Approved by:	Samy Mahmoudi <samy.mahmoudi@gmail.com> (maintainer)
This commit is contained in:
Tobias C. Berner 2020-03-21 12:51:29 +00:00
parent 86c0d1ccae
commit cc06b3172e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=528851
7 changed files with 4 additions and 153 deletions

View File

@ -1,8 +1,7 @@
# $FreeBSD$
PORTNAME= pdf2djvu
PORTVERSION= 0.9.13
PORTREVISION= 4
DISTVERSION= 0.9.17
CATEGORIES= converters
MASTER_SITES= https://github.com/jwilk/${PORTNAME}/releases/download/${PORTVERSION}/

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1571734947
SHA256 (pdf2djvu-0.9.13.tar.xz) = e0ab16d83129625c86df7c121eddf286458f63cb81ae791e5a76df10a3ab4c63
SIZE (pdf2djvu-0.9.13.tar.xz) = 296420
TIMESTAMP = 1584261683
SHA256 (pdf2djvu-0.9.17.tar.xz) = 2976a15344e569d7ba6a694f002e9970d0859edc2ad1b2726692e6c46969cfc4
SIZE (pdf2djvu-0.9.17.tar.xz) = 295280

View File

@ -1,26 +0,0 @@
This patch doesn't come from Gentoo, but because there are already
three unrelated patches that touch the same file, I'm following the
naming convention so that it gets applied in the right order.
Chase constness changes in the poppler API.
--- pdf2djvu.cc.orig 2019-10-27 19:16:30.654895000 +0000
+++ pdf2djvu.cc 2019-10-27 19:16:47.450786000 +0000
@@ -333,7 +333,7 @@
}
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)
+ pdf::gfx::ImageColorMap *color_map, bool interpolate, const int *mask_colors, bool inline_image)
{
if (is_foreground_color_map(color_map) || config.no_render)
{
@@ -376,7 +376,7 @@
bool interpretType3Chars() { return false; }
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)
+ CharCode code, int n_bytes, const Unicode *unistr, int length)
{
double pox, poy, pdx, pdy, px, py, pw, ph;
x -= origin_x; y -= origin_y;

View File

@ -1,66 +0,0 @@
--- pdf-backend.cc.orig 2019-06-10 17:06:44 UTC
+++ pdf-backend.cc
@@ -48,7 +48,7 @@
* ======================
*/
-static void poppler_error_handler(void *data, ErrorCategory category, pdf::Offset pos, const char *message)
+static void poppler_error_handler_new(ErrorCategory category, pdf::Offset pos, const char *message)
{
std::string format;
const char *category_name = _("PDF error");
@@ -94,6 +94,11 @@ static void poppler_error_handler(void *data, ErrorCat
error_log << std::endl;
}
+static void poppler_error_handler(void *data, ErrorCategory category, pdf::Offset pos, const char *message)
+{
+ poppler_error_handler_new(category, pos, message);
+}
+
#if POPPLER_VERSION < 7000
static void poppler_error_handler(void *data, ErrorCategory category, pdf::Offset pos, char *message)
{
@@ -101,10 +106,26 @@ static void poppler_error_handler(void *data, ErrorCat
}
#endif
+// for POPPLER_VERSION >= 8500:
+template <typename T1, typename T2> static auto set_error_callback(T1 callback1, T2 callback2) -> decltype(setErrorCallback(callback2))
+{
+ setErrorCallback(callback2);
+}
+
+// for POPPLER_VERSION < 8500:
+template <typename T1, typename T2> static auto set_error_callback(T1 callback1, T2 callback2) -> decltype(setErrorCallback(callback1, nullptr))
+{
+ setErrorCallback(callback1, nullptr);
+}
+
pdf::Environment::Environment()
{
- globalParams = new GlobalParams();
+ globalParams = std::unique_ptr<GlobalParams>(new GlobalParams);
+#if POPPLER_VERSION >= 7000
+ set_error_callback(poppler_error_handler, poppler_error_handler_new);
+#else
setErrorCallback(poppler_error_handler, nullptr);
+#endif
}
void pdf::Environment::set_antialias(bool value)
@@ -499,12 +520,11 @@ bool pdf::get_glyph(splash::Splash *splash, splash::Fo
void pdf::Renderer::convert_path(pdf::gfx::State *state, splash::Path &splash_path)
{
/* Source was copied from <poppler/SplashOutputDev.c>. */
- pdf::gfx::Subpath *subpath;
- pdf::gfx::Path *path = state->getPath();
+ auto path = state->getPath();
int n_subpaths = path->getNumSubpaths();
for (int i = 0; i < n_subpaths; i++)
{
- subpath = path->getSubpath(i);
+ auto subpath = path->getSubpath(i);
if (subpath->getNumPoints() > 0)
{
double x1, y1, x2, y2, x3, y3;

View File

@ -1,11 +0,0 @@
--- pdf-dpi.cc.orig 2019-10-27 19:10:07 UTC
+++ pdf-dpi.cc
@@ -34,7 +34,7 @@ class DpiGuessDevice : public pdf::OutputDevice (prote
}
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)
+ pdf::gfx::ImageColorMap *color_map, bool interpolate, const int *mask_colors, bool inline_image)
{
this->process_image(state, width, height);
}

View File

@ -1,25 +0,0 @@
--- pdf-unicode.cc.orig 2019-10-27 19:19:18.837645000 +0000
+++ pdf-unicode.cc 2019-10-27 19:20:31.405700000 +0000
@@ -125,11 +125,11 @@
* ===================
*/
-pdf::FullNFKC::FullNFKC(Unicode *unistr, int length)
+pdf::FullNFKC::FullNFKC(const Unicode *unistr, int length)
: data(nullptr), length_(0)
{
assert(length >= 0);
- this->data = unicodeNormalizeNFKC(unistr, length, &this->length_, nullptr);
+ this->data = unicodeNormalizeNFKC(const_cast<Unicode*>(unistr), length, &this->length_, nullptr);
}
pdf::FullNFKC::~FullNFKC()
@@ -141,7 +141,7 @@
* ======================
*/
-pdf::MinimalNFKC::MinimalNFKC(Unicode *unistr, int length)
+pdf::MinimalNFKC::MinimalNFKC(const Unicode *unistr, int length)
{
this->string.append(unistr, length);
}

View File

@ -1,20 +0,0 @@
--- pdf-unicode.hh.orig 2019-10-27 19:18:36.768779000 +0000
+++ pdf-unicode.hh 2019-10-27 19:19:00.052652000 +0000
@@ -58,7 +58,7 @@
Unicode* data;
int length_;
public:
- explicit FullNFKC(Unicode *, int length);
+ explicit FullNFKC(const Unicode *, int length);
~FullNFKC();
int length() const
{
@@ -79,7 +79,7 @@
protected:
std::basic_string<Unicode> string;
public:
- explicit MinimalNFKC(Unicode *, int length);
+ explicit MinimalNFKC(const Unicode *, int length);
int length() const;
operator const Unicode*() const;
};