pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/print/cups-filters Fix build with poppler 0.58
details: https://anonhg.NetBSD.org/pkgsrc/rev/a1916ddf2b6f
branches: trunk
changeset: 367808:a1916ddf2b6f
user: prlw1 <prlw1%pkgsrc.org@localhost>
date: Thu Sep 07 11:24:29 2017 +0000
description:
Fix build with poppler 0.58
diffstat:
print/cups-filters/Makefile | 4 +-
print/cups-filters/distinfo | 3 +-
print/cups-filters/patches/patch-filter_pdf.cxx | 824 ++++++++++++++++++++++++
3 files changed, 828 insertions(+), 3 deletions(-)
diffs (truncated from 855 to 300 lines):
diff -r 2b9a3b742d92 -r a1916ddf2b6f print/cups-filters/Makefile
--- a/print/cups-filters/Makefile Thu Sep 07 10:36:45 2017 +0000
+++ b/print/cups-filters/Makefile Thu Sep 07 11:24:29 2017 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.78 2017/09/04 20:20:55 ryoon Exp $
+# $NetBSD: Makefile,v 1.79 2017/09/07 11:24:29 prlw1 Exp $
DISTNAME= cups-filters-1.17.2
-PKGREVISION= 2
+PKGREVISION= 3
CATEGORIES= print
MASTER_SITES= http://openprinting.org/download/cups-filters/
EXTRACT_SUFX= .tar.xz
diff -r 2b9a3b742d92 -r a1916ddf2b6f print/cups-filters/distinfo
--- a/print/cups-filters/distinfo Thu Sep 07 10:36:45 2017 +0000
+++ b/print/cups-filters/distinfo Thu Sep 07 11:24:29 2017 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.51 2017/09/03 11:27:47 leot Exp $
+$NetBSD: distinfo,v 1.52 2017/09/07 11:24:29 prlw1 Exp $
SHA1 (cups-filters-1.17.2.tar.xz) = f4febf63e2c0a6a9291798fa0ec4ae4f26cc753a
RMD160 (cups-filters-1.17.2.tar.xz) = 06d9cda92a6d8b2d642332aeb06a8c5f9b953199
@@ -8,3 +8,4 @@
SHA1 (patch-configure) = b55dc7dc22008351c396374aceb88d2be293d179
SHA1 (patch-filter_gstoraster.c) = a9fac7892972943f345c6b76529feff0ba098458
SHA1 (patch-filter_mupdftoraster.c) = 4c4f7d292163657f9541c8ce454ba57d248f7ef0
+SHA1 (patch-filter_pdf.cxx) = 34387489460e152719a9879a68310418aff95591
diff -r 2b9a3b742d92 -r a1916ddf2b6f print/cups-filters/patches/patch-filter_pdf.cxx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/print/cups-filters/patches/patch-filter_pdf.cxx Thu Sep 07 11:24:29 2017 +0000
@@ -0,0 +1,824 @@
+$NetBSD: patch-filter_pdf.cxx,v 1.1 2017/09/07 11:24:29 prlw1 Exp $
+
+support poppler-0.58
+https://bugs.linuxfoundation.org/show_bug.cgi?id=1408
+
+--- filter/pdf.cxx.orig 2017-08-15 18:29:57.000000000 +0000
++++ filter/pdf.cxx
+@@ -129,64 +129,125 @@ extern "C" void pdf_prepend_stream(pdf_t
+ Object array;
+ Ref r;
+
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ pageobj = xref->fetch(pageref->num, pageref->gen);
++#else
+ xref->fetch(pageref->num, pageref->gen, &pageobj);
+- if (!pageobj.isDict() || !pageobj.dictLookupNF("Contents", &contents)) {
++#endif
++ if (!pageobj.isDict() ||
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ (contents = pageobj.dictLookupNF("Contents")).isNull()
++#else
++ !pageobj.dictLookupNF("Contents", &contents)
++#endif
++ ) {
+ fprintf(stderr, "Error: malformed pdf\n");
+ return;
+ }
+
+- if (contents.isRef())
++ if (contents.isRef()) {
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ contents = xref->fetch(contents.getRefNum(), contents.getRefGen());
++#else
+ xref->fetch(contents.getRefNum(), contents.getRefGen(), &contents);
++#endif
++ }
+
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ (void) lenobj;
++ dict = Object(new Dict(xref));
++ dict.dictSet("Length", Object(static_cast<int>(len)));
++ stream = Object(static_cast<Stream *>(new MemStream(buf, 0, len, std::move(dict))));
++#else
+ lenobj.initInt(len);
+ dict.initDict(xref);
+ dict.dictSet("Length", &lenobj);
+ stream.initStream(new MemStream(buf, 0, len, &dict));
++#endif
+
+ r = xref->addIndirectObject(&stream);
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ streamrefobj = Object(r.num, r.gen);
++#else
+ streamrefobj.initRef(r.num, r.gen);
++#endif
+
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ array = Object(new Array(xref));
++ array.arrayAdd(std::move(streamrefobj));
++#else
+ array.initArray(xref);
+ array.arrayAdd(&streamrefobj);
++#endif
+
+ if (contents.isStream()) {
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ contents = pageobj.dictLookupNF("Contents"); // streams must be indirect, i.e. not fetch()-ed
++ array.arrayAdd(std::move(contents));
++#else
+ pageobj.dictLookupNF("Contents", &contents); // streams must be indirect, i.e. not fetch()-ed
+ array.arrayAdd(&contents);
++#endif
+ }
+ else if (contents.isArray()) {
+ int i, len = contents.arrayGetLength();
+ Object obj;
+ for (i = 0; i < len; i++) {
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ obj = contents.arrayGetNF(i);
++ array.arrayAdd(std::move(obj));
++#else
+ contents.arrayGetNF(i, &obj);
+ array.arrayAdd(&obj);
++#endif
+ }
+ }
+ else
+ fprintf(stderr, "Error: malformed pdf\n");
+
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ pageobj.dictSet("Contents", std::move(array));
++#else
+ pageobj.dictSet("Contents", &array);
++#endif
+
+ xref->setModifiedObject(&pageobj, *pageref);
++#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 58
+ pageobj.free();
++#endif
+ }
+
+
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++static Object name_object(const char *s)
++{
++ return Object(new GooString(s));
++}
++#else
+ static Object * name_object(const char *s)
+ {
+ Object *o = new Object();
+ o->initName((char *)s);
+ return o;
+ }
++#endif
+
+ /*
+ * Create new PDF integer type object.
+ */
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++static Object int_object(int i)
++{
++ return Object(i);
++}
++#else
+ static Object * int_object(int i)
+ {
+ Object *o = new Object();
+ o->initInt(i);
+ return o;
+ }
++#endif
+
+ static Object * get_resource_dict(XRef *xref,
+ Dict *pagedict,
+@@ -196,21 +257,36 @@ static Object * get_resource_dict(XRef *
+ Object res;
+
+ /* TODO resource dict can also be inherited */
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ res = pagedict->lookupNF("Resources");
++ if (res.isNull())
++#else
+ if (!pagedict->lookupNF("Resources", &res))
++#endif
+ return NULL;
+
+ if (res.isRef()) {
+ *resref = res.getRef();
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ *resdict = xref->fetch(resref->num, resref->gen);
++#else
+ xref->fetch(resref->num, resref->gen, resdict);
++#endif
+ }
+ else if (res.isDict()) {
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ *resdict = res.copy();
++#else
+ res.copy(resdict);
++#endif
+ resref->num = 0;
+ }
+ else
+ resdict = NULL;
+
++#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 58
+ res.free();
++#endif
+ return resdict;
+ }
+
+@@ -226,7 +302,11 @@ extern "C" void pdf_add_type1_font(pdf_t
+ Object resdict;
+ Ref resref;
+
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ pageobj = xref->fetch(pageref->num, pageref->gen);
++#else
+ xref->fetch(pageref->num, pageref->gen, &pageobj);
++#endif
+ if (!pageobj.isDict()) {
+ fprintf(stderr, "Error: malformed pdf\n");
+ return;
+@@ -234,21 +314,35 @@ extern "C" void pdf_add_type1_font(pdf_t
+
+ if (!get_resource_dict(xref, pageobj.getDict(), &resdict, &resref)) {
+ fprintf(stderr, "Error: malformed pdf\n");
++#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 58
+ pageobj.free();
++#endif
+ return;
+ }
+
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ font = Object(new Dict(xref));
++#else
+ font.initDict(xref);
++#endif
+ font.dictSet("Type", name_object("Font"));
+ font.dictSet("Subtype", name_object("Type1"));
+ font.dictSet("BaseFont", name_object(name));
+ xref->addIndirectObject(&font);
+
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ fonts = resdict.dictLookupNF("Font");
++#else
+ resdict.dictLookupNF("Font", &fonts);
++#endif
+ if (fonts.isNull()) {
+ /* Create new font dic obj in page's resources */
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ resdict.dictSet("Font", Object(new Dict(xref)));
++#else
+ fonts.initDict(xref);
+ resdict.dictSet("Font", &fonts);
++#endif
+ }
+
+ Object *fonts_dic;
+@@ -259,7 +353,11 @@ extern "C" void pdf_add_type1_font(pdf_t
+ fonts_dic = &fonts;
+ } else if ( fonts.isRef() ) {
+ /* "Font" resource is indirect reference object */
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ dereferenced_obj = xref->fetch(fonts.getRefNum(), fonts.getRefGen());
++#else
+ xref->fetch(fonts.getRefNum(), fonts.getRefGen(), &dereferenced_obj);
++#endif
+ fonts_dic = &dereferenced_obj;
+ }
+
+@@ -269,7 +367,11 @@ extern "C" void pdf_add_type1_font(pdf_t
+ }
+
+ /* Add new entry to "Font" resource */
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ fonts_dic->dictSet("bannertopdf-font", std::move(font));
++#else
+ fonts_dic->dictSet("bannertopdf-font", &font);
++#endif
+
+ /* Notify poppler about changes */
+ if ( fonts.isRef() ) {
+@@ -281,7 +383,9 @@ extern "C" void pdf_add_type1_font(pdf_t
+ else
+ xref->setModifiedObject(&resdict, resref);
+
++#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 58
+ pageobj.free();
++#endif
+ }
+
+
+@@ -293,23 +397,38 @@ static bool dict_lookup_rect(Object *dic
+ Array *array;
+ int i;
+
++#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
++ o = dict->dictLookup(key);
++ if (o.isNull())
++#else
+ if (!dict->dictLookup(key, &o))
++#endif
+ return false;
+
+ if (!o.isArray()) {
++#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 58
+ o.free();
Home |
Main Index |
Thread Index |
Old Index