Hello community, here is the log from the commit of package cups-filters for openSUSE:Factory checked in at 2019-02-13 10:15:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cups-filters (Old) and /work/SRC/openSUSE:Factory/.cups-filters.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "cups-filters" Wed Feb 13 10:15:20 2019 rev:39 rq:669046 version:1.22.0 Changes: -------- --- /work/SRC/openSUSE:Factory/cups-filters/cups-filters.changes 2019-01-10 15:16:41.434727230 +0100 +++ /work/SRC/openSUSE:Factory/.cups-filters.new.28833/cups-filters.changes 2019-02-13 10:15:29.221401051 +0100 @@ -1,0 +2,18 @@ +Mon Jan 28 08:56:33 UTC 2019 - bjorn.lie@gmail.com + +- Update to version 1.22.0: + * From this release on the pdftopdf filter flattens interactive + PDF forms and annotations internally, using QPDF, instead of + calling external utilities. This especially eliminates slowing + factors as additional piping of the data and unneeded use of + PDF interpreters. Using external utilities for flattening is + still possible in case of problems. In addition, a crash bug in + cups-browsed got fixed and compatibility of the filters with + Poppler 0.72 assured. +- Drop upstream fixed patches: + * 0001-Raise-minimum-poppler-version-from-0.18-to-0.19.patch + * 0002-Adapt-code-for-SplashXPathScanner-state-handling-sin.patch + * 0003-Support-some-more-methods-returning-const.patch + * 0004-Support-GooString-c_str-introduced-by-poppler-0.72.patch + +------------------------------------------------------------------- @@ -8,0 +27 @@ + See https://github.com/OpenPrinting/cups-filters/pull/83 Old: ---- 0001-Raise-minimum-poppler-version-from-0.18-to-0.19.patch 0002-Adapt-code-for-SplashXPathScanner-state-handling-sin.patch 0003-Support-some-more-methods-returning-const.patch 0004-Support-GooString-c_str-introduced-by-poppler-0.72.patch cups-filters-1.21.6.tar.xz New: ---- cups-filters-1.22.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cups-filters.spec ++++++ --- /var/tmp/diff_new_pack.hLZ8Ve/_old 2019-02-13 10:15:30.301400639 +0100 +++ /var/tmp/diff_new_pack.hLZ8Ve/_new 2019-02-13 10:15:30.305400637 +0100 @@ -1,7 +1,7 @@ # # spec file for package cups-filters # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -37,17 +37,9 @@ # and also run: zypper vcmp 'next version' 'current version' # e.g. zypper vcmp '1.0.49' '1.0.49.20140326' -> 1.0.49 is older than 1.0.49.20140326 # and zypper vcmp '1.0.50' '1.0.49.20140326' -> 1.0.50 is newer than 1.0.49.20140326 -Version: 1.21.6 +Version: 1.22.0 Release: 0 Source0: http://www.openprinting.org/download/cups-filters/cups-filters-%{version}.tar.xz -# PATCH-FIX-UPSTREAM 0001-Raise-minimum-poppler-version-from-0.18-to-0.19.patch - https://github.com/OpenPrinting/cups-filters/pull/83 -Patch0: 0001-Raise-minimum-poppler-version-from-0.18-to-0.19.patch -# PATCH-FIX-UPSTREAM 0002-Adapt-code-for-SplashXPathScanner-state-handling-sin.patch -Patch1: 0002-Adapt-code-for-SplashXPathScanner-state-handling-sin.patch -# PATCH-FIX-UPSTREAM 0003-Support-some-more-methods-returning-const.patch -Patch2: 0003-Support-some-more-methods-returning-const.patch -# PATCH-FIX-UPSTREAM 0004-Support-GooString-c_str-introduced-by-poppler-0.72.patch -Patch3: 0004-Support-GooString-c_str-introduced-by-poppler-0.72.patch # Upstream fix for https://bugs.linuxfoundation.org/show_bug.cgi?id=1421 # in https://github.com/OpenPrinting/cups-filters/commit/6db3b08d3b20332b1525b8dd... # dowloaded via @@ -72,7 +64,7 @@ Requires: cups > 1.5.4 BuildRequires: pkgconfig # pdftopdf -BuildRequires: qpdf-devel >= 8.1.0 +BuildRequires: qpdf-devel >= 8.3.0 # pdftops BuildRequires: poppler-tools # pdftoijs, pdftoopvp, pdftoraster @@ -227,10 +219,6 @@ %prep %setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 %build # Just do what is described in the upstream INSTALL file ++++++ cups-filters-1.21.6.tar.xz -> cups-filters-1.22.0.tar.xz ++++++ ++++ 1750 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/INSTALL new/cups-filters-1.22.0/INSTALL --- old/cups-filters-1.21.6/INSTALL 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/INSTALL 2019-01-18 12:27:02.000000000 +0100 @@ -1,4 +1,4 @@ -INSTALL - OpenPrinting CUPS Filters v1.21.6 - 2018-12-17 +INSTALL - OpenPrinting CUPS Filters v1.22.0 - 2019-01-18 -------------------------------------------------------- This file describes how to compile and install OpenPrinting CUPS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/NEWS new/cups-filters-1.22.0/NEWS --- old/cups-filters-1.21.6/NEWS 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/NEWS 2019-01-18 12:27:02.000000000 +0100 @@ -1,6 +1,20 @@ -NEWS - OpenPrinting CUPS Filters v1.21.6 - 2018-12-17 +NEWS - OpenPrinting CUPS Filters v1.22.0 - 2019-01-18 ----------------------------------------------------- +CHANGES IN V1.22.0 + + - pdftopdf: Use QPDF for flattening interactive PDF forms + (Issues #2, #23, #36, Pull request #88). + - pdftopdf: Fixed bug of closing temporary file prematurely + when external PDF form flattening utilities fail (Thanks to + Tobias Hoffmann for finding this, see pull request #88). + - pdftoopvp: More fixes for building with Poppler 0.72 + (Pull request #83, Issue #75). + - pdftoraster, pdftoijs, pdftoopvp: Removed support for + Poppler 0.18 (Pull request #83). + - cups-browsed: Fixed crash in applying the BrowseFilter + cups-browsed.conf directives (Debian bug #916765). + CHANGES IN V1.21.6 - cups-browsed: To find out whether a DNS-SD-discovered diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/README new/cups-filters-1.22.0/README --- old/cups-filters-1.21.6/README 2018-12-17 17:50:47.000000000 +0100 +++ new/cups-filters-1.22.0/README 2019-01-18 12:27:02.000000000 +0100 @@ -1,4 +1,4 @@ -README - OpenPrinting CUPS Filters v1.21.6 - 2018-12-17 +README - OpenPrinting CUPS Filters v1.22.0 - 2019-01-18 ------------------------------------------------------- Looking for compile instructions? Read the file "INSTALL.txt" @@ -28,7 +28,7 @@ by both CUPS and this package. Then the filters of this package should be used. - For compiling and using this package CUPS, libqpdf (8.1.0 or + For compiling and using this package CUPS, libqpdf (8.3.0 or newer), libjpeg, libpng, libtiff, freetype, fontconfig, liblcms (liblcms2 recommended), libavahi-common, libavahi-client, libdbus, and glib are needed. It is highly recommended, especially if @@ -845,9 +845,54 @@ Note: Some pages might end up 180 degree rotated (instead of 0 degree). Those should probably be rotated manually before binding the pages together. +3) Method of flattening interactive PDF forms and annotations. + +Some PDF files (like application forms) contain interactive forms +which the user can fill in inside a PDF viewer like evince. The filled +in data is not integrated in each page of the PDF file but stored in +an extra layer. Due to this the data gets lost when applying +manipulations like scaling or N-up to the pages. To prevent the loss +of the data pdftopdf flattens the form before doing the +manipulations. This means the PDF will be converted into a static PDF +file with the data being integral part of the pages. + +The same flattening is needed for annotations in PDF files. + +By default the actual flattening work is done by QPDF, as QPDF is also +doing everything else in pdftopdf. This way no external utilities need +to be called and so extra piping between processes and extra PDF +interpreter runs are avoided which makes the filtering process faster. + +As we did not test the new QPDF-based form-flattening with thousands +of PDF files yet and it has not been available to actual users yet it +is possible that there are still some bugs. To give users a +possibility to work around possible bugs in QPDF's form flattening, we +have introduced an option to get back to the old flattening by the +external tools pdftocairo or Ghostscript. + +The selection of the method is done by the "pdftopdf-form-flattening" +option, setting it to "auto", "qpdf", "pdftocairo", "ghostscript", +"gs", "internal" or "external": + +Per-job: lpr -o pdftopdf-form-flattening=pdftocairo ... +Per-queue default: lpadmin -p printer -o pdftopdf-form-flattening-default=gs +Remove default: lpadmin -p printer -R pdftopdf-form-flattening-default + +By default, pdftopdf uses QPDF if the option is not supplied, also the +settings "auto" and "internal" make QPDF being used. "external" +auto-selects from the two external utilities, trying pdftocairo at +first and on failure Ghostscript. If the selected utility fails, the +form stays unflattened and so the filled in data will possibly not get +printed. + Native PDF Printer / JCL Support -------------------------------- +Note that for most modern native PDF printers JCL is not needed any +more as they are controlled via IPP. For these the PPD files get +auto-generated by the support of CUPS and cups-filters for driverless +IPP printing. + pdftopdf will emit JCL when provided with a PPD file that includes the "*JCLToPDFInterpreter:" keyword. @@ -915,7 +960,7 @@ pdftopdf is released under the MIT license. -The required libqpdf is available under version 2 of the Artistic License, +The required libqpdf is available under version 2.0 of the Apache License, e.g. here: https://github.com/qpdf/qpdf diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/config.h.in new/cups-filters-1.22.0/config.h.in --- old/cups-filters-1.21.6/config.h.in 2018-12-17 17:50:58.000000000 +0100 +++ new/cups-filters-1.22.0/config.h.in 2019-01-18 12:27:31.000000000 +0100 @@ -135,9 +135,6 @@ /* pdftops supports -r argument. */ #undef HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION -/* Define to 1 if you have the <qpdf/Pl_RunLength.hh> header file. */ -#undef HAVE_QPDF_PL_RUNLENGTH_HH - /* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/configure.ac new/cups-filters-1.22.0/configure.ac --- old/cups-filters-1.21.6/configure.ac 2018-12-17 17:50:47.000000000 +0100 +++ new/cups-filters-1.22.0/configure.ac 2019-01-18 12:27:02.000000000 +0100 @@ -6,8 +6,8 @@ # Version informations # ==================== m4_define([cups_filters_version_major],[1]) -m4_define([cups_filters_version_minor],[21]) -m4_define([cups_filters_version_micro],[6]) +m4_define([cups_filters_version_minor],[22]) +m4_define([cups_filters_version_micro],[0]) m4_define([cups_filters_version],[cups_filters_version_major.cups_filters_version_minor.cups_filters_version_micro]) # ============= @@ -462,7 +462,7 @@ PKG_CHECK_MODULES([IJS], [ijs], [have_ijs=yes], [have_ijs=no]) PKG_CHECK_MODULES([ZLIB], [zlib]) AC_DEFINE([HAVE_LIBZ], [], [Define that we use zlib]) -PKG_CHECK_MODULES([LIBQPDF], [libqpdf >= 8.1.0]) +PKG_CHECK_MODULES([LIBQPDF], [libqpdf >= 8.3.0]) # =============================== # Check for PCLm printing support @@ -472,13 +472,6 @@ [enable_pclm=yes] ) if test "x$enable_pclm" != "xno"; then - # Do we have QPDF 7.0.0 or newer? - AC_CHECK_HEADERS([qpdf/Pl_RunLength.hh], - [], - [enable_pclm=no] - ) -fi -if test "x$enable_pclm" != "xno"; then AC_DEFINE([QPDF_HAVE_PCLM], [1], [QPDF has PCLm support?]) QPDF_NO_PCLM= else @@ -495,7 +488,7 @@ enable_poppler=$enableval,enable_poppler=yes) AM_CONDITIONAL(ENABLE_POPPLER, test x$enable_poppler = xyes) if test x$enable_poppler = xyes; then - PKG_CHECK_MODULES([POPPLER], [poppler >= 0.18]) + PKG_CHECK_MODULES([POPPLER], [poppler >= 0.19]) AC_CHECK_HEADER([poppler/cpp/poppler-version.h], [AC_DEFINE([HAVE_CPP_POPPLER_VERSION_H],,[Define if you have Poppler's "cpp/poppler-version.h" header file.])], []) fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/PDFError.h new/cups-filters-1.22.0/filter/PDFError.h --- old/cups-filters-1.21.6/filter/PDFError.h 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/PDFError.h 2018-12-29 20:31:46.000000000 +0100 @@ -35,10 +35,6 @@ #include "cpp/poppler-version.h" #endif -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 #define pdfError(pos,...) error(errInternal,pos,__VA_ARGS__) -#else -#define pdfError(pos,...) error(pos,__VA_ARGS__) -#endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoijs.cxx new/cups-filters-1.22.0/filter/pdftoijs.cxx --- old/cups-filters-1.21.6/filter/pdftoijs.cxx 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoijs.cxx 2018-12-29 20:31:46.000000000 +0100 @@ -69,7 +69,6 @@ ppd_file_t *ppd = 0; // holds the memory for the strings } -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23 void CDECL myErrorFun(void *data, ErrorCategory category, #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 70 @@ -94,19 +93,6 @@ fprintf(stderr, "%s\n",msg); fflush(stderr); } -#else -void CDECL myErrorFun(int pos, char *msg, va_list args) -{ - if (pos >= 0) { - fprintf(stderr, "ERROR (%d): ", pos); - } else { - fprintf(stderr, "ERROR: "); - } - vfprintf(stderr, msg, args); - fprintf(stderr, "\n"); - fflush(stderr); -} -#endif /* parse "300 400" */ void parse_resolution(const char *str) @@ -299,11 +285,7 @@ int rowpad; bool reverseVideo; -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 setErrorCallback(::myErrorFun,NULL); -#else - setErrorFunction(::myErrorFun); -#endif globalParams = new GlobalParams(); parseOpts(argc, argv); @@ -445,11 +427,7 @@ ,false #endif ); -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 out->startDoc(doc); -#else - out->startDoc(doc->getXRef()); -#endif snprintf(tmp,99,"%d",numChan); ijs_client_set_param(ctx,job_id,"NumChan",tmp,strlen(tmp)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoopvp/OPVPError.h new/cups-filters-1.22.0/filter/pdftoopvp/OPVPError.h --- old/cups-filters-1.21.6/filter/pdftoopvp/OPVPError.h 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoopvp/OPVPError.h 2018-12-29 20:31:46.000000000 +0100 @@ -35,10 +35,6 @@ #include "cpp/poppler-version.h" #endif -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 #define opvpError(pos,...) error(errInternal,pos,__VA_ARGS__) -#else -#define opvpError(pos,...) error(pos,__VA_ARGS__) -#endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoopvp/OPVPOutputDev.cxx new/cups-filters-1.22.0/filter/pdftoopvp/OPVPOutputDev.cxx --- old/cups-filters-1.21.6/filter/pdftoopvp/OPVPOutputDev.cxx 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoopvp/OPVPOutputDev.cxx 2018-12-29 20:31:46.000000000 +0100 @@ -294,7 +294,7 @@ if (state) { if (scaleWidth > 0 && scaleHeight > 0) { - double *ctm = state->getCTM(); + const double *ctm = state->getCTM(); switch (rotate) { case 90: @@ -499,17 +499,14 @@ SplashOutFontFileID *id; SplashFontFile *fontFile; SplashFontSrc *fontsrc = NULL; + const char *fontName = "(unnamed)"; FoFiTrueType *ff; Ref embRef; Object refObj, strObj; GooString *fileName; char *tmpBuf; int tmpBufLen; -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 int *codeToGID; -#else - Gushort *codeToGID; -#endif double m11, m12, m21, m22; int n; int faceIndex = 0; @@ -534,6 +531,13 @@ delete id; } else { + if (gfxFont->getName()) { +#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR <= 71 + fontName = gfxFont->getName()->getCString(); +#else + fontName = gfxFont->getName()->c_str(); +#endif + } // if there is an embedded font, write it to disk if (gfxFont->getEmbeddedFontID(&embRef)) { @@ -541,15 +545,12 @@ if (! tmpBuf) goto err2; -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 } else { SysFontType sftype; fileName = globalParams->findSystemFontFile(gfxFont,&sftype, &faceIndex, NULL); if (fileName == 0) { - opvpError(-1, "Couldn't find a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); + opvpError(-1, "Couldn't find a font for '%s'", fontName); goto err2; } switch (sftype) { @@ -563,34 +564,6 @@ break; } } -#else - // if there is an external font file, use it - } else if (!(fileName = gfxFont->getExtFontFile())) { - DisplayFontParam *dfp; - // look for a display font mapping or a substitute font - dfp = NULL; - if (gfxFont->getName()) { - dfp = globalParams->getDisplayFont(gfxFont); - } - if (!dfp) { - opvpError(-1, "Couldn't find a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); - goto err2; - } - switch (dfp->kind) { - case displayFontT1: - fileName = dfp->t1.fileName; - fontType = gfxFont->isCIDFont() ? fontCIDType0 : fontType1; - break; - case displayFontTT: - fileName = dfp->tt.fileName; - fontType = gfxFont->isCIDFont() ? fontCIDType2 : fontTrueType; - faceIndex = dfp->tt.faceIndex; - break; - } - } -#endif fontsrc = new SplashFontSrc; if (fileName) @@ -604,13 +577,9 @@ if (!(fontFile = fontEngine->loadType1Font( id, fontsrc, -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 (const char **) -#endif ((Gfx8BitFont *)gfxFont)->getEncoding()))) { - opvpError(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); + opvpError(-1, "Couldn't create a font for '%s'", fontName); goto err2; } break; @@ -618,13 +587,9 @@ if (!(fontFile = fontEngine->loadType1CFont( id, fontsrc, -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 (const char **) -#endif ((Gfx8BitFont *)gfxFont)->getEncoding()))) { - opvpError(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); + opvpError(-1, "Couldn't create a font for '%s'", fontName); goto err2; } break; @@ -632,20 +597,20 @@ if (!(fontFile = fontEngine->loadOpenTypeT1CFont( id, fontsrc, -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 (const char **) -#endif ((Gfx8BitFont *)gfxFont)->getEncoding()))) { - opvpError(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); + opvpError(-1, "Couldn't create a font for '%s'", fontName); goto err2; } break; case fontTrueTypeOT: case fontTrueType: if (fileName) +#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR <= 71 ff = FoFiTrueType::load(fileName->getCString()); +#else + ff = FoFiTrueType::load(fileName->c_str()); +#endif else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (ff) { @@ -660,9 +625,7 @@ id, fontsrc, codeToGID, n))) { - opvpError(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); + opvpError(-1, "Couldn't create a font for '%s'", fontName); goto err2; } break; @@ -671,14 +634,11 @@ if (!(fontFile = fontEngine->loadCIDFont( id, fontsrc))) { - opvpError(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); + opvpError(-1, "Couldn't create a font for '%s'", fontName); goto err2; } break; case fontCIDType0COT: -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen(); if (n) { codeToGID = (int *)gmallocn(n, sizeof(int)); @@ -690,14 +650,7 @@ if (!(fontFile = fontEngine->loadOpenTypeCFFFont( id, fontsrc,codeToGID,n))) { -#else - if (!(fontFile = fontEngine->loadOpenTypeCFFFont( - id, - fontsrc))) { -#endif - opvpError(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); + opvpError(-1, "Couldn't create a font for '%s'", fontName); goto err2; } break; @@ -708,19 +661,17 @@ if (((GfxCIDFont *)gfxFont)->getCIDToGID()) { n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen(); if (n) { -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 codeToGID = (int *)gmallocn(n, sizeof(int)); memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), n * sizeof(int)); -#else - codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort)); - memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), - n * sizeof(Gushort)); -#endif } } else { if (fileName) +#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR <= 71 ff = FoFiTrueType::load(fileName->getCString()); +#else + ff = FoFiTrueType::load(fileName->c_str()); +#endif else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (! ff) @@ -732,9 +683,7 @@ id, fontsrc, codeToGID, n, faceIndex))) { - opvpError(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); + opvpError(-1, "Couldn't create a font for '%s'", fontName); goto err2; } break; @@ -760,7 +709,7 @@ if (fontFile->doAdjustMatrix && !gfxFont->isCIDFont()) { double w1, w2; CharCode code; - char *name; + const char *name; for (code = 0; code < 256; ++code) { if ((name = ((Gfx8BitFont *)gfxFont)->getCharName(code)) && name[0] == 'm' && name[1] == '\0') { @@ -929,11 +878,7 @@ tsplash->setLineWidth(state->getTransformedLineWidth()); path = convertPath(state, state->getPath()); -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 spath = tsplash->makeStrokePath(path,0); -#else - spath = tsplash->makeStrokePath(path); -#endif path2 = new OPVPSplashPath(spath); delete spath; delete path; @@ -1115,7 +1060,7 @@ int width, int height, bool invert, bool interpolate, bool inlineImg) { - double *ctm; + const double *ctm; SplashCoord mat[6]; SplashOutImageMaskData imgMaskData; @@ -1379,7 +1324,7 @@ GfxImageColorMap *colorMap, bool interpolate, int *maskColors, bool inlineImg) { - double *ctm; + const double *ctm; SplashCoord mat[6]; SplashOutImageData imgData; SplashColorMode srcMode; @@ -1604,7 +1549,7 @@ Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert, bool maskInterpolate) { - double *ctm; + const double *ctm; SplashCoord mat[6]; SplashOutMaskedImageData imgData; SplashOutImageMaskData imgMaskData; @@ -1759,7 +1704,7 @@ int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, bool maskInterpolate) { - double *ctm; + const double *ctm; SplashCoord mat[6]; SplashOutImageData imgData; SplashOutImageData imgMaskData; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplash.cxx new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplash.cxx --- old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplash.cxx 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplash.cxx 2018-12-29 20:31:46.000000000 +0100 @@ -636,12 +636,8 @@ state->flatness, false); xpath->sort(); -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 SplashXPathScanner *scanner = new SplashXPathScanner(xpath,eo, INT_MIN,INT_MAX); -#else - SplashXPathScanner *scanner = new SplashXPathScanner(xpath,eo); -#endif scanner->getBBox(&xMin,&yMin,&xMax,&yMax); delete scanner; delete xpath; @@ -864,7 +860,6 @@ SplashError OPVPSplash::strokeByMyself(OPVPSplashPath *path) { -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 SplashPath *dPath; OPVPSplashPath *oPath; Splash *osplash; @@ -898,37 +893,6 @@ } delete osplash; return splashOk; -#else - OPVPSplashXPath *xPath, *xPath2; - SplashPattern *savedPattern; - - /* draw dashed line by myself */ - if (path->getLength() == 0) { - return splashOk; - } - xPath = new OPVPSplashXPath(path, state->matrix, state->flatness, false); - if (state->lineDash != NULL && state->lineDashLength > 0) { - xPath2 = xPath->makeDashedPath(state); - delete xPath; - xPath = xPath2; - } - - if (state->lineWidth <= 1) { - xPath->strokeNarrow(this,state); - } else { - /* change fill pattern temprarily */ - savedPattern = state->fillPattern->copy(); - setFillPattern(state->strokePattern->copy()); - - xPath->strokeWide(this,state); - - /* restore fill pattern */ - setFillPattern(savedPattern); - } - - delete xPath; - return splashOk; -#endif } SplashError OPVPSplash::stroke(OPVPSplashPath *path) { @@ -987,11 +951,7 @@ } xPath = new OPVPSplashXPath(path, state->matrix, state->flatness, true); xPath->sort(); -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 scanner = new SplashXPathScanner(xPath, eo, INT_MIN, INT_MAX); -#else - scanner = new SplashXPathScanner(xPath, eo); -#endif // get the min and max x and y values scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI); @@ -1006,7 +966,13 @@ setStrokePattern(state->fillPattern->copy()); for (y = yMinI; y < yMaxI; ++y) { - while (scanner->getNextSpan(y, &x0, &x1)) { +#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 70 + SplashXPathScanIterator iterator(*scanner, y); + while (iterator.getNextSpan(&x0, &x1)) +#else + while (scanner->getNextSpan(y, &x0, &x1)) +#endif + { if (x0 == x1) continue; if (clipRes == splashClipAllInside) { drawSpan(x0, x1-1, y, true); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplashClip.cxx new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplashClip.cxx --- old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplashClip.cxx 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplashClip.cxx 2018-12-29 20:31:46.000000000 +0100 @@ -1,4 +1,9 @@ #include <config.h> + +#ifdef HAVE_CPP_POPPLER_VERSION_H +#include "cpp/poppler-version.h" +#endif + #include "splash/SplashXPathScanner.h" #include "OPVPSplashClip.h" @@ -27,7 +32,6 @@ int i,j; int y, x0, x1; int txMin, tyMin, txMax, tyMax; - int tsxMin, tsyMin, tsxMax, tsyMax; Guchar *cbuf,*tbuf; int blen; OPVPSplashPath *p = new OPVPSplashPath(); @@ -37,17 +41,19 @@ blen = txMax-txMin+1; cbuf = new Guchar[blen]; tbuf = new Guchar[blen]; - - /* dummy call to clear state */ - scanners[0]->getBBox(&tsxMin,&tsyMin,&tsxMax,&tsyMax); - scanners[0]->getNextSpan(tsyMin-2,&x0,&x1); for (y = tyMin;y <= tyMax;y++) { /* clear buffer */ for (i = 0;i < blen;i++) { cbuf[i] = 0; } - while (scanners[0]->getNextSpan(y,&x0,&x1)) { +#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 70 + SplashXPathScanIterator iterator(*scanners[0], y); + while (iterator.getNextSpan(&x0, &x1)) +#else + while (scanners[0]->getNextSpan(y,&x0,&x1)) +#endif + { if (x0 < txMin) x0 = txMin; if (x1 > txMax) x1 = txMax; for (i = x0;i < x1;i++) { @@ -59,7 +65,13 @@ for (i = 0;i < blen;i++) { tbuf[i] = 0; } - while (scanners[j]->getNextSpan(y,&x0,&x1)) { +#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 70 + SplashXPathScanIterator iterator2(*scanners[j], y); + while (iterator2.getNextSpan(&x0, &x1)) +#else + while (scanners[j]->getNextSpan(y,&x0,&x1)) +#endif + { if (x0 < txMin) x0 = txMin; if (x1 > txMax) x1 = txMax; for (i = x0;i < x1;i++) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplashState.cxx new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplashState.cxx --- old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplashState.cxx 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplashState.cxx 2018-12-29 20:31:46.000000000 +0100 @@ -129,7 +129,6 @@ } } -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 void OPVPSplashState::setState(Splash *osplash) { osplash->setMatrix(matrix); osplash->setFlatness(flatness); @@ -139,7 +138,6 @@ osplash->setMiterLimit(miterLimit); osplash->setLineJoin(lineJoin); } -#endif void OPVPSplashState::setStrokePattern(SplashPattern *strokePatternA) { delete strokePattern; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplashState.h new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplashState.h --- old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplashState.h 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplashState.h 2018-12-29 20:31:46.000000000 +0100 @@ -41,9 +41,7 @@ ~OPVPSplashState(); -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 void setState(Splash *osplash); -#endif // Set the stroke pattern. This does not copy <strokePatternA>. void setStrokePattern(SplashPattern *strokePatternA); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx --- old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplashXPath.cxx 2018-12-29 20:31:46.000000000 +0100 @@ -10,344 +10,6 @@ #include "OPVPWrapper.h" #include "OPVPSplash.h" -#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 19 -OPVPSplashXPath *OPVPSplashXPath::makeDashedPath(OPVPSplashState *state) -{ - OPVPSplashXPath *dPath; - bool lineDashStartOn, lineDashOn; - bool atSegStart, atSegEnd, atDashStart, atDashEnd; - int lineDashStartIdx, lineDashIdx, subpathStart; - SplashCoord lineDashTotal, lineDashStartPhase, lineDashDist; - int segIdx; - SplashXPathSeg *seg; - SplashCoord sx0, sy0, sx1, sy1, ax0, ay0, ax1, ay1, dist; - int i; - - dPath = new OPVPSplashXPath(); - - lineDashTotal = 0; - for (i = 0; i < state->lineDashLength; ++i) { - lineDashTotal += state->lineDash[i]; - } - lineDashStartPhase = state->lineDashPhase; - i = splashFloor(lineDashStartPhase / lineDashTotal); - lineDashStartPhase -= i * lineDashTotal; - lineDashStartOn = true; - lineDashStartIdx = 0; - while (lineDashStartPhase >= state->lineDash[lineDashStartIdx]) { - lineDashStartOn = !lineDashStartOn; - lineDashStartPhase -= state->lineDash[lineDashStartIdx]; - ++lineDashStartIdx; - } - - segIdx = 0; - seg = segs; - sx0 = seg->x0; - sy0 = seg->y0; - sx1 = seg->x1; - sy1 = seg->y1; - dist = splashDist(sx0, sy0, sx1, sy1); - lineDashOn = lineDashStartOn; - lineDashIdx = lineDashStartIdx; - lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase; - atSegStart = true; - atDashStart = true; - subpathStart = dPath->length; - - while (segIdx < length) { - - ax0 = sx0; - ay0 = sy0; - if (dist <= lineDashDist) { - ax1 = sx1; - ay1 = sy1; - lineDashDist -= dist; - dist = 0; - atSegEnd = true; - atDashEnd = lineDashDist == 0 || (seg->flags & splashXPathLast); - } else { - ax1 = sx0 + (lineDashDist / dist) * (sx1 - sx0); - ay1 = sy0 + (lineDashDist / dist) * (sy1 - sy0); - sx0 = ax1; - sy0 = ay1; - dist -= lineDashDist; - lineDashDist = 0; - atSegEnd = false; - atDashEnd = true; - } - - if (lineDashOn) { - dPath->addSegment(ax0, ay0, ax1, ay1, - atDashStart, atDashEnd, - atDashStart, atDashEnd); - // end of closed subpath - if (atSegEnd && - (seg->flags & splashXPathLast) && - !(seg->flags & splashXPathEnd1)) { - dPath->segs[subpathStart].flags &= ~splashXPathEnd0; - dPath->segs[dPath->length - 1].flags &= ~splashXPathEnd1; - } - } - - if (atDashEnd) { - lineDashOn = !lineDashOn; - if (++lineDashIdx == state->lineDashLength) { - lineDashIdx = 0; - } - lineDashDist = state->lineDash[lineDashIdx]; - atDashStart = true; - } else { - atDashStart = false; - } - if (atSegEnd) { - if (++segIdx < length) { - ++seg; - sx0 = seg->x0; - sy0 = seg->y0; - sx1 = seg->x1; - sy1 = seg->y1; - dist = splashDist(sx0, sy0, sx1, sy1); - if (seg->flags & splashXPathFirst) { - lineDashOn = lineDashStartOn; - lineDashIdx = lineDashStartIdx; - lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase; - atDashStart = true; - subpathStart = dPath->length; - } - } - atSegStart = true; - } else { - atSegStart = false; - } - } - - return dPath; -} - -void OPVPSplashXPath::strokeWide(OPVPSplash *splash, OPVPSplashState *state) -{ - SplashXPathSeg *seg, *seg2; - OPVPSplashPath *widePath; - SplashCoord d, dx, dy, wdx, wdy, dxPrev, dyPrev, wdxPrev, wdyPrev; - SplashCoord dotprod, miter; - SplashCoord x0,y0,x1,y1,x2,y2,x3,y3; - int i, j; - - dx = dy = wdx = wdy = 0; // make gcc happy - dxPrev = dyPrev = wdxPrev = wdyPrev = 0; // make gcc happy - - for (i = 0, seg = segs; i < length; ++i, ++seg) { - - // save the deltas for the previous segment; if this is the first - // segment on a subpath, compute the deltas for the last segment - // on the subpath (which may be used to draw a line join) - if (seg->flags & splashXPathFirst) { - for (j = i + 1, seg2 = &segs[j]; - j < length; ++j, ++seg2) { - if (seg2->flags & splashXPathLast) { - d = splashDist(seg2->x0, seg2->y0, seg2->x1, seg2->y1); - if (d == 0) { - //~ not clear what the behavior should be for joins with d==0 - dxPrev = 0; - dyPrev = 1; - } else { - d = 1 / d; - dxPrev = d * (seg2->x1 - seg2->x0); - dyPrev = d * (seg2->y1 - seg2->y0); - } - wdxPrev = 0.5 * state->lineWidth * dxPrev; - wdyPrev = 0.5 * state->lineWidth * dyPrev; - break; - } - } - } else { - dxPrev = dx; - dyPrev = dy; - wdxPrev = wdx; - wdyPrev = wdy; - } - - // compute deltas for this line segment - d = splashDist(seg->x0, seg->y0, seg->x1, seg->y1); - if (d == 0) { - // we need to draw end caps on zero-length lines - //~ not clear what the behavior should be for splashLineCapButt with d==0 - dx = 0; - dy = 1; - } else { - d = 1 / d; - dx = d * (seg->x1 - seg->x0); - dy = d * (seg->y1 - seg->y0); - } - wdx = 0.5 * state->lineWidth * dx; - wdy = 0.5 * state->lineWidth * dy; - - // initialize the path (which will be filled) - widePath = new OPVPSplashPath(); - widePath->moveTo(seg->x0 - wdy, seg->y0 + wdx); - - // draw the start cap - if (seg->flags & splashXPathEnd0) { - switch (state->lineCap) { - case splashLineCapButt: - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - break; - case splashLineCapRound: - x0 = seg->x0 - wdy; - y0 = seg->y0 + wdx; - x3 = seg->x0 - wdx; - y3 = seg->y0 - wdy; - splash->arcToCurve(x0, y0, x3, y3, - seg->x0, seg->y0, &x1,&y1,&x2,&y2); - widePath->curveTo(x2,y2,x1,y1,x3,y3); - x0 = x3; - y0 = y3; - x3 = seg->x0 + wdy; - y3 = seg->y0 - wdx; - splash->arcToCurve(x0,y0,x3,y3, - seg->x0, seg->y0, &x1,&y1,&x2,&y2); - widePath->curveTo(x2,y2,x1,y1,x3,y3); - break; - case splashLineCapProjecting: - widePath->lineTo(seg->x0 - wdx - wdy, seg->y0 + wdx - wdy); - widePath->lineTo(seg->x0 - wdx + wdy, seg->y0 - wdx - wdy); - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - break; - } - } else { - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - } - - // draw the left side of the segment - widePath->lineTo(seg->x1 + wdy, seg->y1 - wdx); - - // draw the end cap - if (seg->flags & splashXPathEnd1) { - switch (state->lineCap) { - case splashLineCapButt: - widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx); - break; - case splashLineCapRound: - x0 = seg->x1 + wdy; - y0 = seg->y1 - wdx; - x3 = seg->x1 + wdx; - y3 = seg->y1 + wdy; - splash->arcToCurve(x0, y0, x3, y3, - seg->x1, seg->y1, &x1,&y1,&x2,&y2); - widePath->curveTo(x2,y2,x1,y1,x3,y3); - x0 = x3; - y0 = y3; - x3 = seg->x1 - wdy; - y3 = seg->y1 + wdx; - splash->arcToCurve(x0,y0,x3,y3, - seg->x1, seg->y1, &x1,&y1,&x2,&y2); - widePath->curveTo(x2,y2,x1,y1,x3,y3); - break; - case splashLineCapProjecting: - widePath->lineTo(seg->x1 + wdx + wdy, seg->y1 - wdx + wdy); - widePath->lineTo(seg->x1 + wdx - wdy, seg->y1 + wdx + wdy); - widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx); - break; - } - } else { - widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx); - } - - // draw the right side of the segment - widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx); - - // fill the segment - splash->fill(widePath, true); - delete widePath; - - // draw the line join - if (!(seg->flags & splashXPathEnd0)) { - widePath = NULL; - switch (state->lineJoin) { - case splashLineJoinMiter: - dotprod = -(dx * dxPrev + dy * dyPrev); - if (dotprod != 1) { - widePath = new OPVPSplashPath(); - widePath->moveTo(seg->x0, seg->y0); - miter = 2 / (1 - dotprod); - if (splashSqrt(miter) <= state->miterLimit) { - miter = splashSqrt(miter - 1); - if (dy * dxPrev > dx * dyPrev) { - widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev); - widePath->lineTo(seg->x0 + wdy - miter * wdx, - seg->y0 - wdx - miter * wdy); - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - } else { - widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev); - widePath->lineTo(seg->x0 - wdy - miter * wdx, - seg->y0 + wdx - miter * wdy); - widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx); - } - } else { - if (dy * dxPrev > dx * dyPrev) { - widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev); - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - } else { - widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev); - widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx); - } - } - } - break; - case splashLineJoinRound: - widePath = new OPVPSplashPath(); - /* draw circle */ - widePath->moveTo(seg->x0 + wdy, seg->y0 - wdx); - x0 = seg->x0 + wdy; - y0 = seg->y0 - wdx; - x3 = seg->x0 - wdx; - y3 = seg->y0 - wdy; - splash->arcToCurve(x0, y0, x3, y3, - seg->x0, seg->y0, &x1,&y1,&x2,&y2); - widePath->curveTo(x1,y1,x2,y2,x3,y3); - x0 = x3; - y0 = y3; - x3 = seg->x0 - wdy; - y3 = seg->y0 + wdx; - splash->arcToCurve(x0, y0, x3, y3, - seg->x0, seg->y0, &x1,&y1,&x2,&y2); - widePath->curveTo(x1,y1,x2,y2,x3,y3); - x0 = x3; - y0 = y3; - x3 = seg->x0 + wdx; - y3 = seg->y0 + wdy; - splash->arcToCurve(x0, y0, x3, y3, - seg->x0, seg->y0, &x1,&y1,&x2,&y2); - widePath->curveTo(x1,y1,x2,y2,x3,y3); - x0 = x3; - y0 = y3; - x3 = seg->x0 + wdy; - y3 = seg->y0 - wdx; - splash->arcToCurve(x0, y0, x3, y3, - seg->x0, seg->y0, &x1,&y1,&x2,&y2); - widePath->curveTo(x1,y1,x2,y2,x3,y3); - break; - case splashLineJoinBevel: - widePath = new OPVPSplashPath(); - widePath->moveTo(seg->x0, seg->y0); - if (dy * dxPrev > dx * dyPrev) { - widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev); - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - } else { - widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev); - widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx); - } - break; - } - if (widePath) { - splash->fill(widePath, true); - delete widePath; - } - } - } -} -#endif - void OPVPSplashXPath::strokeNarrow(OPVPSplash *splash, OPVPSplashState *state) { SplashXPathSeg *seg; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplashXPath.h new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplashXPath.h --- old/cups-filters-1.21.6/filter/pdftoopvp/oprs/OPVPSplashXPath.h 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoopvp/oprs/OPVPSplashXPath.h 2018-12-29 20:31:46.000000000 +0100 @@ -23,15 +23,8 @@ OPVPSplashXPath *makeDashedPath(OPVPSplashState *state); void strokeNarrow(OPVPSplash *splash, OPVPSplashState *state); -#if POPPLER_VERSION_MAJOR <= 0 && POPPLER_VERSION_MINOR < 19 - void strokeWide(OPVPSplash *splash, OPVPSplashState *state); -#endif private: -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 OPVPSplashXPath() : SplashXPath(new SplashPath(), 0, 0, false) {}; -#else - OPVPSplashXPath() {}; -#endif OPVPSplashXPath(OPVPSplashXPath *xPath) : SplashXPath(xPath) { } }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoopvp/pdftoopvp.cxx new/cups-filters-1.22.0/filter/pdftoopvp/pdftoopvp.cxx --- old/cups-filters-1.21.6/filter/pdftoopvp/pdftoopvp.cxx 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoopvp/pdftoopvp.cxx 2018-12-29 20:31:46.000000000 +0100 @@ -111,7 +111,6 @@ #define MAX_OPVP_OPTIONS 20 -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23 void CDECL myErrorFun(void *data, ErrorCategory category, #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 70 @@ -136,19 +135,6 @@ fprintf(stderr, "%s\n",msg); fflush(stderr); } -#else -void CDECL myErrorFun(int pos, char *msg, va_list args) -{ - if (pos >= 0) { - fprintf(stderr, "ERROR (%d): ", pos); - } else { - fprintf(stderr, "ERROR: "); - } - vfprintf(stderr, msg, args); - fprintf(stderr, "\n"); - fflush(stderr); -} -#endif static bool getColorProfilePath(ppd_file_t *ppd, GooString *path) { @@ -254,11 +240,7 @@ GooString colorProfilePath("opvp.icc"); exitCode = 99; -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 setErrorCallback(::myErrorFun,NULL); -#else - setErrorFunction(::myErrorFun); -#endif // parse args int num_options; @@ -482,12 +464,21 @@ if (choices != 0) free(choices); } +#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR <= 71 strncpy(jobInfo,jobInfoStr.getCString(),sizeof(jobInfo)-1); jobInfo[sizeof(jobInfo)-1] = '\0'; strncpy(docInfo,docInfoStr.getCString(),sizeof(docInfo)-1); docInfo[sizeof(docInfo)-1] = '\0'; strncpy(pageInfo,pageInfoStr.getCString(),sizeof(pageInfo)-1); pageInfo[sizeof(pageInfo)-1] = '\0'; +#else + strncpy(jobInfo,jobInfoStr.c_str(),sizeof(jobInfo)-1); + jobInfo[sizeof(jobInfo)-1] = '\0'; + strncpy(docInfo,docInfoStr.c_str(),sizeof(docInfo)-1); + docInfo[sizeof(docInfo)-1] = '\0'; + strncpy(pageInfo,pageInfoStr.c_str(),sizeof(pageInfo)-1); + pageInfo[sizeof(pageInfo)-1] = '\0'; +#endif colorProfile = getColorProfilePath(ppd,&colorProfilePath); @@ -647,7 +638,13 @@ name.append("/tmp"); } name.append("/XXXXXX"); +#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR <= 71 fd = mkstemp(name.getCString()); +#else + std::string t = name.toStr(); + fd = mkstemp(&t[0]); + name = GooString(std::move(t)); +#endif if (fd < 0) { opvpError(-1,"Can't create temporary file"); exitCode = 2; @@ -691,7 +688,11 @@ close(fd); doc = new PDFDoc(&name); /* remove name */ +#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR <= 71 unlink(name.getCString()); +#else + unlink(name.c_str()); +#endif } else { /* no jcl check */ doc = new PDFDoc(fileName.copy()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftopdf/pdftopdf.cc new/cups-filters-1.22.0/filter/pdftopdf/pdftopdf.cc --- old/cups-filters-1.21.6/filter/pdftopdf/pdftopdf.cc 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftopdf/pdftopdf.cc 2019-01-14 22:09:16.000000000 +0100 @@ -1026,7 +1026,7 @@ //param.mirror=true; //param.reverse=true; //param.numCopies=3; - if (!proc1->loadFilename("in.pdf")) return 2; + if (!proc1->loadFilename("in.pdf",1)) return 2; param.dump(); if (!processPDFTOPDF(*proc1,param)) return 3; emitComment(*proc1,param); @@ -1063,30 +1063,61 @@ param.dump(); #endif + /* Check with which method we will flatten interactive PDF forms + and annotations so that they get printed also after page + manipulations (scaling, N-up, ...). Flattening means to + integrate the filled in data and the printable annotations into + the pages themselves instead of holding them in an extra + layer. Default method is using QPDF, alternatives are the + external utilities pdftocairo or Ghostscript, but these make + the processing slower, especially due to extra piping of the + data between processes. */ + int qpdf_flatten = 1; + int pdftocairo_flatten = 0; + int gs_flatten = 0; + int external_auto_flatten = 0; + const char *val; + if ((val = cupsGetOption("pdftopdf-form-flattening", num_options, options)) != NULL) { + if (strcasecmp(val, "qpdf") == 0 || strcasecmp(val, "internal") == 0 || + strcasecmp(val, "auto") == 0) { + qpdf_flatten = 1; + } else if (strcasecmp(val, "external") == 0) { + qpdf_flatten = 0; + external_auto_flatten = 1; + } else if (strcasecmp(val, "pdftocairo") == 0) { + qpdf_flatten = 0; + pdftocairo_flatten = 1; + } else if (strcasecmp(val, "ghostscript") == 0 || strcasecmp(val, "gs") == 0) { + qpdf_flatten = 0; + gs_flatten = 1; + } else + fprintf(stderr, + "WARNING: Invalid value for "pdftopdf-form-flattening": "%s"\n", val); + } + cupsFreeOptions(num_options,options); std::unique_ptr<PDFTOPDF_Processor> proc(PDFTOPDF_Factory::processor()); FILE *tmpfile = NULL; if (argc==7) { - if (!proc->loadFilename(argv[6])) { + if (!proc->loadFilename(argv[6],qpdf_flatten)) { ppdClose(ppd); return 1; } } else { tmpfile = copy_stdin_to_temp(); if ((!tmpfile)|| - (!proc->loadFile(tmpfile,WillStayAlive))) { + (!proc->loadFile(tmpfile,WillStayAlive,qpdf_flatten))) { ppdClose(ppd); return 1; } } - /* The input file contains a PDF form. To not loose the data filled - into the form during our further manipulations we need to flatten - the form, meaning that we integrate the filled in data into the - pages themselves instead of holding them in an extra layer */ - if (proc->hasAcroForm()) { + /* If the input file contains a PDF form and we opted for not + using QPDF for flattening the form, we pipe the PDF through + pdftocairo or Ghostscript here */ + if (!qpdf_flatten && proc->hasAcroForm()) { /* Prepare the input file for being read by the form flattening process */ FILE *infile = NULL; @@ -1119,22 +1150,26 @@ const char *command; cups_array_t *args; /* Choose the utility to be used and create its command line */ - /* Try pdftocairo first, the preferred utility for form-flattening */ - command = CUPS_POPPLER_PDFTOCAIRO; - args = cupsArrayNew(NULL, NULL); - cupsArrayAdd(args, strdup(command)); - cupsArrayAdd(args, strdup("-pdf")); - cupsArrayAdd(args, strdup("-")); - cupsArrayAdd(args, strdup(buf)); - /* Run the pdftocairo form flattening process */ - rewind(infile); - int status = sub_process_spawn (command, args, infile); - cupsArrayDelete(args); - if (status == 0) - flattening_done = 1; - else { - error("Unable to execute pdftocairo for form flattening!"); - /* Try Ghostscript, currently the only working alternative */ + if (pdftocairo_flatten || external_auto_flatten) { + /* Try pdftocairo first, the preferred utility for form-flattening */ + command = CUPS_POPPLER_PDFTOCAIRO; + args = cupsArrayNew(NULL, NULL); + cupsArrayAdd(args, strdup(command)); + cupsArrayAdd(args, strdup("-pdf")); + cupsArrayAdd(args, strdup("-")); + cupsArrayAdd(args, strdup(buf)); + /* Run the pdftocairo form flattening process */ + rewind(infile); + int status = sub_process_spawn (command, args, infile); + cupsArrayDelete(args); + if (status == 0) + flattening_done = 1; + else + error("Unable to execute pdftocairo for form flattening!"); + } + if (flattening_done == 0 && + (gs_flatten || external_auto_flatten)) { + /* Try Ghostscript */ command = CUPS_GHOSTSCRIPT; args = cupsArrayNew(NULL, NULL); cupsArrayAdd(args, strdup(command)); @@ -1157,24 +1192,27 @@ cupsArrayDelete(args); if (status == 0) flattening_done = 1; - else { + else error("Unable to execute Ghostscript for form flattening!"); - error("No suitable utility for flattening filled PDF forms available, no flattening performed. Filled in content will not be printed."); - rewind(infile); - } + } + if (flattening_done == 0) { + error("No suitable utility for flattening filled PDF forms available, no flattening performed. Filled in content will possibly not be printed."); + rewind(infile); } /* Clean up */ - fclose(infile); + if (infile != tmpfile) + fclose(infile); /* Load the flattened PDF file into our PDF processor */ if (flattening_done) { rewind(outfile); unlink(buf); - if (!proc->loadFile(outfile,TakeOwnership)) { + if (!proc->loadFile(outfile,TakeOwnership,0)) { error("Unable to create a PDF processor on the flattened form!"); return 1; } } - } + } else if (qpdf_flatten) + fprintf(stderr, "DEBUG: PDF interactive form and annotation flattening done via QPDF\n"); /* TODO // color management @@ -1202,6 +1240,8 @@ emitPostamble(ppd,param); ppdClose(ppd); + if (tmpfile) + fclose(tmpfile); } catch (std::exception &e) { // TODO? exception type error("Exception: %s",e.what()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftopdf/pdftopdf_processor.h new/cups-filters-1.22.0/filter/pdftopdf/pdftopdf_processor.h --- old/cups-filters-1.21.6/filter/pdftopdf/pdftopdf_processor.h 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftopdf/pdftopdf_processor.h 2019-01-14 22:09:16.000000000 +0100 @@ -119,8 +119,8 @@ virtual ~PDFTOPDF_Processor() {} // TODO: ... qpdf wants password at load time - virtual bool loadFile(FILE *f,ArgOwnership take=WillStayAlive) =0; - virtual bool loadFilename(const char *name) =0; + virtual bool loadFile(FILE *f,ArgOwnership take=WillStayAlive,int flatten_forms=1) =0; + virtual bool loadFilename(const char *name,int flatten_forms=1) =0; // TODO? virtual bool may_modify/may_print/? virtual bool check_print_permissions() =0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftopdf/qpdf_pdftopdf_processor.cc new/cups-filters-1.22.0/filter/pdftopdf/qpdf_pdftopdf_processor.cc --- old/cups-filters-1.21.6/filter/pdftopdf/qpdf_pdftopdf_processor.cc 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftopdf/qpdf_pdftopdf_processor.cc 2019-01-14 22:09:16.000000000 +0100 @@ -5,6 +5,8 @@ #include <stdexcept> #include <qpdf/QPDFWriter.hh> #include <qpdf/QUtil.hh> +#include <qpdf/QPDFPageDocumentHelper.hh> +#include <qpdf/QPDFAcroFormDocumentHelper.hh> #include "qpdf_tools.h" #include "qpdf_xobject.h" #include "qpdf_pdftopdf.h" @@ -379,7 +381,7 @@ // TODO? try/catch for PDF parsing errors? -bool QPDF_PDFTOPDF_Processor::loadFile(FILE *f,ArgOwnership take) // {{{ +bool QPDF_PDFTOPDF_Processor::loadFile(FILE *f,ArgOwnership take,int flatten_forms) // {{{ { closeFile(); if (!f) { @@ -414,12 +416,12 @@ error("loadFile with MustDuplicate is not supported"); return false; } - start(); + start(flatten_forms); return true; } // }}} -bool QPDF_PDFTOPDF_Processor::loadFilename(const char *name) // {{{ +bool QPDF_PDFTOPDF_Processor::loadFilename(const char *name,int flatten_forms) // {{{ { closeFile(); try { @@ -429,15 +431,23 @@ error("loadFilename failed: %s",e.what()); return false; } - start(); + start(flatten_forms); return true; } // }}} -void QPDF_PDFTOPDF_Processor::start() // {{{ +void QPDF_PDFTOPDF_Processor::start(int flatten_forms) // {{{ { assert(pdf); + if (flatten_forms) { + QPDFAcroFormDocumentHelper afdh(*pdf); + afdh.generateAppearancesIfNeeded(); + + QPDFPageDocumentHelper dh(*pdf); + dh.flattenAnnotations(an_print); + } + pdf->pushInheritedAttributesToPage(); orig_pages=pdf->getAllPages(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftopdf/qpdf_pdftopdf_processor.h new/cups-filters-1.22.0/filter/pdftopdf/qpdf_pdftopdf_processor.h --- old/cups-filters-1.21.6/filter/pdftopdf/qpdf_pdftopdf_processor.h 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftopdf/qpdf_pdftopdf_processor.h 2019-01-14 22:09:16.000000000 +0100 @@ -34,8 +34,8 @@ class QPDF_PDFTOPDF_Processor : public PDFTOPDF_Processor { public: - virtual bool loadFile(FILE *f,ArgOwnership take=WillStayAlive); - virtual bool loadFilename(const char *name); + virtual bool loadFile(FILE *f,ArgOwnership take=WillStayAlive,int flatten_forms=1); + virtual bool loadFilename(const char *name,int flatten_forms=1); // TODO: virtual bool may_modify/may_print/? virtual bool check_print_permissions(); @@ -61,7 +61,7 @@ private: void closeFile(); void error(const char *fmt,...); - void start(); + void start(int flatten_forms); private: std::unique_ptr<QPDF> pdf; std::vector<QPDFObjectHandle> orig_pages; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/filter/pdftoraster.cxx new/cups-filters-1.22.0/filter/pdftoraster.cxx --- old/cups-filters-1.21.6/filter/pdftoraster.cxx 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/filter/pdftoraster.cxx 2018-12-29 20:31:46.000000000 +0100 @@ -280,7 +280,6 @@ return sgray; } -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23 void CDECL myErrorFun(void *data, ErrorCategory category, #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 70 @@ -305,19 +304,6 @@ fprintf(stderr, "%s\n",msg); fflush(stderr); } -#else -void CDECL myErrorFun(int pos, char *msg, va_list args) -{ - if (pos >= 0) { - fprintf(stderr, "ERROR (%d): ", pos); - } else { - fprintf(stderr, "ERROR: "); - } - vfprintf(stderr, msg, args); - fprintf(stderr, "\n"); - fflush(stderr); -} -#endif #ifdef USE_LCMS1 static int lcmsErrorHandler(int ErrorCode, const char *ErrorText) @@ -1970,11 +1956,7 @@ int rowpad; Catalog *catalog; -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 setErrorCallback(::myErrorFun,NULL); -#else - setErrorFunction(::myErrorFun); -#endif cmsSetLogErrorHandler(lcmsErrorHandler); globalParams = new GlobalParams(); parseOpts(argc, argv); @@ -2133,11 +2115,7 @@ ,false #endif ); -#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19 out->startDoc(doc); -#else - out->startDoc(doc->getXRef()); -#endif if ((raster = cupsRasterOpen(1, pwgraster ? CUPS_RASTER_WRITE_PWG : CUPS_RASTER_WRITE)) == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cups-filters-1.21.6/utils/cups-browsed.c new/cups-filters-1.22.0/utils/cups-browsed.c --- old/cups-filters-1.21.6/utils/cups-browsed.c 2018-12-17 17:50:48.000000000 +0100 +++ new/cups-filters-1.22.0/utils/cups-browsed.c 2018-12-21 22:53:45.000000000 +0100 @@ -5614,19 +5614,21 @@ if (filter->regexp) { /* match regexp */ if (!value) - value = ""; + value = strdup(""); if ((filter->cregexp && regexec(filter->cregexp, value, 0, NULL, 0) == 0) || (!filter->cregexp && !strcasecmp(filter->regexp, value))) { - avahi_free(key); - avahi_free(value); - if (filter->sense == FILTER_NOT_MATCH) + if (filter->sense == FILTER_NOT_MATCH) { + avahi_free(key); + avahi_free(value); goto filter_failed; + } } else { - avahi_free(key); - avahi_free(value); - if (filter->sense == FILTER_MATCH) + if (filter->sense == FILTER_MATCH) { + avahi_free(key); + avahi_free(value); goto filter_failed; + } } } else { /* match boolean value */