Update to pdf2djvu 0.9.17.1.

This commit is contained in:
juanfra 2020-09-17 20:36:12 +00:00
parent 424c214e38
commit af4938edcd
7 changed files with 4 additions and 294 deletions

View File

@ -1,8 +1,8 @@
# $OpenBSD: Makefile,v 1.39 2020/03/10 16:14:59 juanfra Exp $
# $OpenBSD: Makefile,v 1.40 2020/09/17 20:36:12 juanfra Exp $
COMMENT = creates DjVu files from PDF files
V = 0.9.17
V = 0.9.17.1
DISTNAME = pdf2djvu-${V}
CATEGORIES = graphics

View File

@ -1,2 +1,2 @@
SHA256 (pdf2djvu-0.9.17.tar.xz) = KXahU0Tlade6amlPAC6ZcNCFntwq0bJyZpLmxGlpz8Q=
SIZE (pdf2djvu-0.9.17.tar.xz) = 295280
SHA256 (pdf2djvu-0.9.17.1.tar.xz) = W7u3vceFih7qxv8nDloyM5Dyq7a9Owsq4IwZZSciJqM=
SIZE (pdf2djvu-0.9.17.1.tar.xz) = 295540

View File

@ -1,98 +0,0 @@
$OpenBSD: patch-pdf-backend_cc,v 1.7 2020/09/07 18:48:38 kili Exp $
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

View File

@ -1,39 +0,0 @@
$OpenBSD: patch-pdf-backend_hh,v 1.4 2020/09/07 18:48:38 kili Exp $
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
{

View File

@ -1,22 +0,0 @@
$OpenBSD: patch-pdf-dpi_cc,v 1.1 2020/09/07 18:48:38 kili Exp $
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);
}

View File

@ -1,20 +0,0 @@
$OpenBSD: patch-pdf-unicode_cc,v 1.3 2020/09/07 18:48:38 kili Exp $
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>

View File

@ -1,111 +0,0 @@
$OpenBSD: patch-pdf2djvu_cc,v 1.7 2020/09/07 18:48:38 kili Exp $
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
}
}