Submitted By: Douglas R. Reno Date: 2018-12-19 Initial Package Version: 0.92.3 Upstream Status: Applied Origin: Upstream / Ken Description: Contains fixes related to poppler and ImageMagick-6 diff -Naurp inkscape-0.92.3.orig/CMakeScripts/DefineDependsandFlags.cmake inkscape-0.92.3/CMakeScripts/DefineDependsandFlags.cmake --- inkscape-0.92.3.orig/CMakeScripts/DefineDependsandFlags.cmake 2018-03-11 15:38:09.000000000 -0500 +++ inkscape-0.92.3/CMakeScripts/DefineDependsandFlags.cmake 2018-12-18 18:56:48.006784537 -0600 @@ -116,18 +116,6 @@ if(ENABLE_POPPLER) set(HAVE_POPPLER_GLIB ON) endif() endif() - if(POPPLER_VERSION VERSION_GREATER "0.26.0" OR - POPPLER_VERSION VERSION_EQUAL "0.26.0") - set(POPPLER_EVEN_NEWER_COLOR_SPACE_API ON) - endif() - if(POPPLER_VERSION VERSION_GREATER "0.29.0" OR - POPPLER_VERSION VERSION_EQUAL "0.29.0") - set(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API ON) - endif() - if(POPPLER_VERSION VERSION_GREATER "0.58.0" OR - POPPLER_VERSION VERSION_EQUAL "0.58.0") - set(POPPLER_NEW_OBJECT_API ON) - endif() else() set(ENABLE_POPPLER_CAIRO OFF) endif() @@ -375,14 +363,14 @@ list(APPEND INKSCAPE_INCS_SYS ${ZLIB_INC list(APPEND INKSCAPE_LIBS ${ZLIB_LIBRARIES}) if(WITH_IMAGE_MAGICK) - pkg_check_modules(ImageMagick ImageMagick MagickCore Magick++ ) - if(ImageMagick_FOUND) + pkg_check_modules(ImageMagick-6 ImageMagick-6 MagickCore-6 Magick++-6 ) + if(ImageMagick-6_FOUND) - list(APPEND INKSCAPE_LIBS ${ImageMagick_LDFLAGS}) - add_definitions(${ImageMagick_CFLAGS_OTHER}) + list(APPEND INKSCAPE_LIBS ${ImageMagick-6_LDFLAGS}) + add_definitions(${ImageMagick-6_CFLAGS_OTHER}) - list(APPEND INKSCAPE_INCS_SYS ${ImageMagick_INCLUDE_DIRS}) - list(APPEND INKSCAPE_LIBS ${ImageMagick_LIBRARIES}) + list(APPEND INKSCAPE_INCS_SYS ${ImageMagick-6_INCLUDE_DIRS}) + list(APPEND INKSCAPE_LIBS ${ImageMagick-6_LIBRARIES}) else() set(WITH_IMAGE_MAGICK OFF) # enable 'Extensions > Raster' endif() diff -Naurp inkscape-0.92.3.orig/CMakeScripts/DefineDependsandFlags.cmake.orig inkscape-0.92.3/CMakeScripts/DefineDependsandFlags.cmake.orig --- inkscape-0.92.3.orig/CMakeScripts/DefineDependsandFlags.cmake.orig 1969-12-31 18:00:00.000000000 -0600 +++ inkscape-0.92.3/CMakeScripts/DefineDependsandFlags.cmake.orig 2018-12-18 18:56:42.382782001 -0600 @@ -0,0 +1,412 @@ + +set(INKSCAPE_LIBS "") +set(INKSCAPE_INCS "") +set(INKSCAPE_INCS_SYS "") +set(INKSCAPE_CXX_FLAGS "") + +list(APPEND INKSCAPE_INCS ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/src + + # generated includes + ${CMAKE_BINARY_DIR}/include +) + +# ---------------------------------------------------------------------------- +# Files we include +# ---------------------------------------------------------------------------- +if(WIN32) + # Set the link and include directories + get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) + + list(APPEND INKSCAPE_LIBS "-lmscms") + + list(APPEND INKSCAPE_CXX_FLAGS "-mwindows") + list(APPEND INKSCAPE_CXX_FLAGS "-mthreads") + + if(HAVE_MINGW_W64) + list(APPEND INKSCAPE_LIBS "-lgomp") + list(APPEND INKSCAPE_LIBS "-lwinpthread") + endif() + + if(HAVE_MINGW64) + list(APPEND INKSCAPE_CXX_FLAGS "-m64") + else() + list(APPEND INKSCAPE_CXX_FLAGS "-m32") + endif() +endif() + +find_package(PkgConfig REQUIRED) +pkg_check_modules(INKSCAPE_DEP REQUIRED pangocairo pangoft2 fontconfig gthread-2.0 gsl gmodule-2.0) + +list(APPEND INKSCAPE_LIBS ${INKSCAPE_DEP_LDFLAGS}) +list(APPEND INKSCAPE_INCS_SYS ${INKSCAPE_DEP_INCLUDE_DIRS}) +list(APPEND INKSCAPE_LIBS ${INKSCAPE_DEP_LIBRARIES}) +add_definitions(${INKSCAPE_DEP_CFLAGS_OTHER}) + +if(APPLE AND DEFINED ENV{CMAKE_PREFIX_PATH}) + list(APPEND INKSCAPE_LIBS "-L$ENV{CMAKE_PREFIX_PATH}/lib") +endif() +if(APPLE) + if(${GTK+_2.0_TARGET} MATCHES "x11") + pkg_check_modules(x11 REQUIRED x11) + list(APPEND INKSCAPE_LIBS ${x11_LDFLAGS}) + endif() +elseif(WIN32) +# X11 not available on windows +else() + pkg_check_modules(x11 REQUIRED x11) + list(APPEND INKSCAPE_LIBS ${x11_LDFLAGS}) + +endif() + +if(WITH_GNOME_VFS) + find_package(GnomeVFS2) + if(GNOMEVFS2_FOUND) + list(APPEND INKSCAPE_INCS_SYS ${GNOMEVFS2_INCLUDE_DIR}) + list(APPEND INKSCAPE_LIBS ${GNOMEVFS-2_LIBRARY}) + else() + set(WITH_GNOME_VFS OFF) + endif() +endif() + +if(ENABLE_LCMS) + find_package(LCMS2) + if(LCMS2_FOUND) + list(APPEND INKSCAPE_INCS_SYS ${LCMS2_INCLUDE_DIRS}) + list(APPEND INKSCAPE_LIBS ${LCMS2_LIBRARIES}) + add_definitions(${LCMS2_DEFINITIONS}) + set (HAVE_LIBLCMS2 1) + else() + find_package(LCMS) + if(LCMS_FOUND) + list(APPEND INKSCAPE_INCS_SYS ${LCMS_INCLUDE_DIRS}) + list(APPEND INKSCAPE_LIBS ${LCMS_LIBRARIES}) + add_definitions(${LCMS_DEFINITIONS}) + set (HAVE_LIBLCMS1 1) + else() + set(ENABLE_LCMS OFF) + endif() + endif() +endif() + +find_package(Iconv REQUIRED) +list(APPEND INKSCAPE_INCS_SYS ${ICONV_INCLUDE_DIRS}) +list(APPEND INKSCAPE_LIBS ${ICONV_LIBRARIES}) +add_definitions(${ICONV_DEFINITIONS}) + +find_package(Intl REQUIRED) +list(APPEND INKSCAPE_INCS_SYS ${Intl_INCLUDE_DIRS}) +list(APPEND INKSCAPE_LIBS ${Intl_LIBRARIES}) +add_definitions(${Intl_DEFINITIONS}) + +find_package(BoehmGC REQUIRED) +list(APPEND INKSCAPE_INCS_SYS ${BOEHMGC_INCLUDE_DIRS}) +list(APPEND INKSCAPE_LIBS ${BOEHMGC_LIBRARIES}) +add_definitions(${BOEHMGC_DEFINITIONS}) + +if(ENABLE_POPPLER) + find_package(PopplerCairo) + if(POPPLER_FOUND) + set(HAVE_POPPLER ON) + if(ENABLE_POPPLER_CAIRO) + if(POPPLER_CAIRO_FOUND AND POPPLER_GLIB_FOUND) + set(HAVE_POPPLER_CAIRO ON) + endif() + if(POPPLER_GLIB_FOUND AND CAIRO_SVG_FOUND) + set(HAVE_POPPLER_GLIB ON) + endif() + endif() + else() + set(ENABLE_POPPLER_CAIRO OFF) + endif() +else() + set(HAVE_POPPLER OFF) + set(ENABLE_POPPLER_CAIRO OFF) +endif() + +list(APPEND INKSCAPE_INCS_SYS ${POPPLER_INCLUDE_DIRS}) +list(APPEND INKSCAPE_LIBS ${POPPLER_LIBRARIES}) +add_definitions(${POPPLER_DEFINITIONS}) + +if(WITH_LIBWPG) + find_package(LibWPG) + if(LIBWPG_FOUND) + set(WITH_LIBWPG01 ${LIBWPG-0.1_FOUND}) + set(WITH_LIBWPG02 ${LIBWPG-0.2_FOUND}) + set(WITH_LIBWPG03 ${LIBWPG-0.3_FOUND}) + list(APPEND INKSCAPE_INCS_SYS ${LIBWPG_INCLUDE_DIRS}) + list(APPEND INKSCAPE_LIBS ${LIBWPG_LIBRARIES}) + add_definitions(${LIBWPG_DEFINITIONS}) + else() + set(WITH_LIBWPG OFF) + endif() +endif() + +if(WITH_LIBVISIO) + find_package(LibVisio) + if(LIBVISIO_FOUND) + set(WITH_LIBVISIO00 ${LIBVISIO-0.0_FOUND}) + set(WITH_LIBVISIO01 ${LIBVISIO-0.1_FOUND}) + list(APPEND INKSCAPE_INCS_SYS ${LIBVISIO_INCLUDE_DIRS}) + list(APPEND INKSCAPE_LIBS ${LIBVISIO_LIBRARIES}) + add_definitions(${LIBVISIO_DEFINITIONS}) + else() + set(WITH_LIBVISIO OFF) + endif() +endif() + +if(WITH_LIBCDR) + find_package(LibCDR) + if(LIBCDR_FOUND) + set(WITH_LIBCDR00 ${LIBCDR-0.0_FOUND}) + set(WITH_LIBCDR01 ${LIBCDR-0.1_FOUND}) + list(APPEND INKSCAPE_INCS_SYS ${LIBCDR_INCLUDE_DIRS}) + list(APPEND INKSCAPE_LIBS ${LIBCDR_LIBRARIES}) + add_definitions(${LIBCDR_DEFINITIONS}) + else() + set(WITH_LIBCDR OFF) + endif() +endif() + +FIND_PACKAGE(JPEG) +IF(JPEG_FOUND) + list(APPEND INKSCAPE_INCS_SYS ${JPEG_INCLUDE_DIR}) + list(APPEND INKSCAPE_LIBS ${JPEG_LIBRARIES}) + set(HAVE_JPEG ON) +ENDIF() + +find_package(PNG REQUIRED) +list(APPEND INKSCAPE_INCS_SYS ${PNG_PNG_INCLUDE_DIR}) +list(APPEND INKSCAPE_LIBS ${PNG_LIBRARY}) + +find_package(Popt REQUIRED) +list(APPEND INKSCAPE_INCS_SYS ${POPT_INCLUDE_DIR}) +list(APPEND INKSCAPE_LIBS ${POPT_LIBRARIES}) +add_definitions(${POPT_DEFINITIONS}) + +find_package(Potrace) +if(POTRACE_FOUND) + list(APPEND INKSCAPE_INCS_SYS ${POTRACE_INCLUDE_DIRS}) + list(APPEND INKSCAPE_LIBS ${POTRACE_LIBRARIES}) + set(HAVE_POTRACE ON) + add_definitions(-DHAVE_POTRACE) +else(POTRACE_FOUND) + set(HAVE_POTRACE OFF) + message(STATUS "Could not locate the Potrace library headers: the Trace Bitmap and Paintbucket tools will be disabled") +endif() + +if(WITH_DBUS) + pkg_check_modules(DBUS dbus-1 dbus-glib-1) + if(DBUS_FOUND) + list(APPEND INKSCAPE_LIBS ${DBUS_LDFLAGS}) + list(APPEND INKSCAPE_INCS_SYS ${DBUS_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/src/extension/dbus/) + list(APPEND INKSCAPE_LIBS ${DBUS_LIBRARIES}) + add_definitions(${DBUS_CFLAGS_OTHER}) + + else() + set(WITH_DBUS OFF) + endif() +endif() + +if(WITH_SVG2) + add_definitions(-DWITH_MESH -DWITH_CSSBLEND -DWITH_CSSCOMPOSITE -DWITH_SVG2) +else() + add_definitions(-UWITH_MESH -UWITH_CSSBLEND -UWITH_CSSCOMPOSITE -UWITH_SVG2) +endif() + +if(WITH_LPETOOL) + add_definitions(-DWITH_LPETOOL -DLPE_ENABLE_TEST_EFFECTS) +else() + add_definitions(-UWITH_LPETOOL -ULPE_ENABLE_TEST_EFFECTS) +endif() + +# ---------------------------------------------------------------------------- +# CMake's builtin +# ---------------------------------------------------------------------------- + +set(TRY_GTKSPELL 1) +# Include dependencies: +# use patched version until GTK2_CAIROMMCONFIG_INCLUDE_DIR is added +if("${WITH_GTK3_EXPERIMENTAL}") + pkg_check_modules( + GTK3 + REQUIRED + gtkmm-3.0>=3.8 + gdkmm-3.0>=3.8 + gtk+-3.0>=3.8 + gdk-3.0>=3.8 + gdl-3.0>=3.4 + ) + message("Using EXPERIMENTAL Gtkmm 3 build") + list(APPEND INKSCAPE_CXX_FLAGS ${GTK3_CFLAGS_OTHER}) + set(WITH_GTKMM_3_0 1) + message("Using external GDL") + set(WITH_EXT_GDL 1) + + # Check whether we can use new features in Gtkmm 3.10 + # TODO: Drop this test and bump the version number in the GTK test above + # as soon as all supported distributions provide Gtkmm >= 3.10 + pkg_check_modules(GTKMM_3_10 + gtkmm-3.0>=3.10, + ) + + if("${GTKMM_3_10_FOUND}") + message("Using Gtkmm 3.10 build") + set (WITH_GTKMM_3_10 1) + endif() + + pkg_check_modules(GDL_3_6 gdl-3.0>=3.6) + + if("${GDL_3_6_FOUND}") + message("Using GDL 3.6 or higher") + set (WITH_GDL_3_6 1) + endif() + + set(TRY_GTKSPELL ) + pkg_check_modules(GTKSPELL3 gtkspell3-3.0) + + if("${GTKSPELL3_FOUND}") + message("Using GtkSpell 3") + set (WITH_GTKSPELL 1) + else() + unset(WITH_GTKSPELL) + endif() + + list(APPEND INKSCAPE_INCS_SYS + ${GTK3_INCLUDE_DIRS} + ${GTKSPELL3_INCLUDE_DIRS} + ) + + list(APPEND INKSCAPE_LIBS + ${GTK3_LIBRARIES} + ${GTKSPELL3_LIBRARIES} + ) +else() + pkg_check_modules(GTK REQUIRED + gtkmm-2.4>=2.24 + gdkmm-2.4 + gtk+-2.0 + gdk-2.0 + ) + list(APPEND INKSCAPE_CXX_FLAGS ${GTK_CFLAGS_OTHER}) + pkg_check_modules(GTKSPELL2 gtkspell-2.0) + if("${GTKSPELL2_FOUND}") + message("Using GtkSpell 2") + add_definitions(${GTKSPELL2_CFLAGS_OTHER}) + set (WITH_GTKSPELL 1) + else() + unset(WITH_GTKSPELL) + endif() + list(APPEND INKSCAPE_INCS_SYS + ${GTK_INCLUDE_DIRS} + ${GTKSPELL2_INCLUDE_DIRS} + ) + + list(APPEND INKSCAPE_LIBS + ${GTK_LIBRARIES} + ${GTKSPELL2_LIBRARIES} + ) +endif() + +find_package(Freetype REQUIRED) +list(APPEND INKSCAPE_INCS_SYS ${FREETYPE_INCLUDE_DIRS}) +list(APPEND INKSCAPE_LIBS ${FREETYPE_LIBRARIES}) + +find_package(Boost REQUIRED) +list(APPEND INKSCAPE_INCS_SYS ${Boost_INCLUDE_DIRS}) +# list(APPEND INKSCAPE_LIBS ${Boost_LIBRARIES}) + +find_package(ASPELL) +if(ASPELL_FOUND) + list(APPEND INKSCAPE_INCS_SYS ${ASPELL_INCLUDE_DIR}) + list(APPEND INKSCAPE_LIBS ${ASPELL_LIBRARIES}) + add_definitions(${ASPELL_DEFINITIONS}) + set(HAVE_ASPELL TRUE) +endif() + +#find_package(OpenSSL) +#list(APPEND INKSCAPE_INCS_SYS ${OPENSSL_INCLUDE_DIR}) +#list(APPEND INKSCAPE_LIBS ${OPENSSL_LIBRARIES}) + +find_package(LibXslt REQUIRED) +list(APPEND INKSCAPE_INCS_SYS ${LIBXSLT_INCLUDE_DIR}) +list(APPEND INKSCAPE_LIBS ${LIBXSLT_LIBRARIES}) +add_definitions(${LIBXSLT_DEFINITIONS}) + +find_package(LibXml2 REQUIRED) +list(APPEND INKSCAPE_INCS_SYS ${LIBXML2_INCLUDE_DIR}) +list(APPEND INKSCAPE_LIBS ${LIBXML2_LIBRARIES}) +add_definitions(${LIBXML2_DEFINITIONS}) + +if(WITH_OPENMP) + find_package(OpenMP) + if(OPENMP_FOUND) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + list(APPEND INKSCAPE_CXX_FLAGS ${OpenMP_CXX_FLAGS}) + if(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_OPENMP_SUPPORT "YES") + endif() + mark_as_advanced(OpenMP_C_FLAGS) + mark_as_advanced(OpenMP_CXX_FLAGS) + # '-fopenmp' is in OpenMP_C_FLAGS, OpenMP_CXX_FLAGS and implies '-lgomp' + # uncomment explicit linking below if still needed: + set(HAVE_OPENMP ON) + #list(APPEND INKSCAPE_LIBS "-lgomp") # FIXME + else() + set(HAVE_OPENMP OFF) + set(WITH_OPENMP OFF) + endif() +endif() + +find_package(ZLIB REQUIRED) +list(APPEND INKSCAPE_INCS_SYS ${ZLIB_INCLUDE_DIRS}) +list(APPEND INKSCAPE_LIBS ${ZLIB_LIBRARIES}) + +if(WITH_IMAGE_MAGICK) + pkg_check_modules(ImageMagick ImageMagick MagickCore Magick++ ) + if(ImageMagick_FOUND) + + list(APPEND INKSCAPE_LIBS ${ImageMagick_LDFLAGS}) + add_definitions(${ImageMagick_CFLAGS_OTHER}) + + list(APPEND INKSCAPE_INCS_SYS ${ImageMagick_INCLUDE_DIRS}) + list(APPEND INKSCAPE_LIBS ${ImageMagick_LIBRARIES}) + else() + set(WITH_IMAGE_MAGICK OFF) # enable 'Extensions > Raster' + endif() +endif() + +set(ENABLE_NLS OFF) +if(WITH_NLS) + find_package(Gettext) + if(GETTEXT_FOUND) + message(STATUS "Found gettext + msgfmt to convert language files. Translation enabled") + set(ENABLE_NLS ON) + else(GETTEXT_FOUND) + message(STATUS "Cannot find gettext + msgfmt to convert language file. Translation won't be enabled") + endif(GETTEXT_FOUND) +endif(WITH_NLS) + +# find sigc++ and set -std=c++11 if required +find_package(SigC++ REQUIRED) +list(APPEND INKSCAPE_LIBS ${SIGC++_LDFLAGS}) + +list(APPEND INKSCAPE_CXX_FLAGS ${SIGC++_CFLAGS_OTHER}) + +list(REMOVE_DUPLICATES INKSCAPE_CXX_FLAGS) +foreach(flag ${INKSCAPE_CXX_FLAGS}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" CACHE STRING "" FORCE) +endforeach() +# end Dependencies + +list(REMOVE_DUPLICATES INKSCAPE_LIBS) +list(REMOVE_DUPLICATES INKSCAPE_INCS_SYS) + +# C/C++ Flags +include_directories(${INKSCAPE_INCS}) +include_directories(SYSTEM ${INKSCAPE_INCS_SYS}) + +include(${CMAKE_CURRENT_LIST_DIR}/ConfigChecks.cmake) + +unset(INKSCAPE_INCS) +unset(INKSCAPE_INCS_SYS) diff -Naurp inkscape-0.92.3.orig/src/extension/internal/pdfinput/pdf-input.cpp inkscape-0.92.3/src/extension/internal/pdfinput/pdf-input.cpp --- inkscape-0.92.3.orig/src/extension/internal/pdfinput/pdf-input.cpp 2018-03-11 15:38:09.000000000 -0500 +++ inkscape-0.92.3/src/extension/internal/pdfinput/pdf-input.cpp 2018-12-18 18:56:42.382782001 -0600 @@ -793,7 +793,7 @@ PdfInput::open(::Inkscape::Extension::In dlg->getImportSettings(prefs); // Apply crop settings - PDFRectangle *clipToBox = NULL; + _POPPLER_CONST PDFRectangle *clipToBox = NULL; double crop_setting; sp_repr_get_double(prefs, "cropTo", &crop_setting); diff -Naurp inkscape-0.92.3.orig/src/extension/internal/pdfinput/pdf-input.h inkscape-0.92.3/src/extension/internal/pdfinput/pdf-input.h --- inkscape-0.92.3.orig/src/extension/internal/pdfinput/pdf-input.h 2018-03-11 15:38:09.000000000 -0500 +++ inkscape-0.92.3/src/extension/internal/pdfinput/pdf-input.h 2018-12-18 18:56:42.382782001 -0600 @@ -15,6 +15,7 @@ #endif #ifdef HAVE_POPPLER +#include "poppler-transition-api.h" #include diff -Naurp inkscape-0.92.3.orig/src/extension/internal/pdfinput/pdf-parser.cpp inkscape-0.92.3/src/extension/internal/pdfinput/pdf-parser.cpp --- inkscape-0.92.3.orig/src/extension/internal/pdfinput/pdf-parser.cpp 2018-03-11 15:38:09.000000000 -0500 +++ inkscape-0.92.3/src/extension/internal/pdfinput/pdf-parser.cpp 2018-12-18 18:56:42.383782002 -0600 @@ -36,9 +36,9 @@ extern "C" { #include "pdf-parser.h" #include "util/units.h" +#include "glib/poppler-features.h" #include "goo/gmem.h" -#include "goo/GooTimer.h" -#include "goo/GooHash.h" +#include "goo/GooString.h" #include "GlobalParams.h" #include "CharTypes.h" #include "Object.h" @@ -295,8 +295,8 @@ PdfParser::PdfParser(XRef *xrefA, int /*pageNum*/, int rotate, Dict *resDict, - PDFRectangle *box, - PDFRectangle *cropBox) : + _POPPLER_CONST PDFRectangle *box, + _POPPLER_CONST PDFRectangle *cropBox) : xref(xrefA), builder(builderA), subPage(gFalse), @@ -318,7 +318,7 @@ PdfParser::PdfParser(XRef *xrefA, builder->setDocumentSize(Inkscape::Util::Quantity::convert(state->getPageWidth(), "pt", "px"), Inkscape::Util::Quantity::convert(state->getPageHeight(), "pt", "px")); - double *ctm = state->getCTM(); + const double *ctm = state->getCTM(); double scaledCTM[6]; for (int i = 0; i < 6; ++i) { baseMatrix[i] = ctm[i]; @@ -353,7 +353,7 @@ PdfParser::PdfParser(XRef *xrefA, PdfParser::PdfParser(XRef *xrefA, Inkscape::Extension::Internal::SvgBuilder *builderA, Dict *resDict, - PDFRectangle *box) : + _POPPLER_CONST PDFRectangle *box) : xref(xrefA), builder(builderA), subPage(gTrue), @@ -572,7 +572,7 @@ const char *PdfParser::getPreviousOperat void PdfParser::execOp(Object *cmd, Object args[], int numArgs) { PdfOperator *op; - char *name; + const char *name; Object *argPtr; int i; @@ -620,7 +620,7 @@ void PdfParser::execOp(Object *cmd, Obje (this->*op->func)(argPtr, numArgs); } -PdfOperator* PdfParser::findOp(char *name) { +PdfOperator* PdfParser::findOp(const char *name) { int a = -1; int b = numOps; int cmp = -1; @@ -1752,7 +1752,7 @@ void PdfParser::doShadingPatternFillFall GBool stroke, GBool eoFill) { GfxShading *shading; GfxPath *savedPath; - double *ctm, *btm, *ptm; + const double *ctm, *btm, *ptm; double m[6], ictm[6], m1[6]; double xMin, yMin, xMax, yMax; double det; @@ -1994,7 +1994,7 @@ void PdfParser::doFunctionShFill1(GfxFun GfxColor color0M, color1M, colorM0, colorM1, colorMM; GfxColor colors2[4]; double functionColorDelta = colorDeltas[pdfFunctionShading-1]; - double *matrix; + const double *matrix; double xM, yM; int nComps, i, j; @@ -2174,7 +2174,7 @@ void PdfParser::doPatchMeshShFill(GfxPat } } -void PdfParser::fillPatch(GfxPatch *patch, int nComps, int depth) { +void PdfParser::fillPatch(_POPPLER_CONST GfxPatch *patch, int nComps, int depth) { GfxPatch patch00 = blankPatch(); GfxPatch patch01 = blankPatch(); GfxPatch patch10 = blankPatch(); @@ -2582,7 +2582,11 @@ void PdfParser::opShowSpaceText(Object a } } +#if POPPLER_CHECK_VERSION(0,64,0) +void PdfParser::doShowText(const GooString *s) { +#else void PdfParser::doShowText(GooString *s) { +#endif GfxFont *font; int wMode; double riseX, riseY; @@ -2591,17 +2595,21 @@ void PdfParser::doShowText(GooString *s) double x, y, dx, dy, tdx, tdy; double originX, originY, tOriginX, tOriginY; double oldCTM[6], newCTM[6]; - double *mat; + const double *mat; Object charProc; Dict *resDict; Parser *oldParser; +#if POPPLER_CHECK_VERSION(0,64,0) + const char *p; +#else char *p; +#endif int len, n, uLen; font = state->getFont(); wMode = font->getWMode(); - builder->beginString(state, s); + builder->beginString(state); // handle a Type 3 char if (font->getType() == fontType3 && 0) {//out->interpretType3Chars()) { @@ -2732,7 +2740,11 @@ void PdfParser::opXObject(Object args[], { Object obj1, obj2, obj3, refObj; +#if POPPLER_CHECK_VERSION(0,64,0) + const char *name = args[0].getName(); +#else char *name = args[0].getName(); +#endif #if defined(POPPLER_NEW_OBJECT_API) if ((obj1 = res->lookupXObject(name)).isNull()) { #else @@ -3657,7 +3669,6 @@ void PdfParser::opBeginImage(Object /*ar Stream *PdfParser::buildImageStream() { Object dict; Object obj; - char *key; Stream *str; // build dictionary @@ -3675,26 +3686,17 @@ Stream *PdfParser::buildImageStream() { obj.free(); #endif } else { - key = copyString(obj.getName()); -#if defined(POPPLER_NEW_OBJECT_API) - obj = parser->getObj(); -#else - obj.free(); - parser->getObj(&obj); -#endif - if (obj.isEOF() || obj.isError()) { - gfree(key); + Object obj2; + _POPPLER_CALL(obj2, parser->getObj); + if (obj2.isEOF() || obj2.isError()) { + _POPPLER_FREE(obj); break; } -#if defined(POPPLER_NEW_OBJECT_API) - dict.dictAdd(key, std::move(obj)); - } - obj = parser->getObj(); -#else - dict.dictAdd(key, &obj); + _POPPLER_DICTADD(dict, obj.getName(), obj2); + _POPPLER_FREE(obj); + _POPPLER_FREE(obj2); } - parser->getObj(&obj); -#endif + _POPPLER_CALL(obj, parser->getObj); } if (obj.isEOF()) { error(errSyntaxError, getPos(), "End of file in inline image"); diff -Naurp inkscape-0.92.3.orig/src/extension/internal/pdfinput/pdf-parser.h inkscape-0.92.3/src/extension/internal/pdfinput/pdf-parser.h --- inkscape-0.92.3.orig/src/extension/internal/pdfinput/pdf-parser.h 2018-03-11 15:38:09.000000000 -0500 +++ inkscape-0.92.3/src/extension/internal/pdfinput/pdf-parser.h 2018-12-18 18:56:42.383782002 -0600 @@ -9,6 +9,7 @@ #define PDF_PARSER_H #ifdef HAVE_POPPLER +#include "poppler-transition-api.h" #ifdef USE_GCC_PRAGMAS #pragma interface @@ -25,6 +26,7 @@ namespace Inkscape { // TODO clean up and remove using: using Inkscape::Extension::Internal::SvgBuilder; +#include "glib/poppler-features.h" #include "goo/gtypes.h" #include "Object.h" @@ -127,11 +129,14 @@ public: // Constructor for regular output. PdfParser(XRef *xrefA, SvgBuilder *builderA, int pageNum, int rotate, - Dict *resDict, PDFRectangle *box, PDFRectangle *cropBox); + Dict *resDict, + _POPPLER_CONST PDFRectangle *box, + _POPPLER_CONST PDFRectangle *cropBox); // Constructor for a sub-page object. PdfParser(XRef *xrefA, Inkscape::Extension::Internal::SvgBuilder *builderA, - Dict *resDict, PDFRectangle *box); + Dict *resDict, + _POPPLER_CONST PDFRectangle *box); virtual ~PdfParser(); @@ -185,7 +190,7 @@ private: void go(GBool topLevel); void execOp(Object *cmd, Object args[], int numArgs); - PdfOperator *findOp(char *name); + PdfOperator *findOp(const char *name); GBool checkArg(Object *arg, TchkType type); int getPos(); @@ -256,7 +261,7 @@ private: double x2, double y2, GfxColor *color2, int nComps, int depth); void doPatchMeshShFill(GfxPatchMeshShading *shading); - void fillPatch(GfxPatch *patch, int nComps, int depth); + void fillPatch(_POPPLER_CONST GfxPatch *patch, int nComps, int depth); void doEndPath(); // path clipping operators @@ -287,7 +292,12 @@ private: void opMoveShowText(Object args[], int numArgs); void opMoveSetShowText(Object args[], int numArgs); void opShowSpaceText(Object args[], int numArgs); +#if POPPLER_CHECK_VERSION(0,64,0) + void doShowText(const GooString *s); +#else void doShowText(GooString *s); +#endif + // XObject operators void opXObject(Object args[], int numArgs); diff -Naurp inkscape-0.92.3.orig/src/extension/internal/pdfinput/poppler-transition-api.h inkscape-0.92.3/src/extension/internal/pdfinput/poppler-transition-api.h --- inkscape-0.92.3.orig/src/extension/internal/pdfinput/poppler-transition-api.h 1969-12-31 18:00:00.000000000 -0600 +++ inkscape-0.92.3/src/extension/internal/pdfinput/poppler-transition-api.h 2018-12-18 18:57:26.282801776 -0600 @@ -0,0 +1,43 @@ +#ifndef SEEN_POPPLER_TRANSITION_API_H +#define SEEN_POPPLER_TRANSITION_API_H + +#include + +#if POPPLER_CHECK_VERSION(0,72,0) +#define getCString c_str +#endif + +#if POPPLER_CHECK_VERSION(0,70,0) +#define _POPPLER_CONST const +#else +#define _POPPLER_CONST +#endif + +#if POPPLER_CHECK_VERSION(0,69,0) +#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(key, std::move(obj)) +#elif POPPLER_CHECK_VERSION(0,58,0) +#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(copyString(key), std::move(obj)) +#else +#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(copyString(key), &obj) +#endif + +#if POPPLER_CHECK_VERSION(0,58,0) +#define POPPLER_NEW_OBJECT_API +#define _POPPLER_FREE(obj) +#define _POPPLER_CALL(ret, func) (ret = func()) +#define _POPPLER_CALL_ARGS(ret, func, ...) (ret = func(__VA_ARGS__)) +#else +#define _POPPLER_FREE(obj) (obj).free() +#define _POPPLER_CALL(ret, func) (*func(&ret)) +#define _POPPLER_CALL_ARGS(ret, func, ...) (*func(__VA_ARGS__, &ret)) +#endif + +#if POPPLER_CHECK_VERSION(0, 29, 0) +#define POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API +#endif + +#if POPPLER_CHECK_VERSION(0, 25, 0) +#define POPPLER_EVEN_NEWER_COLOR_SPACE_API +#endif + +#endif diff -Naurp inkscape-0.92.3.orig/src/extension/internal/pdfinput/svg-builder.cpp inkscape-0.92.3/src/extension/internal/pdfinput/svg-builder.cpp --- inkscape-0.92.3.orig/src/extension/internal/pdfinput/svg-builder.cpp 2018-03-11 15:38:09.000000000 -0500 +++ inkscape-0.92.3/src/extension/internal/pdfinput/svg-builder.cpp 2018-12-18 18:56:42.384782002 -0600 @@ -625,7 +625,7 @@ gchar *SvgBuilder::_createPattern(GfxPat if ( pattern != NULL ) { if ( pattern->getType() == 2 ) { // Shading pattern GfxShadingPattern *shading_pattern = static_cast(pattern); - double *ptm; + const double *ptm; double m[6] = {1, 0, 0, 1, 0, 0}; double det; @@ -672,7 +672,7 @@ gchar *SvgBuilder::_createTilingPattern( Inkscape::XML::Node *pattern_node = _xml_doc->createElement("svg:pattern"); // Set pattern transform matrix - double *p2u = tiling_pattern->getMatrix(); + const double *p2u = tiling_pattern->getMatrix(); double m[6] = {1, 0, 0, 1, 0, 0}; double det; det = _ttm[0] * _ttm[3] - _ttm[1] * _ttm[2]; // see LP Bug 1168908 @@ -698,7 +698,7 @@ gchar *SvgBuilder::_createTilingPattern( pattern_node->setAttribute("patternUnits", "userSpaceOnUse"); // Set pattern tiling // FIXME: don't ignore XStep and YStep - double *bbox = tiling_pattern->getBBox(); + const double *bbox = tiling_pattern->getBBox(); sp_repr_set_svg_double(pattern_node, "x", 0.0); sp_repr_set_svg_double(pattern_node, "y", 0.0); sp_repr_set_svg_double(pattern_node, "width", bbox[2] - bbox[0]); @@ -751,7 +751,7 @@ gchar *SvgBuilder::_createTilingPattern( */ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for_shading) { Inkscape::XML::Node *gradient; - Function *func; + _POPPLER_CONST Function *func; int num_funcs; bool extend0, extend1; @@ -865,7 +865,7 @@ static bool svgGetShadingColorRGB(GfxSha #define INT_EPSILON 8 bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading, - Function *func) { + _POPPLER_CONST Function *func) { int type = func->getType(); if ( type == 0 || type == 2 ) { // Sampled or exponential function GfxRGB stop1, stop2; @@ -877,9 +877,9 @@ bool SvgBuilder::_addGradientStops(Inksc _addStopToGradient(gradient, 1.0, &stop2, 1.0); } } else if ( type == 3 ) { // Stitching - StitchingFunction *stitchingFunc = static_cast(func); - double *bounds = stitchingFunc->getBounds(); - double *encode = stitchingFunc->getEncode(); + auto stitchingFunc = static_cast<_POPPLER_CONST StitchingFunction*>(func); + const double *bounds = stitchingFunc->getBounds(); + const double *encode = stitchingFunc->getEncode(); int num_funcs = stitchingFunc->getNumFuncs(); // Add stops from all the stitched functions @@ -890,7 +890,7 @@ bool SvgBuilder::_addGradientStops(Inksc svgGetShadingColorRGB(shading, bounds[i + 1], &color); // Add stops if (stitchingFunc->getFunc(i)->getType() == 2) { // process exponential fxn - double expE = (static_cast(stitchingFunc->getFunc(i)))->getE(); + double expE = (static_cast<_POPPLER_CONST ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE(); if (expE > 1.0) { expE = (bounds[i + 1] - bounds[i])/expE; // approximate exponential as a single straight line at x=1 if (encode[2*i] == 0) { // normal sequence @@ -1022,7 +1022,7 @@ void SvgBuilder::updateFont(GfxState *st if (font->getName()) { _font_specification = font->getName()->getCString(); } else { - _font_specification = (char*) "Arial"; + _font_specification = "Arial"; } // Prune the font name to get the correct font family name @@ -1030,7 +1030,7 @@ void SvgBuilder::updateFont(GfxState *st char *font_family = NULL; char *font_style = NULL; char *font_style_lowercase = NULL; - char *plus_sign = strstr(_font_specification, "+"); + const char *plus_sign = strstr(_font_specification, "+"); if (plus_sign) { font_family = g_strdup(plus_sign + 1); _font_specification = plus_sign + 1; @@ -1148,7 +1148,7 @@ void SvgBuilder::updateFont(GfxState *st Inkscape::CSSOStringStream os_font_size; double css_font_size = _font_scaling * state->getFontSize(); if ( font->getType() == fontType3 ) { - double *font_matrix = font->getFontMatrix(); + const double *font_matrix = font->getFontMatrix(); if ( font_matrix[0] != 0.0 ) { css_font_size *= font_matrix[3] / font_matrix[0]; } @@ -1193,7 +1193,7 @@ void SvgBuilder::updateTextPosition(doub void SvgBuilder::updateTextMatrix(GfxState *state) { _flushText(); // Update text matrix - double *text_matrix = state->getTextMat(); + const double *text_matrix = state->getTextMat(); double w_scale = sqrt( text_matrix[0] * text_matrix[0] + text_matrix[2] * text_matrix[2] ); double h_scale = sqrt( text_matrix[1] * text_matrix[1] + text_matrix[3] * text_matrix[3] ); double max_scale; @@ -1361,7 +1361,7 @@ void SvgBuilder::_flushText() { _glyphs.clear(); } -void SvgBuilder::beginString(GfxState *state, GooString * /*s*/) { +void SvgBuilder::beginString(GfxState *state) { if (_need_font_update) { updateFont(state); } diff -Naurp inkscape-0.92.3.orig/src/extension/internal/pdfinput/svg-builder.h inkscape-0.92.3/src/extension/internal/pdfinput/svg-builder.h --- inkscape-0.92.3.orig/src/extension/internal/pdfinput/svg-builder.h 2018-03-11 15:38:09.000000000 -0500 +++ inkscape-0.92.3/src/extension/internal/pdfinput/svg-builder.h 2018-12-18 18:56:42.384782002 -0600 @@ -15,6 +15,7 @@ #endif #ifdef HAVE_POPPLER +#include "poppler-transition-api.h" class SPDocument; namespace Inkscape { @@ -29,7 +30,6 @@ namespace Inkscape { #include #include "CharTypes.h" -class GooString; class Function; class GfxState; struct GfxColor; @@ -81,7 +81,7 @@ struct SvgGlyph { bool style_changed; // Set to true if style has to be reset SPCSSAttr *style; int render_mode; // Text render mode - char *font_specification; // Pointer to current font specification + const char *font_specification; // Pointer to current font specification }; /** @@ -136,7 +136,7 @@ public: void clearSoftMask(GfxState *state); // Text handling - void beginString(GfxState *state, GooString *s); + void beginString(GfxState *state); void endString(GfxState *state); void addChar(GfxState *state, double x, double y, double dx, double dy, @@ -175,7 +175,7 @@ private: void _addStopToGradient(Inkscape::XML::Node *gradient, double offset, GfxRGB *color, double opacity); bool _addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading, - Function *func); + _POPPLER_CONST Function *func); gchar *_createTilingPattern(GfxTilingPattern *tiling_pattern, GfxState *state, bool is_stroke=false); // Image/mask creation @@ -203,7 +203,7 @@ private: SPCSSAttr *_font_style; // Current font style GfxFont *_current_font; - char *_font_specification; + const char *_font_specification; double _font_scaling; bool _need_font_update; Geom::Affine _text_matrix;