From 1dd0660302f363fea47462c15802af6287e2ce48 Mon Sep 17 00:00:00 2001 From: Luigi Scarso <luigi.scarso@gmail.com> Date: Sun, 26 Nov 2017 23:12:25 +0000 Subject: [PATCH] experimental and trunk: poppler 0.60.1 [[Split portion of a mixed commit.]] --- source/libs/poppler/ChangeLog | 8 + .../libs/poppler/TLpatches/patch-02-LLONG_MAX | 44 ++- .../TLpatches/patch-03-Object-functions | 11 +- source/libs/poppler/config.h.in | 3 + source/libs/poppler/configure | 24 +- source/libs/poppler/configure.ac | 2 +- .../poppler/poppler-src/fofi/FoFiTrueType.cc | 3 +- .../poppler/poppler-src/fofi/FoFiType1.cc | 1 + .../poppler/poppler-src/goo/FixedPoint.cc | 16 +- .../libs/poppler/poppler-src/goo/FixedPoint.h | 17 +- .../libs/poppler/poppler-src/goo/GooMutex.h | 7 +- .../libs/poppler/poppler-src/goo/GooString.cc | 38 +-- .../libs/poppler/poppler-src/goo/GooString.h | 29 +- .../poppler/poppler-src/goo/TiffWriter.cc | 2 +- source/libs/poppler/poppler-src/goo/gfile.cc | 26 +- source/libs/poppler/poppler-src/goo/gfile.h | 14 +- source/libs/poppler/poppler-src/goo/glibc.h | 6 +- .../libs/poppler/poppler-src/goo/gtypes_p.h | 30 -- .../libs/poppler/poppler-src/poppler/Annot.cc | 20 +- .../libs/poppler/poppler-src/poppler/Annot.h | 4 +- .../libs/poppler/poppler-src/poppler/Array.cc | 7 +- .../libs/poppler/poppler-src/poppler/Array.h | 3 +- .../libs/poppler/poppler-src/poppler/CMap.cc | 15 +- .../libs/poppler/poppler-src/poppler/CMap.h | 6 +- .../poppler-src/poppler/CairoFontEngine.cc | 12 +- .../poppler-src/poppler/CairoFontEngine.h | 4 +- .../poppler-src/poppler/CairoOutputDev.cc | 20 +- .../poppler-src/poppler/CairoRescaleBox.cc | 6 +- .../poppler/poppler-src/poppler/Catalog.cc | 8 +- .../poppler/poppler-src/poppler/Catalog.h | 4 +- .../poppler-src/poppler/CharCodeToUnicode.cc | 18 +- .../poppler-src/poppler/CharCodeToUnicode.h | 5 +- .../poppler/poppler-src/poppler/DCTStream.cc | 7 +- .../poppler/poppler-src/poppler/Decrypt.cc | 4 +- .../libs/poppler/poppler-src/poppler/Dict.cc | 9 +- .../libs/poppler/poppler-src/poppler/Dict.h | 3 +- .../poppler-src/poppler/FlateEncoder.cc | 2 +- .../poppler-src/poppler/FlateStream.cc | 3 +- .../libs/poppler/poppler-src/poppler/Gfx.cc | 12 +- .../poppler/poppler-src/poppler/GfxFont.cc | 94 +++---- .../poppler-src/poppler/GlobalParams.cc | 258 ++--------------- .../poppler-src/poppler/GlobalParams.h | 53 +--- .../poppler-src/poppler/GlobalParamsWin.cc | 4 +- .../libs/poppler/poppler-src/poppler/Lexer.cc | 16 ++ .../libs/poppler/poppler-src/poppler/Object.h | 3 +- .../poppler/poppler-src/poppler/OutputDev.cc | 4 +- .../poppler/poppler-src/poppler/OutputDev.h | 4 +- .../poppler/poppler-src/poppler/PDFDoc.cc | 23 +- .../libs/poppler/poppler-src/poppler/PDFDoc.h | 4 +- .../poppler-src/poppler/PDFDocFactory.cc | 5 +- .../poppler-src/poppler/PSOutputDev.cc | 37 +-- .../poppler/poppler-src/poppler/PSOutputDev.h | 14 +- .../libs/poppler/poppler-src/poppler/Page.cc | 8 +- .../libs/poppler/poppler-src/poppler/Page.h | 4 +- .../poppler-src/poppler/SplashOutputDev.cc | 266 +++++++----------- .../poppler-src/poppler/SplashOutputDev.h | 4 +- .../poppler/poppler-src/poppler/Stream.cc | 24 +- .../libs/poppler/poppler-src/poppler/Stream.h | 2 +- .../poppler-src/poppler/StructTreeRoot.cc | 5 +- .../poppler-src/poppler/TextOutputDev.cc | 29 +- .../poppler-src/poppler/TextOutputDev.h | 16 +- .../poppler/poppler-src/poppler/UnicodeMap.cc | 17 +- .../poppler/poppler-src/poppler/UnicodeMap.h | 18 +- .../libs/poppler/poppler-src/poppler/XRef.cc | 13 +- .../libs/poppler/poppler-src/poppler/XRef.h | 4 +- .../poppler/poppler-config.h.cmake | 42 +-- .../poppler-src/poppler/poppler-config.h.in | 42 +-- .../poppler/poppler-src/poppler/strtok_r.cpp | 92 ------ source/libs/poppler/version.ac | 2 +- .../texk/web2c/luatexdir/luatex_svnversion.h | 2 +- 70 files changed, 565 insertions(+), 997 deletions(-) delete mode 100644 source/libs/poppler/poppler-src/goo/gtypes_p.h delete mode 100644 source/libs/poppler/poppler-src/poppler/strtok_r.cpp diff --git a/source/libs/poppler/ChangeLog b/source/libs/poppler/ChangeLog index 5faeaf54d..5d17bad96 100644 --- a/source/libs/poppler/ChangeLog +++ b/source/libs/poppler/ChangeLog @@ -1,3 +1,11 @@ +2017-11-26 Luigi Scarso <luigi.scarso@gmail.com> + + Import poppler-0.60.1. + * version.ac: Adjust. + * manually created poppler-config.h.in from poppler-config.h.cmake + * deleted useless files from splash folder + * deleted goo/glibc_strtok_r.cc + 2017-10-04 Luigi Scarso <luigi.scarso@gmail.com> Import poppler-0.60.0. diff --git a/source/libs/poppler/TLpatches/patch-02-LLONG_MAX b/source/libs/poppler/TLpatches/patch-02-LLONG_MAX index bddf47c41..83aade96d 100644 --- a/source/libs/poppler/TLpatches/patch-02-LLONG_MAX +++ b/source/libs/poppler/TLpatches/patch-02-LLONG_MAX @@ -1,10 +1,10 @@ -diff -u GooString.h.orig GooString.h ---- GooString.h.orig 2017-09-18 19:09:44.011215326 +0200 -+++ GooString.h 2017-09-18 19:10:25.035213643 +0200 -@@ -36,6 +36,21 @@ - #endif +diff -bur Lexer.cc.orig Lexer.cc +--- Lexer.cc.orig 2017-11-26 23:13:57.255696673 +0100 ++++ Lexer.cc 2017-11-26 23:14:24.779695545 +0100 +@@ -39,6 +39,22 @@ + #include "Error.h" + #include "XRef.h" - #include <limits.h> // for LLONG_MAX and ULLONG_MAX + +/* <limits.h> and/or the compiler may or may not define these. */ +/* Minimum and maximum values a `signed long long int' can hold. */ @@ -20,6 +20,32 @@ diff -u GooString.h.orig GooString.h +# define ULLONG_MAX 18446744073709551615ULL +#endif + - #include <stdarg.h> - #include <stdlib.h> // for NULL - #include "gtypes.h" ++ + //------------------------------------------------------------------------ + + // A '1' in this array means the character is white space. A '1' or + +diff -bur PDFDoc.cc.orig PDFDoc.cc +--- PDFDoc.cc.orig 2017-11-26 23:14:50.383694495 +0100 ++++ PDFDoc.cc 2017-11-26 23:15:17.955693364 +0100 +@@ -81,6 +81,20 @@ + #include "PDFDoc.h" + #include "Hints.h" + ++/* <limits.h> and/or the compiler may or may not define these. */ ++/* Minimum and maximum values a `signed long long int' can hold. */ ++#ifndef LLONG_MAX ++# define LLONG_MAX 9223372036854775807LL ++#endif ++#ifndef LLONG_MIN ++# define LLONG_MIN (-LLONG_MAX - 1LL) ++#endif ++ ++/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ ++#ifndef ULLONG_MAX ++# define ULLONG_MAX 18446744073709551615ULL ++#endif ++ + #ifdef MULTITHREADED + # define pdfdocLocker() MutexLocker locker(&mutex) + #else diff --git a/source/libs/poppler/TLpatches/patch-03-Object-functions b/source/libs/poppler/TLpatches/patch-03-Object-functions index 03511d2af..44e983bb1 100644 --- a/source/libs/poppler/TLpatches/patch-03-Object-functions +++ b/source/libs/poppler/TLpatches/patch-03-Object-functions @@ -1,6 +1,7 @@ ---- Object.h.std 2017-10-02 23:29:21.000000000 +0200 -+++ Object.h 2017-10-03 10:13:36.496259318 +0200 -@@ -207,7 +207,7 @@ +$ diff -bur Object.h.orig Object.h +--- Object.h.orig 2017-11-26 23:29:43.879657854 +0100 ++++ Object.h 2017-11-25 23:04:35.423262804 +0100 +@@ -208,7 +208,7 @@ GBool isName(const char *nameA) const { return type == objName && !strcmp(cString, nameA); } GBool isDict(const char *dictType) const; @@ -9,7 +10,7 @@ GBool isCmd(const char *cmdA) const { return type == objCmd && !strcmp(cString, cmdA); } -@@ -264,7 +264,7 @@ +@@ -265,7 +265,7 @@ Object dictGetValNF(int i) const; // Stream accessors. @@ -18,7 +19,7 @@ void streamReset(); void streamClose(); int streamGetChar() const; -@@ -379,10 +379,10 @@ +@@ -380,10 +380,10 @@ #include "Stream.h" diff --git a/source/libs/poppler/config.h.in b/source/libs/poppler/config.h.in index 7bc9817fe..7a1ad4fb7 100644 --- a/source/libs/poppler/config.h.in +++ b/source/libs/poppler/config.h.in @@ -55,6 +55,9 @@ /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the `strtok_r' function. */ +#undef HAVE_STRTOK_R + /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H diff --git a/source/libs/poppler/configure b/source/libs/poppler/configure index 4b6fd0880..038237f44 100755 --- a/source/libs/poppler/configure +++ b/source/libs/poppler/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.60.0. +# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.60.1. # # Report bugs to <tex-k@tug.org>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='poppler (TeX Live)' PACKAGE_TARNAME='poppler--tex-live-' -PACKAGE_VERSION='0.60.0' -PACKAGE_STRING='poppler (TeX Live) 0.60.0' +PACKAGE_VERSION='0.60.1' +PACKAGE_STRING='poppler (TeX Live) 0.60.1' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1319,7 +1319,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures poppler (TeX Live) 0.60.0 to adapt to many kinds of systems. +\`configure' configures poppler (TeX Live) 0.60.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1387,7 +1387,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of poppler (TeX Live) 0.60.0:";; + short | recursive ) echo "Configuration of poppler (TeX Live) 0.60.1:";; esac cat <<\_ACEOF @@ -1502,7 +1502,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -poppler (TeX Live) configure 0.60.0 +poppler (TeX Live) configure 0.60.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2092,7 +2092,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by poppler (TeX Live) $as_me 0.60.0, which was +It was created by poppler (TeX Live) $as_me 0.60.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4015,7 +4015,7 @@ fi # Define the identity of the package. PACKAGE='poppler--tex-live-' - VERSION='0.60.0' + VERSION='0.60.1' # Some tools Automake needs. @@ -6249,7 +6249,7 @@ fi -for ac_func in gettimeofday gmtime_r mkstemp popen rand_r timegm +for ac_func in gettimeofday gmtime_r mkstemp popen rand_r strtok_r timegm do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -6624,7 +6624,7 @@ ac_config_headers="$ac_config_headers poppler-config.h:poppler-src/poppler/poppl cat >>confdefs.h <<_ACEOF -#define POPPLER_VERSION "0.60.0" +#define POPPLER_VERSION "0.60.1" _ACEOF @@ -7318,7 +7318,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by poppler (TeX Live) $as_me 0.60.0, which was +This file was extended by poppler (TeX Live) $as_me 0.60.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7384,7 +7384,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -poppler (TeX Live) config.status 0.60.0 +poppler (TeX Live) config.status 0.60.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/source/libs/poppler/configure.ac b/source/libs/poppler/configure.ac index 6f8602ca2..ad574ae41 100644 --- a/source/libs/poppler/configure.ac +++ b/source/libs/poppler/configure.ac @@ -94,7 +94,7 @@ AC_HEADER_DIRENT dnl **** Checks for library functions **** -AC_CHECK_FUNCS([gettimeofday gmtime_r mkstemp popen rand_r timegm]) +AC_CHECK_FUNCS([gettimeofday gmtime_r mkstemp popen rand_r strtok_r timegm]) AC_SYS_LARGEFILE AC_FUNC_FSEEKO AC_CHECK_FUNC([ftell64], [AC_CHECK_FUNCS([fseek64])]) diff --git a/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc b/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc index 291329568..2bbf04680 100644 --- a/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc +++ b/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc @@ -19,7 +19,7 @@ // Copyright (C) 2008, 2009, 2012, 2014-2017 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2008 Tomas Are Haavet <tomasare@gmail.com> // Copyright (C) 2012 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2014 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2015 Aleksei Volkov <Aleksei Volkov> // Copyright (C) 2015, 2016 William Bader <williambader@hotmail.com> @@ -37,6 +37,7 @@ #include <stdlib.h> #include <string.h> +#include <limits.h> #include <algorithm> #include "goo/gtypes.h" #include "goo/gmem.h" diff --git a/source/libs/poppler/poppler-src/fofi/FoFiType1.cc b/source/libs/poppler/poppler-src/fofi/FoFiType1.cc index f741d5d3a..a07a96c3d 100644 --- a/source/libs/poppler/poppler-src/fofi/FoFiType1.cc +++ b/source/libs/poppler/poppler-src/fofi/FoFiType1.cc @@ -32,6 +32,7 @@ #include <stdlib.h> #include <string.h> +#include <limits.h> #include "goo/gmem.h" #include "goo/GooLikely.h" #include "FoFiEncodings.h" diff --git a/source/libs/poppler/poppler-src/goo/FixedPoint.cc b/source/libs/poppler/poppler-src/goo/FixedPoint.cc index 26b2f0fe8..b51446bfb 100644 --- a/source/libs/poppler/poppler-src/goo/FixedPoint.cc +++ b/source/libs/poppler/poppler-src/goo/FixedPoint.cc @@ -8,9 +8,23 @@ // //======================================================================== +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + #include <config.h> -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT #ifdef USE_GCC_PRAGMAS #pragma implementation diff --git a/source/libs/poppler/poppler-src/goo/FixedPoint.h b/source/libs/poppler/poppler-src/goo/FixedPoint.h index 99749802d..408dfc6f4 100644 --- a/source/libs/poppler/poppler-src/goo/FixedPoint.h +++ b/source/libs/poppler/poppler-src/goo/FixedPoint.h @@ -8,12 +8,27 @@ // //======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + #ifndef FIXEDPOINT_H #define FIXEDPOINT_H #include "poppler-config.h" -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT #ifdef USE_GCC_PRAGMAS #pragma interface diff --git a/source/libs/poppler/poppler-src/goo/GooMutex.h b/source/libs/poppler/poppler-src/goo/GooMutex.h index b2714b048..68dabc402 100644 --- a/source/libs/poppler/poppler-src/goo/GooMutex.h +++ b/source/libs/poppler/poppler-src/goo/GooMutex.h @@ -21,6 +21,7 @@ // Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> // Copyright (C) 2014 Bogdan Cristea <cristeab@gmail.com> // Copyright (C) 2014 Peter Breitenlohner <peb@mppmu.mpg.de> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -30,6 +31,8 @@ #ifndef GMUTEX_H #define GMUTEX_H +#ifdef MULTITHREADED + // Usage: // // GooMutex m; @@ -82,4 +85,6 @@ private: GooMutex *mutex; }; -#endif +#endif // MULTITHREADED + +#endif // GMUTEX_H diff --git a/source/libs/poppler/poppler-src/goo/GooString.cc b/source/libs/poppler/poppler-src/goo/GooString.cc index f055b37f4..e23c2b76d 100644 --- a/source/libs/poppler/poppler-src/goo/GooString.cc +++ b/source/libs/poppler/poppler-src/goo/GooString.cc @@ -21,7 +21,7 @@ // Copyright (C) 2008-2011, 2016, 2017 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2011 Kenji Uno <ku@digitaldolphins.jp> // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Pino Toscano <pino@kde.org> // Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // Copyright (C) 2015 William Bader <williambader@hotmail.com> @@ -56,12 +56,8 @@ union GooStringFormatArg { Guint ui; long l; Gulong ul; -#ifdef LLONG_MAX long long ll; -#endif -#ifdef ULLONG_MAX unsigned long long ull; -#endif double f; char c; char *s; @@ -89,20 +85,16 @@ enum GooStringFormatType { fmtULongHexUpper, fmtULongOctal, fmtULongBinary, -#ifdef LLONG_MAX fmtLongLongDecimal, fmtLongLongHex, fmtLongLongHexUpper, fmtLongLongOctal, fmtLongLongBinary, -#endif -#ifdef ULLONG_MAX fmtULongLongDecimal, fmtULongLongHex, fmtULongLongHexUpper, fmtULongLongOctal, fmtULongLongBinary, -#endif fmtDouble, fmtDoubleTrimSmallAware, fmtDoubleTrim, @@ -115,12 +107,8 @@ enum GooStringFormatType { static const char *formatStrings[] = { "d", "x", "X", "o", "b", "ud", "ux", "uX", "uo", "ub", "ld", "lx", "lX", "lo", "lb", "uld", "ulx", "ulX", "ulo", "ulb", -#ifdef LLONG_MAX "lld", "llx", "llX", "llo", "llb", -#endif -#ifdef ULLONG_MAX "ulld", "ullx", "ullX", "ullo", "ullb", -#endif "f", "gs", "g", "c", "s", @@ -424,7 +412,6 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { case fmtULongBinary: args[argsLen].ul = va_arg(argList, Gulong); break; -#ifdef LLONG_MAX case fmtLongLongDecimal: case fmtLongLongHex: case fmtLongLongHexUpper: @@ -432,8 +419,6 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { case fmtLongLongBinary: args[argsLen].ll = va_arg(argList, long long); break; -#endif -#ifdef ULLONG_MAX case fmtULongLongDecimal: case fmtULongLongHex: case fmtULongLongHexUpper: @@ -441,7 +426,6 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { case fmtULongLongBinary: args[argsLen].ull = va_arg(argList, unsigned long long); break; -#endif case fmtDouble: case fmtDoubleTrim: case fmtDoubleTrimSmallAware: @@ -531,7 +515,6 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { case fmtULongBinary: formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 2, &str, &len); break; -#ifdef LLONG_MAX case fmtLongLongDecimal: formatInt(arg.ll, buf, sizeof(buf), zeroFill, width, 10, &str, &len); break; @@ -548,8 +531,6 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { case fmtLongLongBinary: formatInt(arg.ll, buf, sizeof(buf), zeroFill, width, 2, &str, &len); break; -#endif -#ifdef ULLONG_MAX case fmtULongLongDecimal: formatUInt(arg.ull, buf, sizeof(buf), zeroFill, width, 10, &str, &len); @@ -570,7 +551,6 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { formatUInt(arg.ull, buf, sizeof(buf), zeroFill, width, 2, &str, &len); break; -#endif case fmtDouble: formatDouble(arg.f, buf, sizeof(buf), prec, gFalse, &str, &len); break; @@ -641,23 +621,13 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { static const char lowerCaseDigits[17] = "0123456789abcdef"; static const char upperCaseDigits[17] = "0123456789ABCDEF"; -#ifdef LLONG_MAX void GooString::formatInt(long long x, char *buf, int bufSize, GBool zeroFill, int width, int base, char **p, int *len, GBool upperCase) { -#else -void GooString::formatInt(long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase) { -#endif const char *vals = upperCase ? upperCaseDigits : lowerCaseDigits; GBool neg; int start, i, j; -#ifdef LLONG_MAX unsigned long long abs_x; -#else - unsigned long abs_x; -#endif i = bufSize; if ((neg = x < 0)) { @@ -686,15 +656,9 @@ void GooString::formatInt(long x, char *buf, int bufSize, *len = bufSize - i; } -#ifdef ULLONG_MAX void GooString::formatUInt(unsigned long long x, char *buf, int bufSize, GBool zeroFill, int width, int base, char **p, int *len, GBool upperCase) { -#else -void GooString::formatUInt(Gulong x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase) { -#endif const char *vals = upperCase ? upperCaseDigits : lowerCaseDigits; int i, j; diff --git a/source/libs/poppler/poppler-src/goo/GooString.h b/source/libs/poppler/poppler-src/goo/GooString.h index 167ea1ab6..49f2888eb 100644 --- a/source/libs/poppler/poppler-src/goo/GooString.h +++ b/source/libs/poppler/poppler-src/goo/GooString.h @@ -22,6 +22,7 @@ // Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // Copyright (C) 2015 Adam Reichold <adam.reichold@t-online.de> // Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -35,22 +36,6 @@ #pragma interface #endif -#include <limits.h> // for LLONG_MAX and ULLONG_MAX - -/* <limits.h> and/or the compiler may or may not define these. */ -/* Minimum and maximum values a `signed long long int' can hold. */ -#ifndef LLONG_MAX -# define LLONG_MAX 9223372036854775807LL -#endif -#ifndef LLONG_MIN -# define LLONG_MIN (-LLONG_MAX - 1LL) -#endif - -/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ -#ifndef ULLONG_MAX -# define ULLONG_MAX 18446744073709551615ULL -#endif - #include <stdarg.h> #include <stdlib.h> // for NULL #include "gtypes.h" @@ -202,24 +187,12 @@ private: char *s; void resize(int newLength); -#ifdef LLONG_MAX static void formatInt(long long x, char *buf, int bufSize, GBool zeroFill, int width, int base, char **p, int *len, GBool upperCase = gFalse); -#else - static void formatInt(long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase = gFalse); -#endif -#ifdef ULLONG_MAX static void formatUInt(unsigned long long x, char *buf, int bufSize, GBool zeroFill, int width, int base, char **p, int *len, GBool upperCase = gFalse); -#else - static void formatUInt(Gulong x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase = gFalse); -#endif static void formatDouble(double x, char *buf, int bufSize, int prec, GBool trim, char **p, int *len); static void formatDoubleSmallAware(double x, char *buf, int bufSize, int prec, diff --git a/source/libs/poppler/poppler-src/goo/TiffWriter.cc b/source/libs/poppler/poppler-src/goo/TiffWriter.cc index 142842a08..35ceae69f 100644 --- a/source/libs/poppler/poppler-src/goo/TiffWriter.cc +++ b/source/libs/poppler/poppler-src/goo/TiffWriter.cc @@ -14,7 +14,7 @@ #include "TiffWriter.h" -#if ENABLE_LIBTIFF +#ifdef ENABLE_LIBTIFF #include <string.h> diff --git a/source/libs/poppler/poppler-src/goo/gfile.cc b/source/libs/poppler/poppler-src/goo/gfile.cc index 6b98ec21d..fe05de67b 100644 --- a/source/libs/poppler/poppler-src/goo/gfile.cc +++ b/source/libs/poppler/poppler-src/goo/gfile.cc @@ -22,7 +22,7 @@ // Copyright (C) 2009, 2012, 2014 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> // Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Peter Breitenlohner <peb@mppmu.mpg.de> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2017 Christoph Cullmann <cullmann@kde.org> @@ -399,7 +399,7 @@ GBool openTempFile(GooString **name, FILE **f, const char *mode) { char *s; int fd; -#if HAVE_MKSTEMP +#ifdef HAVE_MKSTEMP if ((s = getenv("TMPDIR"))) { *name = new GooString(s); } else { @@ -423,7 +423,7 @@ GBool openTempFile(GooString **name, FILE **f, const char *mode) { #endif } -#ifdef WIN32 +#ifdef _WIN32 GooString *fileNameToUTF8(char *path) { GooString *s; char *p; @@ -462,7 +462,7 @@ GooString *fileNameToUTF8(wchar_t *path) { #endif FILE *openFile(const char *path, const char *mode) { -#ifdef WIN32 +#ifdef _WIN32 OSVERSIONINFO version; wchar_t wPath[_MAX_PATH + 1]; char nPath[_MAX_PATH + 1]; @@ -554,13 +554,13 @@ char *getLine(char *buf, int size, FILE *f) { } int Gfseek(FILE *f, Goffset offset, int whence) { -#if HAVE_FSEEKO +#if defined(HAVE_FSEEKO) return fseeko(f, offset, whence); -#elif HAVE_FSEEK64 +#elif defined(HAVE_FSEEK64) return fseek64(f, offset, whence); #elif defined(__MINGW32__) return fseeko64(f, offset, whence); -#elif _WIN32 +#elif defined(_WIN32) return _fseeki64(f, offset, whence); #else return fseek(f, offset, whence); @@ -568,13 +568,13 @@ int Gfseek(FILE *f, Goffset offset, int whence) { } Goffset Gftell(FILE *f) { -#if HAVE_FSEEKO +#if defined(HAVE_FSEEKO) return ftello(f); -#elif HAVE_FSEEK64 +#elif defined(HAVE_FSEEK64) return ftell64(f); #elif defined(__MINGW32__) return ftello64(f); -#elif _WIN32 +#elif defined(_WIN32) return _ftelli64(f); #else return ftell(f); @@ -582,11 +582,11 @@ Goffset Gftell(FILE *f) { } Goffset GoffsetMax() { -#if HAVE_FSEEKO +#if defined(HAVE_FSEEKO) return (std::numeric_limits<off_t>::max)(); -#elif HAVE_FSEEK64 || defined(__MINGW32__) +#elif defined(HAVE_FSEEK64) || defined(__MINGW32__) return (std::numeric_limits<off64_t>::max)(); -#elif _WIN32 +#elif defined(_WIN32) return (std::numeric_limits<__int64>::max)(); #else return (std::numeric_limits<long>::max)(); diff --git a/source/libs/poppler/poppler-src/goo/gfile.h b/source/libs/poppler/poppler-src/goo/gfile.h index be5399405..805e52322 100644 --- a/source/libs/poppler/poppler-src/goo/gfile.h +++ b/source/libs/poppler/poppler-src/goo/gfile.h @@ -19,7 +19,7 @@ // Copyright (C) 2009, 2011, 2012 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> // Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2014 Bogdan Cristea <cristeab@gmail.com> // Copyright (C) 2014 Peter Breitenlohner <peb@mppmu.mpg.de> // Copyright (C) 2017 Christoph Cullmann <cullmann@kde.org> @@ -53,21 +53,21 @@ extern "C" { #else # include <unistd.h> # include <sys/types.h> -# ifdef VMS +# if defined(VMS) # include "vms_dirent.h" -# elif HAVE_DIRENT_H +# elif defined(HAVE_DIRENT_H) # include <dirent.h> # define NAMLEN(d) strlen((d)->d_name) # else # define dirent direct # define NAMLEN(d) (d)->d_namlen -# if HAVE_SYS_NDIR_H +# ifdef HAVE_SYS_NDIR_H # include <sys/ndir.h> # endif -# if HAVE_SYS_DIR_H +# ifdef HAVE_SYS_DIR_H # include <sys/dir.h> # endif -# if HAVE_NDIR_H +# ifdef HAVE_NDIR_H # include <ndir.h> # endif # endif @@ -105,7 +105,7 @@ extern time_t getModTime(char *fileName); // should be "w" or "wb". Returns true on success. extern GBool openTempFile(GooString **name, FILE **f, const char *mode); -#ifdef WIN32 +#ifdef _WIN32 // Convert a file name from Latin-1 to UTF-8. extern GooString *fileNameToUTF8(char *path); diff --git a/source/libs/poppler/poppler-src/goo/glibc.h b/source/libs/poppler/poppler-src/goo/glibc.h index 45aff9df0..8b372bcaa 100644 --- a/source/libs/poppler/poppler-src/goo/glibc.h +++ b/source/libs/poppler/poppler-src/goo/glibc.h @@ -6,7 +6,7 @@ // // This file is licensed under the GPLv2 or later // -// Copyright (C) 2016 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2016, 2017 Adrian Johnson <ajohnson@redneon.com> // //======================================================================== @@ -31,6 +31,10 @@ struct tm *localtime_r(const time_t *timep, struct tm *result); time_t timegm(struct tm *tm); #endif +#ifndef HAVE_STRTOK_R +char * strtok_r (char *s, const char *delim, char **save_ptr); +#endif + } #endif // GLIBC_H diff --git a/source/libs/poppler/poppler-src/goo/gtypes_p.h b/source/libs/poppler/poppler-src/goo/gtypes_p.h deleted file mode 100644 index cc4866e13..000000000 --- a/source/libs/poppler/poppler-src/goo/gtypes_p.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * gtypes_p.h - * - * Some useful simple types. - * - * Copyright (C) 2011 Adrian Johnson <ajohnson@redneon.com> - */ - -#ifndef GTYPES_P_H -#define GTYPES_P_H - -#include "config.h" - -/* - * Define precise integer types. - */ -#if HAVE_STDINT_H -#include <stdint.h> -#elif _MSC_VER -typedef signed __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef signed __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef signed __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -#endif - -#endif diff --git a/source/libs/poppler/poppler-src/poppler/Annot.cc b/source/libs/poppler/poppler-src/poppler/Annot.cc index 1474c2cfe..7f249d5a9 100644 --- a/source/libs/poppler/poppler-src/poppler/Annot.cc +++ b/source/libs/poppler/poppler-src/poppler/Annot.cc @@ -28,7 +28,7 @@ // Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2012, 2015 Tobias Koenig <tokoe@kdab.com> // Copyright (C) 2013 Peter Breitenlohner <peb@mppmu.mpg.de> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2014, 2015 Marek Kasik <mkasik@redhat.com> // Copyright (C) 2014 Jiri Slaby <jirislaby@gmail.com> // Copyright (C) 2014 Anuj Khare <khareanuj18@gmail.com> @@ -77,7 +77,7 @@ #include <string.h> #include <algorithm> -#if MULTITHREADED +#ifdef MULTITHREADED # define annotLocker() MutexLocker locker(&mutex) # define annotCondLocker(X) MutexLocker locker(&mutex, (X)) #else @@ -1328,7 +1328,7 @@ void Annot::initialize(PDFDoc *docA, Dict *dict) { oc = dict->lookupNF("OC"); -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -1567,17 +1567,17 @@ void Annot::incRefCnt() { } void Annot::decRefCnt() { -#if MULTITHREADED +#ifdef MULTITHREADED gLockMutex(&mutex); #endif if (--refCnt == 0) { -#if MULTITHREADED +#ifdef MULTITHREADED gUnlockMutex(&mutex); #endif delete this; return; } -#if MULTITHREADED +#ifdef MULTITHREADED gUnlockMutex(&mutex); #endif } @@ -1604,7 +1604,7 @@ Annot::~Annot() { if (color) delete color; -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } @@ -3510,7 +3510,7 @@ AnnotTextMarkup::~AnnotTextMarkup() { } void AnnotTextMarkup::setType(AnnotSubtype new_type) { - const char *typeName; + const char *typeName = nullptr; /* squelch bogus compiler warning */ switch (new_type) { case typeHighlight: @@ -5307,7 +5307,7 @@ void AnnotGeometry::initialize(PDFDoc *docA, Dict* dict) { } void AnnotGeometry::setType(AnnotSubtype new_type) { - const char *typeName; + const char *typeName = nullptr; /* squelch bogus compiler warning */ switch (new_type) { case typeSquare: @@ -5565,7 +5565,7 @@ void AnnotPolygon::initialize(PDFDoc *docA, Dict* dict) { } void AnnotPolygon::setType(AnnotSubtype new_type) { - const char *typeName; + const char *typeName = nullptr; /* squelch bogus compiler warning */ switch (new_type) { case typePolygon: diff --git a/source/libs/poppler/poppler-src/poppler/Annot.h b/source/libs/poppler/poppler-src/poppler/Annot.h index 171494a93..82279bdfd 100644 --- a/source/libs/poppler/poppler-src/poppler/Annot.h +++ b/source/libs/poppler/poppler-src/poppler/Annot.h @@ -25,7 +25,7 @@ // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2012, 2015 Tobias Koenig <tokoe@kdab.com> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -683,7 +683,7 @@ protected: GBool ok; bool hasRef; -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; #endif }; diff --git a/source/libs/poppler/poppler-src/poppler/Array.cc b/source/libs/poppler/poppler-src/poppler/Array.cc index 94b8d66af..c6de53ef0 100644 --- a/source/libs/poppler/poppler-src/poppler/Array.cc +++ b/source/libs/poppler/poppler-src/poppler/Array.cc @@ -17,6 +17,7 @@ // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013, 2017 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -35,7 +36,7 @@ #include "Object.h" #include "Array.h" -#if MULTITHREADED +#ifdef MULTITHREADED # define arrayLocker() MutexLocker locker(&mutex) #else # define arrayLocker() @@ -49,7 +50,7 @@ Array::Array(XRef *xrefA) { elems = NULL; size = length = 0; ref = 1; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -60,7 +61,7 @@ Array::~Array() { for (i = 0; i < length; ++i) elems[i].free(); gfree(elems); -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } diff --git a/source/libs/poppler/poppler-src/poppler/Array.h b/source/libs/poppler/poppler-src/poppler/Array.h index d2cdf65ff..2babc8be5 100644 --- a/source/libs/poppler/poppler-src/poppler/Array.h +++ b/source/libs/poppler/poppler-src/poppler/Array.h @@ -17,6 +17,7 @@ // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2017 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -79,7 +80,7 @@ private: int size; // size of <elems> array int length; // number of elements in array int ref; // reference count -#if MULTITHREADED +#ifdef MULTITHREADED mutable GooMutex mutex; #endif }; diff --git a/source/libs/poppler/poppler-src/poppler/CMap.cc b/source/libs/poppler/poppler-src/poppler/CMap.cc index 5ed856545..2d2a7d757 100644 --- a/source/libs/poppler/poppler-src/poppler/CMap.cc +++ b/source/libs/poppler/poppler-src/poppler/CMap.cc @@ -16,6 +16,7 @@ // Copyright (C) 2008 Koji Otani <sho@bbr.jp> // Copyright (C) 2008, 2009, 2017 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2013 Fabio D'Urso <fabiodurso@hotmail.it> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -312,7 +313,7 @@ CMap::CMap(GooString *collectionA, GooString *cMapNameA) { vector[i].cid = 0; } refCnt = 1; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -324,7 +325,7 @@ CMap::CMap(GooString *collectionA, GooString *cMapNameA, int wModeA) { wMode = wModeA; vector = NULL; refCnt = 1; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -432,7 +433,7 @@ CMap::~CMap() { if (vector) { freeCMapVector(vector); } -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } @@ -449,11 +450,11 @@ void CMap::freeCMapVector(CMapVectorEntry *vec) { } void CMap::incRefCnt() { -#if MULTITHREADED +#ifdef MULTITHREADED gLockMutex(&mutex); #endif ++refCnt; -#if MULTITHREADED +#ifdef MULTITHREADED gUnlockMutex(&mutex); #endif } @@ -461,11 +462,11 @@ void CMap::incRefCnt() { void CMap::decRefCnt() { GBool done; -#if MULTITHREADED +#ifdef MULTITHREADED gLockMutex(&mutex); #endif done = --refCnt == 0; -#if MULTITHREADED +#ifdef MULTITHREADED gUnlockMutex(&mutex); #endif if (done) { diff --git a/source/libs/poppler/poppler-src/poppler/CMap.h b/source/libs/poppler/poppler-src/poppler/CMap.h index f4f5a9141..e85c086a5 100644 --- a/source/libs/poppler/poppler-src/poppler/CMap.h +++ b/source/libs/poppler/poppler-src/poppler/CMap.h @@ -15,7 +15,7 @@ // // Copyright (C) 2008 Koji Otani <sho@bbr.jp> // Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -33,7 +33,7 @@ #include "goo/gtypes.h" #include "CharTypes.h" -#if MULTITHREADED +#ifdef MULTITHREADED #include "goo/GooMutex.h" #endif @@ -114,7 +114,7 @@ private: CMapVectorEntry *vector; // vector for first byte (NULL for // identity CMap) int refCnt; -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; #endif }; diff --git a/source/libs/poppler/poppler-src/poppler/CairoFontEngine.cc b/source/libs/poppler/poppler-src/poppler/CairoFontEngine.cc index b56d100c0..a375e0afc 100644 --- a/source/libs/poppler/poppler-src/poppler/CairoFontEngine.cc +++ b/source/libs/poppler/poppler-src/poppler/CairoFontEngine.cc @@ -21,7 +21,7 @@ // Copyright (C) 2006, 2007, 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2007 Koji Otani <sho@bbr.jp> // Copyright (C) 2008, 2009 Chris Wilson <chris@chris-wilson.co.uk> -// Copyright (C) 2008, 2012, 2014, 2016 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2008, 2012, 2014, 2016, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2009 Darren Kenny <darren.kenny@sun.com> // Copyright (C) 2010 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> // Copyright (C) 2010 Jan Kümmel <jan+freedesktop@snorc.org> @@ -49,7 +49,7 @@ #include "Gfx.h" #include "Page.h" -#if HAVE_FCNTL_H && HAVE_SYS_MMAN_H && HAVE_SYS_STAT_H +#if defined(HAVE_FCNTL_H) && defined(HAVE_SYS_MMAN_H) && defined(HAVE_SYS_STAT_H) #include <fcntl.h> #include <sys/stat.h> #include <sys/mman.h> @@ -60,7 +60,7 @@ #pragma implementation #endif -#if MULTITHREADED +#ifdef MULTITHREADED # define fontEngineLocker() MutexLocker locker(&mutex) #else # define fontEngineLocker() @@ -207,7 +207,7 @@ _ft_new_face_uncached (FT_Library lib, return gTrue; } -#if CAN_CHECK_OPEN_FACES +#ifdef CAN_CHECK_OPEN_FACES static struct _ft_face_data { struct _ft_face_data *prev, *next, **head; @@ -817,7 +817,7 @@ CairoFontEngine::CairoFontEngine(FT_Library libA) { FT_Library_Version(lib, &major, &minor, &patch); useCIDs = major > 2 || (major == 2 && (minor > 1 || (minor == 1 && patch > 7))); -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -829,7 +829,7 @@ CairoFontEngine::~CairoFontEngine() { if (fontCache[i]) delete fontCache[i]; } -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } diff --git a/source/libs/poppler/poppler-src/poppler/CairoFontEngine.h b/source/libs/poppler/poppler-src/poppler/CairoFontEngine.h index 0d7317e18..12fa598f1 100644 --- a/source/libs/poppler/poppler-src/poppler/CairoFontEngine.h +++ b/source/libs/poppler/poppler-src/poppler/CairoFontEngine.h @@ -18,7 +18,7 @@ // Copyright (C) 2005 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff@infidigm.net> // Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright (C) 2008 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2008, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // // To see a description of the changes please see the Changelog file that @@ -121,7 +121,7 @@ private: CairoFont *fontCache[cairoFontCacheSize]; FT_Library lib; GBool useCIDs; -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; #endif }; diff --git a/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc b/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc index ffd39ef77..cc8a161be 100644 --- a/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc +++ b/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc @@ -41,13 +41,13 @@ #pragma implementation #endif +#include <cstdint> #include <string.h> #include <math.h> #include <assert.h> #include <cairo.h> #include "goo/gfile.h" -#include "goo/gtypes_p.h" #include "GlobalParams.h" #include "Error.h" #include "Object.h" @@ -169,7 +169,7 @@ CairoOutputDev::CairoOutputDev() { // the SA parameter supposedly defaults to false, but Acrobat // apparently hardwires it to true - stroke_adjust = globalParams->getStrokeAdjust(); + stroke_adjust = gTrue; align_stroke_coords = gFalse; adjusted_stroke_width = gFalse; xref = NULL; @@ -1834,7 +1834,7 @@ void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha, /* convert to a luminocity map */ uint32_t *source_data = (uint32_t*)cairo_image_surface_get_data(source); /* get stride in units of 32 bits */ - int stride = cairo_image_surface_get_stride(source)/4; + ptrdiff_t stride = cairo_image_surface_get_stride(source)/4; for (int y=0; y<height; y++) { for (int x=0; x<width; x++) { int lum = alpha ? fill_opacity : luminocity(source_data[y*stride + x]); @@ -2127,7 +2127,7 @@ void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream * Guchar *pix; cairo_matrix_t matrix; int invert_bit; - int row_stride; + ptrdiff_t row_stride; cairo_filter_t filter; /* TODO: Do we want to cache these? */ @@ -2234,7 +2234,7 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream Guchar *pix; cairo_matrix_t matrix; int invert_bit; - int row_stride; + ptrdiff_t row_stride; /* cairo does a very poor job of scaling down images so we scale them ourselves */ @@ -2527,7 +2527,7 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, GBool maskInterpolate) { ImageStream *maskImgStr, *imgStr; - int row_stride; + ptrdiff_t row_stride; unsigned char *maskBuffer, *buffer; unsigned char *maskDest; unsigned int *dest; @@ -2685,7 +2685,7 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s GBool maskInterpolate) { ImageStream *maskImgStr, *imgStr; - int row_stride; + ptrdiff_t row_stride; unsigned char *maskBuffer, *buffer; unsigned char *maskDest; unsigned int *dest; @@ -2714,7 +2714,9 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s for (y = 0; y < maskHeight; y++) { maskDest = (unsigned char *) (maskBuffer + y * row_stride); pix = maskImgStr->getLine(); - maskColorMap->getGrayLine (pix, maskDest, maskWidth); + if (likely(pix != nullptr)) { + maskColorMap->getGrayLine (pix, maskDest, maskWidth); + } } maskImgStr->close(); @@ -3086,7 +3088,7 @@ public: if (!needsCustomDownscaling || printing || scaledWidth >= width || scaledHeight >= height) { // No downscaling. Create cairo image containing the source image data. unsigned char *buffer; - int stride; + ptrdiff_t stride; image = cairo_image_surface_create (maskColors ? CAIRO_FORMAT_ARGB32 : diff --git a/source/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc b/source/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc index 3c96f45e5..aa9e9e7d5 100644 --- a/source/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc +++ b/source/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc @@ -31,7 +31,7 @@ // under GPL version 2 or later // // Copyright (C) 2012 Hib Eris <hib@hiberis.nl> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -41,17 +41,15 @@ /* This implements a box filter that supports non-integer box sizes */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif +#include <cstdint> #include <stdint.h> #include <stdio.h> #include <assert.h> #include <stdlib.h> #include <math.h> #include "goo/gmem.h" -#include "goo/gtypes_p.h" #include "CairoRescaleBox.h" diff --git a/source/libs/poppler/poppler-src/poppler/Catalog.cc b/source/libs/poppler/poppler-src/poppler/Catalog.cc index 8e8b979e6..eebbbb424 100644 --- a/source/libs/poppler/poppler-src/poppler/Catalog.cc +++ b/source/libs/poppler/poppler-src/poppler/Catalog.cc @@ -28,7 +28,7 @@ // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Julien Nabet <serval2412@yahoo.fr> // Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 José Aliste <jaliste@src.gnome.org> // Copyright (C) 2014 Ed Porras <ed@moto-research.com> // Copyright (C) 2015 Even Rouault <even.rouault@spatialys.com> @@ -64,7 +64,7 @@ #include "FileSpec.h" #include "StructTreeRoot.h" -#if MULTITHREADED +#ifdef MULTITHREADED # define catalogLocker() MutexLocker locker(&mutex) #else # define catalogLocker() @@ -74,7 +74,7 @@ //------------------------------------------------------------------------ Catalog::Catalog(PDFDoc *docA) { -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif ok = gTrue; @@ -169,7 +169,7 @@ Catalog::~Catalog() { delete optContent; delete viewerPrefs; delete structTreeRoot; -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } diff --git a/source/libs/poppler/poppler-src/poppler/Catalog.h b/source/libs/poppler/poppler-src/poppler/Catalog.h index 37d6e1ec4..a2dd7fded 100644 --- a/source/libs/poppler/poppler-src/poppler/Catalog.h +++ b/source/libs/poppler/poppler-src/poppler/Catalog.h @@ -23,7 +23,7 @@ // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 José Aliste <jaliste@src.gnome.org> // Copyright (C) 2016 Masamichi Hosoda <trueroad@trueroad.jp> // @@ -283,7 +283,7 @@ private: NameTree *getEmbeddedFileNameTree(); NameTree *getJSNameTree(); LinkDest *createLinkDest(Object *obj); -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; #endif diff --git a/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc b/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc index fdb787d64..10464547e 100644 --- a/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc +++ b/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc @@ -21,7 +21,7 @@ // Copyright (C) 2010 William Bader <williambader@hotmail.com> // Copyright (C) 2010 Jakub Wilk <jwilk@jwilk.net> // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2014 Jiri Slaby <jirislaby@gmail.com> // Copyright (C) 2015 Marek Kasik <mkasik@redhat.com> // @@ -484,7 +484,7 @@ CharCodeToUnicode::CharCodeToUnicode() { sMapLen = sMapSize = 0; refCnt = 1; isIdentity = gFalse; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -502,7 +502,7 @@ CharCodeToUnicode::CharCodeToUnicode(GooString *tagA) { sMapLen = sMapSize = 0; refCnt = 1; isIdentity = gFalse; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -524,7 +524,7 @@ CharCodeToUnicode::CharCodeToUnicode(GooString *tagA, Unicode *mapA, sMapSize = sMapSizeA; refCnt = 1; isIdentity = gFalse; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -538,17 +538,17 @@ CharCodeToUnicode::~CharCodeToUnicode() { for (int i = 0; i < sMapLen; ++i) gfree(sMap[i].u); gfree(sMap); } -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } void CharCodeToUnicode::incRefCnt() { -#if MULTITHREADED +#ifdef MULTITHREADED gLockMutex(&mutex); #endif ++refCnt; -#if MULTITHREADED +#ifdef MULTITHREADED gUnlockMutex(&mutex); #endif } @@ -556,11 +556,11 @@ void CharCodeToUnicode::incRefCnt() { void CharCodeToUnicode::decRefCnt() { GBool done; -#if MULTITHREADED +#ifdef MULTITHREADED gLockMutex(&mutex); #endif done = --refCnt == 0; -#if MULTITHREADED +#ifdef MULTITHREADED gUnlockMutex(&mutex); #endif if (done) { diff --git a/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h b/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h index 1672105a8..e2b12ae3d 100644 --- a/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h +++ b/source/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h @@ -18,6 +18,7 @@ // Copyright (C) 2007 Julien Rebetez <julienr@svn.gnome.org> // Copyright (C) 2007 Koji Otani <sho@bbr.jp> // Copyright (C) 2008, 2011, 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -35,7 +36,7 @@ #include "CharTypes.h" #include "goo/gtypes.h" -#if MULTITHREADED +#ifdef MULTITHREADED #include "goo/GooMutex.h" #endif @@ -116,7 +117,7 @@ private: int sMapLen, sMapSize; int refCnt; GBool isIdentity; -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; #endif }; diff --git a/source/libs/poppler/poppler-src/poppler/DCTStream.cc b/source/libs/poppler/poppler-src/poppler/DCTStream.cc index b3e1303f2..7a4d5930a 100644 --- a/source/libs/poppler/poppler-src/poppler/DCTStream.cc +++ b/source/libs/poppler/poppler-src/poppler/DCTStream.cc @@ -11,6 +11,7 @@ // Copyright 2011 Daiki Ueno <ueno@unixuser.org> // Copyright 2011 Tomas Hoger <thoger@redhat.com> // Copyright 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright 2017 Adrian Johnson <ajohnson@redneon.com> // //======================================================================== @@ -228,8 +229,10 @@ int DCTStream::getChar() { } int DCTStream::getChars(int nChars, Guchar *buffer) { - int c; - for (int i = 0; i < nChars; ++i) { + // Use volatile to prevent the compiler optimizing + // variables into registers. See setjmp man page. + volatile int i, c; + for (i = 0; i < nChars; ++i) { DO_GET_CHAR if (likely(c != EOF)) buffer[i] = c; else return i; diff --git a/source/libs/poppler/poppler-src/poppler/Decrypt.cc b/source/libs/poppler/poppler-src/poppler/Decrypt.cc index 5d24d0a90..db7558127 100644 --- a/source/libs/poppler/poppler-src/poppler/Decrypt.cc +++ b/source/libs/poppler/poppler-src/poppler/Decrypt.cc @@ -18,7 +18,7 @@ // Copyright (C) 2009 Matthias Franz <matthias@ktug.or.kr> // Copyright (C) 2009 David Benjamin <davidben@mit.edu> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2016 Alok Anand <alok4nand@gmail.com> // Copyright (C) 2016 Thomas Freitag <Thomas.Freitag@alfa.de> // @@ -33,10 +33,10 @@ #pragma implementation #endif +#include <cstdint> #include <string.h> #include "goo/gmem.h" #include "goo/grandom.h" -#include "goo/gtypes_p.h" #include "Decrypt.h" #include "Error.h" diff --git a/source/libs/poppler/poppler-src/poppler/Dict.cc b/source/libs/poppler/poppler-src/poppler/Dict.cc index 2bd86abf4..898147088 100644 --- a/source/libs/poppler/poppler-src/poppler/Dict.cc +++ b/source/libs/poppler/poppler-src/poppler/Dict.cc @@ -21,6 +21,7 @@ // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2014 Scott West <scott.gregory.west@gmail.com> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -41,7 +42,7 @@ #include "XRef.h" #include "Dict.h" -#if MULTITHREADED +#ifdef MULTITHREADED # define dictLocker() MutexLocker locker(&mutex) #else # define dictLocker() @@ -81,7 +82,7 @@ Dict::Dict(XRef *xrefA) { size = length = 0; ref = 1; sorted = gFalse; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -90,7 +91,7 @@ Dict::Dict(Dict* dictA) { xref = dictA->xref; size = length = dictA->length; ref = 1; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif @@ -124,7 +125,7 @@ Dict::~Dict() { entries[i].val.free(); } gfree(entries); -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } diff --git a/source/libs/poppler/poppler-src/poppler/Dict.h b/source/libs/poppler/poppler-src/poppler/Dict.h index 1b922b0e8..328f422c8 100644 --- a/source/libs/poppler/poppler-src/poppler/Dict.h +++ b/source/libs/poppler/poppler-src/poppler/Dict.h @@ -19,6 +19,7 @@ // Copyright (C) 2010, 2017 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2010 PaweÅ‚ Wiejacha <pawel.wiejacha@gmail.com> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -105,7 +106,7 @@ private: int size; // size of <entries> array int length; // number of entries in dictionary int ref; // reference count -#if MULTITHREADED +#ifdef MULTITHREADED mutable GooMutex mutex; #endif diff --git a/source/libs/poppler/poppler-src/poppler/FlateEncoder.cc b/source/libs/poppler/poppler-src/poppler/FlateEncoder.cc index 49a0fa372..c6e4a042c 100644 --- a/source/libs/poppler/poppler-src/poppler/FlateEncoder.cc +++ b/source/libs/poppler/poppler-src/poppler/FlateEncoder.cc @@ -3,6 +3,7 @@ // FlateEncoder.cc // // Copyright (C) 2016, William Bader <williambader@hotmail.com> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // This file is under the GPLv2 or later license // @@ -127,7 +128,6 @@ GBool FlateEncoder::fillBuf() { zlib_status = deflate(&zlib_stream, (inBufEof? Z_FINISH: Z_NO_FLUSH)); if (zlib_status == Z_STREAM_ERROR || - zlib_stream.avail_out < 0 || zlib_stream.avail_out > starting_avail_out) { /* Unrecoverable error */ inBufEof = outBufEof = gTrue; diff --git a/source/libs/poppler/poppler-src/poppler/FlateStream.cc b/source/libs/poppler/poppler-src/poppler/FlateStream.cc index acc716c1c..d23435ff6 100644 --- a/source/libs/poppler/poppler-src/poppler/FlateStream.cc +++ b/source/libs/poppler/poppler-src/poppler/FlateStream.cc @@ -5,6 +5,7 @@ // Copyright (C) 2005, Jeff Muizelaar <jeff@infidigm.net> // Copyright (C) 2010, Albert Astals Cid <aacid@kde.org> // Copyright (C) 2016, William Bader <williambader@hotmail.com> +// Copyright (C) 2017, Adrian Johnson <ajohnson@redneon.com> // // This file is under the GPLv2 or later license // @@ -18,7 +19,7 @@ #include "poppler-config.h" -#if ENABLE_ZLIB_UNCOMPRESS +#ifdef ENABLE_ZLIB_UNCOMPRESS #include "FlateStream.h" diff --git a/source/libs/poppler/poppler-src/poppler/Gfx.cc b/source/libs/poppler/poppler-src/poppler/Gfx.cc index eaef798f3..63346a4cd 100644 --- a/source/libs/poppler/poppler-src/poppler/Gfx.cc +++ b/source/libs/poppler/poppler-src/poppler/Gfx.cc @@ -133,10 +133,6 @@ // Operator table //------------------------------------------------------------------------ -#ifdef _MSC_VER // this works around a bug in the VC7 compiler -# pragma optimize("",off) -#endif - Operator Gfx::opTab[] = { {"\"", 3, {tchkNum, tchkNum, tchkString}, &Gfx::opMoveSetShowText}, @@ -306,10 +302,6 @@ Operator Gfx::opTab[] = { &Gfx::opCurveTo2}, }; -#ifdef _MSC_VER // this works around a bug in the VC7 compiler -# pragma optimize("",on) -#endif - #define numOps (sizeof(opTab) / sizeof(Operator)) static inline GBool isSameGfxColor(const GfxColor &colorA, const GfxColor &colorB, Guint nComps, double delta) { @@ -4160,7 +4152,7 @@ void Gfx::opXObject(Object args[], int numArgs) { return; } -#if OPI_SUPPORT +#ifdef OPI_SUPPORT Object opiDict = obj1.streamGetDict()->lookup("OPI"); if (opiDict.isDict()) { out->opiBegin(state, opiDict.getDict()); @@ -4203,7 +4195,7 @@ void Gfx::opXObject(Object args[], int numArgs) { } else { error(errSyntaxError, getPos(), "XObject subtype is missing or wrong type"); } -#if OPI_SUPPORT +#ifdef OPI_SUPPORT if (opiDict.isDict()) { out->opiEnd(state, opiDict.getDict()); } diff --git a/source/libs/poppler/poppler-src/poppler/GfxFont.cc b/source/libs/poppler/poppler-src/poppler/GfxFont.cc index 04431b3c4..d06eadffb 100644 --- a/source/libs/poppler/poppler-src/poppler/GfxFont.cc +++ b/source/libs/poppler/poppler-src/poppler/GfxFont.cc @@ -1311,12 +1311,10 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA continue; } - // if the 'mapUnknownCharNames' flag is set, do a simple pass-through + // do a simple pass-through // mapping for unknown character names - if (globalParams->getMapUnknownCharNames()) { - uBuf[0] = code; - ctu->setMapping((CharCode)code, uBuf, 1); - } + uBuf[0] = code; + ctu->setMapping((CharCode)code, uBuf, 1); } } } @@ -1505,54 +1503,52 @@ static int parseCharName(char *charName, Unicode *uBuf, int uLen, if (names && (uBuf[0] = globalParams->mapNameToUnicodeText(charName))) { return 1; } - if (globalParams->getMapNumericCharNames()) { - unsigned int n = strlen(charName); - // 3.3. otherwise, if the component is of the form "uni" (U+0075 U+006E - // U+0069) followed by a sequence of uppercase hexadecimal digits (0 .. 9, - // A .. F, i.e. U+0030 .. U+0039, U+0041 .. U+0046), the length of that - // sequence is a multiple of four, and each group of four digits represents - // a number in the set {0x0000 .. 0xD7FF, 0xE000 .. 0xFFFF}, then interpret - // each such number as a Unicode scalar value and map the component to the - // string made of those scalar values. Note that the range and digit length - // restrictions mean that the "uni" prefix can be used only with Unicode - // values from the Basic Multilingual Plane (BMP). - if (n >= 7 && (n % 4) == 3 && !strncmp(charName, "uni", 3)) { - int i; - unsigned int m; - for (i = 0, m = 3; i < uLen && m < n; m += 4) { - if (isxdigit(charName[m]) && isxdigit(charName[m + 1]) && - isxdigit(charName[m + 2]) && isxdigit(charName[m + 3])) { - unsigned int u; - sscanf(charName + m, "%4x", &u); - if (u <= 0xD7FF || (0xE000 <= u && u <= 0xFFFF)) { - uBuf[i++] = u; - } - } - } - return i; - } - // 3.4. otherwise, if the component is of the form "u" (U+0075) followed by - // a sequence of four to six uppercase hexadecimal digits {0 .. 9, A .. F} - // (U+0030 .. U+0039, U+0041 .. U+0046), and those digits represent a - // number in {0x0000 .. 0xD7FF, 0xE000 .. 0x10FFFF}, then interpret this - // number as a Unicode scalar value and map the component to the string - // made of this scalar value. - if (n >= 5 && n <= 7 && charName[0] == 'u' && isxdigit(charName[1]) && - isxdigit(charName[2]) && isxdigit(charName[3]) && isxdigit(charName[4]) - && (n <= 5 || isxdigit(charName[5])) - && (n <= 6 || isxdigit(charName[6]))) { - unsigned int u; - sscanf(charName + 1, "%x", &u); - if (u <= 0xD7FF || (0xE000 <= u && u <= 0x10FFFF)) { - uBuf[0] = u; - return 1; + unsigned int n = strlen(charName); + // 3.3. otherwise, if the component is of the form "uni" (U+0075 U+006E + // U+0069) followed by a sequence of uppercase hexadecimal digits (0 .. 9, + // A .. F, i.e. U+0030 .. U+0039, U+0041 .. U+0046), the length of that + // sequence is a multiple of four, and each group of four digits represents + // a number in the set {0x0000 .. 0xD7FF, 0xE000 .. 0xFFFF}, then interpret + // each such number as a Unicode scalar value and map the component to the + // string made of those scalar values. Note that the range and digit length + // restrictions mean that the "uni" prefix can be used only with Unicode + // values from the Basic Multilingual Plane (BMP). + if (n >= 7 && (n % 4) == 3 && !strncmp(charName, "uni", 3)) { + int i; + unsigned int m; + for (i = 0, m = 3; i < uLen && m < n; m += 4) { + if (isxdigit(charName[m]) && isxdigit(charName[m + 1]) && + isxdigit(charName[m + 2]) && isxdigit(charName[m + 3])) { + unsigned int u; + sscanf(charName + m, "%4x", &u); + if (u <= 0xD7FF || (0xE000 <= u && u <= 0xFFFF)) { + uBuf[i++] = u; + } } } - // Not in Adobe Glyph Mapping convention: look for names like xx - // or Axx and parse for hex or decimal values. - if (numeric && parseNumericName(charName, hex, uBuf)) + return i; + } + // 3.4. otherwise, if the component is of the form "u" (U+0075) followed by + // a sequence of four to six uppercase hexadecimal digits {0 .. 9, A .. F} + // (U+0030 .. U+0039, U+0041 .. U+0046), and those digits represent a + // number in {0x0000 .. 0xD7FF, 0xE000 .. 0x10FFFF}, then interpret this + // number as a Unicode scalar value and map the component to the string + // made of this scalar value. + if (n >= 5 && n <= 7 && charName[0] == 'u' && isxdigit(charName[1]) && + isxdigit(charName[2]) && isxdigit(charName[3]) && isxdigit(charName[4]) + && (n <= 5 || isxdigit(charName[5])) + && (n <= 6 || isxdigit(charName[6]))) { + unsigned int u; + sscanf(charName + 1, "%x", &u); + if (u <= 0xD7FF || (0xE000 <= u && u <= 0x10FFFF)) { + uBuf[0] = u; return 1; + } } + // Not in Adobe Glyph Mapping convention: look for names like xx + // or Axx and parse for hex or decimal values. + if (numeric && parseNumericName(charName, hex, uBuf)) + return 1; // 3.5. otherwise, map the component to the empty string return 0; } diff --git a/source/libs/poppler/poppler-src/poppler/GlobalParams.cc b/source/libs/poppler/poppler-src/poppler/GlobalParams.cc index 93c42d2a7..26669930a 100644 --- a/source/libs/poppler/poppler-src/poppler/GlobalParams.cc +++ b/source/libs/poppler/poppler-src/poppler/GlobalParams.cc @@ -31,7 +31,7 @@ // Copyright (C) 2011 Pino Toscano <pino@kde.org> // Copyright (C) 2011 Koji Otani <sho@bbr.jp> // Copyright (C) 2012 Yi Yang <ahyangyi@gmail.com> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2012 Peter Breitenlohner <peb@mppmu.mpg.de> // Copyright (C) 2013, 2014 Jason Crain <jason@aquaticape.us> @@ -78,7 +78,7 @@ #include "GlobalParams.h" #include "GfxFont.h" -#if WITH_FONTCONFIGURATION_FONTCONFIG +#ifdef WITH_FONTCONFIGURATION_FONTCONFIG #include <fontconfig/fontconfig.h> #endif @@ -88,7 +88,7 @@ # include <strings.h> #endif -#if MULTITHREADED +#ifdef MULTITHREADED # define lockGlobalParams gLockMutex(&mutex) # define lockUnicodeMapCache gLockMutex(&unicodeMapCacheMutex) # define lockCMapCache gLockMutex(&cMapCacheMutex) @@ -127,27 +127,32 @@ extern XpdfPluginVecTable xpdfPluginVecTable; GlobalParams *globalParams = NULL; -#if ENABLE_RELOCATABLE && defined(_WIN32) +#if defined(ENABLE_RELOCATABLE) && defined(_WIN32) /* search for data relative to where we are installed */ static HMODULE hmodule; extern "C" { -BOOL WINAPI -DllMain (HINSTANCE hinstDLL, - DWORD fdwReason, - LPVOID lpvReserved) -{ - switch (fdwReason) - { - case DLL_PROCESS_ATTACH: - hmodule = hinstDLL; - break; + /* Provide declaration to squelch -Wmissing-declarations warning */ + BOOL WINAPI + DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved); + + BOOL WINAPI + DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) + { + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + hmodule = hinstDLL; + break; } - return TRUE; -} + return TRUE; + } } static const char * @@ -253,7 +258,7 @@ public: ~SysFontList(); SysFontInfo *find(GooString *name, GBool isFixedWidth, GBool exact); -#ifdef WIN32 +#ifdef _WIN32 void scanWindowsFonts(GooString *winFontDir); #endif #ifdef WITH_FONTCONFIGURATION_FONTCONFIG @@ -261,7 +266,7 @@ public: #endif private: -#ifdef WIN32 +#ifdef _WIN32 SysFontInfo *makeWindowsFont(char *name, int fontNum, char *path); #endif @@ -540,7 +545,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) UnicodeMap *map; int i; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); gInitMutex(&unicodeMapCacheMutex); gInitMutex(&cMapCacheMutex); @@ -572,7 +577,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) sysFonts = new SysFontList(); psExpandSmaller = gFalse; psShrinkLarger = gTrue; - psCenter = gTrue; psLevel = psLevel2; textEncoding = new GooString("UTF-8"); #if defined(_WIN32) @@ -583,19 +587,8 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) textEOL = eolUnix; #endif textPageBreaks = gTrue; - textKeepTinyChars = gFalse; enableFreeType = gTrue; - strokeAdjust = gTrue; - screenType = screenUnset; - screenSize = -1; - screenDotRadius = -1; - screenGamma = 1.0; - screenBlackThreshold = 0.0; - screenWhiteThreshold = 1.0; - minLineWidth = 0.0; overprintPreview = gFalse; - mapNumericCharNames = gTrue; - mapUnknownCharNames = gTrue; printCommands = gFalse; profileCommands = gFalse; errQuiet = gFalse; @@ -798,7 +791,7 @@ GlobalParams::~GlobalParams() { deleteGooList(plugins, Plugin); #endif -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); gDestroyMutex(&unicodeMapCacheMutex); gDestroyMutex(&cMapCacheMutex); @@ -899,7 +892,7 @@ FILE *GlobalParams::findToUnicodeFile(GooString *name) { return NULL; } -#if WITH_FONTCONFIGURATION_FONTCONFIG +#ifdef WITH_FONTCONFIGURATION_FONTCONFIG static GBool findModifier(const char *name, const char *modifier, const char **start) { const char *match; @@ -1089,7 +1082,7 @@ GooString *GlobalParams::findFontFile(GooString *fontName) { /* if you can't or don't want to use Fontconfig, you need to implement this function for your platform. For Windows, it's in GlobalParamsWin.cc */ -#if WITH_FONTCONFIGURATION_FONTCONFIG +#ifdef WITH_FONTCONFIGURATION_FONTCONFIG // not needed for fontconfig void GlobalParams::setupBaseFonts(char *dir) { } @@ -1384,15 +1377,6 @@ GBool GlobalParams::getPSShrinkLarger() { return f; } -GBool GlobalParams::getPSCenter() { - GBool f; - - lockGlobalParams; - f = psCenter; - unlockGlobalParams; - return f; -} - PSLevel GlobalParams::getPSLevel() { PSLevel level; @@ -1429,15 +1413,6 @@ GBool GlobalParams::getTextPageBreaks() { return pageBreaks; } -GBool GlobalParams::getTextKeepTinyChars() { - GBool tiny; - - lockGlobalParams; - tiny = textKeepTinyChars; - unlockGlobalParams; - return tiny; -} - GBool GlobalParams::getEnableFreeType() { GBool f; @@ -1447,96 +1422,6 @@ GBool GlobalParams::getEnableFreeType() { return f; } -GBool GlobalParams::getStrokeAdjust() { - GBool f; - - lockGlobalParams; - f = strokeAdjust; - unlockGlobalParams; - return f; -} - -ScreenType GlobalParams::getScreenType() { - ScreenType t; - - lockGlobalParams; - t = screenType; - unlockGlobalParams; - return t; -} - -int GlobalParams::getScreenSize() { - int size; - - lockGlobalParams; - size = screenSize; - unlockGlobalParams; - return size; -} - -int GlobalParams::getScreenDotRadius() { - int r; - - lockGlobalParams; - r = screenDotRadius; - unlockGlobalParams; - return r; -} - -double GlobalParams::getScreenGamma() { - double gamma; - - lockGlobalParams; - gamma = screenGamma; - unlockGlobalParams; - return gamma; -} - -double GlobalParams::getScreenBlackThreshold() { - double thresh; - - lockGlobalParams; - thresh = screenBlackThreshold; - unlockGlobalParams; - return thresh; -} - -double GlobalParams::getScreenWhiteThreshold() { - double thresh; - - lockGlobalParams; - thresh = screenWhiteThreshold; - unlockGlobalParams; - return thresh; -} - -double GlobalParams::getMinLineWidth() { - double minLineWidthA; - - lockGlobalParams; - minLineWidthA = minLineWidth; - unlockGlobalParams; - return minLineWidthA; -} - -GBool GlobalParams::getMapNumericCharNames() { - GBool map; - - lockGlobalParams; - map = mapNumericCharNames; - unlockGlobalParams; - return map; -} - -GBool GlobalParams::getMapUnknownCharNames() { - GBool map; - - lockGlobalParams; - map = mapUnknownCharNames; - unlockGlobalParams; - return map; -} - GBool GlobalParams::getPrintCommands() { GBool p; @@ -1671,12 +1556,6 @@ void GlobalParams::setPSShrinkLarger(GBool shrink) { unlockGlobalParams; } -void GlobalParams::setPSCenter(GBool center) { - lockGlobalParams; - psCenter = center; - unlockGlobalParams; -} - void GlobalParams::setPSLevel(PSLevel level) { lockGlobalParams; psLevel = level; @@ -1712,12 +1591,6 @@ void GlobalParams::setTextPageBreaks(GBool pageBreaks) { unlockGlobalParams; } -void GlobalParams::setTextKeepTinyChars(GBool keep) { - lockGlobalParams; - textKeepTinyChars = keep; - unlockGlobalParams; -} - GBool GlobalParams::setEnableFreeType(char *s) { GBool ok; @@ -1727,89 +1600,12 @@ GBool GlobalParams::setEnableFreeType(char *s) { return ok; } -GBool GlobalParams::setDisableFreeTypeHinting(char *s) { - GBool ok; - - lockGlobalParams; - ok = parseYesNo2(s, &disableFreeTypeHinting); - unlockGlobalParams; - return ok; -} - -void GlobalParams::setStrokeAdjust(GBool adjust) -{ - lockGlobalParams; - strokeAdjust = adjust; - unlockGlobalParams; -} - -void GlobalParams::setScreenType(ScreenType st) -{ - lockGlobalParams; - screenType = st; - unlockGlobalParams; -} - -void GlobalParams::setScreenSize(int size) -{ - lockGlobalParams; - screenSize = size; - unlockGlobalParams; -} - -void GlobalParams::setScreenDotRadius(int radius) -{ - lockGlobalParams; - screenDotRadius = radius; - unlockGlobalParams; -} - -void GlobalParams::setScreenGamma(double gamma) -{ - lockGlobalParams; - screenGamma = gamma; - unlockGlobalParams; -} - -void GlobalParams::setScreenBlackThreshold(double blackThreshold) -{ - lockGlobalParams; - screenBlackThreshold = blackThreshold; - unlockGlobalParams; -} - -void GlobalParams::setScreenWhiteThreshold(double whiteThreshold) -{ - lockGlobalParams; - screenWhiteThreshold = whiteThreshold; - unlockGlobalParams; -} - -void GlobalParams::setMinLineWidth(double minLineWidthA) -{ - lockGlobalParams; - minLineWidth = minLineWidthA; - unlockGlobalParams; -} - void GlobalParams::setOverprintPreview(GBool overprintPreviewA) { lockGlobalParams; overprintPreview = overprintPreviewA; unlockGlobalParams; } -void GlobalParams::setMapNumericCharNames(GBool map) { - lockGlobalParams; - mapNumericCharNames = map; - unlockGlobalParams; -} - -void GlobalParams::setMapUnknownCharNames(GBool map) { - lockGlobalParams; - mapUnknownCharNames = map; - unlockGlobalParams; -} - void GlobalParams::setPrintCommands(GBool printCommandsA) { lockGlobalParams; printCommands = printCommandsA; diff --git a/source/libs/poppler/poppler-src/poppler/GlobalParams.h b/source/libs/poppler/poppler-src/poppler/GlobalParams.h index 16dc7a4a0..7c61ae447 100644 --- a/source/libs/poppler/poppler-src/poppler/GlobalParams.h +++ b/source/libs/poppler/poppler-src/poppler/GlobalParams.h @@ -23,7 +23,7 @@ // Copyright (C) 2009, 2011, 2012, 2014, 2015 William Bader <williambader@hotmail.com> // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2011 Pino Toscano <pino@kde.org> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // @@ -45,7 +45,7 @@ #include "goo/gtypes.h" #include "CharTypes.h" -#if MULTITHREADED +#ifdef MULTITHREADED #include "goo/GooMutex.h" #endif @@ -100,15 +100,6 @@ enum EndOfLineKind { //------------------------------------------------------------------------ -enum ScreenType { - screenUnset, - screenDispersed, - screenClustered, - screenStochasticClustered -}; - -//------------------------------------------------------------------------ - class GlobalParams { public: @@ -142,24 +133,12 @@ public: GooString *base14Name = NULL); GBool getPSExpandSmaller(); GBool getPSShrinkLarger(); - GBool getPSCenter(); PSLevel getPSLevel(); GooString *getTextEncodingName(); EndOfLineKind getTextEOL(); GBool getTextPageBreaks(); - GBool getTextKeepTinyChars(); GBool getEnableFreeType(); - GBool getStrokeAdjust(); - ScreenType getScreenType(); - int getScreenSize(); - int getScreenDotRadius(); - double getScreenGamma(); - double getScreenBlackThreshold(); - double getScreenWhiteThreshold(); - double getMinLineWidth(); GBool getOverprintPreview() { return overprintPreview; } - GBool getMapNumericCharNames(); - GBool getMapUnknownCharNames(); GBool getPrintCommands(); GBool getProfileCommands(); GBool getErrQuiet(); @@ -179,25 +158,12 @@ public: void addFontFile(GooString *fontName, GooString *path); void setPSExpandSmaller(GBool expand); void setPSShrinkLarger(GBool shrink); - void setPSCenter(GBool center); void setPSLevel(PSLevel level); void setTextEncoding(char *encodingName); GBool setTextEOL(char *s); void setTextPageBreaks(GBool pageBreaks); - void setTextKeepTinyChars(GBool keep); GBool setEnableFreeType(char *s); - GBool setDisableFreeTypeHinting(char *s); - void setStrokeAdjust(GBool strokeAdjust); - void setScreenType(ScreenType st); - void setScreenSize(int size); - void setScreenDotRadius(int radius); - void setScreenGamma(double gamma); - void setScreenBlackThreshold(double blackThreshold); - void setScreenWhiteThreshold(double whiteThreshold); - void setMinLineWidth(double minLineWidth); void setOverprintPreview(GBool overprintPreviewA); - void setMapNumericCharNames(GBool map); - void setMapUnknownCharNames(GBool map); void setPrintCommands(GBool printCommandsA); void setProfileCommands(GBool profileCommandsA); void setErrQuiet(GBool errQuietA); @@ -251,27 +217,14 @@ private: SysFontList *sysFonts; // system fonts GBool psExpandSmaller; // expand smaller pages to fill paper GBool psShrinkLarger; // shrink larger pages to fit paper - GBool psCenter; // center pages on the paper PSLevel psLevel; // PostScript level to generate GooString *textEncoding; // encoding (unicodeMap) to use for text // output EndOfLineKind textEOL; // type of EOL marker to use for text // output GBool textPageBreaks; // insert end-of-page markers? - GBool textKeepTinyChars; // keep all characters in text output GBool enableFreeType; // FreeType enable flag - GBool disableFreeTypeHinting; // FreeType disable hinting flag - GBool strokeAdjust; // stroke adjustment enable flag - ScreenType screenType; // halftone screen type - int screenSize; // screen matrix size - int screenDotRadius; // screen dot radius - double screenGamma; // screen gamma correction - double screenBlackThreshold; // screen black clamping threshold - double screenWhiteThreshold; // screen white clamping threshold - double minLineWidth; // minimum line width GBool overprintPreview; // enable overprint preview - GBool mapNumericCharNames; // map numeric char names (from font subsets)? - GBool mapUnknownCharNames; // map unknown char names? GBool printCommands; // print the drawing commands GBool profileCommands; // profile the drawing commands GBool errQuiet; // suppress error messages? @@ -287,7 +240,7 @@ private: // [XpdfSecurityHandler] #endif -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; GooMutex unicodeMapCacheMutex; GooMutex cMapCacheMutex; diff --git a/source/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc b/source/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc index eba72fa00..f122fcb6f 100644 --- a/source/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc +++ b/source/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc @@ -4,7 +4,7 @@ // Copyright (C) 2010, 2012 Hib Eris <hib@hiberis.nl> // Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2012 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> - // Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> + // Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Mark Brand <mabrand@mabrand.nl> // Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> // Copyright (C) 2013 Dmytro Morgun <lztoad@gmail.com> @@ -54,7 +54,7 @@ description for all fonts available in Windows. That's how MuPDF works. #include "Lexer.h" #include "Parser.h" -#if MULTITHREADED +#ifdef MULTITHREADED # define lockGlobalParams gLockMutex(&mutex) # define lockUnicodeMapCache gLockMutex(&unicodeMapCacheMutex) # define lockCMapCache gLockMutex(&cMapCacheMutex) diff --git a/source/libs/poppler/poppler-src/poppler/Lexer.cc b/source/libs/poppler/poppler-src/poppler/Lexer.cc index d2329b536..285a265ee 100644 --- a/source/libs/poppler/poppler-src/poppler/Lexer.cc +++ b/source/libs/poppler/poppler-src/poppler/Lexer.cc @@ -39,6 +39,22 @@ #include "Error.h" #include "XRef.h" + +/* <limits.h> and/or the compiler may or may not define these. */ +/* Minimum and maximum values a `signed long long int' can hold. */ +#ifndef LLONG_MAX +# define LLONG_MAX 9223372036854775807LL +#endif +#ifndef LLONG_MIN +# define LLONG_MIN (-LLONG_MAX - 1LL) +#endif + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ +#ifndef ULLONG_MAX +# define ULLONG_MAX 18446744073709551615ULL +#endif + + //------------------------------------------------------------------------ // A '1' in this array means the character is white space. A '1' or diff --git a/source/libs/poppler/poppler-src/poppler/Object.h b/source/libs/poppler/poppler-src/poppler/Object.h index 50b2c1611..e8f071025 100644 --- a/source/libs/poppler/poppler-src/poppler/Object.h +++ b/source/libs/poppler/poppler-src/poppler/Object.h @@ -19,7 +19,7 @@ // Copyright (C) 2009 Jakub Wilk <jwilk@jwilk.net> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com> // Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com> // @@ -38,6 +38,7 @@ #include <set> #include <stdio.h> #include <string.h> +#include <limits.h> #include "goo/gtypes.h" #include "goo/gmem.h" #include "goo/GooString.h" diff --git a/source/libs/poppler/poppler-src/poppler/OutputDev.cc b/source/libs/poppler/poppler-src/poppler/OutputDev.cc index ee3cf5a30..0acdcbdeb 100644 --- a/source/libs/poppler/poppler-src/poppler/OutputDev.cc +++ b/source/libs/poppler/poppler-src/poppler/OutputDev.cc @@ -15,7 +15,7 @@ // // Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com> // Copyright (C) 2006 Thorkild Stray <thorkild@ifi.uio.no> -// Copyright (C) 2007 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2007, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2009, 2012, 2013 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> @@ -170,7 +170,7 @@ void OutputDev::markPoint(char *name, Dict *properties) { } -#if OPI_SUPPORT +#ifdef OPI_SUPPORT void OutputDev::opiBegin(GfxState *state, Dict *opiDict) { } diff --git a/source/libs/poppler/poppler-src/poppler/OutputDev.h b/source/libs/poppler/poppler-src/poppler/OutputDev.h index 0f60f60fe..107c94d2a 100644 --- a/source/libs/poppler/poppler-src/poppler/OutputDev.h +++ b/source/libs/poppler/poppler-src/poppler/OutputDev.h @@ -16,7 +16,7 @@ // Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com> // Copyright (C) 2006 Thorkild Stray <thorkild@ifi.uio.no> // Copyright (C) 2007 Jeff Muizelaar <jeff@infidigm.net> -// Copyright (C) 2007, 2011 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2007, 2011, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2009-2013, 2015 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2009, 2012, 2013 Albert Astals Cid <aacid@kde.org> @@ -309,7 +309,7 @@ public: -#if OPI_SUPPORT +#ifdef OPI_SUPPORT //----- OPI functions virtual void opiBegin(GfxState *state, Dict *opiDict); virtual void opiEnd(GfxState *state, Dict *opiDict); diff --git a/source/libs/poppler/poppler-src/poppler/PDFDoc.cc b/source/libs/poppler/poppler-src/poppler/PDFDoc.cc index da2c266bd..639cd64c6 100644 --- a/source/libs/poppler/poppler-src/poppler/PDFDoc.cc +++ b/source/libs/poppler/poppler-src/poppler/PDFDoc.cc @@ -28,7 +28,7 @@ // Copyright (C) 2010 Philip Lorenz <lorenzph+freedesktop@gmail.com> // Copyright (C) 2011-2016 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it> -// Copyright (C) 2013, 2014 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2014, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> // Copyright (C) 2014 Bogdan Cristea <cristeab@gmail.com> // Copyright (C) 2015 Li Junling <lijunling@sina.com> @@ -51,6 +51,7 @@ #include <locale.h> #include <stdio.h> #include <errno.h> +#include <limits.h> #include <stdlib.h> #include <stddef.h> #include <string.h> @@ -80,7 +81,21 @@ #include "PDFDoc.h" #include "Hints.h" -#if MULTITHREADED +/* <limits.h> and/or the compiler may or may not define these. */ +/* Minimum and maximum values a `signed long long int' can hold. */ +#ifndef LLONG_MAX +# define LLONG_MAX 9223372036854775807LL +#endif +#ifndef LLONG_MIN +# define LLONG_MIN (-LLONG_MAX - 1LL) +#endif + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ +#ifndef ULLONG_MAX +# define ULLONG_MAX 18446744073709551615ULL +#endif + +#ifdef MULTITHREADED # define pdfdocLocker() MutexLocker locker(&mutex) #else # define pdfdocLocker() @@ -105,7 +120,7 @@ void PDFDoc::init() { -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif ok = gFalse; @@ -341,7 +356,7 @@ PDFDoc::~PDFDoc() { gfree(fileNameU); } #endif -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } diff --git a/source/libs/poppler/poppler-src/poppler/PDFDoc.h b/source/libs/poppler/poppler-src/poppler/PDFDoc.h index 83a2e97e6..48d8dcf77 100644 --- a/source/libs/poppler/poppler-src/poppler/PDFDoc.h +++ b/source/libs/poppler/poppler-src/poppler/PDFDoc.h @@ -24,7 +24,7 @@ // Copyright (C) 2010 Srinivas Adicherla <srinivas.adicherla@geodesic.com> // Copyright (C) 2011, 2013, 2014, 2016 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> // Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com> // Copyright (C) 2015 André Guerreiro <aguerreiro1985@gmail.com> @@ -382,7 +382,7 @@ private: int fopenErrno; Goffset startXRefPos; // offset of last xref table -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; #endif }; diff --git a/source/libs/poppler/poppler-src/poppler/PDFDocFactory.cc b/source/libs/poppler/poppler-src/poppler/PDFDocFactory.cc index 1ec464772..cbd1395f5 100644 --- a/source/libs/poppler/poppler-src/poppler/PDFDocFactory.cc +++ b/source/libs/poppler/poppler-src/poppler/PDFDocFactory.cc @@ -6,6 +6,7 @@ // // Copyright 2010 Hib Eris <hib@hiberis.nl> // Copyright 2010 Albert Astals Cid <aacid@kde.org> +// Copyright 2017 Adrian Johnson <ajohnson@redneon.com> // //======================================================================== @@ -18,7 +19,7 @@ #include "PDFDoc.h" #include "LocalPDFDocBuilder.h" #include "StdinPDFDocBuilder.h" -#if ENABLE_LIBCURL +#ifdef ENABLE_LIBCURL #include "CurlPDFDocBuilder.h" #endif #include "ErrorCodes.h" @@ -34,7 +35,7 @@ PDFDocFactory::PDFDocFactory(GooList *pdfDocBuilders) } else { builders = new GooList(); } -#if ENABLE_LIBCURL +#ifdef ENABLE_LIBCURL builders->insert(0, new CurlPDFDocBuilder()); #endif builders->insert(0, new StdinPDFDocBuilder()); diff --git a/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc b/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc index 5e4226f42..ac4f028f1 100644 --- a/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc +++ b/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc @@ -25,7 +25,7 @@ // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2009, 2011, 2012, 2014-2017 William Bader <williambader@hotmail.com> // Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> -// Copyright (C) 2009-2011, 2013-2015 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2009-2011, 2013-2015, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012, 2014 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2012 Lu Wang <coolwanglu@gmail.com> // Copyright (C) 2014 Till Kamppeter <till.kamppeter@gmail.com> @@ -67,10 +67,10 @@ #include "Catalog.h" #include "Page.h" #include "Stream.h" -#if ENABLE_ZLIB +#ifdef ENABLE_ZLIB # include "FlateEncoder.h" #endif -#if ENABLE_ZLIB_UNCOMPRESS +#ifdef ENABLE_ZLIB_UNCOMPRESS # include "FlateStream.h" #endif #include "Annot.h" @@ -78,7 +78,7 @@ #include "PreScanOutputDev.h" #include "FileSpec.h" #include "CharCodeToUnicode.h" -#if HAVE_SPLASH +#ifdef HAVE_SPLASH # include "splash/Splash.h" # include "splash/SplashBitmap.h" # include "SplashOutputDev.h" @@ -1259,6 +1259,7 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, rasterMono = gFalse; rasterResolution = 300; uncompressPreloadedImages = gFalse; + psCenter = gTrue; rasterAntialias = gFalse; displayText = gTrue; ok = gTrue; @@ -1287,7 +1288,7 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, inUncoloredPattern = gFalse; t3FillColorOnly = gFalse; -#if OPI_SUPPORT +#ifdef OPI_SUPPORT // initialize OPI nesting levels opi13Nest = 0; opi20Nest = 0; @@ -1723,7 +1724,7 @@ void PSOutputDev::writeDocSetup(PDFDoc *doc, Catalog *catalog, writePSFmt("{0:d} {1:d} pdfSetupPaper\n", paperWidth, paperHeight); } } -#if OPI_SUPPORT +#ifdef OPI_SUPPORT if (generateOPI) { writePS("/opiMatrix matrix currentmatrix def\n"); } @@ -2985,7 +2986,7 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) { if (useCompressed) { str = str->getUndecodedStream(); } -#if ENABLE_ZLIB +#ifdef ENABLE_ZLIB if (useFlate) { str = new FlateEncoder(str); } else @@ -3220,7 +3221,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, void *annotDisplayDecideCbkData) { PreScanOutputDev *scan; GBool rasterize; -#if HAVE_SPLASH +#ifdef HAVE_SPLASH GBool useFlate, useLZW; SplashOutputDev *splashOut; SplashColor paperColor; @@ -3258,7 +3259,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, return gTrue; } -#if HAVE_SPLASH +#ifdef HAVE_SPLASH // get the rasterization parameters useFlate = getEnableFlate() && level >= psLevel3; useLZW = getEnableLZW(); @@ -3281,7 +3282,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, paperColor[0] = 0xff; splashOut = new SplashOutputDev(splashModeMono8, 1, gFalse, paperColor, gFalse); -#if SPLASH_CMYK +#ifdef SPLASH_CMYK } else if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep || globalParams->getOverprintPreview()) { numComps = 4; @@ -3575,7 +3576,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, isGray = gFalse; } str0->reset(); -#if ENABLE_ZLIB +#ifdef ENABLE_ZLIB if (useFlate) { if (isGray && numComps == 4) { str = new FlateEncoder(new CMYKGrayEncoder(str0)); @@ -3834,7 +3835,7 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { if (tx0 >= 0 && ty0 >= 0) { tx += (rotate == 0 || rotate == 180) ? tx0 : ty0; ty += (rotate == 0 || rotate == 180) ? ty0 : -tx0; - } else if (globalParams->getPSCenter()) { + } else if (psCenter) { if (clipLLX0 < clipURX0 && clipLLY0 < clipURY0) { tx += (imgWidth2 - xScale * (clipURX0 - clipLLX0)) / 2; ty += (imgHeight2 - yScale * (clipURY0 - clipLLY0)) / 2; @@ -6067,7 +6068,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap, // end of image dictionary writePS(">>\n"); -#if OPI_SUPPORT +#ifdef OPI_SUPPORT if (opi13Nest) { if (inlineImg) { // this can't happen -- OPI dictionaries are in XObjects @@ -6120,7 +6121,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap, // add newline and trailer to the end writePSChar('\n'); writePS("%-EOD-\n"); -#if OPI_SUPPORT +#ifdef OPI_SUPPORT if (opi13Nest) { writePS("%%EndData\n"); } @@ -6217,7 +6218,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, if (maskUseCompressed) { maskStr = maskStr->getUndecodedStream(); } -#if ENABLE_ZLIB +#ifdef ENABLE_ZLIB if (maskUseFlate) { maskStr = new FlateEncoder(maskStr); } else @@ -6266,7 +6267,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, if (inlineImg) { // create an array str2 = new FixedLengthEncoder(str, len); -#if ENABLE_ZLIB +#ifdef ENABLE_ZLIB if (getEnableFlate()) { str2 = new FlateEncoder(str2); } else @@ -6513,7 +6514,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, } // add FlateEncode/LZWEncode/RunLengthEncode and ASCIIHex/85 encode filters -#if ENABLE_ZLIB +#ifdef ENABLE_ZLIB if (useFlate) { str = new FlateEncoder(str); } else @@ -6828,7 +6829,7 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace, } } -#if OPI_SUPPORT +#ifdef OPI_SUPPORT void PSOutputDev::opiBegin(GfxState *state, Dict *opiDict) { if (generateOPI) { Object dict = opiDict->lookup("2.0"); diff --git a/source/libs/poppler/poppler-src/poppler/PSOutputDev.h b/source/libs/poppler/poppler-src/poppler/PSOutputDev.h index 8dd1c9504..fd1bea17b 100644 --- a/source/libs/poppler/poppler-src/poppler/PSOutputDev.h +++ b/source/libs/poppler/poppler-src/poppler/PSOutputDev.h @@ -15,14 +15,14 @@ // // Copyright (C) 2005 Martin Kretzschmar <martink@gnome.org> // Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com> -// Copyright (C) 2006-2008, 2012, 2013, 2015 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2006-2008, 2012, 2013, 2015, 2017 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2007 Brad Hards <bradh@kde.org> // Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2009 Till Kamppeter <till.kamppeter@gmail.com> // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2009, 2011, 2015-2017 William Bader <williambader@hotmail.com> // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> -// Copyright (C) 2011, 2014 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2011, 2014, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // // To see a description of the changes please see the Changelog file that @@ -275,7 +275,7 @@ public: Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GBool maskInterpolate) override; -#if OPI_SUPPORT +#ifdef OPI_SUPPORT //----- OPI functions void opiBegin(GfxState *state, Dict *opiDict) override; void opiEnd(GfxState *state, Dict *opiDict) override; @@ -309,6 +309,7 @@ public: { overlayCbk = cbk; overlayCbkData = data; } void setDisplayText(GBool display) { displayText = display; } + void setPSCenter(GBool center) { psCenter = center; } void setRasterAntialias(GBool a) { rasterAntialias = a; } void setRasterResolution(double r) { rasterResolution = r; } void setRasterMono(GBool b) { rasterMono = b; } @@ -323,7 +324,7 @@ public: GBool getPassLevel1CustomColor() const { return passLevel1CustomColor; } GBool getEnableLZW() const { return enableLZW; }; GBool getEnableFlate() const -#if ENABLE_ZLIB +#ifdef ENABLE_ZLIB { return enableFlate; } #else { return gFalse; } @@ -414,7 +415,7 @@ private: int x0, int y0, int x1, int y1, double xStep, double yStep); -#if OPI_SUPPORT +#ifdef OPI_SUPPORT void opiBegin20(GfxState *state, Dict *dict); void opiBegin13(GfxState *state, Dict *dict); void opiTransform(GfxState *state, double x0, double y0, @@ -527,6 +528,7 @@ private: GBool t3NeedsRestore; // set if a 'q' operator was issued GBool forceRasterize; // forces the page to be rasterized into a image before printing GBool displayText; // displayText + GBool psCenter; // center pages on the paper GBool rasterAntialias; // antialias on rasterize GBool uncompressPreloadedImages; double rasterResolution; // PostScript rasterization resolution (dpi) @@ -551,7 +553,7 @@ private: GBool enableLZW; // enable LZW compression GBool enableFlate; // enable Flate compression -#if OPI_SUPPORT +#ifdef OPI_SUPPORT int opi13Nest; // nesting level of OPI 1.3 objects int opi20Nest; // nesting level of OPI 2.0 objects #endif diff --git a/source/libs/poppler/poppler-src/poppler/Page.cc b/source/libs/poppler/poppler-src/poppler/Page.cc index 197e2bef3..ca4a5a6d4 100644 --- a/source/libs/poppler/poppler-src/poppler/Page.cc +++ b/source/libs/poppler/poppler-src/poppler/Page.cc @@ -27,7 +27,7 @@ // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013, 2014 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Jason Crain <jason@aquaticape.us> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2015 Philipp Reinkemeier <philipp.reinkemeier@offis.de> // // To see a description of the changes please see the Changelog file that @@ -61,7 +61,7 @@ #include "Catalog.h" #include "Form.h" -#if MULTITHREADED +#ifdef MULTITHREADED # define pageLocker() MutexLocker locker(&mutex) #else # define pageLocker() @@ -249,7 +249,7 @@ GBool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box) { //------------------------------------------------------------------------ Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *attrsA, Form *form) { -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif ok = gTrue; @@ -328,7 +328,7 @@ Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *at Page::~Page() { delete attrs; delete annots; -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } diff --git a/source/libs/poppler/poppler-src/poppler/Page.h b/source/libs/poppler/poppler-src/poppler/Page.h index 2a5971317..97b70a0cb 100644 --- a/source/libs/poppler/poppler-src/poppler/Page.h +++ b/source/libs/poppler/poppler-src/poppler/Page.h @@ -22,7 +22,7 @@ // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2012, 2017 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -282,7 +282,7 @@ private: Object actions; // page additional actions double duration; // page duration GBool ok; // true if page is valid -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; #endif }; diff --git a/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc b/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc index dc5b68714..281743569 100644 --- a/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc +++ b/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc @@ -29,7 +29,7 @@ // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> // Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com> -// Copyright (C) 2011, 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2011, 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com> // Copyright (C) 2013 Li Junling <lijunling@sina.com> // Copyright (C) 2014 Ed Porras <ed@moto-research.com> @@ -51,7 +51,7 @@ #endif #include <string.h> -#include <math.h> +#include <cmath> #include "goo/gfile.h" #include "GlobalParams.h" #include "Error.h" @@ -84,24 +84,7 @@ extern "C" int unlink(char *filename); #endif #endif -#ifdef _MSC_VER -#include <float.h> -#define isfinite(x) _finite(x) -#endif - -#ifdef __sun -#include <ieeefp.h> -#ifndef isfinite -#define isfinite(x) finite(x) -#endif -#endif - -#if __cplusplus > 199711L -#include <cmath> -#ifndef isfinite -#define isfinite(x) std::isfinite(x) -#endif -#endif +static const double s_minLineWidth = 0.0; static inline void convertGfxColor(SplashColorPtr dest, SplashColorMode colorMode, @@ -110,14 +93,14 @@ static inline void convertGfxColor(SplashColorPtr dest, SplashColor color; GfxGray gray; GfxRGB rgb; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GfxColor deviceN; #endif // make gcc happy color[0] = color[1] = color[2] = 0; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK color[3] = 0; #endif switch (colorMode) { @@ -136,7 +119,7 @@ static inline void convertGfxColor(SplashColorPtr dest, color[1] = colToByte(rgb.g); color[2] = colToByte(rgb.b); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: colorSpace->getCMYK(src, &cmyk); color[0] = colToByte(cmyk.c); @@ -187,7 +170,7 @@ static inline void convertGfxShortColor(SplashColorPtr dest, dest[2] = colToByte(rgb.b); } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: { GfxCMYK cmyk; @@ -233,7 +216,7 @@ void SplashGouraudPattern::getParameterizedColor(double colorinterp, SplashColor GfxColor src; GfxColorSpace* srcColorSpace = shading->getColorSpace(); int colorComps = 3; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (mode == splashModeCMYK8) colorComps=4; else if (mode == splashModeDeviceN8) @@ -514,7 +497,7 @@ static inline Guchar div255(int x) { return (Guchar)((x + (x >> 8) + 0x80) >> 8); } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK #include "GfxState_helpers.h" @@ -570,7 +553,7 @@ static void splashOutBlendMultiply(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -583,7 +566,7 @@ static void splashOutBlendMultiply(SplashColorPtr src, SplashColorPtr dest, blend[i] = (dest[i] * src[i]) / 255; } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -598,7 +581,7 @@ static void splashOutBlendScreen(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -611,7 +594,7 @@ static void splashOutBlendScreen(SplashColorPtr src, SplashColorPtr dest, blend[i] = dest[i] + src[i] - (dest[i] * src[i]) / 255; } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -626,7 +609,7 @@ static void splashOutBlendOverlay(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -641,7 +624,7 @@ static void splashOutBlendOverlay(SplashColorPtr src, SplashColorPtr dest, : 255 - 2 * ((255 - src[i]) * (255 - dest[i])) / 255; } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -656,7 +639,7 @@ static void splashOutBlendDarken(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -669,7 +652,7 @@ static void splashOutBlendDarken(SplashColorPtr src, SplashColorPtr dest, blend[i] = dest[i] < src[i] ? dest[i] : src[i]; } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -684,7 +667,7 @@ static void splashOutBlendLighten(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -697,7 +680,7 @@ static void splashOutBlendLighten(SplashColorPtr src, SplashColorPtr dest, blend[i] = dest[i] > src[i] ? dest[i] : src[i]; } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -713,7 +696,7 @@ static void splashOutBlendColorDodge(SplashColorPtr src, SplashColorPtr dest, SplashColorMode cm) { int i, x; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -731,7 +714,7 @@ static void splashOutBlendColorDodge(SplashColorPtr src, SplashColorPtr dest, } } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -746,7 +729,7 @@ static void splashOutBlendColorBurn(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i, x; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -764,7 +747,7 @@ static void splashOutBlendColorBurn(SplashColorPtr src, SplashColorPtr dest, } } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -779,7 +762,7 @@ static void splashOutBlendHardLight(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -794,7 +777,7 @@ static void splashOutBlendHardLight(SplashColorPtr src, SplashColorPtr dest, : 255 - 2 * ((255 - dest[i]) * (255 - src[i])) / 255; } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -809,7 +792,7 @@ static void splashOutBlendSoftLight(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i, x; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -831,7 +814,7 @@ static void splashOutBlendSoftLight(SplashColorPtr src, SplashColorPtr dest, } } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -847,7 +830,7 @@ static void splashOutBlendDifference(SplashColorPtr src, SplashColorPtr dest, SplashColorMode cm) { int i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -860,7 +843,7 @@ static void splashOutBlendDifference(SplashColorPtr src, SplashColorPtr dest, blend[i] = dest[i] < src[i] ? src[i] - dest[i] : dest[i] - src[i]; } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -881,7 +864,7 @@ static void splashOutBlendExclusion(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -894,7 +877,7 @@ static void splashOutBlendExclusion(SplashColorPtr src, SplashColorPtr dest, blend[i] = dest[i] + src[i] - (2 * dest[i] * src[i]) / 255; } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; @@ -1005,7 +988,7 @@ static void setSat(Guchar rIn, Guchar gIn, Guchar bIn, int sat, static void splashOutBlendHue(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { Guchar r0, g0, b0; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK Guchar r1, g1, b1; int i; SplashColor src2, dest2; @@ -1026,7 +1009,7 @@ static void splashOutBlendHue(SplashColorPtr src, SplashColorPtr dest, setLum(r0, g0, b0, getLum(dest[0], dest[1], dest[2]), &blend[0], &blend[1], &blend[2]); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: case splashModeDeviceN8: for (i = 0; i < 4; i++) { @@ -1056,7 +1039,7 @@ static void splashOutBlendSaturation(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { Guchar r0, g0, b0; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK Guchar r1, g1, b1; int i; SplashColor src2, dest2; @@ -1077,7 +1060,7 @@ static void splashOutBlendSaturation(SplashColorPtr src, SplashColorPtr dest, setLum(r0, g0, b0, getLum(dest[0], dest[1], dest[2]), &blend[0], &blend[1], &blend[2]); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: case splashModeDeviceN8: for (i = 0; i < 4; i++) { @@ -1104,7 +1087,7 @@ static void splashOutBlendSaturation(SplashColorPtr src, SplashColorPtr dest, static void splashOutBlendColor(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK Guchar r, g, b; int i; SplashColor src2, dest2; @@ -1123,7 +1106,7 @@ static void splashOutBlendColor(SplashColorPtr src, SplashColorPtr dest, setLum(src[0], src[1], src[2], getLum(dest[0], dest[1], dest[2]), &blend[0], &blend[1], &blend[2]); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: case splashModeDeviceN8: for (i = 0; i < 4; i++) { @@ -1149,7 +1132,7 @@ static void splashOutBlendColor(SplashColorPtr src, SplashColorPtr dest, static void splashOutBlendLuminosity(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK Guchar r, g, b; int i; SplashColor src2, dest2; @@ -1168,7 +1151,7 @@ static void splashOutBlendLuminosity(SplashColorPtr src, SplashColorPtr dest, setLum(dest[0], dest[1], dest[2], getLum(src[0], src[1], src[2]), &blend[0], &blend[1], &blend[2]); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: case splashModeDeviceN8: for (i = 0; i < 4; i++) { @@ -1407,7 +1390,7 @@ SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, bitmap = new SplashBitmap(1, 1, bitmapRowPad, colorMode, colorMode != splashModeMono1, bitmapTopDown); splash = new Splash(bitmap, vectorAntialias, &screenParams); - splash->setMinLineWidth(globalParams->getMinLineWidth()); + splash->setMinLineWidth(s_minLineWidth); splash->setThinLineMode(thinLineMode); splash->clear(paperColor, 0); @@ -1425,27 +1408,15 @@ SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, } void SplashOutputDev::setupScreenParams(double hDPI, double vDPI) { - screenParams.size = globalParams->getScreenSize(); - screenParams.dotRadius = globalParams->getScreenDotRadius(); - screenParams.gamma = (SplashCoord)globalParams->getScreenGamma(); - screenParams.blackThreshold = - (SplashCoord)globalParams->getScreenBlackThreshold(); - screenParams.whiteThreshold = - (SplashCoord)globalParams->getScreenWhiteThreshold(); - switch (globalParams->getScreenType()) { - case screenDispersed: - screenParams.type = splashScreenDispersed; - if (screenParams.size < 0) { - screenParams.size = 4; - } - break; - case screenClustered: - screenParams.type = splashScreenClustered; - if (screenParams.size < 0) { - screenParams.size = 10; - } - break; - case screenStochasticClustered: + screenParams.size = -1; + screenParams.dotRadius = -1; + screenParams.gamma = (SplashCoord)1.0; + screenParams.blackThreshold = (SplashCoord)0.0; + screenParams.whiteThreshold = (SplashCoord)1.0; + + // use clustered dithering for resolution >= 300 dpi + // (compare to 299.9 to avoid floating point issues) + if (hDPI > 299.9 && vDPI > 299.9) { screenParams.type = splashScreenStochasticClustered; if (screenParams.size < 0) { screenParams.size = 64; @@ -1453,24 +1424,10 @@ void SplashOutputDev::setupScreenParams(double hDPI, double vDPI) { if (screenParams.dotRadius < 0) { screenParams.dotRadius = 2; } - break; - case screenUnset: - default: - // use clustered dithering for resolution >= 300 dpi - // (compare to 299.9 to avoid floating point issues) - if (hDPI > 299.9 && vDPI > 299.9) { - screenParams.type = splashScreenStochasticClustered; - if (screenParams.size < 0) { - screenParams.size = 64; - } - if (screenParams.dotRadius < 0) { - screenParams.dotRadius = 2; - } - } else { - screenParams.type = splashScreenDispersed; - if (screenParams.size < 0) { - screenParams.size = 4; - } + } else { + screenParams.type = splashScreenDispersed; + if (screenParams.size < 0) { + screenParams.size = 4; } } } @@ -1500,14 +1457,9 @@ void SplashOutputDev::startDoc(PDFDoc *docA) { delete fontEngine; } fontEngine = new SplashFontEngine( -#if HAVE_T1LIB_H - globalParams->getEnableT1lib(), -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H globalParams->getEnableFreeType(), enableFreeTypeHinting, enableSlightHinting, -#endif getFontAntialias() && colorMode != splashModeMono1); for (i = 0; i < nT3Fonts; ++i) { @@ -1558,7 +1510,7 @@ void SplashOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { } splash = new Splash(bitmap, vectorAntialias, &screenParams); splash->setThinLineMode(thinLineMode); - splash->setMinLineWidth(globalParams->getMinLineWidth()); + splash->setMinLineWidth(s_minLineWidth); if (state) { ctm = state->getCTM(); mat[0] = (SplashCoord)ctm[0]; @@ -1581,7 +1533,7 @@ void SplashOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { case splashModeBGR8: color[0] = color[1] = color[2] = 0; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: color[0] = color[1] = color[2] = color[3] = 0; break; @@ -1600,7 +1552,7 @@ void SplashOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { splash->setFlatness(1); // the SA parameter supposedly defaults to false, but Acrobat // apparently hardwires it to true - splash->setStrokeAdjust(globalParams->getStrokeAdjust()); + splash->setStrokeAdjust(gTrue); splash->clear(paperColor, 0); } @@ -1711,14 +1663,14 @@ void SplashOutputDev::updateStrokeAdjust(GfxState * /*state*/) { } void SplashOutputDev::updateFillColorSpace(GfxState *state) { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (colorMode == splashModeDeviceN8) state->getFillColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); #endif } void SplashOutputDev::updateStrokeColorSpace(GfxState *state) { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (colorMode == splashModeDeviceN8) state->getStrokeColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); #endif @@ -1727,7 +1679,7 @@ void SplashOutputDev::updateStrokeColorSpace(GfxState *state) { void SplashOutputDev::updateFillColor(GfxState *state) { GfxGray gray; GfxRGB rgb; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GfxColor deviceN; #endif @@ -1744,7 +1696,7 @@ void SplashOutputDev::updateFillColor(GfxState *state) { state->getFillRGB(&rgb); splash->setFillPattern(getColor(&rgb)); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: state->getFillCMYK(&cmyk); splash->setFillPattern(getColor(&cmyk)); @@ -1760,7 +1712,7 @@ void SplashOutputDev::updateFillColor(GfxState *state) { void SplashOutputDev::updateStrokeColor(GfxState *state) { GfxGray gray; GfxRGB rgb; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GfxColor deviceN; #endif @@ -1777,7 +1729,7 @@ void SplashOutputDev::updateStrokeColor(GfxState *state) { state->getStrokeRGB(&rgb); splash->setStrokePattern(getColor(&rgb)); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: state->getStrokeCMYK(&cmyk); splash->setStrokePattern(getColor(&cmyk)); @@ -1820,7 +1772,7 @@ SplashPattern *SplashOutputDev::getColor(GfxRGB *rgb) { return new SplashSolidColor(color); } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK SplashPattern *SplashOutputDev::getColor(GfxCMYK *cmyk) { SplashColor color; @@ -1843,7 +1795,7 @@ SplashPattern *SplashOutputDev::getColor(GfxColor *deviceN) { void SplashOutputDev::getMatteColor(SplashColorMode colorMode, GfxImageColorMap *colorMap, GfxColor *matteColorIn, SplashColor matteColor) { GfxGray gray; GfxRGB rgb; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GfxColor deviceN; #endif @@ -1868,7 +1820,7 @@ void SplashOutputDev::getMatteColor(SplashColorMode colorMode, GfxImageColorMap matteColor[2] = colToByte(rgb.b); matteColor[3] = 255; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: colorMap->getColorSpace()->getCMYK(matteColorIn, &cmyk); matteColor[0] = colToByte(cmyk.c); @@ -1890,7 +1842,7 @@ void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace, int overprintMode, GfxColor *singleColor, GBool grayIndexed) { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK Guint mask; GfxCMYK cmyk; GBool additive = gFalse; @@ -2854,7 +2806,7 @@ void SplashOutputDev::type3D1(GfxState *state, double wx, double wy, splash->clear(color); color[0] = 0xff; } - splash->setMinLineWidth(globalParams->getMinLineWidth()); + splash->setMinLineWidth(s_minLineWidth); splash->setThinLineMode(splashThinLineDefault); splash->setFillPattern(new SplashSolidColor(color)); splash->setStrokePattern(new SplashSolidColor(color)); @@ -2932,7 +2884,7 @@ void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, ctm = state->getCTM(); for (int i = 0; i < 6; ++i) { - if (!isfinite(ctm[i])) return; + if (!std::isfinite(ctm[i])) return; } mat[0] = ctm[0]; mat[1] = ctm[1]; @@ -2978,7 +2930,7 @@ void SplashOutputDev::setSoftMaskFromImageMask(GfxState *state, ctm = state->getCTM(); for (int i = 0; i < 6; ++i) { - if (!isfinite(ctm[i])) return; + if (!std::isfinite(ctm[i])) return; } beginTransparencyGroup(state, bbox, NULL, gFalse, gFalse, gFalse); @@ -3062,7 +3014,7 @@ GBool SplashOutputDev::useIccImageSrc(void *data) { if (colorSpace->getAlt() != NULL && colorSpace->getAlt()->getMode() == csDeviceRGB) return gTrue; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: if (colorSpace->getAlt() != NULL && colorSpace->getAlt()->getMode() == csDeviceCMYK) return gTrue; @@ -3087,7 +3039,7 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, SplashColorPtr q, col; GfxRGB rgb; GfxGray gray; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GfxColor deviceN; #endif @@ -3102,7 +3054,7 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, destComps = 3; else if (imgData->colorMode == splashModeXBGR8) destComps = 4; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK else if (imgData->colorMode == splashModeCMYK8) destComps = 4; else if (imgData->colorMode == splashModeDeviceN8) @@ -3140,7 +3092,7 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, *q++ = col[3]; } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: for (x = 0, q = colorLine; x < imgData->width; ++x, ++p) { col = &imgData->lookup[4 * *p]; @@ -3194,7 +3146,7 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, } } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: if (imgData->colorMap->useCMYKLine()) { imgData->colorMap->getCMYKLine(p, (Guchar *) colorLine, imgData->width); @@ -3253,7 +3205,7 @@ GBool SplashOutputDev::iccImageSrc(void *data, SplashColorPtr colorLine, destComps = 3; else if (imgData->colorMode == splashModeXBGR8) destComps = 4; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK else if (imgData->colorMode == splashModeCMYK8) destComps = 4; else if (imgData->colorMode == splashModeDeviceN8) @@ -3300,7 +3252,7 @@ void SplashOutputDev::iccTransform(void *data, SplashBitmap *bitmap) { imgData->colorMap->getRGBLine(p, colorLine, bitmap->getWidth()); memcpy(p, colorLine, nComps * bitmap->getWidth()); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: imgData->colorMap->getCMYKLine(p, colorLine, bitmap->getWidth()); memcpy(p, colorLine, nComps * bitmap->getWidth()); @@ -3338,7 +3290,7 @@ GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, SplashColorPtr q, col; GfxRGB rgb; GfxGray gray; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GfxColor deviceN; #endif @@ -3385,7 +3337,7 @@ GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, *q++ = col[2]; *q++ = 255; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: col = &imgData->lookup[4 * *p]; *q++ = col[0]; @@ -3417,7 +3369,7 @@ GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, *q++ = colToByte(rgb.b); if (imgData->colorMode == splashModeXBGR8) *q++ = 255; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: imgData->colorMap->getCMYK(p, &cmyk); *q++ = colToByte(cmyk.c); @@ -3505,7 +3457,7 @@ GBool SplashOutputDev::tilingBitmapSrc(void *data, SplashColorPtr colorLine, imgData->bitmap->getPixel(x, imgData->y, col); imgData->pattern->getColor(x, imgData->y, pat); for (int i = 0; i < splashColorModeNComps[imgData->colorMode]; ++i) { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (imgData->colorMode == splashModeCMYK8 || imgData->colorMode == splashModeDeviceN8) dest[i] = div255(pat[i] * (255 - col[0])); else @@ -3545,7 +3497,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, SplashICCTransform tf; GfxGray gray; GfxRGB rgb; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GBool grayIndexed = gFalse; GfxColor deviceN; @@ -3555,7 +3507,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, ctm = state->getCTM(); for (i = 0; i < 6; ++i) { - if (!isfinite(ctm[i])) return; + if (!std::isfinite(ctm[i])) return; } mat[0] = ctm[0]; mat[1] = ctm[1]; @@ -3614,7 +3566,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, imgData.lookup[4*i+3] = 255; } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: grayIndexed = colorMap->getColorSpace()->getMode() != csDeviceGray; imgData.lookup = (SplashColorPtr)gmallocn(n, 4); @@ -3649,7 +3601,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, } } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(), state->getOverprintMode(), NULL, grayIndexed); #else @@ -3699,7 +3651,7 @@ GBool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine, SplashColorPtr q, col; GfxRGB rgb; GfxGray gray; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GfxColor deviceN; #endif @@ -3748,7 +3700,7 @@ GBool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine, *q++ = col[2]; *q++ = 255; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: col = &imgData->lookup[4 * *p]; *q++ = col[0]; @@ -3780,7 +3732,7 @@ GBool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine, *q++ = colToByte(rgb.b); if (imgData->colorMode == splashModeXBGR8) *q++ = 255; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: imgData->colorMap->getCMYK(p, &cmyk); *q++ = colToByte(cmyk.c); @@ -3822,14 +3774,14 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, SplashColor maskColor; GfxGray gray; GfxRGB rgb; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GfxColor deviceN; #endif Guchar pix; int n, i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK colorMap->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); #endif setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(), @@ -3883,7 +3835,7 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, ctm = state->getCTM(); for (i = 0; i < 6; ++i) { - if (!isfinite(ctm[i])) { + if (!std::isfinite(ctm[i])) { delete maskBitmap; return; } @@ -3943,7 +3895,7 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, imgData.lookup[4*i+3] = 255; } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { @@ -4000,14 +3952,14 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, SplashColor maskColor; GfxGray gray; GfxRGB rgb; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GfxColor deviceN; #endif Guchar pix; int n, i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK colorMap->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); #endif setOverprintMask(colorMap->getColorSpace(), state->getFillOverprint(), @@ -4015,7 +3967,7 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, ctm = state->getCTM(); for (i = 0; i < 6; ++i) { - if (!isfinite(ctm[i])) return; + if (!std::isfinite(ctm[i])) return; } mat[0] = ctm[0]; mat[1] = ctm[1]; @@ -4128,7 +4080,7 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, imgData.lookup[4*i+3] = 255; } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: imgData.lookup = (SplashColorPtr)gmallocn(n, 4); for (i = 0; i < n; ++i) { @@ -4270,9 +4222,7 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, // save state transpGroup->origBitmap = bitmap; transpGroup->origSplash = splash; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H transpGroup->fontAA = fontEngine->getAA(); -#endif //~ this handles the blendingColorSpace arg for soft masks, but //~ not yet for transparency groups @@ -4290,7 +4240,7 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, blendingColorSpace->getNComps() == 3)) { //~ does this need to use BGR8? colorMode = splashModeRGB8; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK } else if (blendingColorSpace->getMode() == csDeviceCMYK || (blendingColorSpace->getMode() == csICCBased && blendingColorSpace->getNComps() == 4)) { @@ -4310,12 +4260,10 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, splash = new Splash(bitmap, vectorAntialias, transpGroup->origSplash->getScreen()); if (transpGroup->next != NULL && transpGroup->next->knockout) { -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H fontEngine->setAA(gFalse); -#endif } splash->setThinLineMode(transpGroup->origSplash->getThinLineMode()); - splash->setMinLineWidth(globalParams->getMinLineWidth()); + splash->setMinLineWidth(s_minLineWidth); //~ Acrobat apparently copies at least the fill and stroke colors, and //~ maybe other state(?) -- but not the clipping path (and not sure //~ what else) @@ -4376,9 +4324,7 @@ void SplashOutputDev::paintTransparencyGroup(GfxState *state, double *bbox) { splash->composite(tBitmap, 0, 0, tx, ty, tBitmap->getWidth(), tBitmap->getHeight(), gFalse, !isolated, transpGroupStack->next != NULL && transpGroupStack->next->knockout, knockoutOpacity); -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H fontEngine->setAA(transpGroupStack->fontAA); -#endif if (transpGroupStack->next != NULL && transpGroupStack->next->shape != NULL) { transpGroupStack->next->knockout = gTrue; } @@ -4406,7 +4352,7 @@ void SplashOutputDev::setSoftMask(GfxState *state, double *bbox, SplashColorPtr p; GfxGray gray; GfxRGB rgb; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK GfxCMYK cmyk; GfxColor deviceN; #endif @@ -4444,7 +4390,7 @@ void SplashOutputDev::setSoftMask(GfxState *state, double *bbox, color[2] = colToByte(rgb.b); tSplash->compositeBackground(color); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: transpGroupStack->blendingColorSpace->getCMYK(backdropColor, &cmyk); color[0] = colToByte(cmyk.c); @@ -4503,7 +4449,7 @@ void SplashOutputDev::setSoftMask(GfxState *state, double *bbox, (0.59 / 255.0) * color[1] + (0.11 / 255.0) * color[2]; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: case splashModeDeviceN8: lum = (1 - color[3] / 255.0) @@ -4622,7 +4568,7 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca state->concatCTM(1, 0, 0, 1, bbox[0], bbox[1]); ctm = state->getCTM(); for (i = 0; i < 6; ++i) { - if (!isfinite(ctm[i])) { + if (!std::isfinite(ctm[i])) { state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]); return gFalse; } @@ -4721,7 +4667,7 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca splash = new Splash(bitmap, gTrue); if (paintType == 2) { SplashColor clearColor; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK clearColor[0] = (colorMode == splashModeCMYK8 || colorMode == splashModeDeviceN8) ? 0x00 : 0xFF; #else clearColor[0] = 0xFF; @@ -4731,7 +4677,7 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca splash->clear(paperColor, 0); } splash->setThinLineMode(formerSplash->getThinLineMode()); - splash->setMinLineWidth(globalParams->getMinLineWidth()); + splash->setMinLineWidth(s_minLineWidth); box.x1 = bbox[0]; box.y1 = bbox[1]; box.x2 = bbox[2]; box.y2 = bbox[3]; @@ -4797,7 +4743,7 @@ GBool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTria case splashModeRGB8: bDirectColorTranslation = (shadingMode == csDeviceRGB); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: case splashModeDeviceN8: bDirectColorTranslation = (shadingMode == csDeviceCMYK); @@ -4871,7 +4817,7 @@ GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePat state->closePath(); path = convertPath(state, state->getPath(), gTrue); -#if SPLASH_CMYK +#ifdef SPLASH_CMYK pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); #endif setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(), @@ -4936,7 +4882,7 @@ GBool SplashOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *s state->closePath(); path = convertPath(state, state->getPath(), gTrue); -#if SPLASH_CMYK +#ifdef SPLASH_CMYK pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); #endif setOverprintMask(pattern->getShading()->getColorSpace(), state->getFillOverprint(), diff --git a/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h b/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h index 88635d09a..05b7e9433 100644 --- a/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h +++ b/source/libs/poppler/poppler-src/poppler/SplashOutputDev.h @@ -19,7 +19,7 @@ // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> // Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com> -// Copyright (C) 2011 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2011, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012, 2015 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2015, 2016 William Bader <williambader@hotmail.com> // @@ -404,7 +404,7 @@ private: void setupScreenParams(double hDPI, double vDPI); SplashPattern *getColor(GfxGray gray); SplashPattern *getColor(GfxRGB *rgb); -#if SPLASH_CMYK +#ifdef SPLASH_CMYK SplashPattern *getColor(GfxCMYK *cmyk); SplashPattern *getColor(GfxColor *deviceN); #endif diff --git a/source/libs/poppler/poppler-src/poppler/Stream.cc b/source/libs/poppler/poppler-src/poppler/Stream.cc index 0ad602c79..da1d92675 100644 --- a/source/libs/poppler/poppler-src/poppler/Stream.cc +++ b/source/libs/poppler/poppler-src/poppler/Stream.cc @@ -33,6 +33,7 @@ // Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> // Copyright (C) 2015 Jason Crain <jason@aquaticape.us> // Copyright (C) 2017 Jose Aliste <jaliste@src.gnome.org> +// Copyright (C) 2017 Kay Dohmann <k.dohmann@gmx.net> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -93,7 +94,7 @@ static GBool setDJSYSFLAGS = gFalse; #endif #endif -#if MULTITHREADED +#ifdef MULTITHREADED # define streamLocker() MutexLocker locker(&mutex) #else # define streamLocker() @@ -104,13 +105,13 @@ static GBool setDJSYSFLAGS = gFalse; Stream::Stream() { ref = 1; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } Stream::~Stream() { -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } @@ -288,7 +289,7 @@ Stream *Stream::makeFilter(char *name, Stream *str, Object *params, int recursio str = new CCITTFaxStream(str, encoding, endOfLine, byteAlign, columns, rows, endOfBlock, black); } else if (!strcmp(name, "DCTDecode") || !strcmp(name, "DCT")) { -#if HAVE_DCT_DECODER +#ifdef HAVE_DCT_DECODER int colorXform = -1; if (params->isDict()) { obj = params->dictLookup("ColorTransform", recursion); @@ -1461,11 +1462,6 @@ GBool LZWStream::processNextCode() { clearTable(); goto start; } - if (nextCode >= 4097) { - error(errSyntaxError, getPos(), - "Bad LZW stream - expected clear-table code"); - clearTable(); - } // process the next code nextLength = seqLength + 1; @@ -1491,10 +1487,12 @@ GBool LZWStream::processNextCode() { if (first) { first = gFalse; } else { - table[nextCode].length = nextLength; - table[nextCode].head = prevCode; - table[nextCode].tail = newChar; - ++nextCode; + if (nextCode < 4097) { + table[nextCode].length = nextLength; + table[nextCode].head = prevCode; + table[nextCode].tail = newChar; + ++nextCode; + } if (nextCode + early == 512) nextBits = 10; else if (nextCode + early == 1024) diff --git a/source/libs/poppler/poppler-src/poppler/Stream.h b/source/libs/poppler/poppler-src/poppler/Stream.h index c2c48111c..152dbb0fe 100644 --- a/source/libs/poppler/poppler-src/poppler/Stream.h +++ b/source/libs/poppler/poppler-src/poppler/Stream.h @@ -238,7 +238,7 @@ private: Stream *makeFilter(char *name, Stream *str, Object *params, int recursion = 0, Dict *dict = nullptr); int ref; // reference count -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; #endif }; diff --git a/source/libs/poppler/poppler-src/poppler/StructTreeRoot.cc b/source/libs/poppler/poppler-src/poppler/StructTreeRoot.cc index b8c52c640..5f5611158 100644 --- a/source/libs/poppler/poppler-src/poppler/StructTreeRoot.cc +++ b/source/libs/poppler/poppler-src/poppler/StructTreeRoot.cc @@ -8,6 +8,7 @@ // Copyright 2014 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright 2017 Jan-Erik S <janerik234678@gmail.com> // Copyright 2017 Albert Astals Cid <aacid@kde.org> +// Copyright 2017 Adrian Johnson <ajohnson@redneon.com> // //======================================================================== @@ -66,8 +67,8 @@ void StructTreeRoot::parse(Dict *root) error(errSyntaxError, -1, "Nums item at position {0:d} is wrong type ({1:s})", i, index.getTypeName()); continue; } - const unsigned idx = index.getInt(); - if (idx < 0 || idx >= parentTree.size()) { + const int idx = index.getInt(); + if (idx < 0 || idx >= (int)parentTree.size()) { error(errSyntaxError, -1, "Nums item at position {0:d} is invalid value ({1:d}): [0..{2:d}]", i, idx, parentTree.size() - 1); continue; } diff --git a/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc b/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc index d30874cf3..9a77d0500 100644 --- a/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc +++ b/source/libs/poppler/poppler-src/poppler/TextOutputDev.cc @@ -18,7 +18,7 @@ // Copyright (C) 2006-2008, 2011-2013 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2006, 2007, 2013 Ed Catmur <ed@catmur.co.uk> // Copyright (C) 2006 Jeff Muizelaar <jeff@infidigm.net> -// Copyright (C) 2007, 2008, 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2007, 2008, 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2008 Koji Otani <sho@bbr.jp> // Copyright (C) 2008, 2010-2012, 2014-2017 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2008 Pino Toscano <pino@kde.org> @@ -30,7 +30,7 @@ // Copyright (C) 2010 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> // Copyright (C) 2011 Sam Liao <phyomh@gmail.com> // Copyright (C) 2012 Horst Prote <prote@fmi.uni-stuttgart.de> -// Copyright (C) 2012, 2013-2016 Jason Crain <jason@aquaticape.us> +// Copyright (C) 2012, 2013-2017 Jason Crain <jason@aquaticape.us> // Copyright (C) 2012 Peter Breitenlohner <peb@mppmu.mpg.de> // Copyright (C) 2013 José Aliste <jaliste@src.gnome.org> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> @@ -51,7 +51,7 @@ #include <stdio.h> #include <stdlib.h> #include <stddef.h> -#include <math.h> +#include <cmath> #include <float.h> #include <ctype.h> #include <algorithm> @@ -306,7 +306,7 @@ TextFontInfo::TextFontInfo(GfxState *state) { gfxFont = state->getFont(); if (gfxFont) gfxFont->incRefCnt(); -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST fontName = (gfxFont && gfxFont->getName()) ? gfxFont->getName()->copy() : (GooString *)NULL; flags = gfxFont ? gfxFont->getFlags() : 0; @@ -316,7 +316,7 @@ TextFontInfo::TextFontInfo(GfxState *state) { TextFontInfo::~TextFontInfo() { if (gfxFont) gfxFont->decRefCnt(); -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST if (fontName) { delete fontName; } @@ -360,7 +360,7 @@ TextWord::TextWord(GfxState *state, int rotA, double fontSizeA) { spaceAfter = gFalse; next = NULL; -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST GfxRGB rgb; if ((state->getRender() & 3) == 1) { @@ -790,7 +790,7 @@ int TextWord::cmpYX(const void *p1, const void *p2) { return cmp < 0 ? -1 : cmp > 0 ? 1 : 0; } -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST GooString *TextWord::getText() { GooString *s; @@ -889,12 +889,12 @@ void TextPool::addWord(TextWord *word) { TextWord *w0, *w1; // expand the array if needed - if (unlikely((word->base / textPoolStep) > INT_MAX)) { - error(errSyntaxWarning, -1, "word->base / textPoolStep > INT_MAX"); + wordBaseIdx = (int)(word->base / textPoolStep); + if (unlikely(wordBaseIdx <= INT_MIN + 128 || wordBaseIdx >= INT_MAX - 128)) { + error(errSyntaxWarning, -1, "wordBaseIdx out of range"); delete word; return; } - wordBaseIdx = (int)(word->base / textPoolStep); if (minBaseIdx > maxBaseIdx) { minBaseIdx = wordBaseIdx - 128; maxBaseIdx = wordBaseIdx + 128; @@ -2252,7 +2252,7 @@ GBool TextFlow::blockFits(TextBlock *blk, TextBlock *prevBlk) { return fits; } -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST //------------------------------------------------------------------------ // TextWordList @@ -2599,8 +2599,7 @@ void TextPage::addChar(GfxState *state, double x, double y, } // check the tiny chars limit - if (!globalParams->getTextKeepTinyChars() && - fabs(w1) < 3 && fabs(h1) < 3) { + if (fabs(w1) < 3 && fabs(h1) < 3) { if (++nTinyChars > 50000) { charPos += nBytes; return; @@ -5473,7 +5472,7 @@ int TextPage::dumpFragment(Unicode *text, int len, UnicodeMap *uMap, } } -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST TextWordList *TextPage::makeWordList(GBool physLayout) { return new TextWordList(this, physLayout); } @@ -5859,7 +5858,7 @@ void TextOutputDev::setMergeCombining(GBool merge) { text->setMergeCombining(merge); } -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST TextWordList *TextOutputDev::makeWordList() { return text->makeWordList(physLayout); } diff --git a/source/libs/poppler/poppler-src/poppler/TextOutputDev.h b/source/libs/poppler/poppler-src/poppler/TextOutputDev.h index 707d8ca97..380301fde 100644 --- a/source/libs/poppler/poppler-src/poppler/TextOutputDev.h +++ b/source/libs/poppler/poppler-src/poppler/TextOutputDev.h @@ -16,7 +16,7 @@ // Copyright (C) 2005-2007 Kristian Høgsberg <krh@redhat.com> // Copyright (C) 2006 Ed Catmur <ed@catmur.co.uk> // Copyright (C) 2007, 2008, 2011, 2013 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright (C) 2007 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2007, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2008, 2010, 2015, 2016 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2010 Brian Ewins <brian.ewins@gmail.com> // Copyright (C) 2012, 2013, 2015, 2016 Jason Crain <jason@aquaticape.us> @@ -91,7 +91,7 @@ public: // Get the writing mode (0 or 1), or 0 if the font is not set int getWMode(); -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST // Get the font name (which may be NULL). GooString *getFontName() { return fontName; } @@ -106,7 +106,7 @@ public: private: GfxFont *gfxFont; -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST GooString *fontName; int flags; #endif @@ -165,7 +165,7 @@ public: // Get the next TextWord on the linked list. TextWord *getNext() { return next; } -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST int getLength() { return len; } const Unicode *getChar(int idx) { return &text[idx]; } GooString *getText(); @@ -215,7 +215,7 @@ private: GBool underlined; TextWord *next; // next word in line -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST double colorR, // word color colorG, colorB; @@ -471,7 +471,7 @@ private: friend class TextPage; }; -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST //------------------------------------------------------------------------ // TextWordList @@ -628,7 +628,7 @@ public: // character are drawn on eachother. void setMergeCombining(GBool merge); -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST // Build a flat word list, in content stream order (if // this->rawOrder is true), physical layout order (if <physLayout> // is true and this->rawOrder is false), or reading order (if both @@ -847,7 +847,7 @@ public: // character are drawn on eachother. void setMergeCombining(GBool merge); -#if TEXTOUT_WORD_LIST +#ifdef TEXTOUT_WORD_LIST // Build a flat word list, in content stream order (if // this->rawOrder is true), physical layout order (if // this->physLayout is true and this->rawOrder is false), or reading diff --git a/source/libs/poppler/poppler-src/poppler/UnicodeMap.cc b/source/libs/poppler/poppler-src/poppler/UnicodeMap.cc index 15d9a81e6..0340ef651 100644 --- a/source/libs/poppler/poppler-src/poppler/UnicodeMap.cc +++ b/source/libs/poppler/poppler-src/poppler/UnicodeMap.cc @@ -15,6 +15,7 @@ // // Copyright (C) 2010 Jakub Wilk <jwilk@jwilk.net> // Copyright (C) 2017 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -136,7 +137,7 @@ UnicodeMap::UnicodeMap(GooString *encodingNameA) { eMaps = NULL; eMapsLen = 0; refCnt = 1; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -151,7 +152,7 @@ UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA, eMaps = NULL; eMapsLen = 0; refCnt = 1; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -165,7 +166,7 @@ UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA, eMaps = NULL; eMapsLen = 0; refCnt = 1; -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif } @@ -178,17 +179,17 @@ UnicodeMap::~UnicodeMap() { if (eMaps) { gfree(eMaps); } -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } void UnicodeMap::incRefCnt() { -#if MULTITHREADED +#ifdef MULTITHREADED gLockMutex(&mutex); #endif ++refCnt; -#if MULTITHREADED +#ifdef MULTITHREADED gUnlockMutex(&mutex); #endif } @@ -196,11 +197,11 @@ void UnicodeMap::incRefCnt() { void UnicodeMap::decRefCnt() { GBool done; -#if MULTITHREADED +#ifdef MULTITHREADED gLockMutex(&mutex); #endif done = --refCnt == 0; -#if MULTITHREADED +#ifdef MULTITHREADED gUnlockMutex(&mutex); #endif if (done) { diff --git a/source/libs/poppler/poppler-src/poppler/UnicodeMap.h b/source/libs/poppler/poppler-src/poppler/UnicodeMap.h index ba7df2cfb..46b4c0f95 100644 --- a/source/libs/poppler/poppler-src/poppler/UnicodeMap.h +++ b/source/libs/poppler/poppler-src/poppler/UnicodeMap.h @@ -8,6 +8,20 @@ // //======================================================================== +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + #ifndef UNICODEMAP_H #define UNICODEMAP_H @@ -19,7 +33,7 @@ #include "goo/gtypes.h" #include "CharTypes.h" -#if MULTITHREADED +#ifdef MULTITHREADED #include "goo/GooMutex.h" #endif @@ -94,7 +108,7 @@ private: UnicodeMapExt *eMaps; // (user) int eMapsLen; // (user) int refCnt; -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; #endif }; diff --git a/source/libs/poppler/poppler-src/poppler/XRef.cc b/source/libs/poppler/poppler-src/poppler/XRef.cc index f3b88ec0e..e37d54943 100644 --- a/source/libs/poppler/poppler-src/poppler/XRef.cc +++ b/source/libs/poppler/poppler-src/poppler/XRef.cc @@ -22,7 +22,7 @@ // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2012, 2013, 2016 Thomas Freitag <Thomas.Freitag@kabelmail.de> // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it> -// Copyright (C) 2013, 2014 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2014, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Pino Toscano <pino@kde.org> // Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com> // @@ -32,6 +32,7 @@ //======================================================================== #include <config.h> +#include "poppler-config.h" #ifdef USE_GCC_PRAGMAS #pragma implementation @@ -71,7 +72,7 @@ #define permHighResPrint (1<<11) // bit 12 #define defPermFlags 0xfffc -#if MULTITHREADED +#ifdef MULTITHREADED # define xrefLocker() MutexLocker locker(&mutex) # define xrefCondLocker(X) MutexLocker locker(&mutex, (X)) #else @@ -261,7 +262,7 @@ Object ObjectStream::getObject(int objIdx, int objNum) { //------------------------------------------------------------------------ void XRef::init() { -#if MULTITHREADED +#ifdef MULTITHREADED gInitMutex(&mutex); #endif ok = gTrue; @@ -384,7 +385,7 @@ XRef::~XRef() { if (strOwner) { delete str; } -#if MULTITHREADED +#ifdef MULTITHREADED gDestroyMutex(&mutex); #endif } @@ -1221,13 +1222,13 @@ Object XRef::fetch(int num, int gen, int recursion) { } void XRef::lock() { -#if MULTITHREADED +#ifdef MULTITHREADED gLockMutex(&mutex); #endif } void XRef::unlock() { -#if MULTITHREADED +#ifdef MULTITHREADED gUnlockMutex(&mutex); #endif } diff --git a/source/libs/poppler/poppler-src/poppler/XRef.h b/source/libs/poppler/poppler-src/poppler/XRef.h index e59e8cbb5..9306a99b9 100644 --- a/source/libs/poppler/poppler-src/poppler/XRef.h +++ b/source/libs/poppler/poppler-src/poppler/XRef.h @@ -21,7 +21,7 @@ // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2012, 2013, 2016 Thomas Freitag <Thomas.Freitag@kabelmail.de> // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com> // // To see a description of the changes please see the Changelog file that @@ -235,7 +235,7 @@ private: Goffset mainXRefOffset; // position of the main XRef table/stream GBool scannedSpecialFlags; // true if scanSpecialFlags has been called GBool strOwner; // true if str is owned by the instance -#if MULTITHREADED +#ifdef MULTITHREADED GooMutex mutex; #endif diff --git a/source/libs/poppler/poppler-src/poppler/poppler-config.h.cmake b/source/libs/poppler/poppler-src/poppler/poppler-config.h.cmake index 01c9a4828..3a13e8115 100644 --- a/source/libs/poppler/poppler-src/poppler/poppler-config.h.cmake +++ b/source/libs/poppler/poppler-src/poppler/poppler-config.h.cmake @@ -16,6 +16,7 @@ // Copyright (C) 2014 Bogdan Cristea <cristeab@gmail.com> // Copyright (C) 2014 Hib Eris <hib@hiberis.nl> // Copyright (C) 2016 Tor Lillqvist <tml@collabora.com> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -25,8 +26,6 @@ #ifndef POPPLER_CONFIG_H #define POPPLER_CONFIG_H -#include <stdio.h> - // We duplicate some of the config.h #define's here since they are // used in some of the header files we install. The #ifndef/#endif // around #undef look odd, but it's to silence warnings about @@ -115,11 +114,6 @@ #cmakedefine HAVE_SYS_NDIR_H 1 #endif -/* Have FreeType2 include files */ -#ifndef HAVE_FREETYPE_H -#cmakedefine HAVE_FREETYPE_H 1 -#endif - /* Defines if use cms */ #ifndef USE_CMS #cmakedefine USE_CMS 1 @@ -127,8 +121,8 @@ // Also, there are preprocessor symbols in the header files // that are used but never defined when building poppler using configure -// or cmake: DISABLE_OUTLINE, DEBUG_MEM, SPLASH_CMYK, HAVE_T1LIB_H, -// ENABLE_PLUGINS, DEBUG_FORMS, HAVE_FREETYPE_FREETYPE_H +// or cmake: DISABLE_OUTLINE, DEBUG_MEM, +// ENABLE_PLUGINS, DEBUG_FORMS //------------------------------------------------------------------------ // version @@ -138,21 +132,6 @@ #define popplerCopyright "Copyright 2005-2017 The Poppler Developers - http://poppler.freedesktop.org" #define xpdfCopyright "Copyright 1996-2011 Glyph & Cog, LLC" -//------------------------------------------------------------------------ -// popen -//------------------------------------------------------------------------ - -#if defined(_MSC_VER) || defined(__BORLANDC__) -#define popen _popen -#define pclose _pclose -#endif - -#if defined(VMS) || defined(VMCMS) || defined(DOS) || defined(OS2) || defined(__EMX__) || defined(_WIN32) || defined(__DJGPP__) || defined(MACOS) -#define POPEN_READ_MODE "rb" -#else -#define POPEN_READ_MODE "r" -#endif - //------------------------------------------------------------------------ // Win32 stuff //------------------------------------------------------------------------ @@ -163,19 +142,12 @@ #define CDECL #endif -#if defined(_WIN32) -#ifdef _MSC_VER -#define strtok_r strtok_s -#elif __MINGW32__ && !defined(__WINPTHREADS_VERSION) -char * strtok_r (char *s, const char *delim, char **save_ptr); -#endif -#endif - //------------------------------------------------------------------------ // Compiler //------------------------------------------------------------------------ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#include <stdio.h> // __MINGW_PRINTF_FORMAT is defined in the mingw stdio.h #ifdef __MINGW_PRINTF_FORMAT #define GCC_PRINTF_FORMAT(fmt_index, va_index) \ __attribute__((__format__(__MINGW_PRINTF_FORMAT, fmt_index, va_index))) @@ -187,10 +159,4 @@ char * strtok_r (char *s, const char *delim, char **save_ptr); #define GCC_PRINTF_FORMAT(fmt_index, va_index) #endif -#if defined(_MSC_VER) && _MSC_VER < 1800 -#define fmax(a, b) std::max(a, b) -#define fmin(a, b) std::min(a, b) -#endif - - #endif /* POPPLER_CONFIG_H */ diff --git a/source/libs/poppler/poppler-src/poppler/poppler-config.h.in b/source/libs/poppler/poppler-src/poppler/poppler-config.h.in index 142f6df87..a4a1d4267 100644 --- a/source/libs/poppler/poppler-src/poppler/poppler-config.h.in +++ b/source/libs/poppler/poppler-src/poppler/poppler-config.h.in @@ -16,6 +16,7 @@ // Copyright (C) 2014 Bogdan Cristea <cristeab@gmail.com> // Copyright (C) 2014 Hib Eris <hib@hiberis.nl> // Copyright (C) 2016 Tor Lillqvist <tml@collabora.com> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -25,8 +26,6 @@ #ifndef POPPLER_CONFIG_H #define POPPLER_CONFIG_H -#include <stdio.h> - // We duplicate some of the config.h #define's here since they are // used in some of the header files we install. The #ifndef/#endif // around #undef look odd, but it's to silence warnings about @@ -115,11 +114,6 @@ #undef HAVE_SYS_NDIR_H #endif -/* Have FreeType2 include files */ -#ifndef HAVE_FREETYPE_H -#undef HAVE_FREETYPE_H -#endif - /* Defines if use cms */ #ifndef USE_CMS #undef USE_CMS @@ -127,8 +121,8 @@ // Also, there are preprocessor symbols in the header files // that are used but never defined when building poppler using configure -// or cmake: DISABLE_OUTLINE, DEBUG_MEM, SPLASH_CMYK, HAVE_T1LIB_H, -// ENABLE_PLUGINS, DEBUG_FORMS, HAVE_FREETYPE_FREETYPE_H +// or cmake: DISABLE_OUTLINE, DEBUG_MEM, +// ENABLE_PLUGINS, DEBUG_FORMS //------------------------------------------------------------------------ // version @@ -138,21 +132,6 @@ #define popplerCopyright "Copyright 2005-2017 The Poppler Developers - http://poppler.freedesktop.org" #define xpdfCopyright "Copyright 1996-2011 Glyph & Cog, LLC" -//------------------------------------------------------------------------ -// popen -//------------------------------------------------------------------------ - -#if defined(_MSC_VER) || defined(__BORLANDC__) -#define popen _popen -#define pclose _pclose -#endif - -#if defined(VMS) || defined(VMCMS) || defined(DOS) || defined(OS2) || defined(__EMX__) || defined(_WIN32) || defined(__DJGPP__) || defined(MACOS) -#define POPEN_READ_MODE "rb" -#else -#define POPEN_READ_MODE "r" -#endif - //------------------------------------------------------------------------ // Win32 stuff //------------------------------------------------------------------------ @@ -163,19 +142,12 @@ #define CDECL #endif -#if defined(_WIN32) -#ifdef _MSC_VER -#define strtok_r strtok_s -#elif __MINGW32__ && !defined(__WINPTHREADS_VERSION) -char * strtok_r (char *s, const char *delim, char **save_ptr); -#endif -#endif - //------------------------------------------------------------------------ // Compiler //------------------------------------------------------------------------ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#include <stdio.h> // __MINGW_PRINTF_FORMAT is defined in the mingw stdio.h #ifdef __MINGW_PRINTF_FORMAT #define GCC_PRINTF_FORMAT(fmt_index, va_index) \ __attribute__((__format__(__MINGW_PRINTF_FORMAT, fmt_index, va_index))) @@ -187,10 +159,4 @@ char * strtok_r (char *s, const char *delim, char **save_ptr); #define GCC_PRINTF_FORMAT(fmt_index, va_index) #endif -#if defined(_MSC_VER) && _MSC_VER < 1800 -#define fmax(a, b) std::max(a, b) -#define fmin(a, b) std::min(a, b) -#endif - - #endif /* POPPLER_CONFIG_H */ diff --git a/source/libs/poppler/poppler-src/poppler/strtok_r.cpp b/source/libs/poppler/poppler-src/poppler/strtok_r.cpp deleted file mode 100644 index 6483e0f7b..000000000 --- a/source/libs/poppler/poppler-src/poppler/strtok_r.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* Reentrant string tokenizer. Generic version. - Copyright (C) 1991,1996-1999,2001,2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* Copyright (C) 1991,93,96,97,99,2000,2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on strlen implementation by Torbjorn Granlund (tege@sics.se), - with help from Dan Sahlin (dan@sics.se) and - commentary by Jim Blandy (jimb@ai.mit.edu); - adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), - and implemented by Roland McGrath (roland@ai.mit.edu). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2012 Alexey Pavlov <alexpux@gmail.com> -// Copyright (C) 2012 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#if defined(__MINGW32__) && !defined(__WINPTHREADS_VERSION) -#include <string.h> - -#define __rawmemchr strchr - -char * strtok_r (char *s, const char *delim, char **save_ptr) -{ - char *token; - - if (s == NULL) - s = *save_ptr; - - /* Scan leading delimiters. */ - s += strspn (s, delim); - if (*s == '\0') - { - *save_ptr = s; - return NULL; - } - - /* Find the end of the token. */ - token = s; - s = strpbrk (token, delim); - if (s == NULL) - /* This token finishes the string. */ - *save_ptr = __rawmemchr (token, '\0'); - else - { - /* Terminate the token and make *SAVE_PTR point past it. */ - *s = '\0'; - *save_ptr = s + 1; - } - return token; -} -#endif diff --git a/source/libs/poppler/version.ac b/source/libs/poppler/version.ac index 6f38baf5d..6f7646042 100644 --- a/source/libs/poppler/version.ac +++ b/source/libs/poppler/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current poppler version -m4_define([poppler_version], [0.60.0]) +m4_define([poppler_version], [0.60.1]) diff --git a/source/texk/web2c/luatexdir/luatex_svnversion.h b/source/texk/web2c/luatexdir/luatex_svnversion.h index b7215da7b..c8290d131 100644 --- a/source/texk/web2c/luatexdir/luatex_svnversion.h +++ b/source/texk/web2c/luatexdir/luatex_svnversion.h @@ -1 +1 @@ -#define luatex_svn_revision 6479 +#define luatex_svn_revision 6480 -- GitLab