Merge remote-tracking branch 'origin/master' into better_object
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 576b1f9..390a6b5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,7 +22,7 @@
 endif()
 
 set(POPPLER_MAJOR_VERSION "0")
-set(POPPLER_MINOR_VERSION "56")
+set(POPPLER_MINOR_VERSION "57")
 set(POPPLER_MICRO_VERSION "0")
 set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}")
 
@@ -539,7 +539,7 @@
 else(MSVC)
 add_library(poppler SHARED ${poppler_SRCS})
 endif(MSVC)
-set_target_properties(poppler PROPERTIES VERSION 67.0.0 SOVERSION 67)
+set_target_properties(poppler PROPERTIES VERSION 68.0.0 SOVERSION 68)
 target_link_libraries(poppler LINK_PRIVATE ${poppler_LIBS})
 install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
 
diff --git a/NEWS b/NEWS
index 0ca52ca..2a8c537 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,17 @@
+Release 0.57.0
+        core:
+         * Fix parsing of Type 1 fonts with newlines in encoding sequences. Bug #101728
+         * Fix crash in broken documents
+
+        utils:
+         * pdfunite: Fix crash with broken documents. Bug #101208
+         * pdftohtml: skip control characters Bug #101770
+         * pdfseparate: minor improvement to the documentation. Bug #101800
+
+        build system:
+         * cmake: Set RUNPATH for poppler shared libs. Bug #101945
+         * configure: fix --disable-FEATURE actually enabling the feature
+
 Release 0.56.0
         core:
          * FormFieldButton::setState() shouldn't check the field is readOnly
diff --git a/configure.ac b/configure.ac
index 98d497a..1cf8b29 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 m4_define([poppler_version_major],[0])
-m4_define([poppler_version_minor],[56])
+m4_define([poppler_version_minor],[57])
 m4_define([poppler_version_micro],[0])
 m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro])
 
@@ -122,16 +122,36 @@
 fi
 
 AC_ARG_ENABLE(single-precision,
-[  --enable-single-precision     use single precision arithmetic (instead of double precision) in the Splash backend],
-AC_DEFINE(USE_FLOAT,      [1], [Use single precision arithmetic in the Splash backend]))
+        AC_HELP_STRING([--enable-single-precision],
+                       [use single precision arithmetic (instead of double
+                        precision) in the Splash backend]),
+        enable_single_precision=$enableval,
+        enable_single_precision=no)
+if test x$enable_single_precision != xno; then
+        AC_DEFINE(USE_FLOAT, [1], [Use single precision arithmetic in the Splash backend])
+fi
 
 AC_ARG_ENABLE(fixedpoint,
-[  --enable-fixedpoint     use fixed point (instead of double precision) arithmetic in the Splash backend],
-AC_DEFINE(USE_FIXEDPOINT, [1], [Use fixed point arithmetic in the Splash backend]))
+        AC_HELP_STRING([--enable-fixedpoint],
+                       [use fixed point (instead of double precision) arithmetic
+                        in the Splash backend]),
+        enable_fixedpoint=$enableval,
+        enable_fixedpoint=no)
+if test x$enable_fixedpoint != xno; then
+        if test x$enable_single_precision != xno; then
+                AC_MSG_ERROR([Choose only one of --enable-single-precision or --enable-fixedpoint!])
+        fi
+        AC_DEFINE(USE_FIXEDPOINT, [1], [Use fixed point arithmetic in the Splash backend])
+fi
 
 AC_ARG_ENABLE(cmyk,
-[  --enable-cmyk           Include support for CMYK rasterization],
-AC_DEFINE(SPLASH_CMYK, [1], [Include support for CMYK rasterization]))
+        AC_HELP_STRING([--enable-cmyk],
+                       [Include support for CMYK rasterization]),
+        enable_cmyk=$enableval,
+        enable_cmyk=no)
+if test x$enable_cmyk != xno; then
+        AC_DEFINE(SPLASH_CMYK, [1], [Include support for CMYK rasterization])
+fi
 
 dnl Relocation support
 AC_ARG_ENABLE(relocatable,
diff --git a/cpp/Doxyfile b/cpp/Doxyfile
index 53d1452..7322471 100644
--- a/cpp/Doxyfile
+++ b/cpp/Doxyfile
@@ -31,7 +31,7 @@
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER         = 0.56.0
+PROJECT_NUMBER         = 0.57.0
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
 # base path where the generated documentation will be put.
diff --git a/poppler/CurlCachedFile.h b/poppler/CurlCachedFile.h
index 49882ab..80e6972 100644
--- a/poppler/CurlCachedFile.h
+++ b/poppler/CurlCachedFile.h
@@ -25,8 +25,8 @@
 
   CurlCachedFileLoader();
   ~CurlCachedFileLoader();
-  size_t init(GooString *url, CachedFile* cachedFile);
-  int load(const std::vector<ByteRange> &ranges, CachedFileWriter *writer);
+  size_t init(GooString *url, CachedFile* cachedFile) override;
+  int load(const std::vector<ByteRange> &ranges, CachedFileWriter *writer) override;
 
 private:
 
diff --git a/poppler/CurlPDFDocBuilder.h b/poppler/CurlPDFDocBuilder.h
index fb34862..43b442d 100644
--- a/poppler/CurlPDFDocBuilder.h
+++ b/poppler/CurlPDFDocBuilder.h
@@ -25,8 +25,8 @@
 public:
 
   PDFDoc *buildPDFDoc(const GooString &uri, GooString *ownerPassword = NULL,
-    GooString *userPassword = NULL, void *guiDataA = NULL);
-  GBool supports(const GooString &uri);
+    GooString *userPassword = NULL, void *guiDataA = NULL) override;
+  GBool supports(const GooString &uri) override;
 
 };
 
diff --git a/poppler/Makefile.am b/poppler/Makefile.am
index 3448c1e..b2970cb 100644
--- a/poppler/Makefile.am
+++ b/poppler/Makefile.am
@@ -327,7 +327,7 @@
 	$(win32_libs)
 
 libpoppler_la_LDFLAGS =				\
-	-version-info 67:0:0			\
+	-version-info 68:0:0			\
 	@create_shared_lib@			\
 	@auto_import_flags@
 
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 2949915..b2d6d3a 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -3237,10 +3237,10 @@
   int nStripes, stripeH, stripeY;
   int c, w, h, x, y, comp, i;
   int numComps, initialNumComps;
-#endif
   char hexBuf[32*2 + 2];	// 32 values X 2 chars/value + line ending + null
   Guchar digit;
   GBool isGray;
+#endif
 
   if (!postInitDone) {
     postInit();
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index 649fbbd..df76765 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -215,7 +215,6 @@
   int encoding;
   GBool endOfLine, byteAlign, endOfBlock, black;
   int columns, rows;
-  int colorXform;
   Object globals, obj;
 
   if (!strcmp(name, "ASCIIHexDecode") || !strcmp(name, "AHx")) {
@@ -289,14 +288,14 @@
     str = new CCITTFaxStream(str, encoding, endOfLine, byteAlign,
 			     columns, rows, endOfBlock, black);
   } else if (!strcmp(name, "DCTDecode") || !strcmp(name, "DCT")) {
-    colorXform = -1;
+#if HAVE_DCT_DECODER
+    int colorXform = -1;
     if (params->isDict()) {
       obj = params->dictLookup("ColorTransform", recursion);
       if (obj.isInt()) {
 	colorXform = obj.getInt();
       }
     }
-#ifdef HAVE_DCT_DECODER
     str = new DCTStream(str, colorXform, dict, recursion);
 #else
     error(errSyntaxError, getPos(), "Unknown filter '{0:s}'", name);
diff --git a/poppler/StructTreeRoot.cc b/poppler/StructTreeRoot.cc
index 5af530e..b8c52c6 100644
--- a/poppler/StructTreeRoot.cc
+++ b/poppler/StructTreeRoot.cc
@@ -6,6 +6,7 @@
 //
 // Copyright 2013, 2014 Igalia S.L.
 // Copyright 2014 Fabio D'Urso <fabiodurso@hotmail.it>
+// Copyright 2017 Jan-Erik S <janerik234678@gmail.com>
 // Copyright 2017 Albert Astals Cid <aacid@kde.org>
 //
 //========================================================================
diff --git a/qt4/src/Doxyfile b/qt4/src/Doxyfile
index b85278d..1e1503b 100644
--- a/qt4/src/Doxyfile
+++ b/qt4/src/Doxyfile
@@ -31,7 +31,7 @@
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER         = 0.56.0
+PROJECT_NUMBER         = 0.57.0
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
 # base path where the generated documentation will be put.
diff --git a/qt5/src/Doxyfile b/qt5/src/Doxyfile
index a7f71f4..8d12120 100644
--- a/qt5/src/Doxyfile
+++ b/qt5/src/Doxyfile
@@ -31,7 +31,7 @@
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER         = 0.56.0
+PROJECT_NUMBER         = 0.57.0
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
 # base path where the generated documentation will be put.
diff --git a/utils/pdfseparate.1 b/utils/pdfseparate.1
index 856f345..132511a 100644
--- a/utils/pdfseparate.1
+++ b/utils/pdfseparate.1
@@ -13,10 +13,11 @@
 pdfseparate reads the PDF file
 .IR PDF-file ,
 extracts one or more pages, and writes one PDF file for each page to
-.IR PDF-page-pattern ,
+.IR PDF-page-pattern.
+.PP
 PDF-page-pattern should contain
-.BR %d .
-%d is replaced by the page number.
+.BR %d
+(or any variant respecting printf format), since %d is replaced by the page number.
 .TP
 The PDF-file should not be encrypted.
 .SH OPTIONS
diff --git a/utils/pdfseparate.cc b/utils/pdfseparate.cc
index 45274ec..a6f1d5e 100644
--- a/utils/pdfseparate.cc
+++ b/utils/pdfseparate.cc
@@ -9,6 +9,7 @@
 // Copyright (C) 2013, 2016 Pino Toscano <pino@kde.org>
 // Copyright (C) 2013 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
 // Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
+// Copyright (C) 2017 Léonard Michelet <leonard.michelet@smile.fr>
 //
 //========================================================================
 #include "config.h"
@@ -97,7 +98,7 @@
     }
   }
   if (!foundmatch && firstPage != lastPage) {
-    error(errSyntaxError, -1, "'{0:s}' must contain '%d' if more than one page should be extracted", destFileName);
+    error(errSyntaxError, -1, "'{0:s}' must contain '%d' (or any variant respecting printf format) if more than one page should be extracted, in order to print the page number", destFileName);
     free(auxDestFileName);
     delete doc;
     return false;