[poppler] 23 commits - CMakeLists.txt cmake/modules config.h.cmake ConfigureChecks.cmake fofi/FoFiTrueType.cc fofi/FoFiType1.cc glib/CMakeLists.txt glib/demo goo/FixedPoint.cc goo/FixedPoint.h goo/gfile.cc goo/gfile.h goo/glibc.h goo/glibc_strtok_r.cc goo/GooMutex.h goo/GooString.cc goo/GooString.h goo/gtypes_p.h goo/TiffWriter.cc poppler/Annot.cc poppler/Annot.h poppler/Array.cc poppler/Array.h poppler/CairoFontEngine.cc poppler/CairoFontEngine.h poppler/CairoOutputDev.cc poppler/CairoRescaleBox.cc poppler/Catalog.cc poppler/Catalog.h poppler/CharCodeToUnicode.cc poppler/CharCodeToUnicode.h poppler/CMap.cc poppler/CMap.h poppler/DCTStream.cc poppler/Decrypt.cc poppler/Dict.cc poppler/Dict.h poppler/FlateEncoder.cc poppler/FlateStream.cc poppler/Gfx.cc poppler/GlobalParams.cc poppler/GlobalParams.h poppler/GlobalParamsWin.cc poppler/Object.h poppler/OutputDev.cc poppler/OutputDev.h poppler/Page.cc poppler/Page.h poppler/PDFDoc.cc poppler/PDFDocFactory.cc poppler/PDFDoc.h poppler/poppl er-config.h.cmake poppler/PSOutputDev.cc poppler/PSOutputDev.h poppler/SplashOutputDev.cc poppler/SplashOutputDev.h poppler/Stream.cc poppler/Stream.h poppler/strtok_r.cpp poppler/StructTreeRoot.cc poppler/TextOutputDev.cc poppler/TextOutputDev.h poppler/UnicodeMap.cc poppler/UnicodeMap.h poppler/XRef.cc poppler/XRef.h qt4/src qt5/src splash/SplashBitmap.cc splash/SplashBitmap.h splash/Splash.cc splash/SplashFontEngine.cc splash/SplashFontEngine.h splash/SplashFTFont.cc splash/SplashFTFontEngine.cc splash/SplashFTFontEngine.h splash/SplashFTFontFile.cc splash/SplashFTFontFile.h splash/SplashFTFont.h splash/Splash.h splash/SplashMath.h splash/SplashState.cc splash/SplashState.h splash/SplashT1Font.cc splash/SplashT1FontEngine.cc splash/SplashT1FontEngine.h splash/SplashT1FontFile.cc splash/SplashT1FontFile.h splash/SplashT1Font.h splash/SplashTypes.h splash/SplashXPath.cc utils/CMakeLists.txt utils/ImageOutputDev.cc utils/pdfimages.cc utils/pdftocairo.cc utils/pdftocairo-win32.h util s/pdftoppm.cc utils/pdftops.cc

Adrian Johnson ajohnson at kemper.freedesktop.org
Sat Oct 21 10:44:18 UTC 2017


 CMakeLists.txt                    |   35 +---
 ConfigureChecks.cmake             |    8 
 cmake/modules/PopplerMacros.cmake |    4 
 config.h.cmake                    |   59 +------
 fofi/FoFiTrueType.cc              |    1 
 fofi/FoFiType1.cc                 |    1 
 glib/CMakeLists.txt               |    4 
 glib/demo/utils.c                 |   16 +
 goo/FixedPoint.cc                 |    2 
 goo/FixedPoint.h                  |    2 
 goo/GooMutex.h                    |    6 
 goo/GooString.cc                  |   36 ----
 goo/GooString.h                   |   13 -
 goo/TiffWriter.cc                 |    2 
 goo/gfile.cc                      |   24 +-
 goo/gfile.h                       |   12 -
 goo/glibc.h                       |    4 
 goo/glibc_strtok_r.cc             |    4 
 goo/gtypes_p.h                    |   30 ---
 poppler/Annot.cc                  |   18 +-
 poppler/Annot.h                   |    2 
 poppler/Array.cc                  |    6 
 poppler/Array.h                   |    2 
 poppler/CMap.cc                   |   14 -
 poppler/CMap.h                    |    4 
 poppler/CairoFontEngine.cc        |   10 -
 poppler/CairoFontEngine.h         |    2 
 poppler/CairoOutputDev.cc         |    2 
 poppler/CairoRescaleBox.cc        |    4 
 poppler/Catalog.cc                |    6 
 poppler/Catalog.h                 |    2 
 poppler/CharCodeToUnicode.cc      |   16 -
 poppler/CharCodeToUnicode.h       |    4 
 poppler/DCTStream.cc              |    6 
 poppler/Decrypt.cc                |    2 
 poppler/Dict.cc                   |    8 
 poppler/Dict.h                    |    2 
 poppler/FlateEncoder.cc           |    1 
 poppler/FlateStream.cc            |    2 
 poppler/Gfx.cc                    |   12 -
 poppler/GlobalParams.cc           |   47 +++--
 poppler/GlobalParams.h            |    4 
 poppler/GlobalParamsWin.cc        |    2 
 poppler/Object.h                  |    1 
 poppler/OutputDev.cc              |    2 
 poppler/OutputDev.h               |    2 
 poppler/PDFDoc.cc                 |    7 
 poppler/PDFDoc.h                  |    2 
 poppler/PDFDocFactory.cc          |    4 
 poppler/PSOutputDev.cc            |   32 +--
 poppler/PSOutputDev.h             |    8 
 poppler/Page.cc                   |    6 
 poppler/Page.h                    |    2 
 poppler/SplashOutputDev.cc        |  188 +++++++++--------------
 poppler/SplashOutputDev.h         |    2 
 poppler/Stream.cc                 |    8 
 poppler/Stream.h                  |    2 
 poppler/StructTreeRoot.cc         |    4 
 poppler/TextOutputDev.cc          |   16 -
 poppler/TextOutputDev.h           |   14 -
 poppler/UnicodeMap.cc             |   16 -
 poppler/UnicodeMap.h              |    4 
 poppler/XRef.cc                   |   11 -
 poppler/XRef.h                    |    2 
 poppler/poppler-config.h.cmake    |   41 -----
 qt4/src/ArthurOutputDev.cc        |    5 
 qt4/src/poppler-document.cc       |    2 
 qt4/src/poppler-page.cc           |    4 
 qt5/src/ArthurOutputDev.cc        |    5 
 qt5/src/poppler-document.cc       |    2 
 qt5/src/poppler-page.cc           |    4 
 splash/Splash.cc                  |   76 ++++-----
 splash/Splash.h                   |   10 -
 splash/SplashBitmap.cc            |   20 +-
 splash/SplashBitmap.h             |    2 
 splash/SplashFTFont.cc            |   10 -
 splash/SplashFTFont.h             |    4 
 splash/SplashFTFontEngine.cc      |    4 
 splash/SplashFTFontEngine.h       |    4 
 splash/SplashFTFontFile.cc        |    4 
 splash/SplashFTFontFile.h         |    4 
 splash/SplashFontEngine.cc        |   50 ------
 splash/SplashFontEngine.h         |   12 -
 splash/SplashMath.h               |   46 ++---
 splash/SplashState.cc             |   10 -
 splash/SplashState.h              |    2 
 splash/SplashT1Font.cc            |  309 --------------------------------------
 splash/SplashT1Font.h             |   69 --------
 splash/SplashT1FontEngine.cc      |  138 ----------------
 splash/SplashT1FontEngine.h       |   50 ------
 splash/SplashT1FontFile.cc        |  134 ----------------
 splash/SplashT1FontFile.h         |   70 --------
 splash/SplashTypes.h              |   16 -
 splash/SplashXPath.cc             |    6 
 utils/CMakeLists.txt              |    4 
 utils/ImageOutputDev.cc           |    4 
 utils/pdfimages.cc                |    4 
 utils/pdftocairo-win32.h          |    2 
 utils/pdftocairo.cc               |   48 ++---
 utils/pdftoppm.cc                 |   20 +-
 utils/pdftops.cc                  |   12 -
 101 files changed, 471 insertions(+), 1510 deletions(-)

New commits:
commit 9c7b557da043c897292219a16f419ba9650e6dfc
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 20:22:02 2017 +1030

    Fix mingw warnings

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 0b2b010b..7b0f8cdf 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -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/poppler/DCTStream.cc b/poppler/DCTStream.cc
index b3e1303f..938e18a6 100644
--- a/poppler/DCTStream.cc
+++ b/poppler/DCTStream.cc
@@ -228,8 +228,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/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 8da28179..31a9957c 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -134,20 +134,25 @@ GlobalParams *globalParams = NULL;
 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 *
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 38e27685..69870bde 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -32,6 +32,7 @@
 //========================================================================
 
 #include <config.h>
+#include "poppler-config.h"
 
 #ifdef USE_GCC_PRAGMAS
 #pragma implementation
diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake
index 0e806f4c..2e8cb0d7 100644
--- a/poppler/poppler-config.h.cmake
+++ b/poppler/poppler-config.h.cmake
@@ -25,8 +25,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
@@ -148,6 +146,7 @@
 //------------------------------------------------------------------------
 
 #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)))
commit 69414f14f60c49f9e0a8243603c6330fa3d11837
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 18:40:58 2017 +1030

    mingw build fix - use win32 threads
    
    The cmake FindThreads detects both win32 and pthreads on mingw.
    It also attempts a TryRun test for pthreads which won't work with
    a cross compile.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 260e44a4..4b8a1a6d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,9 +10,13 @@ include(MacroOptionalFindPackage)
 find_package(PkgConfig)
 include(MacroEnsureVersion)
 include(MacroBoolTo01)
-set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
-set(THREADS_PREFER_PTHREAD_FLAG TRUE)
-find_package(Threads)
+if (WIN32)
+  message("-- Using win32 threads")
+else()
+  set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+  set(THREADS_PREFER_PTHREAD_FLAG TRUE)
+  find_package(Threads)
+endif()
 include(TestBigEndian)
 test_big_endian(WORDS_BIGENDIAN)
 include(CheckFileOffsetBits)
commit ecd2b7bf71b110b0e245e2866a13f2c0a901921f
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 17:03:19 2017 +1030

    Remove VC7 workaround
    
    VC7 (2002) does not support C++11

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index aac6e48b..63346a4c 100644
--- a/poppler/Gfx.cc
+++ b/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) {
commit 6e3e639c632f8527f9dc75061605e4a55f2faae9
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 16:59:31 2017 +1030

    Use <cmath> for isfinite()

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 5a6d6f5d..72df6810 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -51,7 +51,7 @@
 #endif
 
 #include <string.h>
-#include <math.h>
+#include <cmath>
 #include "goo/gfile.h"
 #include "GlobalParams.h"
 #include "Error.h"
@@ -84,25 +84,6 @@ 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,
commit f9cef28b504445c7976baa0a51676204f95397fc
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 15:13:42 2017 +1030

    c++11 has long long

diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index 29132956..83a6b84b 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -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/fofi/FoFiType1.cc b/fofi/FoFiType1.cc
index f741d5d3..a07a96c3 100644
--- a/fofi/FoFiType1.cc
+++ b/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/goo/GooString.cc b/goo/GooString.cc
index f055b37f..ef7676c8 100644
--- a/goo/GooString.cc
+++ b/goo/GooString.cc
@@ -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/goo/GooString.h b/goo/GooString.h
index 0cd56c9e..2caf9e79 100644
--- a/goo/GooString.h
+++ b/goo/GooString.h
@@ -35,7 +35,6 @@
 #pragma interface
 #endif
 
-#include <limits.h> // for LLONG_MAX and ULLONG_MAX
 #include <stdarg.h>
 #include <stdlib.h> // for NULL
 #include "gtypes.h"
@@ -187,24 +186,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/poppler/Object.h b/poppler/Object.h
index 8b18af68..7e734615 100644
--- a/poppler/Object.h
+++ b/poppler/Object.h
@@ -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/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 1f997488..50a5163c 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -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>
commit 4f2bd307711f792f8caf93a560444e17bd98611a
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 13:45:38 2017 +1030

    Remove fmax/fmin from poppler-config.h
    
    C++11 has fmax/fmin in <cmath> so use it and remove the #ifdefs for MSVC.

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 08379757..4a51e6fc 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -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>
diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake
index 5f00cbc8..0e806f4c 100644
--- a/poppler/poppler-config.h.cmake
+++ b/poppler/poppler-config.h.cmake
@@ -159,10 +159,4 @@
 #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 */
commit 555e2ea6b6f80a6f79eeaa44a39c24dc8461e78c
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 13:33:07 2017 +1030

    Move strtok_r to goo/glibc
    
    Move strtok_r out of poppler-config.h as it is not used in any header files
    
    Move strtok_r.cpp to goo/glibc_strtok_r.cc to keep it with the other emulated
    glibc functions. But keep it in a separate file due to the different license.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 125a730e..260e44a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -369,6 +369,7 @@ set(poppler_SRCS
   goo/gstrtod.cc
   goo/grandom.cc
   goo/glibc.cc
+  goo/glibc_strtok_r.cc
   fofi/FoFiBase.cc
   fofi/FoFiEncodings.cc
   fofi/FoFiTrueType.cc
@@ -423,7 +424,6 @@ set(poppler_SRCS
   poppler/Stream.cc
   poppler/StructTreeRoot.cc
   poppler/StructElement.cc
-  poppler/strtok_r.cpp
   poppler/UnicodeMap.cc
   poppler/UnicodeTypeTable.cc
   poppler/UTF.cc
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index e748437e..21bad506 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -32,6 +32,7 @@ check_function_exists(mkstemp HAVE_MKSTEMP)
 check_function_exists(rand_r HAVE_RAND_R)
 check_function_exists(strcpy_s HAVE_STRCPY_S)
 check_function_exists(strcat_s HAVE_STRCAT_S)
+check_function_exists(strtok_r HAVE_STRTOK_R)
 
 macro(CHECK_FOR_DIR include var)
   check_c_source_compiles(
diff --git a/config.h.cmake b/config.h.cmake
index 170963d0..abebd6f2 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -94,6 +94,9 @@
 /* Define to 1 if you have the `strcat_s' function. */
 #cmakedefine HAVE_STRCAT_S 1
 
+/* Defines if strtok_r is available on your system */
+#cmakedefine HAVE_STRTOK_R 1
+
 /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
 #cmakedefine HAVE_NDIR_H 1
 
diff --git a/goo/glibc.h b/goo/glibc.h
index 45aff9df..375f70dc 100644
--- a/goo/glibc.h
+++ b/goo/glibc.h
@@ -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/poppler/strtok_r.cpp b/goo/glibc_strtok_r.cc
similarity index 98%
rename from poppler/strtok_r.cpp
rename to goo/glibc_strtok_r.cc
index 6483e0f7..9952e45b 100644
--- a/poppler/strtok_r.cpp
+++ b/goo/glibc_strtok_r.cc
@@ -55,7 +55,8 @@
 //
 //========================================================================
 
-#if defined(__MINGW32__) && !defined(__WINPTHREADS_VERSION)
+#ifndef HAVE_STRTOK_R
+
 #include <string.h>
 
 #define __rawmemchr strchr
@@ -89,4 +90,5 @@ char * strtok_r (char *s, const char *delim, char **save_ptr)
     }
   return token;
 }
+
 #endif
diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake
index 4472e8f0..5f00cbc8 100644
--- a/poppler/poppler-config.h.cmake
+++ b/poppler/poppler-config.h.cmake
@@ -143,14 +143,6 @@
 #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
 //------------------------------------------------------------------------
commit 2ca32d2cfc57626bbc833d4981c7d0a071ccc985
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 13:18:12 2017 +1030

    move/remove macros from poppler-config.h that don't need to be there
    
    popen/pclose are not used in any .h files - move to config.h
    
    POPEN_READ_MODE is not used - remove

diff --git a/config.h.cmake b/config.h.cmake
index 4da61344..170963d0 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -197,6 +197,14 @@
 #define snprintf _snprintf
 #endif
 
+//------------------------------------------------------------------------
+// popen
+//------------------------------------------------------------------------
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+#define popen _popen
+#define pclose _pclose
+#endif
+
 /* Number of bits in a file offset, on hosts where this is settable. */
 #cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
 
diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake
index ba6f5e32..4472e8f0 100644
--- a/poppler/poppler-config.h.cmake
+++ b/poppler/poppler-config.h.cmake
@@ -134,21 +134,6 @@
 #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
 //------------------------------------------------------------------------
 
commit bf3931016614c434f7229e00bb75e3b113803d04
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 12:55:41 2017 +1030

    Remove unused HAVE_ZLIB_H/HAVE_LIBZ macros

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ff217cc..125a730e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -192,9 +192,6 @@ if(ENABLE_CPP)
 endif()
 if(ENABLE_ZLIB)
   find_package(ZLIB)
-  if(ZLIB_FOUND)
-    set(HAVE_LIBZ ${ZLIB_FOUND})
-  endif()
   set(ENABLE_ZLIB ${ZLIB_FOUND})
 endif()
 if(ENABLE_ZLIB_UNCOMPRESS AND NOT ENABLE_ZLIB)
diff --git a/config.h.cmake b/config.h.cmake
index a9d525e1..4da61344 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -123,9 +123,6 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #cmakedefine HAVE_UNISTD_H 1
 
-/* Define to 1 if you have the <zlib.h> header file. */
-#cmakedefine HAVE_ZLIB_H 1
-
 /* Define to 1 if you have a big endian machine */
 #cmakedefine WORDS_BIGENDIAN 1
 
commit 82e7f4bad79d122fe8cf16be54901d1f1668ca37
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 12:05:10 2017 +1030

    Make poppler compile if threads not available

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b3661087..8ff217cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -102,8 +102,11 @@ else()
   message(FATAL_ERROR "Invalid font configuration setting: ${FONT_CONFIGURATION}")
 endif()
 
+if(CMAKE_USE_PTHREADS_INIT OR WIN32)
+  set(MULTITHREADED ON)
+endif()
+
 # Enable these unconditionally.
-set(MULTITHREADED ON)
 set(OPI_SUPPORT ON)
 set(TEXTOUT_WORD_LIST ON)
 
diff --git a/goo/GooMutex.h b/goo/GooMutex.h
index b2714b04..9736234e 100644
--- a/goo/GooMutex.h
+++ b/goo/GooMutex.h
@@ -30,6 +30,8 @@
 #ifndef GMUTEX_H
 #define GMUTEX_H
 
+#ifdef MULTITHREADED
+
 // Usage:
 //
 // GooMutex m;
@@ -82,4 +84,6 @@ private:
   GooMutex *mutex;
 };
 
-#endif
+#endif // MULTITHREADED
+
+#endif // GMUTEX_H
commit 350b905537f59323a6b9a854cf019e8e95940bd6
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 2 11:36:42 2017 +1030

    Use -pthread flag instead of -lpthread
    
    The -pthread flag should be used for compiling with threads as it sets
    flags for both the preprocessor and linker.
    
    In cmake this is achieved with the set(THREADS_PREFER_PTHREAD_FLAG TRUE)
    before find_package(Threads) and using the Threads::Threads import target.
    
    Also added set(CMAKE_THREAD_PREFER_PTHREAD TRUE) as we only support
    pthread on non windows platforms.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9a8062b..b3661087 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,8 @@ include(MacroOptionalFindPackage)
 find_package(PkgConfig)
 include(MacroEnsureVersion)
 include(MacroBoolTo01)
+set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+set(THREADS_PREFER_PTHREAD_FLAG TRUE)
 find_package(Threads)
 include(TestBigEndian)
 test_big_endian(WORDS_BIGENDIAN)
@@ -287,9 +289,6 @@ include_directories(
   ${CMAKE_CURRENT_BINARY_DIR}/poppler
   ${FREETYPE_INCLUDE_DIRS}
 )
-if(CMAKE_USE_PTHREADS_INIT)
-  set(HAVE_PTHREAD ON)
-endif()
 
 if(ENABLE_ZLIB)
   include_directories(${ZLIB_INCLUDE_DIR})
@@ -534,9 +533,6 @@ endif()
 if(TIFF_FOUND)
   set(poppler_LIBS ${poppler_LIBS} ${TIFF_LIBRARIES})
 endif()
-if(HAVE_PTHREAD)
-  set(poppler_LIBS ${poppler_LIBS} ${CMAKE_THREAD_LIBS_INIT})
-endif()
 
 if(MSVC)
 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
@@ -547,6 +543,9 @@ add_library(poppler ${poppler_SRCS})
 endif()
 set_target_properties(poppler PROPERTIES VERSION 71.0.0 SOVERSION 71)
 target_link_libraries(poppler LINK_PRIVATE ${poppler_LIBS})
+if(CMAKE_USE_PTHREADS_INIT)
+   target_link_libraries(poppler LINK_PRIVATE Threads::Threads)
+endif()
 install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
 
 if(ENABLE_XPDF_HEADERS)
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index 1f06fec8..3e861c06 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -83,8 +83,8 @@ set(poppler_glib_generated_SRCS
 add_library(poppler-glib SHARED ${poppler_glib_SRCS} ${poppler_glib_generated_SRCS})
 set_target_properties(poppler-glib PROPERTIES VERSION 8.9.0 SOVERSION 8)
 target_link_libraries(poppler-glib poppler ${GLIB2_LIBRARIES} ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARIES})
-if(HAVE_PTHREAD)
-   target_link_libraries(poppler-glib -lpthread)
+if(CMAKE_USE_PTHREADS_INIT)
+   target_link_libraries(poppler-glib Threads::Threads)
 endif()
 install(TARGETS poppler-glib RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
 
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 2925eb25..0d82d4ea 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -37,8 +37,8 @@ if (HAVE_CAIRO)
   if(LCMS_FOUND)
     target_link_libraries(pdftocairo ${LCMS_LIBRARIES})
   endif()
-  if(HAVE_PTHREAD)
-    target_link_libraries(pdftocairo ${CMAKE_THREAD_LIBS_INIT})
+  if(CMAKE_USE_PTHREADS_INIT)
+    target_link_libraries(pdftocairo Threads::Threads)
   endif()
   if(LCMS2_FOUND)
     target_link_libraries(pdftocairo ${LCMS2_LIBRARIES})
commit e01e6db4e0643b7b318a3d7dc49442bb2d6ade00
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 20:51:13 2017 +1030

    HAVE_PTHREAD is not used

diff --git a/config.h.cmake b/config.h.cmake
index 650105fe..a9d525e1 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -103,9 +103,6 @@
 /* Define to 1 if you have the `popen' function. */
 #cmakedefine HAVE_POPEN 1
 
-/* Define if you have POSIX threads libraries and header files. */
-#cmakedefine HAVE_PTHREAD 1
-
 /* Use splash for rendering. */
 #cmakedefine HAVE_SPLASH 1
 
commit 36010177e9c168d110c44407512c93b49a9cf95c
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 19:28:13 2017 +1030

    Remove unused macros
    
    The jpeg.h HAVE_BOOLEAN is only required if the application defines
    type 'boolean' to prevent jpeg.h from redefining it.

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 528ef5e4..e748437e 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -13,14 +13,9 @@ include(CheckCSourceCompiles)
 
 check_include_files(dlfcn.h HAVE_DLFCN_H)
 check_include_files(fcntl.h HAVE_FCNTL_H)
-check_include_files(inttypes.h HAVE_INTTYPES_H)
-check_include_files(memory.h HAVE_MEMORY_H)
 check_include_files(stdlib.h HAVE_STDLIB_H)
-check_include_files(strings.h HAVE_STRINGS_H)
-check_include_files(string.h HAVE_STRING_H)
 check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
 check_include_files(sys/stat.h HAVE_SYS_STAT_H)
-check_include_files(sys/types.h HAVE_SYS_TYPES_H)
 check_include_files(unistd.h HAVE_UNISTD_H)
 
 check_function_exists(fseek64 HAVE_FSEEK64)
@@ -34,7 +29,6 @@ check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
 check_function_exists(localtime_r HAVE_LOCALTIME_R)
 check_function_exists(popen HAVE_POPEN)
 check_function_exists(mkstemp HAVE_MKSTEMP)
-check_function_exists(mkstemps HAVE_MKSTEMPS)
 check_function_exists(rand_r HAVE_RAND_R)
 check_function_exists(strcpy_s HAVE_STRCPY_S)
 check_function_exists(strcat_s HAVE_STRCAT_S)
diff --git a/config.h.cmake b/config.h.cmake
index 71781fef..650105fe 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -73,9 +73,6 @@
 /* Define if you have the iconv() function and it works. */
 #cmakedefine HAVE_ICONV 1
 
-/* Define to 1 if you have the <inttypes.h> header file. */
-#cmakedefine HAVE_INTTYPES_H 1
-
 /* Define to 1 if you have the `openjpeg' library (-lopenjpeg). */
 #cmakedefine HAVE_LIBOPENJPEG 1
 
@@ -85,15 +82,9 @@
 /* Defines if localtime_r is available on your system */
 #cmakedefine HAVE_LOCALTIME_R 1
 
-/* Define to 1 if you have the <memory.h> header file. */
-#cmakedefine HAVE_MEMORY_H 1
-
 /* Define to 1 if you have the `mkstemp' function. */
 #cmakedefine HAVE_MKSTEMP 1
 
-/* Define to 1 if you have the `mkstemps' function. */
-#cmakedefine HAVE_MKSTEMPS 1
-
 /* Define to 1 if you have the `rand_r' function. */
 #cmakedefine HAVE_RAND_R 1
 
@@ -118,15 +109,6 @@
 /* Use splash for rendering. */
 #cmakedefine HAVE_SPLASH 1
 
-/* Define to 1 if you have the <stdlib.h> header file. */
-#cmakedefine HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#cmakedefine HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#cmakedefine HAVE_STRING_H 1
-
 /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
    */
 #cmakedefine HAVE_SYS_DIR_H 1
@@ -141,9 +123,6 @@
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #cmakedefine HAVE_SYS_STAT_H 1
 
-/* Define to 1 if you have the <sys/types.h> header file. */
-#cmakedefine HAVE_SYS_TYPES_H 1
-
 /* Define to 1 if you have the <unistd.h> header file. */
 #cmakedefine HAVE_UNISTD_H 1
 
@@ -192,9 +171,6 @@
 /* Include support for CMYK rasterization */
 #cmakedefine SPLASH_CMYK 1
 
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
 /* Enable word list support. */
 #cmakedefine TEXTOUT_WORD_LIST 1
 
@@ -222,18 +198,6 @@
 /* OpenJPEG with the OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG flag */
 #cmakedefine WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG 1
 
-/* Define to 1 if the X Window System is missing or not being used. */
-/* #undef X_DISPLAY_MISSING */
-
-/*
- * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
- * headers and I'm too lazy to write a configure test as long as only
- * unixware is related
- */
-#ifdef _UNIXWARE
-#define HAVE_BOOLEAN
-#endif
-
 /* MS defined snprintf as deprecated but then added it in Visual Studio 2015. */
 #if defined(_MSC_VER) && _MSC_VER < 1900
 #define snprintf _snprintf
commit 6658754b9b8dfd1ba692da2681d95e21e9c1c2d4
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 19:09:28 2017 +1030

    We always have config.h so drop the macro

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1afd85cb..c9a8062b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -264,7 +264,6 @@ if(ENABLE_LIBCURL)
   endif()
 endif()
 
-add_definitions(-DHAVE_CONFIG_H=1)
 if(MINGW)
   # Use mingw's ansi stdio extensions
   add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
diff --git a/poppler/CairoRescaleBox.cc b/poppler/CairoRescaleBox.cc
index d30c9f7f..391466ab 100644
--- a/poppler/CairoRescaleBox.cc
+++ b/poppler/CairoRescaleBox.cc
@@ -41,9 +41,7 @@
 
 /* This implements a box filter that supports non-integer box sizes */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <cstdint>
 #include <stdint.h>
commit 7b0d736ccd5d3e1327684d21d6afbe2dec01188f
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 19:04:39 2017 +1030

    c++11 has <cstdint> so we can drop the stdint.h checks and emulation

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 345f29c5..528ef5e4 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -15,7 +15,6 @@ check_include_files(dlfcn.h HAVE_DLFCN_H)
 check_include_files(fcntl.h HAVE_FCNTL_H)
 check_include_files(inttypes.h HAVE_INTTYPES_H)
 check_include_files(memory.h HAVE_MEMORY_H)
-check_include_files(stdint.h HAVE_STDINT_H)
 check_include_files(stdlib.h HAVE_STDLIB_H)
 check_include_files(strings.h HAVE_STRINGS_H)
 check_include_files(string.h HAVE_STRING_H)
diff --git a/config.h.cmake b/config.h.cmake
index bc410f19..71781fef 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -118,9 +118,6 @@
 /* Use splash for rendering. */
 #cmakedefine HAVE_SPLASH 1
 
-/* Define to 1 if you have the <stdint.h> header file. */
-#cmakedefine HAVE_STDINT_H 1
-
 /* Define to 1 if you have the <stdlib.h> header file. */
 #cmakedefine HAVE_STDLIB_H 1
 
diff --git a/goo/gtypes_p.h b/goo/gtypes_p.h
deleted file mode 100644
index cc4866e1..00000000
--- a/goo/gtypes_p.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * gtypes_p.h
- *
- * Some useful simple types.
- *
- * Copyright (C) 2011 Adrian Johnson <ajohnson at 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/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index fdff172e..43c604f0 100644
--- a/poppler/CairoOutputDev.cc
+++ b/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"
diff --git a/poppler/CairoRescaleBox.cc b/poppler/CairoRescaleBox.cc
index 3c96f45e..d30c9f7f 100644
--- a/poppler/CairoRescaleBox.cc
+++ b/poppler/CairoRescaleBox.cc
@@ -45,13 +45,13 @@
 #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/poppler/Decrypt.cc b/poppler/Decrypt.cc
index 5d24d0a9..65a2b572 100644
--- a/poppler/Decrypt.cc
+++ b/poppler/Decrypt.cc
@@ -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/utils/pdftocairo-win32.h b/utils/pdftocairo-win32.h
index 202b8643..1361267f 100644
--- a/utils/pdftocairo-win32.h
+++ b/utils/pdftocairo-win32.h
@@ -10,10 +10,10 @@
 //
 //========================================================================
 
+#include <cstdint>
 #include <cairo.h>
 #include "goo/gmem.h"
 #include "goo/gtypes.h"
-#include "goo/gtypes_p.h"
 #include "goo/GooString.h"
 
 #ifdef CAIRO_HAS_WIN32_SURFACE
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index c2bb25fe..46f3e1e2 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -38,13 +38,13 @@
 
 #include "config.h"
 #include <poppler-config.h>
+#include <cstdint>
 #include <stdio.h>
 #include <math.h>
 #include <string.h>
 #include "parseargs.h"
 #include "goo/gmem.h"
 #include "goo/gtypes.h"
-#include "goo/gtypes_p.h"
 #include "goo/GooString.h"
 #include "goo/ImgWriter.h"
 #include "goo/JpegWriter.h"
commit 465edbbffcc94f9af9fac7606086a28362f92d09
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 18:48:07 2017 +1030

    Fix remaining -Wundef warnings
    
    and make -Wundef a default warning

diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
index 05b69476..95af97cf 100644
--- a/cmake/modules/PopplerMacros.cmake
+++ b/cmake/modules/PopplerMacros.cmake
@@ -110,6 +110,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
   set(_warn "${_warn} -Wnon-virtual-dtor")
   set(_warn "${_warn} -Woverloaded-virtual")
   set(_warn "${_warn} -Wmissing-declarations")
+  set(_warn "${_warn} -Wundef")
   if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
     set(_warn "${_warn} -Wsuggest-override")
   endif()
@@ -117,7 +118,6 @@ if(CMAKE_COMPILER_IS_GNUCXX)
   # set extra warnings
   set(_warnx "${_warnx} -Wconversion")
   set(_warnx "${_warnx} -Wshadow")
-  set(_warnx "${_warnx} -Wundef")
   set(_warnx "${_warnx} -Wuseless-cast")
   set(_warnx "${_warnx} -Wzero-as-null-pointer-constant")
 
diff --git a/goo/FixedPoint.h b/goo/FixedPoint.h
index 99749802..47110595 100644
--- a/goo/FixedPoint.h
+++ b/goo/FixedPoint.h
@@ -13,7 +13,7 @@
 
 #include "poppler-config.h"
 
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
 
 #ifdef USE_GCC_PRAGMAS
 #pragma interface
diff --git a/goo/TiffWriter.cc b/goo/TiffWriter.cc
index 142842a0..35ceae69 100644
--- a/goo/TiffWriter.cc
+++ b/goo/TiffWriter.cc
@@ -14,7 +14,7 @@
 
 #include "TiffWriter.h"
 
-#if ENABLE_LIBTIFF
+#ifdef ENABLE_LIBTIFF
 
 #include <string.h>
 
diff --git a/goo/gfile.cc b/goo/gfile.cc
index 642f3966..09136303 100644
--- a/goo/gfile.cc
+++ b/goo/gfile.cc
@@ -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 {
@@ -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/goo/gfile.h b/goo/gfile.h
index 0929f7ef..9e0612f6 100644
--- a/goo/gfile.h
+++ b/goo/gfile.h
@@ -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
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 1474c2cf..0b2b010b 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -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
 }
diff --git a/poppler/Annot.h b/poppler/Annot.h
index 171494a9..fa5d2064 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -683,7 +683,7 @@ protected:
   GBool ok;
 
   bool hasRef;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 };
diff --git a/poppler/Array.cc b/poppler/Array.cc
index 94b8d66a..ed8f58d1 100644
--- a/poppler/Array.cc
+++ b/poppler/Array.cc
@@ -35,7 +35,7 @@
 #include "Object.h"
 #include "Array.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define arrayLocker()   MutexLocker locker(&mutex)
 #else
 #  define arrayLocker()
@@ -49,7 +49,7 @@ Array::Array(XRef *xrefA) {
   elems = NULL;
   size = length = 0;
   ref = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -60,7 +60,7 @@ Array::~Array() {
   for (i = 0; i < length; ++i)
     elems[i].free();
   gfree(elems);
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }
diff --git a/poppler/Array.h b/poppler/Array.h
index d2cdf65f..2e7c3800 100644
--- a/poppler/Array.h
+++ b/poppler/Array.h
@@ -79,7 +79,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/poppler/CMap.cc b/poppler/CMap.cc
index 5ed85654..a9e0482f 100644
--- a/poppler/CMap.cc
+++ b/poppler/CMap.cc
@@ -312,7 +312,7 @@ CMap::CMap(GooString *collectionA, GooString *cMapNameA) {
     vector[i].cid = 0;
   }
   refCnt = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -324,7 +324,7 @@ CMap::CMap(GooString *collectionA, GooString *cMapNameA, int wModeA) {
   wMode = wModeA;
   vector = NULL;
   refCnt = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -432,7 +432,7 @@ CMap::~CMap() {
   if (vector) {
     freeCMapVector(vector);
   }
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }
@@ -449,11 +449,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 +461,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/poppler/CMap.h b/poppler/CMap.h
index f4f5a914..52820933 100644
--- a/poppler/CMap.h
+++ b/poppler/CMap.h
@@ -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/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index b56d100c..742a81e7 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -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/poppler/CairoFontEngine.h b/poppler/CairoFontEngine.h
index 0d7317e1..25566a85 100644
--- a/poppler/CairoFontEngine.h
+++ b/poppler/CairoFontEngine.h
@@ -121,7 +121,7 @@ private:
   CairoFont *fontCache[cairoFontCacheSize];
   FT_Library lib;
   GBool useCIDs;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 };
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 8e8b979e..80cfa40e 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -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/poppler/Catalog.h b/poppler/Catalog.h
index 37d6e1ec..18f07458 100644
--- a/poppler/Catalog.h
+++ b/poppler/Catalog.h
@@ -283,7 +283,7 @@ private:
   NameTree *getEmbeddedFileNameTree();
   NameTree *getJSNameTree();
   LinkDest *createLinkDest(Object *obj);
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 
diff --git a/poppler/CharCodeToUnicode.cc b/poppler/CharCodeToUnicode.cc
index fdb787d6..0dfbceab 100644
--- a/poppler/CharCodeToUnicode.cc
+++ b/poppler/CharCodeToUnicode.cc
@@ -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/poppler/CharCodeToUnicode.h b/poppler/CharCodeToUnicode.h
index 1672105a..e8f8e774 100644
--- a/poppler/CharCodeToUnicode.h
+++ b/poppler/CharCodeToUnicode.h
@@ -35,7 +35,7 @@
 #include "CharTypes.h"
 #include "goo/gtypes.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #include "goo/GooMutex.h"
 #endif
 
@@ -116,7 +116,7 @@ private:
   int sMapLen, sMapSize;
   int refCnt;
   GBool isIdentity;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 };
diff --git a/poppler/Dict.cc b/poppler/Dict.cc
index 2bd86abf..5bc01818 100644
--- a/poppler/Dict.cc
+++ b/poppler/Dict.cc
@@ -41,7 +41,7 @@
 #include "XRef.h"
 #include "Dict.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define dictLocker()   MutexLocker locker(&mutex)
 #else
 #  define dictLocker()
@@ -81,7 +81,7 @@ Dict::Dict(XRef *xrefA) {
   size = length = 0;
   ref = 1;
   sorted = gFalse;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -90,7 +90,7 @@ Dict::Dict(Dict* dictA) {
   xref = dictA->xref;
   size = length = dictA->length;
   ref = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 
@@ -124,7 +124,7 @@ Dict::~Dict() {
     entries[i].val.free();
   }
   gfree(entries);
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }
diff --git a/poppler/Dict.h b/poppler/Dict.h
index 1b922b0e..553bfa5b 100644
--- a/poppler/Dict.h
+++ b/poppler/Dict.h
@@ -105,7 +105,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/poppler/FlateStream.cc b/poppler/FlateStream.cc
index acc716c1..8f9daf31 100644
--- a/poppler/FlateStream.cc
+++ b/poppler/FlateStream.cc
@@ -18,7 +18,7 @@
 
 #include "poppler-config.h"
 
-#if ENABLE_ZLIB_UNCOMPRESS
+#ifdef ENABLE_ZLIB_UNCOMPRESS
 
 #include "FlateStream.h"
 
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index eaef798f..aac6e48b 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -4160,7 +4160,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 +4203,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/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 2ba23ec8..8da28179 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -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)
@@ -540,7 +540,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
   UnicodeMap *map;
   int i;
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
   gInitMutex(&unicodeMapCacheMutex);
   gInitMutex(&cMapCacheMutex);
@@ -786,7 +786,7 @@ GlobalParams::~GlobalParams() {
   deleteGooList(plugins, Plugin);
 #endif
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
   gDestroyMutex(&unicodeMapCacheMutex);
   gDestroyMutex(&cMapCacheMutex);
@@ -887,7 +887,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;
@@ -1077,7 +1077,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) {
 }
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 78a70cdf..11c3211a 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -45,7 +45,7 @@
 #include "goo/gtypes.h"
 #include "CharTypes.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #include "goo/GooMutex.h"
 #endif
 
@@ -240,7 +240,7 @@ private:
 				//   [XpdfSecurityHandler]
 #endif
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
   GooMutex unicodeMapCacheMutex;
   GooMutex cMapCacheMutex;
diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
index eba72fa0..df99681c 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
@@ -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/poppler/OutputDev.cc b/poppler/OutputDev.cc
index ee3cf5a3..ace9c016 100644
--- a/poppler/OutputDev.cc
+++ b/poppler/OutputDev.cc
@@ -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/poppler/OutputDev.h b/poppler/OutputDev.h
index 0f60f60f..b6645acc 100644
--- a/poppler/OutputDev.h
+++ b/poppler/OutputDev.h
@@ -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/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index da2c266b..1f997488 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -80,7 +80,7 @@
 #include "PDFDoc.h"
 #include "Hints.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define pdfdocLocker()   MutexLocker locker(&mutex)
 #else
 #  define pdfdocLocker()
@@ -105,7 +105,7 @@
 
 void PDFDoc::init()
 {
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
   ok = gFalse;
@@ -341,7 +341,7 @@ PDFDoc::~PDFDoc() {
     gfree(fileNameU);
   }
 #endif
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }
diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h
index 83a2e97e..624177f5 100644
--- a/poppler/PDFDoc.h
+++ b/poppler/PDFDoc.h
@@ -382,7 +382,7 @@ private:
   int fopenErrno;
 
   Goffset startXRefPos;		// offset of last xref table
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 };
diff --git a/poppler/PDFDocFactory.cc b/poppler/PDFDocFactory.cc
index 1ec46477..59b1b9fa 100644
--- a/poppler/PDFDocFactory.cc
+++ b/poppler/PDFDocFactory.cc
@@ -18,7 +18,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 +34,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/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 925ff627..bdb328fb 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1288,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;
@@ -1724,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");
     }
@@ -2986,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
@@ -3221,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;
@@ -3259,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();
@@ -3576,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));
@@ -6068,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
@@ -6121,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");
     }
@@ -6218,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
@@ -6267,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
@@ -6514,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
@@ -6829,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/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index f081414e..56798a7b 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -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;
@@ -324,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; }
@@ -415,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,
@@ -553,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/poppler/Page.cc b/poppler/Page.cc
index 197e2bef..81402335 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -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/poppler/Page.h b/poppler/Page.h
index 2a597131..054491b1 100644
--- a/poppler/Page.h
+++ b/poppler/Page.h
@@ -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/poppler/Stream.cc b/poppler/Stream.cc
index 0ad602c7..b541356d 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -93,7 +93,7 @@ static GBool setDJSYSFLAGS = gFalse;
 #endif
 #endif
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define streamLocker()   MutexLocker locker(&mutex)
 #else
 #  define streamLocker()
@@ -104,13 +104,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 +288,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);
diff --git a/poppler/Stream.h b/poppler/Stream.h
index c2c48111..152dbb0f 100644
--- a/poppler/Stream.h
+++ b/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/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 6b642491..08379757 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -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;
@@ -2252,7 +2252,7 @@ GBool TextFlow::blockFits(TextBlock *blk, TextBlock *prevBlk) {
   return fits;
 }
 
-#if TEXTOUT_WORD_LIST
+#ifdef TEXTOUT_WORD_LIST
 
 //------------------------------------------------------------------------
 // TextWordList
@@ -5472,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);
 }
@@ -5858,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/poppler/TextOutputDev.h b/poppler/TextOutputDev.h
index 707d8ca9..675ed600 100644
--- a/poppler/TextOutputDev.h
+++ b/poppler/TextOutputDev.h
@@ -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/poppler/UnicodeMap.cc b/poppler/UnicodeMap.cc
index 15d9a81e..ebffbe5e 100644
--- a/poppler/UnicodeMap.cc
+++ b/poppler/UnicodeMap.cc
@@ -136,7 +136,7 @@ UnicodeMap::UnicodeMap(GooString *encodingNameA) {
   eMaps = NULL;
   eMapsLen = 0;
   refCnt = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -151,7 +151,7 @@ UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA,
   eMaps = NULL;
   eMapsLen = 0;
   refCnt = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -165,7 +165,7 @@ UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA,
   eMaps = NULL;
   eMapsLen = 0;
   refCnt = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -178,17 +178,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 +196,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/poppler/UnicodeMap.h b/poppler/UnicodeMap.h
index ba7df2cf..6332bece 100644
--- a/poppler/UnicodeMap.h
+++ b/poppler/UnicodeMap.h
@@ -19,7 +19,7 @@
 #include "goo/gtypes.h"
 #include "CharTypes.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #include "goo/GooMutex.h"
 #endif
 
@@ -94,7 +94,7 @@ private:
   UnicodeMapExt *eMaps;		// (user)
   int eMapsLen;			// (user)
   int refCnt;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 };
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index f3b88ec0..38e27685 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -71,7 +71,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 +261,7 @@ Object ObjectStream::getObject(int objIdx, int objNum) {
 //------------------------------------------------------------------------
 
 void XRef::init() {
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
   ok = gTrue;
@@ -384,7 +384,7 @@ XRef::~XRef() {
   if (strOwner) {
     delete str;
   }
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }
@@ -1221,13 +1221,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/poppler/XRef.h b/poppler/XRef.h
index e59e8cbb..983991e6 100644
--- a/poppler/XRef.h
+++ b/poppler/XRef.h
@@ -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/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc
index a7c2faea..41bbcdb4 100644
--- a/utils/ImageOutputDev.cc
+++ b/utils/ImageOutputDev.cc
@@ -630,7 +630,7 @@ void ImageOutputDev::writeImage(GfxState *state, Object *ref, Stream *str,
                               colorMap->getNumPixelComps() == 4)))) {
     // output in PNG format
 
-#if ENABLE_LIBPNG
+#ifdef ENABLE_LIBPNG
     ImgWriter *writer;
 
     if (!colorMap || (colorMap->getNumPixelComps() == 1 && colorMap->getBits() == 1)) {
@@ -657,7 +657,7 @@ void ImageOutputDev::writeImage(GfxState *state, Object *ref, Stream *str,
   } else if (outputTiff) {
     // output in TIFF format
 
-#if ENABLE_LIBTIFF
+#ifdef ENABLE_LIBTIFF
     ImgWriter *writer;
 
     if (!colorMap || (colorMap->getNumPixelComps() == 1 && colorMap->getBits() == 1)) {
diff --git a/utils/pdfimages.cc b/utils/pdfimages.cc
index 563839e1..5e006057 100644
--- a/utils/pdfimages.cc
+++ b/utils/pdfimages.cc
@@ -70,11 +70,11 @@ static const ArgDesc argDesc[] = {
    "first page to convert"},
   {"-l",      argInt,      &lastPage,      0,
    "last page to convert"},
-#if ENABLE_LIBPNG
+#ifdef ENABLE_LIBPNG
   {"-png",      argFlag,     &enablePNG,      0,
    "change the default output format to PNG"},
 #endif
-#if ENABLE_LIBTIFF
+#ifdef ENABLE_LIBTIFF
   {"-tiff",      argFlag,     &enableTiff,      0,
    "change the default output format to TIFF"},
 #endif
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index 8858f6f3..c2bb25fe 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -55,7 +55,7 @@
 #include "PDFDoc.h"
 #include "PDFDocFactory.h"
 #include "CairoOutputDev.h"
-#if USE_CMS
+#ifdef USE_CMS
 #ifdef USE_LCMS1
 #include <lcms.h>
 #else
@@ -63,13 +63,13 @@
 #endif
 #endif
 #include <cairo.h>
-#if CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_PS_SURFACE
 #include <cairo-ps.h>
 #endif
-#if CAIRO_HAS_PDF_SURFACE
+#ifdef CAIRO_HAS_PDF_SURFACE
 #include <cairo-pdf.h>
 #endif
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
 #include <cairo-svg.h>
 #endif
 
@@ -139,33 +139,33 @@ static GBool setupdlg = gFalse;
 #endif
 
 static const ArgDesc argDesc[] = {
-#if ENABLE_LIBPNG
+#ifdef ENABLE_LIBPNG
   {"-png",    argFlag,     &png,           0,
    "generate a PNG file"},
 #endif
-#if ENABLE_LIBJPEG
+#ifdef ENABLE_LIBJPEG
   {"-jpeg",   argFlag,     &jpeg,           0,
    "generate a JPEG file"},
   {"-jpegopt",  argGooString, &jpegOpt,    0,
    "jpeg options, with format <opt1>=<val1>[,<optN>=<valN>]*"},
 #endif
-#if ENABLE_LIBTIFF
+#ifdef ENABLE_LIBTIFF
   {"-tiff",    argFlag,     &tiff,           0,
    "generate a TIFF file"},
   {"-tiffcompression", argString, tiffCompressionStr, sizeof(tiffCompressionStr),
    "set TIFF compression: none, packbits, jpeg, lzw, deflate"},
 #endif
-#if CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_PS_SURFACE
   {"-ps",     argFlag,     &ps,            0,
    "generate PostScript file"},
   {"-eps",        argFlag,     &eps,          0,
    "generate Encapsulated PostScript (EPS)"},
 #endif
-#if CAIRO_HAS_PDF_SURFACE
+#ifdef CAIRO_HAS_PDF_SURFACE
   {"-pdf",    argFlag,     &pdf,           0,
    "generate a PDF file"},
 #endif
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
   {"-svg",    argFlag,     &svg,           0,
    "generate a Scalable Vector Graphics (SVG) file"},
 #endif
@@ -227,7 +227,7 @@ static const ArgDesc argDesc[] = {
    "use a transparent background instead of white (PNG)"},
   {"-antialias",   argGooString,     &antialias,          0,
    "set cairo antialias option"},
-#if USE_CMS
+#ifdef USE_CMS
   {"-icc",   argGooString,     &icc,          0,
    "ICC color profile to use"},
 #endif
@@ -282,7 +282,7 @@ static  FILE *output_file;
 static GBool usePDFPageSize;
 static cairo_antialias_t antialiasEnum = CAIRO_ANTIALIAS_DEFAULT;
 
-#if USE_CMS
+#ifdef USE_CMS
 static unsigned char *icc_data;
 static int icc_data_size;
 static cmsHPROFILE profile;
@@ -387,7 +387,7 @@ static void writePageImage(GooString *filename)
   unsigned char *data;
 
   if (png) {
-#if ENABLE_LIBPNG
+#ifdef ENABLE_LIBPNG
     if (transp)
       writer = new PNGWriter(PNGWriter::RGBA);
     else if (gray)
@@ -397,7 +397,7 @@ static void writePageImage(GooString *filename)
     else
       writer = new PNGWriter(PNGWriter::RGB);
 
-#if USE_CMS
+#ifdef USE_CMS
 #ifdef USE_LCMS1
     if (icc_data)
       static_cast<PNGWriter*>(writer)->setICCProfile(cmsTakeProductName(profile), icc_data, icc_data_size);
@@ -418,7 +418,7 @@ static void writePageImage(GooString *filename)
 #endif
 
   } else if (jpeg) {
-#if ENABLE_LIBJPEG
+#ifdef ENABLE_LIBJPEG
     if (gray)
       writer = new JpegWriter(JpegWriter::GRAY);
     else
@@ -429,7 +429,7 @@ static void writePageImage(GooString *filename)
       static_cast<JpegWriter*>(writer)->setQuality(jpegQuality);
 #endif
   } else if (tiff) {
-#if ENABLE_LIBTIFF
+#ifdef ENABLE_LIBTIFF
     if (transp)
       writer = new TiffWriter(TiffWriter::RGBA_PREMULTIPLIED);
     else if (gray)
@@ -627,7 +627,7 @@ static void beginDocument(GooString *inputFileName, GooString *outputFileName, d
     }
 
     if (ps || eps) {
-#if CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_PS_SURFACE
       surface = cairo_ps_surface_create_for_stream(writeStream, output_file, w, h);
       if (level2)
 	cairo_ps_surface_restrict_to_level (surface, CAIRO_PS_LEVEL_2);
@@ -641,11 +641,11 @@ static void beginDocument(GooString *inputFileName, GooString *outputFileName, d
       cairo_ps_surface_dsc_begin_page_setup (surface);
 #endif
     } else if (pdf) {
-#if CAIRO_HAS_PDF_SURFACE
+#ifdef CAIRO_HAS_PDF_SURFACE
       surface = cairo_pdf_surface_create_for_stream(writeStream, output_file, w, h);
 #endif
     } else if (svg) {
-#if CAIRO_HAS_SVG_SURFACE
+#ifdef CAIRO_HAS_SVG_SURFACE
       surface = cairo_svg_surface_create_for_stream(writeStream, output_file, w, h);
       cairo_svg_surface_restrict_to_version (surface, CAIRO_SVG_VERSION_1_2);
 #endif
@@ -661,7 +661,7 @@ static void beginPage(double *w, double *h)
 {
   if (printing) {
     if (ps || eps) {
-#if CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_PS_SURFACE
       if (*w > *h) {
 	cairo_ps_surface_dsc_comment (surface, "%%PageOrientation: Landscape");
 	cairo_ps_surface_set_size (surface, *h, *w);
@@ -672,7 +672,7 @@ static void beginPage(double *w, double *h)
 #endif
     }
 
-#if CAIRO_HAS_PDF_SURFACE
+#ifdef CAIRO_HAS_PDF_SURFACE
     if (pdf)
       cairo_pdf_surface_set_size (surface, *w, *h);
 #endif
@@ -1119,7 +1119,7 @@ int main(int argc, char *argv[]) {
 
   outputFileName = getOutputFileName(fileName, outputName);
 
-#if USE_CMS
+#ifdef USE_CMS
   icc_data = NULL;
   if (icc.getCString()[0]) {
     FILE *file = fopen(icc.getCString(), "rb");
@@ -1287,7 +1287,7 @@ int main(int argc, char *argv[]) {
   if (userPW)
     delete userPW;
 
-#if USE_CMS
+#ifdef USE_CMS
   cmsCloseProfile(profile);
   if (icc_data)
     gfree(icc_data);
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 136d6894..20f59ef7 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -152,11 +152,11 @@ static const ArgDesc argDesc[] = {
    "generate a monochrome PBM file"},
   {"-gray",   argFlag,     &gray,          0,
    "generate a grayscale PGM file"},
-#if ENABLE_LIBPNG
+#ifdef ENABLE_LIBPNG
   {"-png",    argFlag,     &png,           0,
    "generate a PNG file"},
 #endif
-#if ENABLE_LIBJPEG
+#ifdef ENABLE_LIBJPEG
   {"-jpeg",   argFlag,     &jpeg,           0,
    "generate a JPEG file"},
 #ifdef SPLASH_CMYK
@@ -170,7 +170,7 @@ static const ArgDesc argDesc[] = {
   {"-overprint",argFlag,   &overprint,      0,
    "enable overprint"},
 #endif
-#if ENABLE_LIBTIFF
+#ifdef ENABLE_LIBTIFF
   {"-tiff",    argFlag,     &tiff,           0,
    "generate a TIFF file"},
   {"-tiffcompression", argString, TiffCompressionStr, sizeof(TiffCompressionStr),
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index 19651c31..816fef4d 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -85,7 +85,7 @@ static GBool level3Sep = gFalse;
 static GBool origPageSizes = gFalse;
 static GBool doEPS = gFalse;
 static GBool doForm = gFalse;
-#if OPI_SUPPORT
+#ifdef OPI_SUPPORT
 static GBool doOPI = gFalse;
 #endif
 static int splashResolution = 0;
@@ -139,7 +139,7 @@ static const ArgDesc argDesc[] = {
    "generate Encapsulated PostScript (EPS)"},
   {"-form",       argFlag,     &doForm,         0,
    "generate a PostScript form"},
-#if OPI_SUPPORT
+#ifdef OPI_SUPPORT
   {"-opi",        argFlag,     &doOPI,          0,
    "generate OPI comments"},
 #endif
@@ -411,7 +411,7 @@ int main(int argc, char *argv[]) {
   psOut->setPreloadImagesForms(preload);
   psOut->setOptimizeColorSpace(optimizeColorSpace);
   psOut->setPassLevel1CustomColor(passLevel1CustomColor);
-#if OPI_SUPPORT
+#ifdef OPI_SUPPORT
   psOut->setGenerateOPI(doOPI);
 #endif
   psOut->setUseBinary(psBinary);
commit b424862bf5df75db651076c780c7242eaf887479
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 18:18:42 2017 +1030

    Remove HAVE_FREETYPE macros
    
    Freetype is a mandatory dependency so we can drop the macros.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e3bf93a..1afd85cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -288,7 +288,6 @@ include_directories(
   ${CMAKE_CURRENT_BINARY_DIR}/poppler
   ${FREETYPE_INCLUDE_DIRS}
 )
-set(HAVE_FREETYPE_H ON)
 if(CMAKE_USE_PTHREADS_INIT)
   set(HAVE_PTHREAD ON)
 endif()
diff --git a/config.h.cmake b/config.h.cmake
index a8e1bbd7..bc410f19 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -46,9 +46,6 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #cmakedefine HAVE_FCNTL_H 1
 
-/* Have FreeType2 include files */
-#cmakedefine HAVE_FREETYPE_H 1
-
 /* Define to 1 if you have the `fseek64' function. */
 #cmakedefine HAVE_FSEEK64 1
 
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 0ae9263b..5a6d6f5d 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -1476,11 +1476,9 @@ void SplashOutputDev::startDoc(PDFDoc *docA) {
     delete fontEngine;
   }
   fontEngine = new SplashFontEngine(
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
 				    globalParams->getEnableFreeType(),
 				    enableFreeTypeHinting,
 				    enableSlightHinting,
-#endif
 				      getFontAntialias() &&
 				      colorMode != splashModeMono1);
   for (i = 0; i < nT3Fonts; ++i) {
@@ -4243,9 +4241,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
@@ -4283,9 +4279,7 @@ 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(s_minLineWidth);
@@ -4349,9 +4343,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;
     }
diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake
index 9bac2d76..ba6f5e32 100644
--- a/poppler/poppler-config.h.cmake
+++ b/poppler/poppler-config.h.cmake
@@ -115,11 +115,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
@@ -128,7 +123,7 @@
 // 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,
-// ENABLE_PLUGINS, DEBUG_FORMS, HAVE_FREETYPE_FREETYPE_H
+// ENABLE_PLUGINS, DEBUG_FORMS
 
 //------------------------------------------------------------------------
 // version
diff --git a/qt4/src/ArthurOutputDev.cc b/qt4/src/ArthurOutputDev.cc
index 547198c8..8b5caeec 100644
--- a/qt4/src/ArthurOutputDev.cc
+++ b/qt4/src/ArthurOutputDev.cc
@@ -112,11 +112,9 @@ void ArthurOutputDev::startDoc(XRef *xrefA) {
   const bool isSlightHinting = m_fontHinting == SlightHinting;
 
   m_fontEngine = new SplashFontEngine(
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   globalParams->getEnableFreeType(),
   isHintingEnabled,
   isSlightHinting,
-#endif
   m_painter->testRenderHint(QPainter::TextAntialiasing));
 #endif
 }
diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc
index d7f25d12..f31e6a5f 100644
--- a/qt5/src/ArthurOutputDev.cc
+++ b/qt5/src/ArthurOutputDev.cc
@@ -111,11 +111,9 @@ void ArthurOutputDev::startDoc(XRef *xrefA) {
   const bool isSlightHinting = m_fontHinting == SlightHinting;
 
   m_fontEngine = new SplashFontEngine(
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   globalParams->getEnableFreeType(),
   isHintingEnabled,
   isSlightHinting,
-#endif
   m_painter->testRenderHint(QPainter::TextAntialiasing));
 #endif
 }
diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc
index 38911d3b..268f50e6 100644
--- a/splash/SplashFTFont.cc
+++ b/splash/SplashFTFont.cc
@@ -25,8 +25,6 @@
 
 #include <config.h>
 
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
-
 #ifdef USE_GCC_PRAGMAS
 #pragma implementation
 #endif
@@ -509,5 +507,3 @@ static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2,
   p->needClose = gTrue;
   return 0;
 }
-
-#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
diff --git a/splash/SplashFTFont.h b/splash/SplashFTFont.h
index 7d5c1e32..f354210a 100644
--- a/splash/SplashFTFont.h
+++ b/splash/SplashFTFont.h
@@ -25,8 +25,6 @@
 
 #include "poppler-config.h"
 
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
-
 #ifdef USE_GCC_PRAGMAS
 #pragma interface
 #endif
@@ -75,6 +73,4 @@ private:
   GBool enableSlightHinting;
 };
 
-#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
-
 #endif
diff --git a/splash/SplashFTFontEngine.cc b/splash/SplashFTFontEngine.cc
index 9fef8f00..eb1d8cf1 100644
--- a/splash/SplashFTFontEngine.cc
+++ b/splash/SplashFTFontEngine.cc
@@ -23,8 +23,6 @@
 
 #include <config.h>
 
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
-
 #ifdef USE_GCC_PRAGMAS
 #pragma implementation
 #endif
@@ -176,5 +174,3 @@ SplashFontFile *SplashFTFontEngine::loadTrueTypeFont(SplashFontFileID *idA,
 					   faceIndex);
   return ret;
 }
-
-#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
diff --git a/splash/SplashFTFontEngine.h b/splash/SplashFTFontEngine.h
index 11bbea74..37835bcb 100644
--- a/splash/SplashFTFontEngine.h
+++ b/splash/SplashFTFontEngine.h
@@ -25,8 +25,6 @@
 #ifndef SPLASHFTFONTENGINE_H
 #define SPLASHFTFONTENGINE_H
 
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
-
 #ifdef USE_GCC_PRAGMAS
 #pragma interface
 #endif
@@ -76,6 +74,4 @@ private:
   friend class SplashFTFont;
 };
 
-#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
-
 #endif
diff --git a/splash/SplashFTFontFile.cc b/splash/SplashFTFontFile.cc
index 4370d466..a03f9862 100644
--- a/splash/SplashFTFontFile.cc
+++ b/splash/SplashFTFontFile.cc
@@ -22,8 +22,6 @@
 
 #include <config.h>
 
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
-
 #ifdef USE_GCC_PRAGMAS
 #pragma implementation
 #endif
@@ -149,5 +147,3 @@ SplashFont *SplashFTFontFile::makeFont(SplashCoord *mat,
 int *SplashFTFontFile::getCodeToGID() {
   return codeToGID;
 }
-
-#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
diff --git a/splash/SplashFTFontFile.h b/splash/SplashFTFontFile.h
index 20503bd6..e26c5231 100644
--- a/splash/SplashFTFontFile.h
+++ b/splash/SplashFTFontFile.h
@@ -22,8 +22,6 @@
 #ifndef SPLASHFTFONTFILE_H
 #define SPLASHFTFONTFILE_H
 
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
-
 #ifdef USE_GCC_PRAGMAS
 #pragma interface
 #endif
@@ -85,6 +83,4 @@ private:
   friend class SplashFTFont;
 };
 
-#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
-
 #endif
diff --git a/splash/SplashFontEngine.cc b/splash/SplashFontEngine.cc
index 462eb3da..d8dd3e2f 100644
--- a/splash/SplashFontEngine.cc
+++ b/splash/SplashFontEngine.cc
@@ -61,11 +61,9 @@ extern "C" int unlink(char *filename);
 //------------------------------------------------------------------------
 
 SplashFontEngine::SplashFontEngine(
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
 				   GBool enableFreeType,
 				   GBool enableFreeTypeHinting,
 				   GBool enableSlightHinting,
-#endif
 				   GBool aa) {
   int i;
 
@@ -73,13 +71,11 @@ SplashFontEngine::SplashFontEngine(
     fontCache[i] = NULL;
   }
 
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (enableFreeType) {
     ftEngine = SplashFTFontEngine::init(aa, enableFreeTypeHinting, enableSlightHinting);
   } else {
     ftEngine = NULL;
   }
-#endif
 }
 
 SplashFontEngine::~SplashFontEngine() {
@@ -91,11 +87,9 @@ SplashFontEngine::~SplashFontEngine() {
     }
   }
 
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (ftEngine) {
     delete ftEngine;
   }
-#endif
 }
 
 SplashFontFile *SplashFontEngine::getFontFile(SplashFontFileID *id) {
@@ -119,11 +113,9 @@ SplashFontFile *SplashFontEngine::loadType1Font(SplashFontFileID *idA,
   SplashFontFile *fontFile;
 
   fontFile = NULL;
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadType1Font(idA, src, enc);
   }
-#endif
 
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
@@ -141,11 +133,9 @@ SplashFontFile *SplashFontEngine::loadType1CFont(SplashFontFileID *idA,
   SplashFontFile *fontFile;
 
   fontFile = NULL;
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadType1CFont(idA, src, enc);
   }
-#endif
 
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
@@ -163,11 +153,9 @@ SplashFontFile *SplashFontEngine::loadOpenTypeT1CFont(SplashFontFileID *idA,
   SplashFontFile *fontFile;
 
   fontFile = NULL;
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadOpenTypeT1CFont(idA, src, enc);
   }
-#endif
 
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
@@ -184,11 +172,9 @@ SplashFontFile *SplashFontEngine::loadCIDFont(SplashFontFileID *idA,
   SplashFontFile *fontFile;
 
   fontFile = NULL;
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadCIDFont(idA, src);
   }
-#endif
 
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
@@ -207,11 +193,9 @@ SplashFontFile *SplashFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA,
   SplashFontFile *fontFile;
 
   fontFile = NULL;
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadOpenTypeCFFFont(idA, src, codeToGID, codeToGIDLen);
   }
-#endif
 
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
@@ -231,12 +215,10 @@ SplashFontFile *SplashFontEngine::loadTrueTypeFont(SplashFontFileID *idA,
   SplashFontFile *fontFile;
 
   fontFile = NULL;
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadTrueTypeFont(idA, src,
                                         codeToGID, codeToGIDLen, faceIndex);
   }
-#endif
 
   if (!fontFile) {
     gfree(codeToGID);
@@ -252,7 +234,6 @@ SplashFontFile *SplashFontEngine::loadTrueTypeFont(SplashFontFileID *idA,
   return fontFile;
 }
 
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
 GBool SplashFontEngine::getAA() {
   return (ftEngine == NULL) ? gFalse : ftEngine->getAA();
 }
@@ -262,7 +243,6 @@ void SplashFontEngine::setAA(GBool aa) {
     ftEngine->setAA(aa);
   }
 }
-#endif
 
 SplashFont *SplashFontEngine::getFont(SplashFontFile *fontFile,
 				      SplashCoord *textMat,
diff --git a/splash/SplashFontEngine.h b/splash/SplashFontEngine.h
index 6afa3908..9f0ae0e6 100644
--- a/splash/SplashFontEngine.h
+++ b/splash/SplashFontEngine.h
@@ -54,11 +54,9 @@ public:
 
   // Create a font engine.
   SplashFontEngine(
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
 		   GBool enableFreeType,
 		   GBool enableFreeTypeHinting,
 		   GBool enableSlightHinting,
-#endif
 		   GBool aa);
 
   ~SplashFontEngine();
@@ -87,18 +85,14 @@ public:
   // Note that the Splash y axis points downward.
   SplashFont *getFont(SplashFontFile *fontFile,
 		      SplashCoord *textMat, SplashCoord *ctm);
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   GBool getAA();
   void setAA(GBool aa);
-#endif
 
 private:
 
   SplashFont *fontCache[splashFontCacheSize];
 
-#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   SplashFTFontEngine *ftEngine;
-#endif
 };
 
 #endif
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index e320525c..136d6894 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -176,10 +176,8 @@ static const ArgDesc argDesc[] = {
   {"-tiffcompression", argString, TiffCompressionStr, sizeof(TiffCompressionStr),
    "set TIFF compression: none, packbits, jpeg, lzw, deflate"},
 #endif
-#if HAVE_FREETYPE_FREETYPE_H | HAVE_FREETYPE_H
   {"-freetype",   argString,      enableFreeTypeStr, sizeof(enableFreeTypeStr),
    "enable FreeType font rasterizer: yes, no"},
-#endif
   {"-thinlinemode", argString, thinLineModeStr, sizeof(thinLineModeStr),
    "set thin line mode: none, solid, shape. Default: none"},
   
commit e0428ef002e9c8d6e2046fcdeeedcf7462367501
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 18:02:15 2017 +1030

    Remove unused t1lib code

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe5911c3..8e3bf93a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -461,9 +461,6 @@ if(ENABLE_SPLASH)
     splash/SplashPattern.cc
     splash/SplashScreen.cc
     splash/SplashState.cc
-    splash/SplashT1Font.cc
-    splash/SplashT1FontEngine.cc
-    splash/SplashT1FontFile.cc
     splash/SplashXPath.cc
     splash/SplashXPathScanner.cc
   )
@@ -710,9 +707,6 @@ if(ENABLE_XPDF_HEADERS)
       splash/SplashPattern.h
       splash/SplashScreen.h
       splash/SplashState.h
-      splash/SplashT1Font.h
-      splash/SplashT1FontEngine.h
-      splash/SplashT1FontFile.h
       splash/SplashTypes.h
       splash/SplashXPath.h
       splash/SplashXPathScanner.h
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 0724bfde..0ae9263b 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -1476,9 +1476,6 @@ void SplashOutputDev::startDoc(PDFDoc *docA) {
     delete fontEngine;
   }
   fontEngine = new SplashFontEngine(
-#ifdef HAVE_T1LIB_H
-				    globalParams->getEnableT1lib(),
-#endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
 				    globalParams->getEnableFreeType(),
 				    enableFreeTypeHinting,
diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake
index 01c9a482..9bac2d76 100644
--- a/poppler/poppler-config.h.cmake
+++ b/poppler/poppler-config.h.cmake
@@ -127,7 +127,7 @@
 
 // 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,
+// or cmake: DISABLE_OUTLINE, DEBUG_MEM,
 // ENABLE_PLUGINS, DEBUG_FORMS, HAVE_FREETYPE_FREETYPE_H
 
 //------------------------------------------------------------------------
diff --git a/qt4/src/ArthurOutputDev.cc b/qt4/src/ArthurOutputDev.cc
index 7e80b4a2..547198c8 100644
--- a/qt4/src/ArthurOutputDev.cc
+++ b/qt4/src/ArthurOutputDev.cc
@@ -112,9 +112,6 @@ void ArthurOutputDev::startDoc(XRef *xrefA) {
   const bool isSlightHinting = m_fontHinting == SlightHinting;
 
   m_fontEngine = new SplashFontEngine(
-#if HAVE_T1LIB_H
-  globalParams->getEnableT1lib(),
-#endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   globalParams->getEnableFreeType(),
   isHintingEnabled,
diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc
index 61c5990b..d7f25d12 100644
--- a/qt5/src/ArthurOutputDev.cc
+++ b/qt5/src/ArthurOutputDev.cc
@@ -111,9 +111,6 @@ void ArthurOutputDev::startDoc(XRef *xrefA) {
   const bool isSlightHinting = m_fontHinting == SlightHinting;
 
   m_fontEngine = new SplashFontEngine(
-#if HAVE_T1LIB_H
-  globalParams->getEnableT1lib(),
-#endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   globalParams->getEnableFreeType(),
   isHintingEnabled,
diff --git a/splash/SplashFontEngine.cc b/splash/SplashFontEngine.cc
index 73ef8de0..462eb3da 100644
--- a/splash/SplashFontEngine.cc
+++ b/splash/SplashFontEngine.cc
@@ -30,10 +30,6 @@
 #pragma implementation
 #endif
 
-#if HAVE_T1LIB_H
-#include <t1lib.h>
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #ifdef HAVE_UNISTD_H
@@ -42,7 +38,6 @@
 #include "goo/gmem.h"
 #include "goo/GooString.h"
 #include "SplashMath.h"
-#include "SplashT1FontEngine.h"
 #include "SplashFTFontEngine.h"
 #include "SplashFontFile.h"
 #include "SplashFontFileID.h"
@@ -66,9 +61,6 @@ extern "C" int unlink(char *filename);
 //------------------------------------------------------------------------
 
 SplashFontEngine::SplashFontEngine(
-#if HAVE_T1LIB_H
-				   GBool enableT1lib,
-#endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
 				   GBool enableFreeType,
 				   GBool enableFreeTypeHinting,
@@ -81,13 +73,6 @@ SplashFontEngine::SplashFontEngine(
     fontCache[i] = NULL;
   }
 
-#if HAVE_T1LIB_H
-  if (enableT1lib) {
-    t1Engine = SplashT1FontEngine::init(aa);
-  } else {
-    t1Engine = NULL;
-  }
-#endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (enableFreeType) {
     ftEngine = SplashFTFontEngine::init(aa, enableFreeTypeHinting, enableSlightHinting);
@@ -106,11 +91,6 @@ SplashFontEngine::~SplashFontEngine() {
     }
   }
 
-#if HAVE_T1LIB_H
-  if (t1Engine) {
-    delete t1Engine;
-  }
-#endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (ftEngine) {
     delete ftEngine;
@@ -139,11 +119,6 @@ SplashFontFile *SplashFontEngine::loadType1Font(SplashFontFileID *idA,
   SplashFontFile *fontFile;
 
   fontFile = NULL;
-#if HAVE_T1LIB_H
-  if (!fontFile && t1Engine) {
-    fontFile = t1Engine->loadType1Font(idA, src, enc);
-  }
-#endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadType1Font(idA, src, enc);
@@ -166,11 +141,6 @@ SplashFontFile *SplashFontEngine::loadType1CFont(SplashFontFileID *idA,
   SplashFontFile *fontFile;
 
   fontFile = NULL;
-#if HAVE_T1LIB_H
-  if (!fontFile && t1Engine) {
-    fontFile = t1Engine->loadType1CFont(idA, src, enc);
-  }
-#endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadType1CFont(idA, src, enc);
diff --git a/splash/SplashFontEngine.h b/splash/SplashFontEngine.h
index 6888d84b..6afa3908 100644
--- a/splash/SplashFontEngine.h
+++ b/splash/SplashFontEngine.h
@@ -54,9 +54,6 @@ public:
 
   // Create a font engine.
   SplashFontEngine(
-#ifdef HAVE_T1LIB_H
-		   GBool enableT1lib,
-#endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
 		   GBool enableFreeType,
 		   GBool enableFreeTypeHinting,
@@ -99,9 +96,6 @@ private:
 
   SplashFont *fontCache[splashFontCacheSize];
 
-#ifdef HAVE_T1LIB_H
-  SplashT1FontEngine *t1Engine;
-#endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   SplashFTFontEngine *ftEngine;
 #endif
diff --git a/splash/SplashT1Font.cc b/splash/SplashT1Font.cc
deleted file mode 100644
index 0fdfaaf5..00000000
--- a/splash/SplashT1Font.cc
+++ /dev/null
@@ -1,309 +0,0 @@
-//========================================================================
-//
-// SplashT1Font.cc
-//
-//========================================================================
-
-//========================================================================
-//
-// 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) 2007 Albert Astals Cid <aacid at 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
-//
-//========================================================================
-
-#include <config.h>
-
-#if HAVE_T1LIB_H
-
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
-#include <stdlib.h>
-#include <t1lib.h>
-#include "goo/gmem.h"
-#include "SplashMath.h"
-#include "SplashGlyphBitmap.h"
-#include "SplashPath.h"
-#include "SplashT1FontEngine.h"
-#include "SplashT1FontFile.h"
-#include "SplashT1Font.h"
-
-//------------------------------------------------------------------------
-
-static Guchar bitReverse[256] = {
-  0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
-  0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
-  0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
-  0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
-  0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
-  0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
-  0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
-  0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
-  0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
-  0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
-  0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
-  0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
-  0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
-  0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
-  0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
-  0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
-  0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
-  0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
-  0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
-  0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
-  0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
-  0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
-  0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
-  0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
-  0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
-  0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
-  0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
-  0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
-  0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
-  0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
-  0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
-  0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
-};
-
-//------------------------------------------------------------------------
-// SplashT1Font
-//------------------------------------------------------------------------
-
-SplashT1Font::SplashT1Font(SplashT1FontFile *fontFileA, SplashCoord *matA,
-			   SplashCoord *textMatA):
-  SplashFont(fontFileA, matA, textMatA, fontFileA->engine->aa)
-{
-  T1_TMATRIX matrix;
-  BBox bbox;
-  SplashCoord bbx0, bby0, bbx1, bby1;
-  int x, y;
-
-  t1libID = T1_CopyFont(fontFileA->t1libID);
-  outlineID = -1;
-
-  // compute font size
-  size = (float)splashDist(0, 0, mat[2], mat[3]);
-
-  // transform the four corners of the font bounding box -- the min
-  // and max values form the bounding box of the transformed font
-  bbox = T1_GetFontBBox(t1libID);
-  bbx0 = 0.001 * bbox.llx;
-  bby0 = 0.001 * bbox.lly;
-  bbx1 = 0.001 * bbox.urx;
-  bby1 = 0.001 * bbox.ury;
-  // some fonts are completely broken, so we fake it (with values
-  // large enough that most glyphs should fit)
-  if (bbx0 == 0 && bby0 == 0 && bbx1 == 0 && bby1 == 0) {
-    bbx0 = bby0 = -0.5;
-    bbx1 = bby1 = 1.5;
-  }
-  x = (int)(mat[0] * bbx0 + mat[2] * bby0);
-  xMin = xMax = x;
-  y = (int)(mat[1] * bbx0 + mat[3] * bby0);
-  yMin = yMax = y;
-  x = (int)(mat[0] * bbx0 + mat[2] * bby1);
-  if (x < xMin) {
-    xMin = x;
-  } else if (x > xMax) {
-    xMax = x;
-  }
-  y = (int)(mat[1] * bbx0 + mat[3] * bby1);
-  if (y < yMin) {
-    yMin = y;
-  } else if (y > yMax) {
-    yMax = y;
-  }
-  x = (int)(mat[0] * bbx1 + mat[2] * bby0);
-  if (x < xMin) {
-    xMin = x;
-  } else if (x > xMax) {
-    xMax = x;
-  }
-  y = (int)(mat[1] * bbx1 + mat[3] * bby0);
-  if (y < yMin) {
-    yMin = y;
-  } else if (y > yMax) {
-    yMax = y;
-  }
-  x = (int)(mat[0] * bbx1 + mat[2] * bby1);
-  if (x < xMin) {
-    xMin = x;
-  } else if (x > xMax) {
-    xMax = x;
-  }
-  y = (int)(mat[1] * bbx1 + mat[3] * bby1);
-  if (y < yMin) {
-    yMin = y;
-  } else if (y > yMax) {
-    yMax = y;
-  }
-  // This is a kludge: some buggy PDF generators embed fonts with
-  // zero bounding boxes.
-  if (xMax == xMin) {
-    xMin = 0;
-    xMax = (int)size;
-  }
-  if (yMax == yMin) {
-    yMin = 0;
-    yMax = (int)(1.2 * size);
-  }
-  // Another kludge: an unusually large xMin or yMin coordinate is
-  // probably wrong.
-  if (xMin > 0) {
-    xMin = 0;
-  }
-  if (yMin > 0) {
-    yMin = 0;
-  }
-  // Another kludge: t1lib doesn't correctly handle fonts with
-  // real (non-integer) bounding box coordinates.
-  if (xMax - xMin > 5000) {
-    xMin = 0;
-    xMax = (int)size;
-  }
-  if (yMax - yMin > 5000) {
-    yMin = 0;
-    yMax = (int)(1.2 * size);
-  }
-
-  // transform the font
-  matrix.cxx = (double)mat[0] / size;
-  matrix.cxy = (double)mat[1] / size;
-  matrix.cyx = (double)mat[2] / size;
-  matrix.cyy = (double)mat[3] / size;
-  T1_TransformFont(t1libID, &matrix);
-}
-
-SplashT1Font::~SplashT1Font() {
-  T1_DeleteFont(t1libID);
-  if (outlineID >= 0) {
-    T1_DeleteFont(outlineID);
-  }
-}
-
-GBool SplashT1Font::getGlyph(int c, int xFrac, int yFrac,
-			     SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) {
-  return SplashFont::getGlyph(c, 0, 0, bitmap, x0, y0, clip, clipRes);
-}
-
-GBool SplashT1Font::makeGlyph(int c, int xFrac, int yFrac,
-			      SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) {
-  GLYPH *glyph;
-  int n, i;
-
-  if (aa) {
-    glyph = T1_AASetChar(t1libID, c, size, NULL);
-  } else {
-    glyph = T1_SetChar(t1libID, c, size, NULL);
-  }
-  if (!glyph) {
-    return gFalse;
-  }
-
-  bitmap->x = -glyph->metrics.leftSideBearing;
-  bitmap->y = glyph->metrics.ascent;
-  bitmap->w = glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing;
-  bitmap->h = glyph->metrics.ascent - glyph->metrics.descent;
-  bitmap->aa = aa;
-  if (aa) {
-    bitmap->data = (Guchar *)glyph->bits;
-    bitmap->freeData = gFalse;
-  } else {
-    n = bitmap->h * ((bitmap->w + 7) >> 3);
-    bitmap->data = (Guchar *)gmalloc(n);
-    for (i = 0; i < n; ++i) {
-      bitmap->data[i] = bitReverse[glyph->bits[i] & 0xff];
-    }
-    bitmap->freeData = gTrue;
-  }
-
-  *clipRes = clip->testRect(x0 - bitmap->x,
-                            y0 - bitmap->y,
-                            x0 - bitmap->x + bitmap->w - 1,
-                            y0 - bitmap->y + bitmap->h - 1);
-
-  return gTrue;
-}
-
-SplashPath *SplashT1Font::getGlyphPath(int c) {
-  T1_TMATRIX matrix;
-  SplashPath *path;
-  T1_OUTLINE *outline;
-  T1_PATHSEGMENT *seg;
-  T1_BEZIERSEGMENT *bez;
-  int x, y, x1, y1;
-  GBool needClose;
-
-  if (outlineID < 0) {
-    outlineID = T1_CopyFont(((SplashT1FontFile *)fontFile)->t1libID);
-    outlineSize = (float)splashDist(0, 0, textMat[2], textMat[3]);
-    matrix.cxx = (double)textMat[0] / outlineSize;
-    matrix.cxy = (double)textMat[1] / outlineSize;
-    matrix.cyx = (double)textMat[2] / outlineSize;
-    matrix.cyy = (double)textMat[3] / outlineSize;
-    // t1lib doesn't seem to handle small sizes correctly here, so set
-    // the size to 1000, and scale the resulting coordinates later
-    outlineMul = (float)(outlineSize / 65536000.0);
-    outlineSize = 1000;
-    T1_TransformFont(outlineID, &matrix);
-  }
-
-  path = new SplashPath();
-  if ((outline = T1_GetCharOutline(outlineID, c, outlineSize, NULL))) {
-    // NB: t1lib uses integer coordinates here; we keep a running
-    // (x,y) total as integers, so that the final point in the path is
-    // exactly the same as the first point, thus avoiding weird
-    // mitered join glitches
-    x = y = 0;
-    needClose = gFalse;
-    for (seg = outline; seg; seg = seg->link) {
-      switch (seg->type) {
-      case T1_PATHTYPE_MOVE:
-	if (needClose) {
-	  path->close();
-	  needClose = gFalse;
-	}
-	x += seg->dest.x;
-	y += seg->dest.y;
-	path->moveTo(outlineMul * x, -outlineMul * y);
-	break;
-      case T1_PATHTYPE_LINE:
-	x += seg->dest.x;
-	y += seg->dest.y;
-	path->lineTo(outlineMul * x, -outlineMul * y);
-	needClose = gTrue;
-	break;
-      case T1_PATHTYPE_BEZIER:
-	bez = (T1_BEZIERSEGMENT *)seg;
-	x1 = x + bez->dest.x;
-	y1 = y + bez->dest.y;
-	path->curveTo(outlineMul * (x + bez->B.x),
-		      -outlineMul * (y + bez->B.y),
-		      outlineMul * (x + bez->C.x),
-		      -outlineMul * (y + bez->C.y),
-		      outlineMul * x1,
-		      -outlineMul * y1);
-	x = x1;
-	y = y1;
-	needClose = gTrue;
-	break;
-      }
-    }
-    if (needClose) {
-      path->close();
-    }
-    T1_FreeOutline(outline);
-  }
-
-  return path;
-}
-
-#endif // HAVE_T1LIB_H
diff --git a/splash/SplashT1Font.h b/splash/SplashT1Font.h
deleted file mode 100644
index 1dbe66cd..00000000
--- a/splash/SplashT1Font.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//========================================================================
-//
-// SplashT1Font.h
-//
-//========================================================================
-
-//========================================================================
-//
-// 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) 2007 Albert Astals Cid <aacid at 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
-//
-//========================================================================
-
-#ifndef SPLASHT1FONT_H
-#define SPLASHT1FONT_H
-
-#if HAVE_T1LIB_H
-
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
-#include "SplashFont.h"
-
-class SplashT1FontFile;
-
-//------------------------------------------------------------------------
-// SplashT1Font
-//------------------------------------------------------------------------
-
-class SplashT1Font: public SplashFont {
-public:
-
-  SplashT1Font(SplashT1FontFile *fontFileA, SplashCoord *matA,
-	       SplashCoord *textMatA);
-
-  virtual ~SplashT1Font();
-
-  // Munge xFrac and yFrac before calling SplashFont::getGlyph.
-  virtual GBool getGlyph(int c, int xFrac, int yFrac,
-			 SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes);
-
-  // Rasterize a glyph.  The <xFrac> and <yFrac> values are the same
-  // as described for getGlyph.
-  virtual GBool makeGlyph(int c, int xFrac, int yFrac,
-			  SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes);
-
-  // Return the path for a glyph.
-  virtual SplashPath *getGlyphPath(int c);
-
-private:
-
-  int t1libID;			// t1lib font ID
-  int outlineID;		// t1lib font ID for glyph outlines
-  float size;
-  float outlineSize;		// size for glyph outlines
-  float outlineMul;
-};
-
-#endif // HAVE_T1LIB_H
-
-#endif
diff --git a/splash/SplashT1FontEngine.cc b/splash/SplashT1FontEngine.cc
deleted file mode 100644
index fb4b38da..00000000
--- a/splash/SplashT1FontEngine.cc
+++ /dev/null
@@ -1,138 +0,0 @@
-//========================================================================
-//
-// SplashT1FontEngine.cc
-//
-//========================================================================
-
-//========================================================================
-//
-// 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) 2006 Takashi Iwai <tiwai at suse.de>
-// Copyright (C) 2009 Albert Astals Cid <aacid at 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
-//
-//========================================================================
-
-#include <config.h>
-
-#if HAVE_T1LIB_H
-
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
-#include <t1lib.h>
-#include "goo/GooString.h"
-#include "goo/gfile.h"
-#include "fofi/FoFiType1C.h"
-#include "SplashT1FontFile.h"
-#include "SplashT1FontEngine.h"
-
-#ifdef VMS
-#if (__VMS_VER < 70000000)
-extern "C" int unlink(char *filename);
-#endif
-#endif
-
-//------------------------------------------------------------------------
-
-int SplashT1FontEngine::t1libInitCount = 0;
-
-//------------------------------------------------------------------------
-
-static void fileWrite(void *stream, const char *data, int len) {
-  fwrite(data, 1, len, (FILE *)stream);
-}
-
-//------------------------------------------------------------------------
-// SplashT1FontEngine
-//------------------------------------------------------------------------
-
-SplashT1FontEngine::SplashT1FontEngine(GBool aaA) {
-  aa = aaA;
-}
-
-SplashT1FontEngine *SplashT1FontEngine::init(GBool aaA) {
-  // grayVals[i] = round(i * 255 / 16)
-  static unsigned long grayVals[17] = {
-    0, 16, 32, 48, 64, 80, 96, 112, 128, 143, 159, 175, 191, 207, 223, 239, 255
-  };
-
-  //~ for multithreading: need a mutex here
-  if (t1libInitCount == 0) {
-    T1_SetBitmapPad(8);
-    if (!T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE |
-		    T1_NO_AFM)) {
-      return NULL;
-    }
-    if (aaA) {
-      T1_AASetBitsPerPixel(8);
-      T1_AASetLevel(T1_AA_HIGH);
-      T1_AAHSetGrayValues(grayVals);
-    } else {
-      T1_AANSetGrayValues(0, 1);
-    }
-  }
-  ++t1libInitCount;
-
-  return new SplashT1FontEngine(aaA);
-}
-
-SplashT1FontEngine::~SplashT1FontEngine() {
-  //~ for multithreading: need a mutex here
-  if (--t1libInitCount == 0) {
-    T1_CloseLib();
-  }
-}
-
-SplashFontFile *SplashT1FontEngine::loadType1Font(SplashFontFileID *idA,
-						  SplashFontSrc *src,
-						  const char **enc) {
-  return SplashT1FontFile::loadType1Font(this, idA, src, enc);
-}
-
-SplashFontFile *SplashT1FontEngine::loadType1CFont(SplashFontFileID *idA,
-						   SplashFontSrc *src,
-						   const char **enc) {
-  FoFiType1C *ff;
-  GooString *tmpFileName;
-  FILE *tmpFile;
-  SplashFontFile *ret;
-
-  SplashFontSrc *newsrc;
-  
-  if (src->isFile)
-    ff = FoFiType1C::load(src->fileName->getCString());
-  else
-    ff = FoFiType1C::make(src->buf, src->bufLen);
-  if (! ff)
-    return NULL;
-
-  tmpFileName = NULL;
-  if (!openTempFile(&tmpFileName, &tmpFile, "wb")) {
-    delete ff;
-    return NULL;
-  }
-  ff->convertToType1(NULL, NULL, gTrue, &fileWrite, tmpFile);
-  delete ff;
-  fclose(tmpFile);
-  newsrc = new SplashFontSrc;
-  newsrc->setFile(tmpFileName, gTrue);
-  delete tmpFileName;
-  ret = SplashT1FontFile::loadType1Font(this, idA, newsrc, enc);
-  newsrc->unref();
-  return ret;
-}
-
-#endif // HAVE_T1LIB_H
diff --git a/splash/SplashT1FontEngine.h b/splash/SplashT1FontEngine.h
deleted file mode 100644
index 268a0147..00000000
--- a/splash/SplashT1FontEngine.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//========================================================================
-//
-// SplashT1FontEngine.h
-//
-//========================================================================
-
-#ifndef SPLASHT1FONTENGINE_H
-#define SPLASHT1FONTENGINE_H
-
-#if HAVE_T1LIB_H
-
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
-#include "goo/gtypes.h"
-
-class SplashFontFile;
-class SplashFontFileID;
-class SplashFontSrc;
-
-//------------------------------------------------------------------------
-// SplashT1FontEngine
-//------------------------------------------------------------------------
-
-class SplashT1FontEngine {
-public:
-
-  static SplashT1FontEngine *init(GBool aaA);
-
-  ~SplashT1FontEngine();
-
-  // Load fonts.
-  SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
-  SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc);
-
-private:
-
-  SplashT1FontEngine(GBool aaA);
-
-  static int t1libInitCount;
-  GBool aa;
-
-  friend class SplashT1FontFile;
-  friend class SplashT1Font;
-};
-
-#endif // HAVE_T1LIB_H
-
-#endif
diff --git a/splash/SplashT1FontFile.cc b/splash/SplashT1FontFile.cc
deleted file mode 100644
index 1832a916..00000000
--- a/splash/SplashT1FontFile.cc
+++ /dev/null
@@ -1,134 +0,0 @@
-//========================================================================
-//
-// SplashT1FontFile.cc
-//
-//========================================================================
-
-//========================================================================
-//
-// 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) 2006 Takashi Iwai <tiwai at suse.de>
-// Copyright (C) 2009 Albert Astals Cid <aacid at 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
-//
-//========================================================================
-
-#include <config.h>
-
-#if HAVE_T1LIB_H
-
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
-#include <string.h>
-#include <t1lib.h>
-#include "goo/GooString.h"
-#include "goo/gfile.h"
-#include "goo/gmem.h"
-#include "SplashT1FontEngine.h"
-#include "SplashT1Font.h"
-#include "SplashT1FontFile.h"
-
-//------------------------------------------------------------------------
-// SplashT1FontFile
-//------------------------------------------------------------------------
-
-SplashFontFile *SplashT1FontFile::loadType1Font(SplashT1FontEngine *engineA,
-						SplashFontFileID *idA,
-						SplashFontSrc *src,
-						const char **encA) {
-  int t1libIDA;
-  const char **encTmp;
-  char *encStrTmp;
-  int encStrSize;
-  char *encPtr;
-  int i;
-
-  GooString *fileNameA;
-  SplashFontSrc *newsrc = NULL;
-  SplashFontFile *ff;
-
-  if (! src->isFile) {
-    GooString *tmpFileName;
-    FILE *tmpFile;
-    if (!openTempFile(&tmpFileName, &tmpFile, "wb"))
-      return NULL;
-    fwrite(src->buf, 1, src->bufLen, tmpFile);
-    fclose(tmpFile);
-    newsrc = new SplashFontSrc;
-    newsrc->setFile(tmpFileName, gTrue);
-    src = newsrc;
-    delete tmpFileName;
-  }
-  fileNameA = src->fileName;
-  // load the font file
-  if ((t1libIDA = T1_AddFont(fileNameA->getCString())) < 0) {
-    delete newsrc;
-    return NULL;
-  }
-  T1_LoadFont(t1libIDA);
-
-  // reencode it
-  encStrSize = 0;
-  for (i = 0; i < 256; ++i) {
-    if (encA[i]) {
-      encStrSize += strlen(encA[i]) + 1;
-    }
-  }
-  encTmp = (const char **)gmallocn(257, sizeof(char *));
-  encStrTmp = (char *)gmallocn(encStrSize, sizeof(char));
-  encPtr = encStrTmp;
-  for (i = 0; i < 256; ++i) {
-    if (encA[i]) {
-      strcpy(encPtr, encA[i]);
-      encTmp[i] = encPtr;
-      encPtr += strlen(encPtr) + 1;
-    } else {
-      encTmp[i] = ".notdef";
-    }
-  }
-  encTmp[256] = "custom";
-  T1_ReencodeFont(t1libIDA, (char **)encTmp);
-
-  ff = new SplashT1FontFile(engineA, idA, src,
-			      t1libIDA, encTmp, encStrTmp);
-  if (newsrc)
-    newsrc->unref();
-  return ff;
-}
-
-SplashT1FontFile::SplashT1FontFile(SplashT1FontEngine *engineA,
-				   SplashFontFileID *idA,
-				   SplashFontSrc *srcA,
-				   int t1libIDA, const char **encA, char *encStrA):
-  SplashFontFile(idA, srcA)
-{
-  engine = engineA;
-  t1libID = t1libIDA;
-  enc = encA;
-  encStr = encStrA;
-}
-
-SplashT1FontFile::~SplashT1FontFile() {
-  gfree(encStr);
-  gfree(enc);
-  T1_DeleteFont(t1libID);
-}
-
-SplashFont *SplashT1FontFile::makeFont(SplashCoord *mat,
-				       SplashCoord *textMat) {
-  SplashFont *font;
-
-  font = new SplashT1Font(this, mat, textMat);
-  font->initCache();
-  return font;
-}
-
-#endif // HAVE_T1LIB_H
diff --git a/splash/SplashT1FontFile.h b/splash/SplashT1FontFile.h
deleted file mode 100644
index c094b6d8..00000000
--- a/splash/SplashT1FontFile.h
+++ /dev/null
@@ -1,70 +0,0 @@
-//========================================================================
-//
-// SplashT1FontFile.h
-//
-//========================================================================
-
-//========================================================================
-//
-// 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) 2006 Takashi Iwai <tiwai at suse.de>
-//
-// 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 SPLASHT1FONTFILE_H
-#define SPLASHT1FONTFILE_H
-
-#if HAVE_T1LIB_H
-
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
-#include "SplashFontFile.h"
-
-class SplashT1FontEngine;
-
-//------------------------------------------------------------------------
-// SplashT1FontFile
-//------------------------------------------------------------------------
-
-class SplashT1FontFile: public SplashFontFile {
-public:
-
-  static SplashFontFile *loadType1Font(SplashT1FontEngine *engineA,
-				       SplashFontFileID *idA,
-				       SplashFontSrc *src,
-				       const char **encA);
-
-  virtual ~SplashT1FontFile();
-
-  // Create a new SplashT1Font, i.e., a scaled instance of this font
-  // file.
-  virtual SplashFont *makeFont(SplashCoord *mat,
-			       SplashCoord *textMat);
-
-private:
-
-  SplashT1FontFile(SplashT1FontEngine *engineA,
-		   SplashFontFileID *idA,
-		   SplashFontSrc *src,
-		   int t1libIDA, const char **encA, char *encStrA);
-
-  SplashT1FontEngine *engine;
-  int t1libID;			// t1lib font ID
-  const char **enc;
-  char *encStr;
-
-  friend class SplashT1Font;
-};
-
-#endif // HAVE_T1LIB_H
-
-#endif
commit 7f01a804455dcc9d87fa17b566b8bd269b2d5489
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 17:31:23 2017 +1030

    Use _WIN32 to check for windows, not WIN32
    
    These should have been fixed in #24259 but must have been missed.

diff --git a/goo/gfile.cc b/goo/gfile.cc
index 6b98ec21..642f3966 100644
--- a/goo/gfile.cc
+++ b/goo/gfile.cc
@@ -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];
diff --git a/goo/gfile.h b/goo/gfile.h
index be539940..0929f7ef 100644
--- a/goo/gfile.h
+++ b/goo/gfile.h
@@ -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/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 2a7e56bc..2ba23ec8 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -253,7 +253,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 +261,7 @@ public:
 #endif
 private:
 
-#ifdef WIN32
+#ifdef _WIN32
   SysFontInfo *makeWindowsFont(char *name, int fontNum,
 			       char *path);
 #endif
diff --git a/splash/SplashMath.h b/splash/SplashMath.h
index a56bd12b..8b3b5040 100644
--- a/splash/SplashMath.h
+++ b/splash/SplashMath.h
@@ -64,7 +64,7 @@ static inline int splashFloor(SplashCoord x) {
 		   : "=m" (oldCW), "=m" (newCW), "=m" (result), "=r" (t)
 		   : "m" (x));
     return result;
-#elif defined(WIN32) && defined(_M_IX86)
+#elif defined(_WIN32) && defined(_M_IX86)
     // floor() and (int)() are implemented separately, which results
     // in changing the FPCW multiple times - so we optimize it with
     // some inline assembly
@@ -111,7 +111,7 @@ static inline int splashCeil(SplashCoord x) {
 		   : "=m" (oldCW), "=m" (newCW), "=m" (result), "=r" (t)
 		   : "m" (x));
   return result;
-#elif defined(WIN32) && defined(_M_IX86)
+#elif defined(_WIN32) && defined(_M_IX86)
   // ceil() and (int)() are implemented separately, which results
   // in changing the FPCW multiple times - so we optimize it with
   // some inline assembly
@@ -156,7 +156,7 @@ static inline int splashRound(SplashCoord x) {
 		   : "=m" (oldCW), "=m" (newCW), "=m" (result), "=r" (t)
 		   : "m" (x));
   return result;
-#elif defined(WIN32) && defined(_M_IX86)
+#elif defined(_WIN32) && defined(_M_IX86)
   // this could use round-to-nearest mode and avoid the "+0.5",
   // but that produces slightly different results (because i+0.5
   // sometimes rounds up and sometimes down using the even rule)
commit e38ffea64dc9c113607168e298c7ccdf8edaa61e
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 17:25:19 2017 +1030

    Fix some -Wundef warnings

diff --git a/goo/FixedPoint.cc b/goo/FixedPoint.cc
index 26b2f0fe..8a510105 100644
--- a/goo/FixedPoint.cc
+++ b/goo/FixedPoint.cc
@@ -10,7 +10,7 @@
 
 #include <config.h>
 
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
 
 #ifdef USE_GCC_PRAGMAS
 #pragma implementation
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 1461910d..2a7e56bc 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -127,7 +127,7 @@ 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 */
 
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index b3fffe46..925ff627 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -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"
@@ -3282,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;
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index ff4e9119..0724bfde 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -112,14 +112,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) {
@@ -138,7 +138,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);
@@ -189,7 +189,7 @@ static inline void convertGfxShortColor(SplashColorPtr dest,
       dest[2] = colToByte(rgb.b);
     }
     break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     case splashModeCMYK8:
     {
       GfxCMYK cmyk;
@@ -235,7 +235,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)
@@ -516,7 +516,7 @@ static inline Guchar div255(int x) {
   return (Guchar)((x + (x >> 8) + 0x80) >> 8);
 }
 
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 
 #include "GfxState_helpers.h"
 
@@ -572,7 +572,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];
@@ -585,7 +585,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];
@@ -600,7 +600,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];
@@ -613,7 +613,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];
@@ -628,7 +628,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];
@@ -643,7 +643,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];
@@ -658,7 +658,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];
@@ -671,7 +671,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];
@@ -686,7 +686,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];
@@ -699,7 +699,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];
@@ -715,7 +715,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];
@@ -733,7 +733,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];
@@ -748,7 +748,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];
@@ -766,7 +766,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];
@@ -781,7 +781,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];
@@ -796,7 +796,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];
@@ -811,7 +811,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];
@@ -833,7 +833,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];
@@ -849,7 +849,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];
@@ -862,7 +862,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];
@@ -883,7 +883,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];
@@ -896,7 +896,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];
@@ -1007,7 +1007,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;
@@ -1028,7 +1028,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++) {
@@ -1058,7 +1058,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;
@@ -1079,7 +1079,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++) {
@@ -1106,7 +1106,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;
@@ -1125,7 +1125,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++) {
@@ -1151,7 +1151,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;
@@ -1170,7 +1170,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++) {
@@ -1476,7 +1476,7 @@ void SplashOutputDev::startDoc(PDFDoc *docA) {
     delete fontEngine;
   }
   fontEngine = new SplashFontEngine(
-#if HAVE_T1LIB_H
+#ifdef HAVE_T1LIB_H
 				    globalParams->getEnableT1lib(),
 #endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
@@ -1557,7 +1557,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;
@@ -1687,14 +1687,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
@@ -1703,7 +1703,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
@@ -1720,7 +1720,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));
@@ -1736,7 +1736,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
@@ -1753,7 +1753,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));
@@ -1796,7 +1796,7 @@ SplashPattern *SplashOutputDev::getColor(GfxRGB *rgb) {
   return new SplashSolidColor(color);
 }
 
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 SplashPattern *SplashOutputDev::getColor(GfxCMYK *cmyk) {
   SplashColor color;
 
@@ -1819,7 +1819,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
@@ -1844,7 +1844,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);
@@ -1866,7 +1866,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;
@@ -3038,7 +3038,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;
@@ -3063,7 +3063,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
@@ -3078,7 +3078,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)
@@ -3116,7 +3116,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];
@@ -3170,7 +3170,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);
@@ -3229,7 +3229,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)
@@ -3276,7 +3276,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());
@@ -3314,7 +3314,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
@@ -3361,7 +3361,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];
@@ -3393,7 +3393,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);
@@ -3481,7 +3481,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
@@ -3521,7 +3521,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;
@@ -3590,7 +3590,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);
@@ -3625,7 +3625,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		   
@@ -3675,7 +3675,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
@@ -3724,7 +3724,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];
@@ -3756,7 +3756,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);
@@ -3798,14 +3798,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(),
@@ -3919,7 +3919,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) {
@@ -3976,14 +3976,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(),
@@ -4104,7 +4104,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) {
@@ -4266,7 +4266,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)) {
@@ -4382,7 +4382,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
@@ -4420,7 +4420,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);
@@ -4479,7 +4479,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)
@@ -4697,7 +4697,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;
@@ -4773,7 +4773,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);
@@ -4847,7 +4847,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(),
@@ -4912,7 +4912,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/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index 88635d09..0b49ddeb 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -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/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index f5ac11eb..e639beb5 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -839,7 +839,7 @@ namespace Poppler {
     }
 
     bool isOverprintPreviewAvailable() {
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
         return true;
 #else
         return false;
diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc
index 1a55bb57..b9d387a0 100644
--- a/qt4/src/poppler-page.cc
+++ b/qt4/src/poppler-page.cc
@@ -305,7 +305,7 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
 #if defined(HAVE_SPLASH)
       SplashColor bgColor;
       GBool overprintPreview = gFalse;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       overprintPreview = m_page->parentDoc->m_hints & Document::OverprintPreview ? gTrue : gFalse;
       if (overprintPreview)
       {
@@ -338,7 +338,7 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
       }
 
       SplashColorMode colorMode = splashModeXBGR8;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       if (overprintPreview) colorMode = splashModeDeviceN8;
 #endif
  
diff --git a/qt5/src/poppler-document.cc b/qt5/src/poppler-document.cc
index b3261872..3ae96a11 100644
--- a/qt5/src/poppler-document.cc
+++ b/qt5/src/poppler-document.cc
@@ -836,7 +836,7 @@ namespace Poppler {
     }
 
     bool isOverprintPreviewAvailable() {
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
         return true;
 #else
         return false;
diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc
index 3ff676ec..e0672727 100644
--- a/qt5/src/poppler-page.cc
+++ b/qt5/src/poppler-page.cc
@@ -307,7 +307,7 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
 #if defined(HAVE_SPLASH)
       SplashColor bgColor;
       GBool overprintPreview = gFalse;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       overprintPreview = m_page->parentDoc->m_hints & Document::OverprintPreview ? gTrue : gFalse;
       if (overprintPreview)
       {
@@ -340,7 +340,7 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
       }
 
       SplashColorMode colorMode = splashModeXBGR8;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       if (overprintPreview) colorMode = splashModeDeviceN8;
 #endif
 
diff --git a/splash/Splash.cc b/splash/Splash.cc
index a4ea9788..2c78d60a 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -171,7 +171,7 @@ SplashPipeResultColorCtrl Splash::pipeResultColorNoAlphaBlend[] = {
   splashPipeResultColorNoAlphaBlendRGB,
   splashPipeResultColorNoAlphaBlendRGB,
   splashPipeResultColorNoAlphaBlendRGB
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   ,
   splashPipeResultColorNoAlphaBlendCMYK,
   splashPipeResultColorNoAlphaBlendDeviceN
@@ -184,7 +184,7 @@ SplashPipeResultColorCtrl Splash::pipeResultColorAlphaNoBlend[] = {
   splashPipeResultColorAlphaNoBlendRGB,
   splashPipeResultColorAlphaNoBlendRGB,
   splashPipeResultColorAlphaNoBlendRGB
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   ,
   splashPipeResultColorAlphaNoBlendCMYK,
   splashPipeResultColorAlphaNoBlendDeviceN
@@ -197,7 +197,7 @@ SplashPipeResultColorCtrl Splash::pipeResultColorAlphaBlend[] = {
   splashPipeResultColorAlphaBlendRGB,
   splashPipeResultColorAlphaBlendRGB,
   splashPipeResultColorAlphaBlendRGB
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   ,
   splashPipeResultColorAlphaBlendCMYK,
   splashPipeResultColorAlphaBlendDeviceN
@@ -311,7 +311,7 @@ inline void Splash::pipeInit(SplashPipe *pipe, int x, int y,
       pipe->run = &Splash::pipeRunSimpleXBGR8;
     } else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) {
       pipe->run = &Splash::pipeRunSimpleBGR8;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     } else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) {
       pipe->run = &Splash::pipeRunSimpleCMYK8;
     } else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) {
@@ -332,7 +332,7 @@ inline void Splash::pipeInit(SplashPipe *pipe, int x, int y,
       pipe->run = &Splash::pipeRunAAXBGR8;
     } else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) {
       pipe->run = &Splash::pipeRunAABGR8;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     } else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) {
       pipe->run = &Splash::pipeRunAACMYK8;
     } else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) {
@@ -349,7 +349,7 @@ void Splash::pipeRun(SplashPipe *pipe) {
   SplashColorPtr cSrc;
   Guchar cResult0, cResult1, cResult2, cResult3;
   int t;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   int cp, mask;
   Guchar cResult[SPOT_NCOMPS+4];
 #endif
@@ -365,7 +365,7 @@ void Splash::pipeRun(SplashPipe *pipe) {
       pipeIncX(pipe);
       return;
     }
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     if (bitmap->mode == splashModeCMYK8 || bitmap->mode == splashModeDeviceN8) {
       if (state->fillOverprint && state->overprintMode && pipe->pattern->isCMYK()) {
         Guint mask = 15;
@@ -423,7 +423,7 @@ void Splash::pipeRun(SplashPipe *pipe) {
       *pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]];
       *pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]];
       break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     case splashModeCMYK8:
       if (state->overprintMask & 1) {
 	pipe->destColorPtr[0] = (state->overprintAdditive) ? 
@@ -482,12 +482,12 @@ void Splash::pipeRun(SplashPipe *pipe) {
           destColorPtr += (alpha0X+pipe->x) * 3;
           break;
         case splashModeXBGR8:
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
         case splashModeCMYK8:
 #endif
           destColorPtr += (alpha0X+pipe->x) * 4;
           break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
         case splashModeDeviceN8:
           destColorPtr += (alpha0X+pipe->x) * (SPOT_NCOMPS + 4);
           break;
@@ -519,7 +519,7 @@ void Splash::pipeRun(SplashPipe *pipe) {
       cDest[1] = destColorPtr[1];
       cDest[2] = destColorPtr[0];
       break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     case splashModeCMYK8:
       cDest[0] = destColorPtr[0];
       cDest[1] = destColorPtr[1];
@@ -566,7 +566,7 @@ void Splash::pipeRun(SplashPipe *pipe) {
       } else {
 	t = (aDest * 255) / pipe->shape - aDest;
 	switch (bitmap->mode) {
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 	case splashModeDeviceN8:
 	  for (cp = 0; cp < SPOT_NCOMPS + 4; cp++)
 	    cSrcNonIso[cp] = clip255(pipe->cSrc[cp] +
@@ -607,7 +607,7 @@ void Splash::pipeRun(SplashPipe *pipe) {
     //----- blend function
 
     if (state->blendFunc) {
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       if (bitmap->mode == splashModeDeviceN8) {
         for (int k = 4; k < 4 + SPOT_NCOMPS; k++) {
           cBlend[k] = 0;
@@ -654,7 +654,7 @@ void Splash::pipeRun(SplashPipe *pipe) {
       cResult2 = state->rgbTransferB[div255((255 - aDest) * cSrc[2] +
 					    aDest * cBlend[2])];
       break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     case splashPipeResultColorNoAlphaBlendCMYK:
       cResult0 = state->cmykTransferC[div255((255 - aDest) * cSrc[0] +
 					     aDest * cBlend[0])];
@@ -694,7 +694,7 @@ void Splash::pipeRun(SplashPipe *pipe) {
 					aSrc * cSrc[2]) / alphaI];
       }
       break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     case splashPipeResultColorAlphaNoBlendCMYK:
       if (alphaI == 0) {
 	cResult0 = 0;
@@ -754,7 +754,7 @@ void Splash::pipeRun(SplashPipe *pipe) {
 				       alphaI];
       }
       break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     case splashPipeResultColorAlphaBlendCMYK:
       if (alphaI == 0) {
 	cResult0 = 0;
@@ -828,7 +828,7 @@ void Splash::pipeRun(SplashPipe *pipe) {
       *pipe->destColorPtr++ = cResult1;
       *pipe->destColorPtr++ = cResult0;
       break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     case splashModeCMYK8:
       if (state->overprintMask & 1) {
 	pipe->destColorPtr[0] = (state->overprintAdditive) ? 
@@ -945,7 +945,7 @@ void Splash::pipeRunSimpleBGR8(SplashPipe *pipe) {
   ++pipe->x;
 }
 
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 // special case:
 // !pipe->pattern && pipe->noTransparency && !state->blendFunc &&
 // bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) {
@@ -1206,7 +1206,7 @@ void Splash::pipeRunAABGR8(SplashPipe *pipe) {
   ++pipe->x;
 }
 
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 // special case:
 // !pipe->pattern && !pipe->noTransparency && !state->softMask &&
 // pipe->usesShape && !pipe->alpha0Ptr && !state->blendFunc &&
@@ -1345,7 +1345,7 @@ inline void Splash::pipeSetXY(SplashPipe *pipe, int x, int y) {
   case splashModeXBGR8:
     pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x];
     break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   case splashModeCMYK8:
     pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x];
     break;
@@ -1390,7 +1390,7 @@ inline void Splash::pipeIncX(SplashPipe *pipe) {
   case splashModeXBGR8:
     pipe->destColorPtr += 4;
     break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   case splashModeCMYK8:
     pipe->destColorPtr += 4;
     break;
@@ -1967,7 +1967,7 @@ void Splash::clear(SplashColorPtr color, Guchar alpha) {
       }
     }
     break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   case splashModeCMYK8:
     if (color[0] == color[1] && color[1] == color[2] && color[2] == color[3]) {
       if (bitmap->rowSize < 0) {
@@ -2188,7 +2188,7 @@ SplashPath *Splash::flattenPath(SplashPath *path, SplashCoord *matrix,
   int i;
 
   fPath = new SplashPath();
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
   flatness2 = flatness;
 #else
   flatness2 = flatness * flatness;
@@ -2257,7 +2257,7 @@ void Splash::flattenCurve(SplashCoord x0, SplashCoord y0,
     // line)
     transform(matrix, (xl0 + xr3) * 0.5, (yl0 + yr3) * 0.5, &mx, &my);
     transform(matrix, xx1, yy1, &tx, &ty);
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
     d1 = splashDist(tx, ty, mx, my);
 #else
     dx = tx - mx;
@@ -2265,7 +2265,7 @@ void Splash::flattenCurve(SplashCoord x0, SplashCoord y0,
     d1 = dx*dx + dy*dy;
 #endif
     transform(matrix, xx2, yy2, &tx, &ty);
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
     d2 = splashDist(tx, ty, mx, my);
 #else
     dx = tx - mx;
@@ -3712,7 +3712,7 @@ SplashError Splash::drawImage(SplashImageSource src, SplashICCTransform tf, void
     ok = srcMode == splashModeBGR8;
     nComps = 3;
     break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   case splashModeCMYK8:
     ok = srcMode == splashModeCMYK8;
     nComps = 4;
@@ -4192,7 +4192,7 @@ void Splash::scaleImageYdXd(SplashImageSource src, void *srcData,
   Guchar *lineBuf, *alphaLineBuf;
   Guint *pixBuf, *alphaPixBuf;
   Guint pix0, pix1, pix2;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   Guint pix3;
   Guint pix[SPOT_NCOMPS+4], cp;
 #endif
@@ -4350,7 +4350,7 @@ void Splash::scaleImageYdXd(SplashImageSource src, void *srcData,
 	*destPtr++ = (Guchar)pix0;
 	break;
 
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       case splashModeCMYK8:
 
 	// compute the final pixel
@@ -4535,7 +4535,7 @@ void Splash::scaleImageYdXu(SplashImageSource src, void *srcData,
 	  *destPtr++ = (Guchar)pix[0];
 	}
 	break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       case splashModeCMYK8:
 	for (i = 0; i < xStep; ++i) {
 	  *destPtr++ = (Guchar)pix[0];
@@ -4685,7 +4685,7 @@ void Splash::scaleImageYuXd(SplashImageSource src, void *srcData,
 	  *destPtr++ = (Guchar)pix[0];
 	}
 	break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       case splashModeCMYK8:
 	for (i = 0; i < yStep; ++i) {
 	  destPtr = destPtr0 + (i * scaledWidth + x) * nComps;
@@ -4838,7 +4838,7 @@ void Splash::scaleImageYuXu(SplashImageSource src, void *srcData,
 	  }
 	}
 	break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       case splashModeCMYK8:
 	for (i = 0; i < yStep; ++i) {
 	  for (j = 0; j < xStep; ++j) {
@@ -4999,7 +4999,7 @@ void Splash::scaleImageYuXuBilinear(SplashImageSource src, void *srcData,
           *destPtr++ = (Guchar)pix[1];
           *destPtr++ = (Guchar)pix[0];
           break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
         case splashModeCMYK8:
           *destPtr++ = (Guchar)pix[0];
           *destPtr++ = (Guchar)pix[1];
@@ -5326,7 +5326,7 @@ void Splash::compositeBackground(SplashColorPtr color) {
   SplashColorPtr p;
   Guchar *q;
   Guchar alpha, alpha1, c, color0, color1, color2;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   Guchar color3;
   Guchar colorsp[SPOT_NCOMPS+4], cp;
 #endif
@@ -5428,7 +5428,7 @@ void Splash::compositeBackground(SplashColorPtr color) {
       }
     }
     break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   case splashModeCMYK8:
     color0 = color[0];
     color1 = color[1];
@@ -5537,7 +5537,7 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading)
     case splashModeXBGR8:
       colorComps=4;
     break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     case splashModeCMYK8:
       colorComps=4;
     break;
@@ -5878,7 +5878,7 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
       }
     }
     break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   case splashModeCMYK8:
     for (y = 0; y < h; ++y) {
       p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest];
@@ -6027,7 +6027,7 @@ SplashPath *pathIn, *dashPath, *pathOut;
 	 ++k1) ;
 
     // compute the deltas for segment (i1, j0)
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
     // the 1/d value can be small, which introduces significant
     // inaccuracies in fixed point mode
     d = splashDist(pathIn->pts[i1].x, pathIn->pts[i1].y,
@@ -6128,7 +6128,7 @@ SplashPath *pathIn, *dashPath, *pathOut;
     if (!last || closed) {
 
       // compute the deltas for segment (j1, k0)
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
       // the 1/d value can be small, which introduces significant
       // inaccuracies in fixed point mode
       d = splashDist(pathIn->pts[j1].x, pathIn->pts[j1].y,
diff --git a/splash/Splash.h b/splash/Splash.h
index 3ca15c38..87e56093 100644
--- a/splash/Splash.h
+++ b/splash/Splash.h
@@ -62,7 +62,7 @@ typedef void (*SplashICCTransform)(void *data, SplashBitmap *bitmap);
 //------------------------------------------------------------------------
 
 enum SplashPipeResultColorCtrl {
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   splashPipeResultColorNoAlphaBlendCMYK,
   splashPipeResultColorNoAlphaBlendDeviceN,
 #endif
@@ -70,13 +70,13 @@ enum SplashPipeResultColorCtrl {
   splashPipeResultColorNoAlphaBlendMono,
   splashPipeResultColorAlphaNoBlendMono,
   splashPipeResultColorAlphaNoBlendRGB,
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   splashPipeResultColorAlphaNoBlendCMYK,
   splashPipeResultColorAlphaNoBlendDeviceN,
 #endif
   splashPipeResultColorAlphaBlendMono,
   splashPipeResultColorAlphaBlendRGB
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   ,
   splashPipeResultColorAlphaBlendCMYK,
   splashPipeResultColorAlphaBlendDeviceN
@@ -298,7 +298,7 @@ private:
   void pipeRunSimpleRGB8(SplashPipe *pipe);
   void pipeRunSimpleXBGR8(SplashPipe *pipe);
   void pipeRunSimpleBGR8(SplashPipe *pipe);
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   void pipeRunSimpleCMYK8(SplashPipe *pipe);
   void pipeRunSimpleDeviceN8(SplashPipe *pipe);
 #endif
@@ -307,7 +307,7 @@ private:
   void pipeRunAARGB8(SplashPipe *pipe);
   void pipeRunAAXBGR8(SplashPipe *pipe);
   void pipeRunAABGR8(SplashPipe *pipe);
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   void pipeRunAACMYK8(SplashPipe *pipe);
   void pipeRunAADeviceN8(SplashPipe *pipe);
 #endif
diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc
index 060a858e..5acee7d0 100644
--- a/splash/SplashBitmap.cc
+++ b/splash/SplashBitmap.cc
@@ -90,7 +90,7 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPadA,
       rowSize = -1;
     }
     break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   case splashModeCMYK8:
     if (width > 0 && width <= INT_MAX / 4) {
       rowSize = width * 4;
@@ -247,7 +247,7 @@ SplashError SplashBitmap::writePNMFile(FILE *f) {
     }
     break;
 
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   case splashModeCMYK8:
   case splashModeDeviceN8:
     // PNM doesn't support CMYK
@@ -308,7 +308,7 @@ void SplashBitmap::getPixel(int x, int y, SplashColorPtr pixel) {
     pixel[1] = p[1];
     pixel[2] = p[0];
     break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   case splashModeCMYK8:
     p = &data[y * rowSize + 4 * x];
     pixel[0] = p[0];
@@ -376,7 +376,7 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in
     #endif
 
     #ifdef ENABLE_LIBJPEG
-    #if SPLASH_CMYK
+    #ifdef SPLASH_CMYK
     case splashFormatJpegCMYK:
       writer = new JpegWriter(JpegWriter::CMYK);
       setJpegParams(writer, params);
@@ -403,7 +403,7 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in
       case splashModeBGR8:
         writer = new TiffWriter(TiffWriter::RGB);
         break;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       case splashModeCMYK8:
       case splashModeDeviceN8:
         writer = new TiffWriter(TiffWriter::CMYK);
@@ -443,7 +443,7 @@ void SplashBitmap::getRGBLine(int yl, SplashColorPtr line) {
     m = byteToDbl(col[1]);
     y = byteToDbl(col[2]);
     k = byteToDbl(col[3]);
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     if (separationList->getLength() > 0) {
       for (int i = 0; i < separationList->getLength(); i++) {
         if (col[i+4] > 0) {
@@ -489,7 +489,7 @@ void SplashBitmap::getXBGRLine(int yl, SplashColorPtr line, ConversionMode conve
     m = byteToDbl(col[1]);
     y = byteToDbl(col[2]);
     k = byteToDbl(col[3]);
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     if (separationList->getLength() > 0) {
       for (int i = 0; i < separationList->getLength(); i++) {
         if (col[i+4] > 0) {
@@ -593,7 +593,7 @@ GBool SplashBitmap::convertToXBGR(ConversionMode conversionMode) {
   return newdata != NULL;
 }
 
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 void SplashBitmap::getCMYKLine(int yl, SplashColorPtr line) {
   SplashColor col;
 
@@ -637,7 +637,7 @@ void SplashBitmap::getCMYKLine(int yl, SplashColorPtr line) {
 
 SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI, SplashColorMode imageWriterFormat) {
   if (mode != splashModeRGB8 && mode != splashModeMono8 && mode != splashModeMono1 && mode != splashModeXBGR8 && mode != splashModeBGR8
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
       && mode != splashModeCMYK8 && mode != splashModeDeviceN8
 #endif
      ) {
@@ -650,7 +650,7 @@ SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int
   }
 
   switch (mode) {
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     case splashModeCMYK8:
       if (writer->supportCMYK()) {
         SplashColorPtr row;
diff --git a/splash/SplashBitmap.h b/splash/SplashBitmap.h
index deb65c12..ccd3e7d9 100644
--- a/splash/SplashBitmap.h
+++ b/splash/SplashBitmap.h
@@ -96,7 +96,7 @@ public:
   void getPixel(int x, int y, SplashColorPtr pixel);
   void getRGBLine(int y, SplashColorPtr line);
   void getXBGRLine(int y, SplashColorPtr line, ConversionMode conversionMode = conversionOpaque);
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   void getCMYKLine(int y, SplashColorPtr line);
 #endif
   Guchar getAlpha(int x, int y);
diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc
index b785826d..38911d3b 100644
--- a/splash/SplashFTFont.cc
+++ b/splash/SplashFTFont.cc
@@ -65,7 +65,7 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
   FT_Face face;
   int div;
   int x, y;
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
   SplashCoord scale;
 #endif
 
@@ -87,7 +87,7 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
 
   div = face->bbox.xMax > 20000 ? 65536 : 1;
 
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
   scale = (SplashCoord)1 / (SplashCoord)face->units_per_EM;
 
   // transform the four corners of the font bounding box -- the min
@@ -204,7 +204,7 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
   }
 
   // compute the transform matrix
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
   matrix.xx = (FT_Fixed)((mat[0] / size).get16Dot16());
   matrix.yx = (FT_Fixed)((mat[1] / size).get16Dot16());
   matrix.xy = (FT_Fixed)((mat[2] / size).get16Dot16());
diff --git a/splash/SplashFontEngine.h b/splash/SplashFontEngine.h
index 6502ea5a..6888d84b 100644
--- a/splash/SplashFontEngine.h
+++ b/splash/SplashFontEngine.h
@@ -54,7 +54,7 @@ public:
 
   // Create a font engine.
   SplashFontEngine(
-#if HAVE_T1LIB_H
+#ifdef HAVE_T1LIB_H
 		   GBool enableT1lib,
 #endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
@@ -99,7 +99,7 @@ private:
 
   SplashFont *fontCache[splashFontCacheSize];
 
-#if HAVE_T1LIB_H
+#ifdef HAVE_T1LIB_H
   SplashT1FontEngine *t1Engine;
 #endif
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
diff --git a/splash/SplashMath.h b/splash/SplashMath.h
index ca73c2bd..a56bd12b 100644
--- a/splash/SplashMath.h
+++ b/splash/SplashMath.h
@@ -23,7 +23,7 @@
 
 #include "poppler-config.h"
 
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
 #include "goo/FixedPoint.h"
 #else
 #include <math.h>
@@ -31,9 +31,9 @@
 #include "SplashTypes.h"
 
 static inline SplashCoord splashAbs(SplashCoord x) {
-#if USE_FIXEDPOINT
+#if defined(USE_FIXEDPOINT)
   return FixedPoint::abs(x);
-#elif USE_FLOAT
+#elif defined(USE_FLOAT)
   return fabsf(x);
 #else
   return fabs(x);
@@ -41,11 +41,11 @@ static inline SplashCoord splashAbs(SplashCoord x) {
 }
 
 static inline int splashFloor(SplashCoord x) {
-  #if USE_FIXEDPOINT
+#if defined(USE_FIXEDPOINT)
     return FixedPoint::floor(x);
-  #elif USE_FLOAT
+#elif defined(USE_FLOAT)
     return (int)floorf(x);
-  #elif __GNUC__ && __i386__
+#elif defined(__GNUC__) && defined(__i386__)
     // floor() and (int)() are implemented separately, which results
     // in changing the FPCW multiple times - so we optimize it with
     // some inline assembly
@@ -64,7 +64,7 @@ static inline int splashFloor(SplashCoord x) {
 		   : "=m" (oldCW), "=m" (newCW), "=m" (result), "=r" (t)
 		   : "m" (x));
     return result;
-  #elif defined(WIN32) && defined(_M_IX86)
+#elif defined(WIN32) && defined(_M_IX86)
     // floor() and (int)() are implemented separately, which results
     // in changing the FPCW multiple times - so we optimize it with
     // some inline assembly
@@ -81,18 +81,18 @@ static inline int splashFloor(SplashCoord x) {
     __asm fistp DWORD PTR result
     __asm fldcw WORD PTR oldCW
     return result;
-  #else
+#else
     if (x > 0) return (int)x;
     else return (int)floor(x);
-  #endif
+#endif
 }
 
 static inline int splashCeil(SplashCoord x) {
-#if USE_FIXEDPOINT
+#if defined(USE_FIXEDPOINT)
   return FixedPoint::ceil(x);
-#elif USE_FLOAT
+#elif defined(USE_FLOAT)
   return (int)ceilf(x);
-#elif __GNUC__ && __i386__
+#elif defined(__GNUC__) && defined(__i386__)
   // ceil() and (int)() are implemented separately, which results
   // in changing the FPCW multiple times - so we optimize it with
   // some inline assembly
@@ -134,9 +134,9 @@ static inline int splashCeil(SplashCoord x) {
 }
 
 static inline int splashRound(SplashCoord x) {
-#if USE_FIXEDPOINT
+#if defined(USE_FIXEDPOINT)
   return FixedPoint::round(x);
-#elif __GNUC__ && __i386__
+#elif defined(__GNUC__) && defined(__i386__)
   // this could use round-to-nearest mode and avoid the "+0.5",
   // but that produces slightly different results (because i+0.5
   // sometimes rounds up and sometimes down using the even rule)
@@ -180,7 +180,7 @@ static inline int splashRound(SplashCoord x) {
 }
 
 static inline SplashCoord splashAvg(SplashCoord x, SplashCoord y) {
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
   return FixedPoint::avg(x, y);
 #else
   return 0.5 * (x + y);
@@ -188,9 +188,9 @@ static inline SplashCoord splashAvg(SplashCoord x, SplashCoord y) {
 }
  
 static inline SplashCoord splashSqrt(SplashCoord x) {
-#if USE_FIXEDPOINT
+#if defined(USE_FIXEDPOINT)
   return FixedPoint::sqrt(x);
-#elif USE_FLOAT
+#elif defined(USE_FLOAT)
   return sqrtf(x);
 #else
   return sqrt(x);
@@ -198,9 +198,9 @@ static inline SplashCoord splashSqrt(SplashCoord x) {
 }
 
 static inline SplashCoord splashPow(SplashCoord x, SplashCoord y) {
-#if USE_FIXEDPOINT
+#if defined(USE_FIXEDPOINT)
   return FixedPoint::pow(x, y);
-#elif USE_FLOAT
+#elif defined(USE_FLOAT)
   return powf(x, y);
 #else
   return pow(x, y);
@@ -212,7 +212,7 @@ static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0,
   SplashCoord dx, dy;
   dx = x1 - x0;
   dy = y1 - y0;
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
   // this handles the situation where dx*dx or dy*dy is too large to
   // fit in the 16.16 fixed point format
   SplashCoord dxa, dya, d;
@@ -235,7 +235,7 @@ static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0,
 static inline GBool splashCheckDet(SplashCoord m11, SplashCoord m12,
 				   SplashCoord m21, SplashCoord m22,
 				   SplashCoord epsilon) {
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
   return FixedPoint::checkDet(m11, m12, m21, m22, epsilon);
 #else
   return fabs(m11 * m22 - m12 * m21) >= epsilon;
diff --git a/splash/SplashState.cc b/splash/SplashState.cc
index f0c98c5e..ac10185d 100644
--- a/splash/SplashState.cc
+++ b/splash/SplashState.cc
@@ -39,7 +39,7 @@
 // number of components in each color mode
 int splashColorModeNComps[] = {
   1, 1, 3, 3, 4
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   , 4, 4 + SPOT_NCOMPS
 #endif
 };
@@ -83,7 +83,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias,
     rgbTransferG[i] = (Guchar)i;
     rgbTransferB[i] = (Guchar)i;
     grayTransfer[i] = (Guchar)i;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     cmykTransferC[i] = (Guchar)i;
     cmykTransferM[i] = (Guchar)i;
     cmykTransferY[i] = (Guchar)i;
@@ -136,7 +136,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias,
     rgbTransferG[i] = (Guchar)i;
     rgbTransferB[i] = (Guchar)i;
     grayTransfer[i] = (Guchar)i;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
     cmykTransferC[i] = (Guchar)i;
     cmykTransferM[i] = (Guchar)i;
     cmykTransferY[i] = (Guchar)i;
@@ -187,7 +187,7 @@ SplashState::SplashState(SplashState *state) {
   memcpy(rgbTransferG, state->rgbTransferG, 256);
   memcpy(rgbTransferB, state->rgbTransferB, 256);
   memcpy(grayTransfer, state->grayTransfer, 256);
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   memcpy(cmykTransferC, state->cmykTransferC, 256);
   memcpy(cmykTransferM, state->cmykTransferM, 256);
   memcpy(cmykTransferY, state->cmykTransferY, 256);
@@ -249,7 +249,7 @@ void SplashState::setSoftMask(SplashBitmap *softMaskA) {
 
 void SplashState::setTransfer(Guchar *red, Guchar *green, Guchar *blue,
 			      Guchar *gray) {
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   int i;
 
   for (i = 0; i < 256; ++i) {
diff --git a/splash/SplashState.h b/splash/SplashState.h
index fea76035..38e34fda 100644
--- a/splash/SplashState.h
+++ b/splash/SplashState.h
@@ -124,7 +124,7 @@ private:
          rgbTransferG[256],
          rgbTransferB[256];
   Guchar grayTransfer[256];
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   Guchar cmykTransferC[256],
          cmykTransferM[256],
          cmykTransferY[256],
diff --git a/splash/SplashTypes.h b/splash/SplashTypes.h
index 5ea81600..19b0570c 100644
--- a/splash/SplashTypes.h
+++ b/splash/SplashTypes.h
@@ -31,10 +31,10 @@
 // coordinates
 //------------------------------------------------------------------------
 
-#if USE_FIXEDPOINT
+#if defined(USE_FIXEDPOINT)
 #include "goo/FixedPoint.h"
 typedef FixedPoint SplashCoord;
-#elif USE_FLOAT
+#elif defined(USE_FLOAT)
 typedef float SplashCoord;
 #else
 typedef double SplashCoord;
@@ -64,7 +64,7 @@ enum SplashColorMode {
 				//   BGRBGR...
   splashModeXBGR8		// 1 byte per component, 4 bytes per pixel:
 				//   XBGRXBGR...
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   ,
   splashModeCMYK8,	// 1 byte per component, 4 bytes per pixel:
 				//   CMYKCMYK...
@@ -85,7 +85,7 @@ enum SplashThinLineMode {
 extern int splashColorModeNComps[];
 
 // max number of components in any SplashColor
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 #define splashMaxColorComps SPOT_NCOMPS+4
 #else
 #define splashMaxColorComps 4
@@ -104,7 +104,7 @@ static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; }
 static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; }
 static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; }
 
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 // CMYK8
 static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; }
 static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; }
@@ -123,7 +123,7 @@ static inline void splashClearColor(SplashColorPtr dest) {
   dest[0] = 0;
   dest[1] = 0;
   dest[2] = 0;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   dest[3] = 0;
   for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++)
     dest[i] = 0;
@@ -134,7 +134,7 @@ static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
   dest[0] = src[0];
   dest[1] = src[1];
   dest[2] = src[2];
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   dest[3] = src[3];
   for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++)
     dest[i] = src[i];
@@ -145,7 +145,7 @@ static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) {
   dest[0] ^= src[0];
   dest[1] ^= src[1];
   dest[2] ^= src[2];
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   dest[3] ^= src[3];
   for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++)
     dest[i] ^= src[i];
diff --git a/splash/SplashXPath.cc b/splash/SplashXPath.cc
index 27106ee3..23db4eb8 100644
--- a/splash/SplashXPath.cc
+++ b/splash/SplashXPath.cc
@@ -289,7 +289,7 @@ void SplashXPath::addCurve(SplashCoord x0, SplashCoord y0,
   SplashCoord dx, dy, mx, my, d1, d2, flatness2;
   int p1, p2, p3;
 
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
   flatness2 = flatness;
 #else
   flatness2 = flatness * flatness;
@@ -333,7 +333,7 @@ void SplashXPath::addCurve(SplashCoord x0, SplashCoord y0,
     // line)
     mx = (xl0 + xr3) * 0.5;
     my = (yl0 + yr3) * 0.5;
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
     d1 = splashDist(xx1, yy1, mx, my);
     d2 = splashDist(xx2, yy2, mx, my);
 #else
@@ -411,7 +411,7 @@ void SplashXPath::addSegment(SplashCoord x0, SplashCoord y0,
     segs[length].dxdy = segs[length].dydx = 0;
     segs[length].flags |= splashXPathVert;
   } else {
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
     if (FixedPoint::divCheck(x1 - x0, y1 - y0, &segs[length].dxdy)) {
       segs[length].dydx = (SplashCoord)1 / segs[length].dxdy;
     } else {
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 8da5327b..e320525c 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -90,7 +90,7 @@ static GBool tiff = gFalse;
 static GooString jpegOpt;
 static int jpegQuality = -1;
 static bool jpegProgressive = false;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 static GBool overprint = gFalse;
 #endif
 static char enableFreeTypeStr[16] = "";
@@ -159,14 +159,14 @@ static const ArgDesc argDesc[] = {
 #if ENABLE_LIBJPEG
   {"-jpeg",   argFlag,     &jpeg,           0,
    "generate a JPEG file"},
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   {"-jpegcmyk",argFlag,    &jpegcmyk,       0,
    "generate a CMYK JPEG file"},
 #endif
   {"-jpegopt",  argGooString, &jpegOpt,    0,
    "jpeg options, with format <opt1>=<val1>[,<optN>=<valN>]*"},
 #endif
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   {"-overprint",argFlag,   &overprint,      0,
    "enable overprint"},
 #endif
@@ -350,7 +350,7 @@ static void processPageJobs() {
     // process the job    
     SplashOutputDev *splashOut = new SplashOutputDev(mono ? splashModeMono1 :
                   gray ? splashModeMono8 :
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
         			    (jpegcmyk || overprint) ? splashModeDeviceN8 :
 #endif
 		              splashModeRGB8, 4, gFalse, *pageJob.paperColor, gTrue, thinLineMode);
@@ -517,7 +517,7 @@ int main(int argc, char *argv[]) {
   }
 
   // write PPM files
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   if (jpegcmyk || overprint) {
     globalParams->setOverprintPreview(gTrue);
     for (int cp = 0; cp < SPOT_NCOMPS+4; cp++)
@@ -534,7 +534,7 @@ int main(int argc, char *argv[]) {
 
   splashOut = new SplashOutputDev(mono ? splashModeMono1 :
 				    gray ? splashModeMono8 :
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 				    (jpegcmyk || overprint) ? splashModeDeviceN8 :
 #endif
 				             splashModeRGB8, 4,
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index b1339f23..19651c31 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -112,7 +112,7 @@ static char userPassword[33] = "\001";
 static GBool quiet = gFalse;
 static GBool printVersion = gFalse;
 static GBool printHelp = gFalse;
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
 static GBool overprint = gFalse;
 #endif
 
@@ -185,7 +185,7 @@ static const ArgDesc argDesc[] = {
    "owner password (for encrypted files)"},
   {"-upw",        argString,   userPassword,    sizeof(userPassword),
    "user password (for encrypted files)"},
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   {"-overprint",argFlag,   &overprint,      0,
    "enable overprint"},
 #endif
@@ -286,7 +286,7 @@ int main(int argc, char *argv[]) {
       goto err0;
     }
   }
-#if SPLASH_CMYK
+#ifdef SPLASH_CMYK
   if (overprint) {
     globalParams->setOverprintPreview(gTrue);
   }
commit 9bb84057624c3b2f8fc5d137e70ae34efa46fe31
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 13:27:10 2017 +1030

    glib demo: fix deprecated warnings

diff --git a/glib/demo/utils.c b/glib/demo/utils.c
index 8194ff2b..ad9405aa 100644
--- a/glib/demo/utils.c
+++ b/glib/demo/utils.c
@@ -274,8 +274,13 @@ pgd_action_view_play_rendition (GtkWidget    *button,
 		uri = g_file_get_uri (file);
 		g_object_unref (file);
 		if (uri) {
+#if GTK_CHECK_VERSION(3, 22, 0)
+			gtk_show_uri_on_window (GTK_WINDOW(gtk_widget_get_window (button)),
+				      uri, GDK_CURRENT_TIME, NULL);
+#else
 			gtk_show_uri (gtk_widget_get_screen (button),
 				      uri, GDK_CURRENT_TIME, NULL);
+#endif
 			g_free (uri);
 		}
 	}
@@ -537,9 +542,14 @@ pgd_movie_view_play_movie (GtkWidget    *button,
 	uri = g_file_get_uri (file);
 	g_object_unref (file);
 	if (uri) {
-		gtk_show_uri (gtk_widget_get_screen (button),
-			      uri, GDK_CURRENT_TIME, NULL);
-		g_free (uri);
+#if GTK_CHECK_VERSION(3, 22, 0)
+	    gtk_show_uri_on_window (GTK_WINDOW(gtk_widget_get_window (button)),
+				    uri, GDK_CURRENT_TIME, NULL);
+#else
+	    gtk_show_uri (gtk_widget_get_screen (button),
+			  uri, GDK_CURRENT_TIME, NULL);
+#endif
+	    g_free (uri);
 	}
 }
 
commit 5d954d1c4f25447f70d949e31afeeefb70c2a8d5
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 12:53:38 2017 +1030

    Fix warning: implicit declaration of function ‘localtime_r’
    
    poppler/glib/demo/utils.c:488:20: warning: implicit declaration of function ‘localtime_r’ [-Wimplicit-function-declaration]
      if (time == 0 || !localtime_r (&time, &t)) return NULL;
                          ^~~~~~~~~~~
    
    The c files also need the -D_DEFAULT_SOURCE feature macro to enable non standard C++11 functons.

diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
index ba4bceb3..05b69476 100644
--- a/cmake/modules/PopplerMacros.cmake
+++ b/cmake/modules/PopplerMacros.cmake
@@ -132,7 +132,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
   set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g3 -fno-inline ${_save_cxxflags}")
   set(CMAKE_CXX_FLAGS_PROFILE        "-g3 -fno-inline -ftest-coverage -fprofile-arcs ${_save_cxxflags}")
   set(_save_cflags "${CMAKE_C_FLAGS}")
-  set(CMAKE_C_FLAGS                  "-std=c99")
+  set(CMAKE_C_FLAGS                  "-std=c99 -D_DEFAULT_SOURCE")
   set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g ${_save_cflags}")
   set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG ${_save_cflags}")
   set(CMAKE_C_FLAGS_DEBUG            "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline ${_save_cflags}")
commit 8ccc9efb6c5f717b8cd206a92f802c66bc0a69c7
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 1 12:35:19 2017 +1030

    Fix warning: comparison of unsigned expression < 0 is always false

diff --git a/poppler/FlateEncoder.cc b/poppler/FlateEncoder.cc
index 49a0fa37..def50a04 100644
--- a/poppler/FlateEncoder.cc
+++ b/poppler/FlateEncoder.cc
@@ -127,7 +127,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/poppler/StructTreeRoot.cc b/poppler/StructTreeRoot.cc
index b8c52c64..f7c7153b 100644
--- a/poppler/StructTreeRoot.cc
+++ b/poppler/StructTreeRoot.cc
@@ -66,8 +66,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;
           }


More information about the poppler mailing list