pdftex[795] branches/stable/source/src: sync before TL18 pretest

commits+karl at tug.org commits+karl at tug.org
Wed Feb 28 00:34:24 CET 2018


Revision: 795
          http://tug.org/svn/pdftex?view=revision&revision=795
Author:   karl
Date:     2018-02-28 00:34:23 +0100 (Wed, 28 Feb 2018)
Log Message:
-----------
sync before TL18 pretest

Modified Paths:
--------------
    branches/stable/source/src/Makefile.in
    branches/stable/source/src/build-aux/compile
    branches/stable/source/src/build-aux/config.guess
    branches/stable/source/src/build-aux/config.sub
    branches/stable/source/src/build-aux/depcomp
    branches/stable/source/src/build-aux/texinfo.tex
    branches/stable/source/src/configure
    branches/stable/source/src/doc/ChangeLog
    branches/stable/source/src/doc/Makefile.in
    branches/stable/source/src/doc/build-tools.txt
    branches/stable/source/src/doc/tlbuild.info
    branches/stable/source/src/doc/tlbuild.texi
    branches/stable/source/src/libs/Makefile.in
    branches/stable/source/src/libs/README
    branches/stable/source/src/libs/configure
    branches/stable/source/src/libs/libpng/ChangeLog
    branches/stable/source/src/libs/libpng/configure
    branches/stable/source/src/libs/libpng/configure.ac
    branches/stable/source/src/libs/poppler/ChangeLog
    branches/stable/source/src/libs/poppler/Makefile.am
    branches/stable/source/src/libs/poppler/Makefile.in
    branches/stable/source/src/libs/poppler/TLpatches/ChangeLog
    branches/stable/source/src/libs/poppler/TLpatches/TL-Changes
    branches/stable/source/src/libs/poppler/aclocal.m4
    branches/stable/source/src/libs/poppler/config.h.in
    branches/stable/source/src/libs/poppler/configure
    branches/stable/source/src/libs/poppler/configure.ac
    branches/stable/source/src/libs/poppler/include/Makefile.in
    branches/stable/source/src/libs/poppler/include/fofi/Makefile.in
    branches/stable/source/src/libs/poppler/include/goo/Makefile.in
    branches/stable/source/src/libs/poppler/poppler-src/CMakeLists.txt
    branches/stable/source/src/libs/poppler/poppler-src/ChangeLog
    branches/stable/source/src/libs/poppler/poppler-src/ConfigureChecks.cmake
    branches/stable/source/src/libs/poppler/poppler-src/INSTALL
    branches/stable/source/src/libs/poppler/poppler-src/NEWS
    branches/stable/source/src/libs/poppler/poppler-src/config.h.cmake
    branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiIdentifier.cc
    branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiTrueType.cc
    branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiTrueType.h
    branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1.cc
    branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1.h
    branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1C.cc
    branches/stable/source/src/libs/poppler/poppler-src/goo/FixedPoint.cc
    branches/stable/source/src/libs/poppler/poppler-src/goo/FixedPoint.h
    branches/stable/source/src/libs/poppler/poppler-src/goo/GooHash.cc
    branches/stable/source/src/libs/poppler/poppler-src/goo/GooMutex.h
    branches/stable/source/src/libs/poppler/poppler-src/goo/GooString.cc
    branches/stable/source/src/libs/poppler/poppler-src/goo/GooString.h
    branches/stable/source/src/libs/poppler/poppler-src/goo/JpegWriter.cc
    branches/stable/source/src/libs/poppler/poppler-src/goo/JpegWriter.h
    branches/stable/source/src/libs/poppler/poppler-src/goo/NetPBMWriter.h
    branches/stable/source/src/libs/poppler/poppler-src/goo/PNGWriter.cc
    branches/stable/source/src/libs/poppler/poppler-src/goo/PNGWriter.h
    branches/stable/source/src/libs/poppler/poppler-src/goo/TiffWriter.cc
    branches/stable/source/src/libs/poppler/poppler-src/goo/TiffWriter.h
    branches/stable/source/src/libs/poppler/poppler-src/goo/gfile.cc
    branches/stable/source/src/libs/poppler/poppler-src/goo/gfile.h
    branches/stable/source/src/libs/poppler/poppler-src/goo/glibc.h
    branches/stable/source/src/libs/poppler/poppler-src/goo/gmem.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Annot.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Annot.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Array.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Array.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CMap.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CMap.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoFontEngine.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoFontEngine.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoOutputDev.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoOutputDev.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Catalog.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Catalog.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlCachedFile.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlPDFDocBuilder.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlPDFDocBuilder.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/DCTStream.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/DCTStream.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Decrypt.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Decrypt.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Dict.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Dict.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Error.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/FileSpec.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/FileSpec.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateEncoder.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateEncoder.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateStream.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateStream.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/FontInfo.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Form.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Form.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Function.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Function.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Gfx.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Gfx.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxFont.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxFont.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxState.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxState.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParams.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParams.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Hints.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/JBIG2Stream.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/JBIG2Stream.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/JPEG2000Stream.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/JPXStream.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Lexer.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Lexer.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Linearization.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Link.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Link.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/LocalPDFDocBuilder.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Movie.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Movie.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Object.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Object.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/OptionalContent.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Outline.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/OutputDev.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/OutputDev.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/PDFDoc.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/PDFDoc.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/PDFDocFactory.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/PSOutputDev.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/PSOutputDev.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Page.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Page.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/PageLabelInfo.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/PageTransition.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Parser.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Parser.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/PopplerCache.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/PopplerCache.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/PreScanOutputDev.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Rendition.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Rendition.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/SecurityHandler.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/SecurityHandler.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/SignatureHandler.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/SignatureHandler.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/SignatureInfo.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/SignatureInfo.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Sound.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Sound.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/SplashOutputDev.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/SplashOutputDev.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/StdinCachedFile.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/StdinPDFDocBuilder.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/StdinPDFDocBuilder.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Stream.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Stream.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/StructElement.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/StructTreeRoot.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/TextOutputDev.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/TextOutputDev.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/UTF.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/UTF.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/UnicodeMap.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/UnicodeMap.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/ViewerPreferences.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/XRef.cc
    branches/stable/source/src/libs/poppler/poppler-src/poppler/XRef.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/poppler-config.h.cmake
    branches/stable/source/src/libs/poppler/poppler-src/poppler-cairo.pc.cmake
    branches/stable/source/src/libs/poppler/poppler-src/poppler-cpp.pc.cmake
    branches/stable/source/src/libs/poppler/poppler-src/poppler-glib.pc.cmake
    branches/stable/source/src/libs/poppler/poppler-src/poppler-qt5.pc.cmake
    branches/stable/source/src/libs/poppler/poppler-src/poppler-splash.pc.cmake
    branches/stable/source/src/libs/poppler/poppler-src/poppler.pc.cmake
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashTypes.h
    branches/stable/source/src/libs/poppler/version.ac
    branches/stable/source/src/m4/ChangeLog
    branches/stable/source/src/m4/kpse-pkgs.m4
    branches/stable/source/src/texk/Makefile.in
    branches/stable/source/src/texk/README
    branches/stable/source/src/texk/configure
    branches/stable/source/src/texk/kpathsea/ChangeLog
    branches/stable/source/src/texk/kpathsea/NEWS
    branches/stable/source/src/texk/kpathsea/c-auto.in
    branches/stable/source/src/texk/kpathsea/cnf-to-paths.awk
    branches/stable/source/src/texk/kpathsea/configure
    branches/stable/source/src/texk/kpathsea/doc/kpathsea.info
    branches/stable/source/src/texk/kpathsea/doc/kpathsea.texi
    branches/stable/source/src/texk/kpathsea/kpathsea.pc.in
    branches/stable/source/src/texk/kpathsea/kpsewhich.c
    branches/stable/source/src/texk/kpathsea/lib.h
    branches/stable/source/src/texk/kpathsea/mktexlsr
    branches/stable/source/src/texk/kpathsea/pathsearch.c
    branches/stable/source/src/texk/kpathsea/progname.c
    branches/stable/source/src/texk/kpathsea/readable.c
    branches/stable/source/src/texk/kpathsea/readable.h
    branches/stable/source/src/texk/kpathsea/str-list.c
    branches/stable/source/src/texk/kpathsea/str-list.h
    branches/stable/source/src/texk/kpathsea/tests/kpsewhich.test
    branches/stable/source/src/texk/kpathsea/tex-file.c
    branches/stable/source/src/texk/kpathsea/tex-make.c
    branches/stable/source/src/texk/kpathsea/texmf.cnf
    branches/stable/source/src/texk/kpathsea/version.ac
    branches/stable/source/src/texk/kpathsea/xgetcwd.c
    branches/stable/source/src/texk/tests/TeXLive/TLUtils.pm
    branches/stable/source/src/texk/web2c/ChangeLog
    branches/stable/source/src/texk/web2c/Makefile.am
    branches/stable/source/src/texk/web2c/Makefile.in
    branches/stable/source/src/texk/web2c/ac/web2c.ac
    branches/stable/source/src/texk/web2c/aclocal.m4
    branches/stable/source/src/texk/web2c/c-auto.in
    branches/stable/source/src/texk/web2c/configure
    branches/stable/source/src/texk/web2c/configure.ac
    branches/stable/source/src/texk/web2c/cwebboot.cin
    branches/stable/source/src/texk/web2c/cwebdir/ChangeLog
    branches/stable/source/src/texk/web2c/cwebdir/common.c
    branches/stable/source/src/texk/web2c/cwebdir/common.w
    branches/stable/source/src/texk/web2c/cwebdir/cweave.w
    branches/stable/source/src/texk/web2c/doc/Makefile.in
    branches/stable/source/src/texk/web2c/doc/web2c.info
    branches/stable/source/src/texk/web2c/doc/web2c.texi
    branches/stable/source/src/texk/web2c/lib/Makefile.in
    branches/stable/source/src/texk/web2c/lib/texmfmp.c
    branches/stable/source/src/texk/web2c/man/Makefile.in
    branches/stable/source/src/texk/web2c/omegafonts/Makefile.in
    branches/stable/source/src/texk/web2c/otps/Makefile.in
    branches/stable/source/src/texk/web2c/otps/win32/Makefile.in
    branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog
    branches/stable/source/src/texk/web2c/pdftexdir/pdftex.web
    branches/stable/source/src/texk/web2c/synctexdir/ChangeLog
    branches/stable/source/src/texk/web2c/synctexdir/man5/synctex.5
    branches/stable/source/src/texk/web2c/texmfmp.h
    branches/stable/source/src/texk/web2c/tiedir/ChangeLog
    branches/stable/source/src/texk/web2c/tiedir/tie.w
    branches/stable/source/src/texk/web2c/web2c/configure
    branches/stable/source/src/texk/web2c/window/Makefile.in
    branches/stable/source/src/utils/Makefile.in
    branches/stable/source/src/utils/README
    branches/stable/source/src/utils/configure
    branches/stable/source/src/version.ac

Added Paths:
-----------
    branches/stable/source/src/libs/poppler/TLpatches/patch-04-ctime
    branches/stable/source/src/libs/poppler/poppler-src/COPYING3
    branches/stable/source/src/libs/poppler/poppler-src/README.contributors
    branches/stable/source/src/libs/poppler/poppler-src/goo/glibc_strtok_r.cc
    branches/stable/source/src/libs/poppler/poppler-src/gtkdoc.py
    branches/stable/source/src/libs/poppler/poppler-src/make-glib-api-docs
    branches/stable/source/src/libs/poppler/poppler-src/poppler/UnicodeMapFuncs.h
    branches/stable/source/src/m4/ax_cxx_compile_stdcxx.m4
    branches/stable/source/src/m4/kpse-lua53-flags.m4

Removed Paths:
-------------
    branches/stable/source/src/libs/poppler/TLpatches/patch-02-LLONG_MAX
    branches/stable/source/src/libs/poppler/TLpatches/patch-03-Object-functions
    branches/stable/source/src/libs/poppler/poppler-src/Makefile.am
    branches/stable/source/src/libs/poppler/poppler-src/TODO
    branches/stable/source/src/libs/poppler/poppler-src/config.h.in
    branches/stable/source/src/libs/poppler/poppler-src/configure.ac
    branches/stable/source/src/libs/poppler/poppler-src/fofi/Makefile.am
    branches/stable/source/src/libs/poppler/poppler-src/goo/Makefile.am
    branches/stable/source/src/libs/poppler/poppler-src/goo/gtypes_p.h
    branches/stable/source/src/libs/poppler/poppler-src/gtk-doc.make
    branches/stable/source/src/libs/poppler/poppler-src/poppler/Makefile.am
    branches/stable/source/src/libs/poppler/poppler-src/poppler/UTF8.h
    branches/stable/source/src/libs/poppler/poppler-src/poppler/strtok_r.cpp
    branches/stable/source/src/libs/poppler/poppler-src/poppler-cairo-uninstalled.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-cairo.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-cpp-uninstalled.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-cpp.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-glib-uninstalled.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-glib.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-qt4-uninstalled.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-qt4.pc.cmake
    branches/stable/source/src/libs/poppler/poppler-src/poppler-qt4.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-qt5-uninstalled.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-qt5.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-splash-uninstalled.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-splash.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler-uninstalled.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/poppler.pc.in
    branches/stable/source/src/libs/poppler/poppler-src/splash/Makefile.am
    branches/stable/source/src/libs/poppler/poppler-src/splash/Splash.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/Splash.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashBitmap.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashBitmap.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashClip.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashClip.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashErrorCodes.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFTFont.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFTFont.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFTFontEngine.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFTFontEngine.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFTFontFile.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFTFontFile.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFont.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFont.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFontEngine.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFontEngine.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFontFile.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFontFile.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFontFileID.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashFontFileID.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashGlyphBitmap.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashMath.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashPath.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashPath.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashPattern.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashPattern.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashScreen.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashScreen.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashState.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashState.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashT1Font.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashT1Font.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashT1FontEngine.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashT1FontEngine.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashT1FontFile.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashT1FontFile.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashXPath.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashXPath.h
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashXPathScanner.cc
    branches/stable/source/src/libs/poppler/poppler-src/splash/SplashXPathScanner.h

Modified: branches/stable/source/src/Makefile.in
===================================================================
--- branches/stable/source/src/Makefile.in	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/Makefile.in	2018-02-27 23:34:23 UTC (rev 795)
@@ -122,6 +122,7 @@
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/tardate.ac \
 	$(top_srcdir)/version.ac \
 	$(top_srcdir)/utils/autosp/ac/withenable.ac \
+	$(top_srcdir)/utils/axodraw2/ac/withenable.ac \
 	$(top_srcdir)/utils/devnag/ac/withenable.ac \
 	$(top_srcdir)/utils/lacheck/ac/withenable.ac \
 	$(top_srcdir)/utils/m-tx/ac/withenable.ac \
@@ -190,6 +191,7 @@
 	$(top_srcdir)/libs/libpaper/ac/withenable.ac \
 	$(top_srcdir)/libs/luajit/ac/withenable.ac \
 	$(top_srcdir)/libs/lua52/ac/withenable.ac \
+	$(top_srcdir)/libs/lua53/ac/withenable.ac \
 	$(top_srcdir)/libs/zlib/ac/withenable.ac \
 	$(top_srcdir)/texk/ptexenc/ac/withenable.ac \
 	$(top_srcdir)/texk/kpathsea/ac/withenable.ac \

Modified: branches/stable/source/src/build-aux/compile
===================================================================
--- branches/stable/source/src/build-aux/compile	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/build-aux/compile	2018-02-27 23:34:23 UTC (rev 795)
@@ -3,7 +3,7 @@
 
 scriptversion=2017-09-16.17; # UTC
 
-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey at cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify

Modified: branches/stable/source/src/build-aux/config.guess
===================================================================
--- branches/stable/source/src/build-aux/config.guess	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/build-aux/config.guess	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2017 Free Software Foundation, Inc.
+#   Copyright 1992-2018 Free Software Foundation, Inc.
 
-timestamp='2017-12-17'
+timestamp='2018-02-24'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2017 Free Software Foundation, Inc.
+Copyright 1992-2018 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -107,9 +107,9 @@
 dummy=$tmp/dummy ;
 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
 case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > $dummy.c ;
+ ,,)    echo "int x;" > "$dummy.c" ;
 	for c in cc gcc c89 c99 ; do
-	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	  if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
 	     CC_FOR_BUILD="$c"; break ;
 	  fi ;
 	done ;
@@ -132,14 +132,14 @@
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-case "${UNAME_SYSTEM}" in
+case "$UNAME_SYSTEM" in
 Linux|GNU|GNU/*)
 	# If the system lacks a compiler, then just pick glibc.
 	# We could probably try harder.
 	LIBC=gnu
 
-	eval $set_cc_for_build
-	cat <<-EOF > $dummy.c
+	eval "$set_cc_for_build"
+	cat <<-EOF > "$dummy.c"
 	#include <features.h>
 	#if defined(__UCLIBC__)
 	LIBC=uclibc
@@ -149,13 +149,20 @@
 	LIBC=gnu
 	#endif
 	EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
+
+	# If ldd exists, use it to detect musl libc.
+	if command -v ldd >/dev/null && \
+		ldd --version 2>&1 | grep -q ^musl
+	then
+	    LIBC=musl
+	fi
 	;;
 esac
 
 # Note: order is significant - the case branches are not exclusive.
 
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
 	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -169,10 +176,10 @@
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
 	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
-	    /sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || \
+	    "/sbin/$sysctl" 2>/dev/null || \
+	    "/usr/sbin/$sysctl" 2>/dev/null || \
 	    echo unknown)`
-	case "${UNAME_MACHINE_ARCH}" in
+	case "$UNAME_MACHINE_ARCH" in
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
@@ -179,20 +186,20 @@
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
 	    earmv*)
-		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
-		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
-		machine=${arch}${endian}-unknown
+		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine="${arch}${endian}"-unknown
 		;;
-	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
 	# to ELF recently (or will in the future) and ABI.
-	case "${UNAME_MACHINE_ARCH}" in
+	case "$UNAME_MACHINE_ARCH" in
 	    earm*)
 		os=netbsdelf
 		;;
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
-		eval $set_cc_for_build
+		eval "$set_cc_for_build"
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
 			| grep -q __ELF__
 		then
@@ -208,10 +215,10 @@
 		;;
 	esac
 	# Determine ABI tags.
-	case "${UNAME_MACHINE_ARCH}" in
+	case "$UNAME_MACHINE_ARCH" in
 	    earm*)
 		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
-		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
 		;;
 	esac
 	# The OS release
@@ -219,51 +226,51 @@
 	# thus, need a distinct triplet. However, they do not need
 	# kernel version information, so it can be replaced with a
 	# suitable tag, in the style of linux-gnu.
-	case "${UNAME_VERSION}" in
+	case "$UNAME_VERSION" in
 	    Debian*)
 		release='-gnu'
 		;;
 	    *)
-		release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
+		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}${abi}"
+	echo "$machine-${os}${release}${abi}"
 	exit ;;
     *:Bitrig:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
 	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
 	exit ;;
     *:LibertyBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
 	exit ;;
     *:MidnightBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-midnightbsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
 	exit ;;
     *:ekkoBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
 	exit ;;
     *:SolidBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
 	exit ;;
     macppc:MirBSD:*:*)
-	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
 	exit ;;
     *:MirBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
 	exit ;;
     *:Sortix:*:*)
-	echo ${UNAME_MACHINE}-unknown-sortix
+	echo "$UNAME_MACHINE"-unknown-sortix
 	exit ;;
     *:Redox:*:*)
-	echo ${UNAME_MACHINE}-unknown-redox
+	echo "$UNAME_MACHINE"-unknown-redox
 	exit ;;
     mips:OSF1:*.*)
         echo mips-dec-osf1
@@ -319,7 +326,7 @@
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
 	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
 	exitcode=$?
 	trap '' 0
@@ -328,10 +335,10 @@
 	echo m68k-unknown-sysv4
 	exit ;;
     *:[Aa]miga[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-amigaos
+	echo "$UNAME_MACHINE"-unknown-amigaos
 	exit ;;
     *:[Mm]orph[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-morphos
+	echo "$UNAME_MACHINE"-unknown-morphos
 	exit ;;
     *:OS/390:*:*)
 	echo i370-ibm-openedition
@@ -343,7 +350,7 @@
 	echo powerpc-ibm-os400
 	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-	echo arm-acorn-riscix${UNAME_RELEASE}
+	echo arm-acorn-riscix"$UNAME_RELEASE"
 	exit ;;
     arm*:riscos:*:*|arm*:RISCOS:*:*)
 	echo arm-unknown-riscos
@@ -370,19 +377,19 @@
 	    sparc) echo sparc-icl-nx7; exit ;;
 	esac ;;
     s390x:SunOS:*:*)
-	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
 	exit ;;
     sun4H:SunOS:5.*:*)
-	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
 	exit ;;
     i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
-	echo i386-pc-auroraux${UNAME_RELEASE}
+	echo i386-pc-auroraux"$UNAME_RELEASE"
 	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-	eval $set_cc_for_build
+	eval "$set_cc_for_build"
 	SUN_ARCH=i386
 	# If there is a compiler, see if it is configured for 64-bit objects.
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
@@ -395,13 +402,13 @@
 		SUN_ARCH=x86_64
 	    fi
 	fi
-	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
 	# it's likely to be more like Solaris than SunOS4.
-	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
     sun4*:SunOS:*:*)
 	case "`/usr/bin/arch -k`" in
@@ -410,25 +417,25 @@
 		;;
 	esac
 	# Japanese Language versions have a version number like `4.1.3-JL'.
-	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
 	exit ;;
     sun3*:SunOS:*:*)
-	echo m68k-sun-sunos${UNAME_RELEASE}
+	echo m68k-sun-sunos"$UNAME_RELEASE"
 	exit ;;
     sun*:*:4.2BSD:*)
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
+	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
-		echo m68k-sun-sunos${UNAME_RELEASE}
+		echo m68k-sun-sunos"$UNAME_RELEASE"
 		;;
 	    sun4)
-		echo sparc-sun-sunos${UNAME_RELEASE}
+		echo sparc-sun-sunos"$UNAME_RELEASE"
 		;;
 	esac
 	exit ;;
     aushp:SunOS:*:*)
-	echo sparc-auspex-sunos${UNAME_RELEASE}
+	echo sparc-auspex-sunos"$UNAME_RELEASE"
 	exit ;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
@@ -439,44 +446,44 @@
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint"$UNAME_RELEASE"
 	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint"$UNAME_RELEASE"
 	exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint"$UNAME_RELEASE"
 	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-	echo m68k-milan-mint${UNAME_RELEASE}
+	echo m68k-milan-mint"$UNAME_RELEASE"
 	exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-	echo m68k-hades-mint${UNAME_RELEASE}
+	echo m68k-hades-mint"$UNAME_RELEASE"
 	exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-	echo m68k-unknown-mint${UNAME_RELEASE}
+	echo m68k-unknown-mint"$UNAME_RELEASE"
 	exit ;;
     m68k:machten:*:*)
-	echo m68k-apple-machten${UNAME_RELEASE}
+	echo m68k-apple-machten"$UNAME_RELEASE"
 	exit ;;
     powerpc:machten:*:*)
-	echo powerpc-apple-machten${UNAME_RELEASE}
+	echo powerpc-apple-machten"$UNAME_RELEASE"
 	exit ;;
     RISC*:Mach:*:*)
 	echo mips-dec-mach_bsd4.3
 	exit ;;
     RISC*:ULTRIX:*:*)
-	echo mips-dec-ultrix${UNAME_RELEASE}
+	echo mips-dec-ultrix"$UNAME_RELEASE"
 	exit ;;
     VAX*:ULTRIX*:*:*)
-	echo vax-dec-ultrix${UNAME_RELEASE}
+	echo vax-dec-ultrix"$UNAME_RELEASE"
 	exit ;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
-	echo clipper-intergraph-clix${UNAME_RELEASE}
+	echo clipper-intergraph-clix"$UNAME_RELEASE"
 	exit ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
+	eval "$set_cc_for_build"
+	sed 's/^	//' << EOF > "$dummy.c"
 #ifdef __cplusplus
 #include <stdio.h>  /* for printf() prototype */
 	int main (int argc, char *argv[]) {
@@ -497,11 +504,11 @@
 	  exit (-1);
 	}
 EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c &&
-	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
+	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
 	    { echo "$SYSTEM_NAME"; exit; }
-	echo mips-mips-riscos${UNAME_RELEASE}
+	echo mips-mips-riscos"$UNAME_RELEASE"
 	exit ;;
     Motorola:PowerMAX_OS:*:*)
 	echo powerpc-motorola-powermax
@@ -527,17 +534,17 @@
     AViiON:dgux:*:*)
 	# DG/UX returns AViiON for all architectures
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
 	then
-	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
+	       [ "$TARGET_BINARY_INTERFACE"x = x ]
 	    then
-		echo m88k-dg-dgux${UNAME_RELEASE}
+		echo m88k-dg-dgux"$UNAME_RELEASE"
 	    else
-		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
 	    fi
 	else
-	    echo i586-dg-dgux${UNAME_RELEASE}
+	    echo i586-dg-dgux"$UNAME_RELEASE"
 	fi
 	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
@@ -554,7 +561,7 @@
 	echo m68k-tektronix-bsd
 	exit ;;
     *:IRIX*:*:*)
-	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
 	exit ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
 	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
@@ -566,14 +573,14 @@
 	if [ -x /usr/bin/oslevel ] ; then
 		IBM_REV=`/usr/bin/oslevel`
 	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
 	fi
-	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
 	exit ;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		eval $set_cc_for_build
-		sed 's/^		//' << EOF >$dummy.c
+		eval "$set_cc_for_build"
+		sed 's/^		//' << EOF > "$dummy.c"
 		#include <sys/systemcfg.h>
 
 		main()
@@ -584,7 +591,7 @@
 			exit(0);
 			}
 EOF
-		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
 		then
 			echo "$SYSTEM_NAME"
 		else
@@ -598,7 +605,7 @@
 	exit ;;
     *:AIX:*:[4567])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
 		IBM_ARCH=powerpc
@@ -607,9 +614,9 @@
 		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
 			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
 	fi
-	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
 	exit ;;
     *:AIX:*:*)
 	echo rs6000-ibm-aix
@@ -618,7 +625,7 @@
 	echo romp-ibm-bsd4.4
 	exit ;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
 	exit ;;                             # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
 	echo rs6000-bull-bosx
@@ -633,8 +640,8 @@
 	echo m68k-hp-bsd4.4
 	exit ;;
     9000/[34678]??:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	case "${UNAME_MACHINE}" in
+	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+	case "$UNAME_MACHINE" in
 	    9000/31?)            HP_ARCH=m68000 ;;
 	    9000/[34]??)         HP_ARCH=m68k ;;
 	    9000/[678][0-9][0-9])
@@ -641,11 +648,11 @@
 		if [ -x /usr/bin/getconf ]; then
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-		    case "${sc_cpu_version}" in
+		    case "$sc_cpu_version" in
 		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
 		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
-			case "${sc_kernel_bits}" in
+			case "$sc_kernel_bits" in
 			  32) HP_ARCH=hppa2.0n ;;
 			  64) HP_ARCH=hppa2.0w ;;
 			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
@@ -652,9 +659,9 @@
 			esac ;;
 		    esac
 		fi
-		if [ "${HP_ARCH}" = "" ]; then
-		    eval $set_cc_for_build
-		    sed 's/^		//' << EOF >$dummy.c
+		if [ "$HP_ARCH" = "" ]; then
+		    eval "$set_cc_for_build"
+		    sed 's/^		//' << EOF > "$dummy.c"
 
 		#define _HPUX_SOURCE
 		#include <stdlib.h>
@@ -687,13 +694,13 @@
 		    exit (0);
 		}
 EOF
-		    (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
-	if [ ${HP_ARCH} = hppa2.0w ]
+	if [ "$HP_ARCH" = hppa2.0w ]
 	then
-	    eval $set_cc_for_build
+	    eval "$set_cc_for_build"
 
 	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
 	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
@@ -712,15 +719,15 @@
 		HP_ARCH=hppa64
 	    fi
 	fi
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
 	exit ;;
     ia64:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	echo ia64-hp-hpux${HPUX_REV}
+	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux"$HPUX_REV"
 	exit ;;
     3050*:HI-UX:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
+	eval "$set_cc_for_build"
+	sed 's/^	//' << EOF > "$dummy.c"
 	#include <unistd.h>
 	int
 	main ()
@@ -745,7 +752,7 @@
 	  exit (0);
 	}
 EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
 		{ echo "$SYSTEM_NAME"; exit; }
 	echo unknown-hitachi-hiuxwe2
 	exit ;;
@@ -766,9 +773,9 @@
 	exit ;;
     i*86:OSF1:*:*)
 	if [ -x /usr/sbin/sysversion ] ; then
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	    echo "$UNAME_MACHINE"-unknown-osf1mk
 	else
-	    echo ${UNAME_MACHINE}-unknown-osf1
+	    echo "$UNAME_MACHINE"-unknown-osf1
 	fi
 	exit ;;
     parisc*:Lites*:*:*)
@@ -793,109 +800,109 @@
 	echo c4-convex-bsd
 	exit ;;
     CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*[A-Z]90:*:*:*)
-	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
 	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
 	      -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*T3E:*:*:*)
-	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*SV1:*:*:*)
-	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     *:UNICOS/mp:*:*)
-	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
 	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     5000:UNIX_System_V:4.*:*)
 	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
 	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
 	exit ;;
     sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	echo sparc-unknown-bsdi"$UNAME_RELEASE"
 	exit ;;
     *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
 	exit ;;
     *:FreeBSD:*:*)
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	case ${UNAME_PROCESSOR} in
+	case "$UNAME_PROCESSOR" in
 	    amd64)
 		UNAME_PROCESSOR=x86_64 ;;
 	    i386)
 		UNAME_PROCESSOR=i586 ;;
 	esac
-	echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
 	exit ;;
     i*:CYGWIN*:*)
-	echo ${UNAME_MACHINE}-pc-cygwin
+	echo "$UNAME_MACHINE"-pc-cygwin
 	exit ;;
     *:MINGW64*:*)
-	echo ${UNAME_MACHINE}-pc-mingw64
+	echo "$UNAME_MACHINE"-pc-mingw64
 	exit ;;
     *:MINGW*:*)
-	echo ${UNAME_MACHINE}-pc-mingw32
+	echo "$UNAME_MACHINE"-pc-mingw32
 	exit ;;
     *:MSYS*:*)
-	echo ${UNAME_MACHINE}-pc-msys
+	echo "$UNAME_MACHINE"-pc-msys
 	exit ;;
     i*:PW*:*)
-	echo ${UNAME_MACHINE}-pc-pw32
+	echo "$UNAME_MACHINE"-pc-pw32
 	exit ;;
     *:Interix*:*)
-	case ${UNAME_MACHINE} in
+	case "$UNAME_MACHINE" in
 	    x86)
-		echo i586-pc-interix${UNAME_RELEASE}
+		echo i586-pc-interix"$UNAME_RELEASE"
 		exit ;;
 	    authenticamd | genuineintel | EM64T)
-		echo x86_64-unknown-interix${UNAME_RELEASE}
+		echo x86_64-unknown-interix"$UNAME_RELEASE"
 		exit ;;
 	    IA64)
-		echo ia64-unknown-interix${UNAME_RELEASE}
+		echo ia64-unknown-interix"$UNAME_RELEASE"
 		exit ;;
 	esac ;;
     i*:UWIN*:*)
-	echo ${UNAME_MACHINE}-pc-uwin
+	echo "$UNAME_MACHINE"-pc-uwin
 	exit ;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
 	echo x86_64-unknown-cygwin
 	exit ;;
     prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
 	exit ;;
     i*86:Minix:*:*)
-	echo ${UNAME_MACHINE}-pc-minix
+	echo "$UNAME_MACHINE"-pc-minix
 	exit ;;
     aarch64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     aarch64_be:Linux:*:*)
 	UNAME_MACHINE=aarch64_be
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -909,63 +916,63 @@
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     arm*:Linux:*:*)
-	eval $set_cc_for_build
+	eval "$set_cc_for_build"
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	else
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 		| grep -q __ARM_PCS_VFP
 	    then
-		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
 	    else
-		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
 	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     cris:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
 	exit ;;
     crisv32:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
 	exit ;;
     e2k:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     frv:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     hexagon:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     i*86:Linux:*:*)
-	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     k1om:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
+	eval "$set_cc_for_build"
+	sed 's/^	//' << EOF > "$dummy.c"
 	#undef CPU
 	#undef ${UNAME_MACHINE}
 	#undef ${UNAME_MACHINE}el
@@ -979,70 +986,74 @@
 	#endif
 	#endif
 EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
+	test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
 	;;
     mips64el:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     openrisc*:Linux:*:*)
-	echo or1k-unknown-linux-${LIBC}
+	echo or1k-unknown-linux-"$LIBC"
 	exit ;;
     or32:Linux:*:* | or1k*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-${LIBC}
+	echo sparc-unknown-linux-"$LIBC"
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-${LIBC}
+	echo hppa64-unknown-linux-"$LIBC"
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
-	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
-	  *)    echo hppa-unknown-linux-${LIBC} ;;
+	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
+	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
+	  *)    echo hppa-unknown-linux-"$LIBC" ;;
 	esac
 	exit ;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-${LIBC}
+	echo powerpc64-unknown-linux-"$LIBC"
 	exit ;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-${LIBC}
+	echo powerpc-unknown-linux-"$LIBC"
 	exit ;;
     ppc64le:Linux:*:*)
-	echo powerpc64le-unknown-linux-${LIBC}
+	echo powerpc64le-unknown-linux-"$LIBC"
 	exit ;;
     ppcle:Linux:*:*)
-	echo powerpcle-unknown-linux-${LIBC}
+	echo powerpcle-unknown-linux-"$LIBC"
 	exit ;;
     riscv32:Linux:*:* | riscv64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
 	exit ;;
     sh64*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+	if objdump -f /bin/sh | grep -q elf32-x86-64; then
+	    echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32
+	else
+	    echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
+	fi
 	exit ;;
     xtensa*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1056,34 +1067,34 @@
 	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
 	# Use sysv4.2uw... so that sysv4* matches it.
-	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
 	exit ;;
     i*86:OS/2:*:*)
 	# If we were able to find `uname', then EMX Unix compatibility
 	# is probably installed.
-	echo ${UNAME_MACHINE}-pc-os2-emx
+	echo "$UNAME_MACHINE"-pc-os2-emx
 	exit ;;
     i*86:XTS-300:*:STOP)
-	echo ${UNAME_MACHINE}-unknown-stop
+	echo "$UNAME_MACHINE"-unknown-stop
 	exit ;;
     i*86:atheos:*:*)
-	echo ${UNAME_MACHINE}-unknown-atheos
+	echo "$UNAME_MACHINE"-unknown-atheos
 	exit ;;
     i*86:syllable:*:*)
-	echo ${UNAME_MACHINE}-pc-syllable
+	echo "$UNAME_MACHINE"-pc-syllable
 	exit ;;
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
+	echo i386-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     i*86:*DOS:*:*)
-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	echo "$UNAME_MACHINE"-pc-msdosdjgpp
 	exit ;;
     i*86:*:4.*:*)
-	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
 	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
 	fi
 	exit ;;
     i*86:*:5:[678]*)
@@ -1093,12 +1104,12 @@
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
 	esac
-	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
 	exit ;;
     i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
 		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
 		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
@@ -1108,9 +1119,9 @@
 			&& UNAME_MACHINE=i686
 		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
 			&& UNAME_MACHINE=i686
-		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
 	else
-		echo ${UNAME_MACHINE}-pc-sysv32
+		echo "$UNAME_MACHINE"-pc-sysv32
 	fi
 	exit ;;
     pc:*:*:*)
@@ -1130,9 +1141,9 @@
 	exit ;;
     i860:*:4.*:*) # i860-SVR4
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
 	fi
 	exit ;;
     mini*:CTIX:SYS*5:*)
@@ -1152,9 +1163,9 @@
 	test -r /etc/.relid \
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
 	  && { echo i486-ncr-sysv4; exit; } ;;
@@ -1163,28 +1174,28 @@
 	test -r /etc/.relid \
 	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
-	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	echo m68k-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
 	exit ;;
     TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	echo sparc-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
-	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     SM[BE]S:UNIX_SV:*:*)
-	echo mips-dde-sysv${UNAME_RELEASE}
+	echo mips-dde-sysv"$UNAME_RELEASE"
 	exit ;;
     RM*:ReliantUNIX-*:*:*)
 	echo mips-sni-sysv4
@@ -1195,7 +1206,7 @@
     *:SINIX-*:*:*)
 	if uname -p 2>/dev/null >/dev/null ; then
 		UNAME_MACHINE=`(uname -p) 2>/dev/null`
-		echo ${UNAME_MACHINE}-sni-sysv4
+		echo "$UNAME_MACHINE"-sni-sysv4
 	else
 		echo ns32k-sni-sysv
 	fi
@@ -1215,7 +1226,7 @@
 	exit ;;
     i*86:VOS:*:*)
 	# From Paul.Green at stratus.com.
-	echo ${UNAME_MACHINE}-stratus-vos
+	echo "$UNAME_MACHINE"-stratus-vos
 	exit ;;
     *:VOS:*:*)
 	# From Paul.Green at stratus.com.
@@ -1222,7 +1233,7 @@
 	echo hppa1.1-stratus-vos
 	exit ;;
     mc68*:A/UX:*:*)
-	echo m68k-apple-aux${UNAME_RELEASE}
+	echo m68k-apple-aux"$UNAME_RELEASE"
 	exit ;;
     news*:NEWS-OS:6*:*)
 	echo mips-sony-newsos6
@@ -1229,9 +1240,9 @@
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
-		echo mips-nec-sysv${UNAME_RELEASE}
+		echo mips-nec-sysv"$UNAME_RELEASE"
 	else
-		echo mips-unknown-sysv${UNAME_RELEASE}
+		echo mips-unknown-sysv"$UNAME_RELEASE"
 	fi
 	exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
@@ -1250,39 +1261,39 @@
 	echo x86_64-unknown-haiku
 	exit ;;
     SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux${UNAME_RELEASE}
+	echo sx4-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-5:SUPER-UX:*:*)
-	echo sx5-nec-superux${UNAME_RELEASE}
+	echo sx5-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-6:SUPER-UX:*:*)
-	echo sx6-nec-superux${UNAME_RELEASE}
+	echo sx6-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-7:SUPER-UX:*:*)
-	echo sx7-nec-superux${UNAME_RELEASE}
+	echo sx7-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-8:SUPER-UX:*:*)
-	echo sx8-nec-superux${UNAME_RELEASE}
+	echo sx8-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-8R:SUPER-UX:*:*)
-	echo sx8r-nec-superux${UNAME_RELEASE}
+	echo sx8r-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-ACE:SUPER-UX:*:*)
-	echo sxace-nec-superux${UNAME_RELEASE}
+	echo sxace-nec-superux"$UNAME_RELEASE"
 	exit ;;
     Power*:Rhapsody:*:*)
-	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
 	exit ;;
     *:Rhapsody:*:*)
-	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
 	exit ;;
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	eval $set_cc_for_build
+	eval "$set_cc_for_build"
 	if test "$UNAME_PROCESSOR" = unknown ; then
 	    UNAME_PROCESSOR=powerpc
 	fi
-	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+	if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
 	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
 		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
@@ -1310,7 +1321,7 @@
 	    # that Apple uses in portable devices.
 	    UNAME_PROCESSOR=x86_64
 	fi
-	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
@@ -1318,22 +1329,25 @@
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
-	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
 	exit ;;
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit ;;
     NEO-*:NONSTOP_KERNEL:*:*)
-	echo neo-tandem-nsk${UNAME_RELEASE}
+	echo neo-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
     NSE-*:NONSTOP_KERNEL:*:*)
-	echo nse-tandem-nsk${UNAME_RELEASE}
+	echo nse-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
     NSR-*:NONSTOP_KERNEL:*:*)
-	echo nsr-tandem-nsk${UNAME_RELEASE}
+	echo nsr-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
+    NSV-*:NONSTOP_KERNEL:*:*)
+	echo nsv-tandem-nsk"$UNAME_RELEASE"
+	exit ;;
     NSX-*:NONSTOP_KERNEL:*:*)
-	echo nsx-tandem-nsk${UNAME_RELEASE}
+	echo nsx-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
     *:NonStop-UX:*:*)
 	echo mips-compaq-nonstopux
@@ -1342,7 +1356,7 @@
 	echo bs2000-siemens-sysv
 	exit ;;
     DS/*:UNIX_System_V:*:*)
-	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
 	exit ;;
     *:Plan9:*:*)
 	# "uname -m" is not consistent, so use $cputype instead. 386
@@ -1353,7 +1367,7 @@
 	else
 	    UNAME_MACHINE="$cputype"
 	fi
-	echo ${UNAME_MACHINE}-unknown-plan9
+	echo "$UNAME_MACHINE"-unknown-plan9
 	exit ;;
     *:TOPS-10:*:*)
 	echo pdp10-unknown-tops10
@@ -1374,14 +1388,14 @@
 	echo pdp10-unknown-its
 	exit ;;
     SEI:*:*:SEIUX)
-	echo mips-sei-seiux${UNAME_RELEASE}
+	echo mips-sei-seiux"$UNAME_RELEASE"
 	exit ;;
     *:DragonFly:*:*)
-	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
 	exit ;;
     *:*VMS:*:*)
 	UNAME_MACHINE=`(uname -p) 2>/dev/null`
-	case "${UNAME_MACHINE}" in
+	case "$UNAME_MACHINE" in
 	    A*) echo alpha-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
 	    V*) echo vax-dec-vms ; exit ;;
@@ -1390,16 +1404,16 @@
 	echo i386-pc-xenix
 	exit ;;
     i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
+	echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
 	exit ;;
     i*86:rdos:*:*)
-	echo ${UNAME_MACHINE}-pc-rdos
+	echo "$UNAME_MACHINE"-pc-rdos
 	exit ;;
     i*86:AROS:*:*)
-	echo ${UNAME_MACHINE}-pc-aros
+	echo "$UNAME_MACHINE"-pc-aros
 	exit ;;
     x86_64:VMkernel:*:*)
-	echo ${UNAME_MACHINE}-unknown-esx
+	echo "$UNAME_MACHINE"-unknown-esx
 	exit ;;
     amd64:Isilon\ OneFS:*:*)
 	echo x86_64-unknown-onefs
@@ -1408,7 +1422,7 @@
 
 echo "$0: unable to guess system type" >&2
 
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}" in
+case "$UNAME_MACHINE:$UNAME_SYSTEM" in
     mips:Linux | mips64:Linux)
 	# If we got here on MIPS GNU/Linux, output extra information.
 	cat >&2 <<EOF
@@ -1450,10 +1464,10 @@
 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
 
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
+UNAME_MACHINE = "$UNAME_MACHINE"
+UNAME_RELEASE = "$UNAME_RELEASE"
+UNAME_SYSTEM  = "$UNAME_SYSTEM"
+UNAME_VERSION = "$UNAME_VERSION"
 EOF
 
 exit 1

Modified: branches/stable/source/src/build-aux/config.sub
===================================================================
--- branches/stable/source/src/build-aux/config.sub	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/build-aux/config.sub	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2017 Free Software Foundation, Inc.
+#   Copyright 1992-2018 Free Software Foundation, Inc.
 
-timestamp='2017-11-23'
+timestamp='2018-02-22'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -67,7 +67,7 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2017 Free Software Foundation, Inc.
+Copyright 1992-2018 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -94,7 +94,7 @@
 
     *local*)
        # First pass through any local machine types.
-       echo $1
+       echo "$1"
        exit ;;
 
     * )
@@ -112,7 +112,7 @@
 
 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
 # Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
@@ -120,16 +120,16 @@
   kopensolaris*-gnu* | cloudabi*-eabi* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
   android-linux)
     os=-linux-android
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
     ;;
   *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
+    basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
+    if [ "$basic_machine" != "$1" ]
+    then os=`echo "$1" | sed 's/.*-/-/'`
     else os=; fi
     ;;
 esac
@@ -178,44 +178,44 @@
 		;;
 	-sco6)
 		os=-sco5v6
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco5)
 		os=-sco3.2v5
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco4)
 		os=-sco3.2v4
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco3.2.[4-9]*)
 		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco3.2v[4-9]*)
 		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco5v6*)
 		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco*)
 		os=-sco3.2v2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-udk*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-isc)
 		os=-isc2.2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-clix*)
 		basic_machine=clipper-intergraph
 		;;
 	-isc*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-lynx*178)
 		os=-lynxos178
@@ -227,7 +227,7 @@
 		os=-lynxos
 		;;
 	-ptx*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
 		;;
 	-psos*)
 		os=-psos
@@ -296,7 +296,7 @@
 	| nios | nios2 | nios2eb | nios2el \
 	| ns16k | ns32k \
 	| open8 | or1k | or1knd | or32 \
-	| pdp10 | pdp11 | pj | pjl \
+	| pdp10 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pru \
 	| pyramid \
@@ -333,7 +333,7 @@
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
 		;;
 	ms1)
 		basic_machine=mt-unknown
@@ -362,7 +362,7 @@
 	  ;;
 	# Object if more than one company name word.
 	*-*-*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
@@ -457,7 +457,7 @@
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
-		basic_machine=i386-unknown
+		basic_machine=i386-pc
 		os=-bsd
 		;;
 	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
@@ -491,7 +491,7 @@
 		basic_machine=x86_64-pc
 		;;
 	amd64-*)
-		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	amdahl)
 		basic_machine=580-amdahl
@@ -536,7 +536,7 @@
 		os=-linux
 		;;
 	blackfin-*)
-		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		os=-linux
 		;;
 	bluegene*)
@@ -544,13 +544,13 @@
 		os=-cnk
 		;;
 	c54x-*)
-		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	c55x-*)
-		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	c6x-*)
-		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	c90)
 		basic_machine=c90-cray
@@ -648,7 +648,7 @@
 		os=$os"spe"
 		;;
 	e500v[12]-*)
-		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		os=$os"spe"
 		;;
 	ebmon29k)
@@ -740,9 +740,6 @@
 	hp9k8[0-9][0-9] | hp8[0-9][0-9])
 		basic_machine=hppa1.0-hp
 		;;
-	hppa-next)
-		os=-nextstep3
-		;;
 	hppaosf)
 		basic_machine=hppa1.1-hp
 		os=-osf
@@ -755,19 +752,19 @@
 		basic_machine=i370-ibm
 		;;
 	i*86v32)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
 		;;
 	i*86v4*)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
 		os=-sysv4
 		;;
 	i*86v)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
 		os=-sysv
 		;;
 	i*86sol2)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
 		os=-solaris2
 		;;
 	i386mach)
@@ -774,7 +771,7 @@
 		basic_machine=i386-mach
 		os=-mach
 		;;
-	i386-vsta | vsta)
+	vsta)
 		basic_machine=i386-unknown
 		os=-vsta
 		;;
@@ -793,7 +790,7 @@
 		os=-sysv
 		;;
 	leon-*|leon[3-9]-*)
-		basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+		basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
 		;;
 	m68knommu)
 		basic_machine=m68k-unknown
@@ -800,12 +797,9 @@
 		os=-linux
 		;;
 	m68knommu-*)
-		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		os=-linux
 		;;
-	m88k-omron*)
-		basic_machine=m88k-omron
-		;;
 	magnum | m3230)
 		basic_machine=mips-mips
 		os=-sysv
@@ -837,10 +831,10 @@
 		os=-mint
 		;;
 	mips3*-*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
 		;;
 	mips3*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
 		;;
 	monitor)
 		basic_machine=m68k-rom68k
@@ -859,7 +853,7 @@
 		os=-msdos
 		;;
 	ms1-*)
-		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
 		;;
 	msys)
 		basic_machine=i686-pc
@@ -946,6 +940,9 @@
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
+	nsv-tandem)
+		basic_machine=nsv-tandem
+		;;
 	nsx-tandem)
 		basic_machine=nsx-tandem
 		;;
@@ -981,7 +978,7 @@
 		os=-linux
 		;;
 	parisc-*)
-		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		os=-linux
 		;;
 	pbd)
@@ -997,7 +994,7 @@
 		basic_machine=i386-pc
 		;;
 	pc98-*)
-		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
@@ -1012,16 +1009,16 @@
 		basic_machine=i786-pc
 		;;
 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	pentium4-*)
-		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	pn)
 		basic_machine=pn-gould
@@ -1031,23 +1028,23 @@
 	ppc | ppcbe)	basic_machine=powerpc-unknown
 		;;
 	ppc-* | ppcbe-*)
-		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle)
 		basic_machine=powerpcle-unknown
 		;;
 	ppcle-* | powerpclittle-*)
-		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	ppc64)	basic_machine=powerpc64-unknown
 		;;
-	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	ppc64le | powerpc64little)
 		basic_machine=powerpc64le-unknown
 		;;
 	ppc64le-* | powerpc64little-*)
-		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	ps2)
 		basic_machine=i386-ibm
@@ -1101,17 +1098,10 @@
 	sequent)
 		basic_machine=i386-sequent
 		;;
-	sh)
-		basic_machine=sh-hitachi
-		os=-hms
-		;;
 	sh5el)
 		basic_machine=sh5le-unknown
 		;;
-	sh64)
-		basic_machine=sh64-unknown
-		;;
-	sparclite-wrs | simso-wrs)
+	simso-wrs)
 		basic_machine=sparclite-wrs
 		os=-vxworks
 		;;
@@ -1130,7 +1120,7 @@
 		os=-sysv4
 		;;
 	strongarm-* | thumb-*)
-		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	sun2)
 		basic_machine=m68000-sun
@@ -1244,9 +1234,6 @@
 		basic_machine=a29k-wrs
 		os=-vxworks
 		;;
-	wasm32)
-		basic_machine=wasm32-unknown
-		;;
 	w65*)
 		basic_machine=w65-wdc
 		os=-none
@@ -1266,20 +1253,12 @@
 		basic_machine=xps100-honeywell
 		;;
 	xscale-* | xscalee[bl]-*)
-		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
 		;;
 	ymp)
 		basic_machine=ymp-cray
 		os=-unicos
 		;;
-	z8k-*-coff)
-		basic_machine=z8k-unknown
-		os=-sim
-		;;
-	z80-*-coff)
-		basic_machine=z80-unknown
-		os=-sim
-		;;
 	none)
 		basic_machine=none-none
 		os=-none
@@ -1308,10 +1287,6 @@
 	vax)
 		basic_machine=vax-dec
 		;;
-	pdp10)
-		# there are many clones, so DEC is not a safe bet
-		basic_machine=pdp10-unknown
-		;;
 	pdp11)
 		basic_machine=pdp11-dec
 		;;
@@ -1321,9 +1296,6 @@
 	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
-		basic_machine=sparc-sun
-		;;
 	cydra)
 		basic_machine=cydra-cydrome
 		;;
@@ -1343,7 +1315,7 @@
 		# Make sure to match an already-canonicalized machine name.
 		;;
 	*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
 		exit 1
 		;;
 esac
@@ -1351,10 +1323,10 @@
 # Here we canonicalize certain aliases for manufacturers.
 case $basic_machine in
 	*-digital*)
-		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
 		;;
 	*-commodore*)
-		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
 		;;
 	*)
 		;;
@@ -1377,9 +1349,6 @@
 	-solaris)
 		os=-solaris2
 		;;
-	-svr4*)
-		os=-sysv4
-		;;
 	-unixware*)
 		os=-sysv4.2uw
 		;;
@@ -1386,6 +1355,10 @@
 	-gnu/linux*)
 		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
 		;;
+	# es1800 is here to avoid being matched by es* (a different OS)
+	-es1800*)
+		os=-ose
+		;;
 	# Now accept the basic system types.
 	# The portable systems comes first.
 	# Each alternative MUST end in a * to match a version number.
@@ -1398,7 +1371,7 @@
 	      | -aos* | -aros* | -cloudabi* | -sortix* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
 	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
@@ -1409,14 +1382,15 @@
 	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
 	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
-	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -morphos* | -superux* | -rtmk* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
 	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
-	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
+	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
+	      | -midnightbsd*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1433,12 +1407,12 @@
 	-nto*)
 		os=`echo $os | sed -e 's|nto|nto-qnx|'`
 		;;
-	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	-sim | -xray | -os68k* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* \
 	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
 		;;
 	-mac*)
-		os=`echo $os | sed -e 's|mac|macos|'`
+		os=`echo "$os" | sed -e 's|mac|macos|'`
 		;;
 	-linux-dietlibc)
 		os=-linux-dietlibc
@@ -1447,10 +1421,10 @@
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
 	-sunos5*)
-		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
 		;;
 	-sunos6*)
-		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
 		;;
 	-opened*)
 		os=-openedition
@@ -1461,12 +1435,6 @@
 	-wince*)
 		os=-wince
 		;;
-	-osfrose*)
-		os=-osfrose
-		;;
-	-osf*)
-		os=-osf
-		;;
 	-utek*)
 		os=-bsd
 		;;
@@ -1513,7 +1481,7 @@
 	-oss*)
 		os=-sysv3
 		;;
-	-svr4)
+	-svr4*)
 		os=-sysv4
 		;;
 	-svr3)
@@ -1528,18 +1496,9 @@
 	-ose*)
 		os=-ose
 		;;
-	-es1800*)
-		os=-ose
-		;;
-	-xenix)
-		os=-xenix
-		;;
 	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
 		os=-mint
 		;;
-	-aros*)
-		os=-aros
-		;;
 	-zvmoe)
 		os=-zvmoe
 		;;
@@ -1568,7 +1527,7 @@
 	*)
 		# Get rid of the `-' at the beginning of $os.
 		os=`echo $os | sed 's/[^-]*-//'`
-		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
 		exit 1
 		;;
 esac
@@ -1664,9 +1623,6 @@
 	*-be)
 		os=-beos
 		;;
-	*-haiku)
-		os=-haiku
-		;;
 	*-ibm)
 		os=-aix
 		;;
@@ -1721,9 +1677,6 @@
 	i370-*)
 		os=-mvs
 		;;
-	*-next)
-		os=-nextstep3
-		;;
 	*-gould)
 		os=-sysv
 		;;
@@ -1833,11 +1786,11 @@
 				vendor=stratus
 				;;
 		esac
-		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
 		;;
 esac
 
-echo $basic_machine$os
+echo "$basic_machine$os"
 exit
 
 # Local variables:

Modified: branches/stable/source/src/build-aux/depcomp
===================================================================
--- branches/stable/source/src/build-aux/depcomp	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/build-aux/depcomp	2018-02-27 23:34:23 UTC (rev 795)
@@ -3,7 +3,7 @@
 
 scriptversion=2017-09-16.17; # UTC
 
-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by

Modified: branches/stable/source/src/build-aux/texinfo.tex
===================================================================
--- branches/stable/source/src/build-aux/texinfo.tex	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/build-aux/texinfo.tex	2018-02-27 23:34:23 UTC (rev 795)
@@ -3,11 +3,11 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2017-12-26.21}
+\def\texinfoversion{2018-01-09.11}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
+% 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
 % Free Software Foundation, Inc.
 %
 % This texinfo.tex file is free software: you can redistribute it and/or
@@ -2235,6 +2235,20 @@
 \font\smallersy=cmsy8
 \def\smallerecsize{0800}
 
+% Fonts for math mode superscripts (7pt).
+\def\sevennominalsize{7pt}
+\setfont\sevenrm\rmshape{7}{1000}{OT1}
+\setfont\seventt\ttshape{10}{700}{OT1TT}
+\setfont\sevenbf\bfshape{10}{700}{OT1}
+\setfont\sevenit\itshape{7}{1000}{OT1IT}
+\setfont\sevensl\slshape{10}{700}{OT1}
+\setfont\sevensf\sfshape{10}{700}{OT1}
+\setfont\sevensc\scshape{10}{700}{OT1}
+\setfont\seventtsl\ttslshape{10}{700}{OT1TT}
+\font\seveni=cmmi7
+\font\sevensy=cmsy7
+\def\sevenecsize{0700}
+
 % Fonts for title page (20.4pt):
 \def\titlenominalsize{20pt}
 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
@@ -2369,6 +2383,20 @@
 \font\smallersy=cmsy8
 \def\smallerecsize{0800}
 
+% Fonts for math mode superscripts (7pt).
+\def\sevennominalsize{7pt}
+\setfont\sevenrm\rmshape{7}{1000}{OT1}
+\setfont\seventt\ttshape{10}{700}{OT1TT}
+\setfont\sevenbf\bfshape{10}{700}{OT1}
+\setfont\sevenit\itshape{7}{1000}{OT1IT}
+\setfont\sevensl\slshape{10}{700}{OT1}
+\setfont\sevensf\sfshape{10}{700}{OT1}
+\setfont\sevensc\scshape{10}{700}{OT1}
+\setfont\seventtsl\ttslshape{10}{700}{OT1TT}
+\font\seveni=cmmi7
+\font\sevensy=cmsy7
+\def\sevenecsize{0700}
+
 % Fonts for title page (20.4pt):
 \def\titlenominalsize{20pt}
 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
@@ -2503,13 +2531,20 @@
 
 
 % In order for the font changes to affect most math symbols and letters,
-% we have to define the \textfont of the standard families.  We don't
-% bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
+% we have to define the \textfont of the standard families.
+% We don't bother to reset \scriptscriptfont; awaiting user need.
 %
 \def\resetmathfonts{%
   \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
   \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
   \textfont\ttfam=\ttfont \textfont\sffam=\sffont
+  %
+  % Fonts for superscript.  Note that the 7pt fonts are used regardless
+  % of the current font size.
+  \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
+  \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
+  \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
+  \scriptfont\sffam=\sevensf
 }
 
 %
@@ -2519,6 +2554,9 @@
 % to also set the current \fam for math mode.  Our \STYLE (e.g., \rm)
 % commands hardwire \STYLEfont to set the current font.
 %
+% The fonts used for \ifont are for "math italics"  (\itfont is for italics
+% in regular text).  \syfont is also used in math mode only.
+%
 % Each font-changing command also sets the names \lsize (one size lower)
 % and \lllsize (three sizes lower).  These relative commands are used
 % in, e.g., the LaTeX logo and acronyms.

Modified: branches/stable/source/src/configure
===================================================================
--- branches/stable/source/src/configure	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/configure	2018-02-27 23:34:23 UTC (rev 795)
@@ -786,6 +786,7 @@
 enable_cxx_runtime_hack
 enable_libtool_hack
 enable_autosp
+enable_axodraw2
 enable_devnag
 enable_lacheck
 enable_m_tx
@@ -822,6 +823,7 @@
 enable_pdftex
 enable_pdftex_synctex
 enable_luatex
+enable_luatex53
 enable_luajittex
 enable_mp
 enable_pmp
@@ -1595,6 +1597,7 @@
   --enable-cxx-runtime-hack  link C++ runtime statically
   --enable-libtool-hack   ignore libtool dependency_libs
   --disable-autosp        do not build the autosp package
+  --disable-axodraw2      do not build the axodraw2 package
   --disable-devnag        do not build the devnag package
   --disable-lacheck       do not build the lacheck package
   --disable-m-tx          do not build the m-tx package
@@ -1630,6 +1633,7 @@
   --disable-pdftex          do not compile and install pdfTeX
   --disable-pdftex-synctex    build pdfTeX without SyncTeX support
   --disable-luatex          do not compile and install LuaTeX
+  --disable-luatex53        do not compile and install LuaTeX53
   --disable-luajittex       do not compile and install LuaJITTeX
   --disable-mp              do not compile and install MetaPost
   --disable-pmp             do not compile and install pMetaPost
@@ -4180,7 +4184,8 @@
 esac
 
 ## utils/autosp/ac/withenable.ac: configure.ac fragment for TeX Live subdir
-## configure options and TL libraries required for vlna
+## $Id: withenable.ac 46590 2018-02-10 23:30:32Z karl $
+## configure options and TL libraries required for autosp.
 # Check whether --enable-autosp was given.
 if test "${enable_autosp+set}" = set; then :
   enableval=$enable_autosp;
@@ -4197,6 +4202,25 @@
     ;;
 esac
 
+## utils/autosp/ac/withenable.ac: configure.ac fragment for TeX Live subdir
+## $Id: withenable.ac 46590 2018-02-10 23:30:32Z karl $
+## configure options and TL libraries for axodraw2.
+# Check whether --enable-axodraw2 was given.
+if test "${enable_axodraw2+set}" = set; then :
+  enableval=$enable_axodraw2;
+fi
+case $enable_axodraw2 in #(
+  yes|no) :
+     ;; #(
+  *) :
+
+   enable_axodraw2=$enable_all_pkgs
+     { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming \`--enable-axodraw2=$enable_axodraw2'" >&5
+$as_echo "$as_me: Assuming \`--enable-axodraw2=$enable_axodraw2'" >&6;}
+     ac_configure_args="$ac_configure_args '--enable-axodraw2=$enable_axodraw2'"
+    ;;
+esac
+
 ## utils/devnag/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory utils/devnag/
 ## configure options and TL libraries required for devnag
 # Check whether --enable-devnag was given.
@@ -4660,6 +4684,24 @@
   need_zziplib=yes
   need_lua52=yes
 }
+# Check whether --enable-luatex53 was given.
+if test "${enable_luatex53+set}" = set; then :
+  enableval=$enable_luatex53;
+fi
+case $enable_luatex53 in #(
+  yes | no) :
+     ;; #(
+  *) :
+    enable_luatex53=yes ;;
+esac
+
+test "x$enable_web2c:$enable_luatex53" = xyes:yes && {
+  need_poppler=yes
+  need_mpfr=yes
+  need_libpng=yes
+  need_zziplib=yes
+  need_lua53=yes
+}
 # Check whether --enable-luajittex was given.
 if test "${enable_luajittex+set}" = set; then :
   enableval=$enable_luajittex;
@@ -6359,6 +6401,9 @@
 ## libs/lua52/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory libs/lua52/
 ## configure options and TL libraries required for lua52
 
+## libs/lua53/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory libs/lua53/
+## configure options and TL libraries required for lua53
+
 ## libs/zlib/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory libs/zlib/
 ## configure options and TL libraries required for zlib
 
@@ -24838,11 +24883,11 @@
 test "x$srcdir" = x. || msg_compiling="$msg_compiling
       from sources in $kpse_src"
 { $as_echo "$as_me:${as_lineno-$LINENO}: result:
-** Configuration summary for $PACKAGE_STRING (2018/dev$with_banner_add):
+** Configuration summary for $PACKAGE_STRING (2018$with_banner_add):
 
    $msg_compiling" >&5
 $as_echo "
-** Configuration summary for $PACKAGE_STRING (2018/dev$with_banner_add):
+** Configuration summary for $PACKAGE_STRING (2018$with_banner_add):
 
    $msg_compiling" >&6; }
 case $kpse_src$kpse_bld in

Modified: branches/stable/source/src/doc/ChangeLog
===================================================================
--- branches/stable/source/src/doc/ChangeLog	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/doc/ChangeLog	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,3 +1,17 @@
+2018-02-20  Karl Berry  <karl at freefriends.org>
+
+	* tlbuild.texi (Continuous integration): Texinfo syntax, wording.
+
+2018-02-20  Norbert Preining  <norbert at preining.info>
+
+	* tlbuild.texi (Continuous integration): new chapter.
+
+2018-02-10  Karl Berry  <karl at freefriends.org>
+
+	* tlbuild.texi (Adding a new program module): more specifics
+	on our usual layout and new files.
+	(version): (February) 2018.
+
 2017-03-22  Karl Berry  <karl at tug.org>
 
 	* tlbuild.texi: we now default to gcc for ICU too.

Modified: branches/stable/source/src/doc/Makefile.in
===================================================================
--- branches/stable/source/src/doc/Makefile.in	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/doc/Makefile.in	2018-02-27 23:34:23 UTC (rev 795)
@@ -122,6 +122,7 @@
 	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/tardate.ac \
 	$(top_srcdir)/version.ac \
 	$(top_srcdir)/utils/autosp/ac/withenable.ac \
+	$(top_srcdir)/utils/axodraw2/ac/withenable.ac \
 	$(top_srcdir)/utils/devnag/ac/withenable.ac \
 	$(top_srcdir)/utils/lacheck/ac/withenable.ac \
 	$(top_srcdir)/utils/m-tx/ac/withenable.ac \
@@ -190,6 +191,7 @@
 	$(top_srcdir)/libs/libpaper/ac/withenable.ac \
 	$(top_srcdir)/libs/luajit/ac/withenable.ac \
 	$(top_srcdir)/libs/lua52/ac/withenable.ac \
+	$(top_srcdir)/libs/lua53/ac/withenable.ac \
 	$(top_srcdir)/libs/zlib/ac/withenable.ac \
 	$(top_srcdir)/texk/ptexenc/ac/withenable.ac \
 	$(top_srcdir)/texk/kpathsea/ac/withenable.ac \

Modified: branches/stable/source/src/doc/build-tools.txt
===================================================================
--- branches/stable/source/src/doc/build-tools.txt	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/doc/build-tools.txt	2018-02-27 23:34:23 UTC (rev 795)
@@ -4,4 +4,4 @@
 flex 2.6.0
 ltmain.sh (GNU libtool) 2.4.6
 m4 (GNU M4) 1.4.18
-makeinfo (GNU texinfo) 6.4
+makeinfo (GNU texinfo) 6.5

Modified: branches/stable/source/src/doc/tlbuild.info
===================================================================
--- branches/stable/source/src/doc/tlbuild.info	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/doc/tlbuild.info	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,9 +1,9 @@
-This is tlbuild.info, produced by makeinfo version 6.4 from
+This is tlbuild.info, produced by makeinfo version 6.5 from
 tlbuild.texi.
 
 This file documents the TeX Live build system and more.
 
-Copyright (C) 2016-2017 Karl Berry.
+Copyright (C) 2016-2018 Karl Berry.
 Copyright (C) 2013-2015 Karl Berry & Peter Breitenlohner.
 
    Permission is granted to make and distribute verbatim copies of this
@@ -33,7 +33,7 @@
 
 File: tlbuild.info,  Node: Top,  Next: Introduction,  Up: (dir)
 
-Building TeX Live (2017)
+Building TeX Live (2018)
 ************************
 
 For an overview of this manual, *note Introduction::.
@@ -49,6 +49,7 @@
 * Configure options::           List of all configure options.
 * Cross compilation::           Building on host X for target Y.
 * Coding conventions::          Conventions to follow.
+* Continuous integration::      Automated build testing.
 * install-tl::                  The TeX Live installer.
 * tlmgr::                       The native TeX Live package manager.
 * Index::                       General index.
@@ -59,7 +60,8 @@
 1 Introduction
 **************
 
-This manual (dated April 2017) corresponds to the TeX Live 2017 release.
+This manual (dated February 2018) corresponds to the TeX Live 2018
+release.
 
    This manual is aimed at system installers and programmers, and
 focuses on how to configure, build, and develop the TeX Live (TL)
@@ -74,13 +76,13 @@
    For information on acquiring the TL sources, see
 <http://tug.org/texlive/svn>.
 
-   This manual does not duplicate the (primarily user-level) information
-found in other TL documentation resources, such as:
+   This manual does not duplicate the information found in other TL
+documentation resources, such as:
 
    * The TeX Live web pages: <http://tug.org/texlive>.
 
-   * The web page with an overview of how to build the binaries which
-     are distributed with TeX Live: <http://tug.org/texlive/build.html>.
+   * The web page describing how to build the binaries which are
+     distributed with TeX Live: <http://tug.org/texlive/build.html>.
 
    * The TeX Live user manual: <http://tug.org/texlive/doc.html>, or run
      'texdoc texlive'.
@@ -596,7 +598,7 @@
      flex 2.6.0
      ltmain.sh (GNU libtool) 2.4.6
      m4 (GNU M4) 1.4.18
-     makeinfo (GNU texinfo) 6.4
+     makeinfo (GNU texinfo) 6.5
 
    These versions should be used to update the generated files (e.g.,
 'configure' or 'Makefile.in') in all or parts of the TL tree after their
@@ -1120,11 +1122,10 @@
 the TeX-specific libraries and is included by adding its name 'PROG' to
 the M4 list 'kpse_utils_pkgs' in 'm4/kpse-pkgs.m4'.
 
-   In either case, apart from the program sources and build system
-('configure.ac' and 'Makefile.am'), the subdirectory 'texk/PROG' or
-'utils/PROG' must provide a fragment 'ac/withenable.ac' that contains
-the M4 macro 'KPSE_ENABLE_PROG' defined in 'm4/kpse-setup.m4' with
-'PROG' as the mandatory first argument and three optional arguments:
+   In either case, the subdirectory 'texk/PROG' or 'utils/PROG' must
+provide a fragment 'ac/withenable.ac' that contains the M4 macro
+'KPSE_ENABLE_PROG' defined in 'm4/kpse-setup.m4' with 'PROG' as the
+mandatory first argument and three optional arguments:
 
   1. a list of required libraries from the TL tree;
 
@@ -1133,13 +1134,58 @@
      compilation is not possible, 'x' if the program requires X11
      libraries);
 
-  3. and a comment added to the help text for the 'configure' option
+  3. a comment added to the help text for the 'configure' option
      '--enable-PROG' or '--disable-PROG'.
 
    If the module requires specific configure options to be seen at the
-top-level, they should be defined in an additional fragment 'ac/PROG.ac'
+top level, they should be defined in an additional fragment 'ac/PROG.ac'
 included from 'ac/withenable.ac' and 'configure.ac'.
 
+   Usually, the new program is maintained somewhere outside of TeX Live.
+In that case, we put the upstream sources into a subdirectory 'PROG-src'
+(e.g., 'utils/newprog/newprog-src').  We do not run 'configure' in this
+original '...-src' directory, only in our own directory, but we do
+compile using the source files in '...-src'.
+
+   So, these are the files that we must generally create:
+
+'ac/withenable.ac'
+     The 'KPSE_ENABLE_PROG' call just explained.
+
+'configure.ac'
+'Makefile.am'
+     By merging the contents of the original 'configure.ac' (if
+     provided) and a comparable program already in TL. There is no magic
+     recipe, it's necessary to think about needs to be done in the
+     original vs. in TeX Live.
+
+'TLpatches/TL-Changes'
+     Actions taken after getting the original source tree; typically
+     removal of derived or unused common files.
+
+'TLpatches/patch-...'
+     If any changes are needed to the original sources, record the
+     patches here so they can be applied next time.  And send them
+     upstream so that perhaps they won't have to be.
+
+'ChangeLog'
+     Record all TL-specific changes, now and in the future.
+
+   Then, run GNU 'autoreconf' in the new directory (*note Build system
+tools::).  After that works, 'svn add' the necessary files, notably
+'Makefile.in aclocal.m4 configure', and 'svn:ignore' the Automake cache
+'autom4te.cache'.  (This is so people checking out the TL source tree do
+not have to run any autotools, but can simply run 'configure'.)
+
+   Then, run the TL tool 'reautoconf' in the top-level TL 'source/'
+directory, to incorporate the new program into the build tree.
+
+   Then, run (and rerun) a build until the program compiles and tests
+successfully, probably involving rerunning autoreconf in the source
+directory, 'make' in the build directory, etc.
+
+   After final success, don't forget to commit.
+
 
 File: tlbuild.info,  Node: Adding a new generic library module,  Next: Adding a new TeX-specific library module,  Prev: Adding a new program module,  Up: Extending TeX Live
 
@@ -1864,7 +1910,7 @@
 thus cross compilation is not possible.
 
 
-File: tlbuild.info,  Node: Coding conventions,  Next: install-tl,  Prev: Cross compilation,  Up: Top
+File: tlbuild.info,  Node: Coding conventions,  Next: Continuous integration,  Prev: Cross compilation,  Up: Top
 
 9 Coding conventions
 ********************
@@ -1986,8 +2032,86 @@
 modification of quantities supposed to be constant.
 
 
-File: tlbuild.info,  Node: install-tl,  Next: tlmgr,  Prev: Coding conventions,  Up: Top
+File: tlbuild.info,  Node: Continuous integration,  Next: install-tl,  Prev: Coding conventions,  Up: Top
 
+10 Continuous integration
+*************************
+
+Overview: the sources of TeX Live are subjected to continuous
+integration testing on Travis-CI
+(<https://travis-ci.org/TeX-Live/texlive-source>) via a git-svn mirror
+of the sources that is pushed to Github
+(<https://github.com/TeX-Live/texlive-source>).  The git-svn mirror is
+updated (currently) at 30 minute intervals, and only the last commit
+pushed is tested on Travis-CI.
+
+Transfer from Subversion to Github
+----------------------------------
+
+git-svn (<https://git-scm.com/docs/git-svn>) is used to check out the
+subtree 'Build/source' of the Subversion repository.  The author index
+file used is not maintained in either Git or Subversion but can be
+provided on request.
+
+   The initial checkout was done by invoking
+     git svn --authors-file usermap clone svn://USER@tug.org/texlive/trunk/Build/source
+
+where the 'usermap' file maps Subversion user names to name and emails
+of the authors.  If no user account at <tug.org> is available, anonymous
+checkout is possible, too:
+     git svn --authors-file usermap clone svn://tug.org/texlive/trunk/Build/source
+
+   In the following, we will use _admin_ to refer to a user who has
+read/write access to the TeX Live subversion repository, and is also an
+administrator of the 'TeX-Live' Team on Github.  The above initial
+checkout has been carried out by _admin_ on the server 'texlive.info'.
+
+   On Github (<https://github.com>), a new git repository named
+'texlive-source' was created by _admin_ within the 'TeX-Live'
+"organization" (<https://github.com/TeX-Live>).  The remote was added to
+the checkout with 'git remote add origin
+git at github.com:TeX-Live/texlive-source.git'.
+
+   To automate the update on Github, a new ssh key was generated and
+added to the 'texlive-source' repository on Github as deployment key.
+This way pushes using this key can only go to the 'texlive-source'
+repository and not anywhere else.
+
+   The usage of 'git-svn' requires a strict discipline to keep a linear
+history in the master branch.  Since we are aiming at a pure mirror
+facility, we have decided to further restrict the 'master' branch of the
+'texlive-source' repository on Github to changes by _admin_.
+
+   This setup allows other developers to branch off 'master' and push
+their branches to the Github repository, but all updates need to come
+from the local 'master' (not the one on Github) to Subversion, back to
+'master' on 'texlive.info', and from there to Github.
+
+Automatic update of the Git mirror
+----------------------------------
+
+_admin_ has installed a cron job on 'texlive.info' running every 30
+minute which essentially runs 'git svn rebase' and 'git push' in the
+'master' branch of the checkout.  The first command fetches the changes
+from the Subversion repository and updates the 'master' branch with
+them, the second one pushes changes (if available) to Github.
+
+CI testing on Travis-CI
+-----------------------
+
+The 'source' tree of TeX Live contains a top-level file '.travis.yml'
+which controls the automatic testing on Travis-CI. _admin_ has
+registered to Travis-CI and allowed access to the Github's 'TeX-Live'
+organization's 'texlive-source' repository.  The default settings are to
+build the last commit of each push.  No further action is necessary on
+Travis-CI.
+
+   If changes have been pushed via the cron job above, Travis-CI will
+automatically checkout the last pushed commit and try building it.
+
+
+File: tlbuild.info,  Node: install-tl,  Next: tlmgr,  Prev: Continuous integration,  Up: Top
+
 Appendix A install-tl
 *********************
 
@@ -4515,6 +4639,8 @@
 * --without-x:                           --without-x.          (line  6)
 * -C configure option:                   Build in parallel.    (line 11)
 * -j make option:                        Build in parallel.    (line  6)
+* .travis.yml:                           Continuous integration.
+                                                               (line 68)
 * adapting TeX Live for distros:         Distro builds.        (line 54)
 * adding a new generic library:          Adding a new generic library module.
                                                                (line  6)
@@ -4572,6 +4698,8 @@
 * CC_BUILD:                              Cross problems.       (line 13)
 * chktex:                                Declarations and definitions.
                                                                (line 18)
+* ci:                                    Continuous integration.
+                                                               (line  6)
 * clisp:                                 Variables for configure.
                                                                (line 18)
 * CLISP:                                 Variables for configure.
@@ -4613,6 +4741,8 @@
                                                                (line  6)
 * configuring, for cross compilation:    Cross configuring.    (line  6)
 * const:                                 Const.                (line  6)
+* continuous integration:                Continuous integration.
+                                                               (line  6)
 * conventions, coding:                   Coding conventions.   (line  6)
 * CPPFLAGS:                              Variables for configure.
                                                                (line 12)
@@ -4696,7 +4826,7 @@
                                                                (line  6)
 * kpathsea library:                      kpathsea library.     (line  6)
 * kpathsea.ac:                           kpathsea library.     (line 20)
-* kpse-libpng-flags.m4:                  png library.          (line 42)
+* kpse-libpng-flags.m4:                  png library.          (line 43)
 * kpse-pkgs.m4:                          Overview of build system.
                                                                (line 30)
 * kpse-zlib-flags.m4:                    zlib library.         (line  6)
@@ -4729,7 +4859,7 @@
 * KPSE_LARGEFILE:                        Macros for libraries. (line  8)
 * KPSE_LIBPNG_FLAGS:                     Macros for library and header flags.
                                                                (line 10)
-* KPSE_LIBPNG_FLAGS <1>:                 png library.          (line 42)
+* KPSE_LIBPNG_FLAGS <1>:                 png library.          (line 43)
 * kpse_libs_pkgs:                        Adding a new generic library module.
                                                                (line  6)
 * KPSE_LIB_FLAGS:                        Macros for library and header flags.
@@ -4745,10 +4875,10 @@
                                                                (line  6)
 * kpse_texlibs_pkgs:                     Adding a new TeX-specific library module.
                                                                (line 11)
-* KPSE_TRY_LIB:                          png library.          (line 17)
+* KPSE_TRY_LIB:                          png library.          (line 18)
 * KPSE_TRY_LIB <1>:                      Adding a new generic library module.
                                                                (line 20)
-* KPSE_TRY_LIBXX:                        png library.          (line 30)
+* KPSE_TRY_LIBXX:                        png library.          (line 31)
 * KPSE_TRY_LIBXX <1>:                    Adding a new generic library module.
                                                                (line 20)
 * kpse_utils_pkgs:                       Adding a new program module.
@@ -4888,6 +5018,8 @@
 * top-level directories:                 Top-level directories.
                                                                (line  6)
 * touching files to avoid rerunning:     Build system tools.   (line 39)
+* Travis-CI:                             Continuous integration.
+                                                               (line  6)
 * type cast, avoiding:                   Const.                (line 38)
 * use-commit-times, Subversion:          Build system tools.   (line 34)
 * variable declarations, in source code: Declarations and definitions.
@@ -4939,312 +5071,313 @@
 
 Tag Table:
 Node: Top1208
-Node: Introduction2126
-Node: Overview of build system3878
-Node: Prerequisites5921
-Node: Building8319
-Node: Build iteration9567
-Node: Build problems10639
-Node: Build in parallel11042
-Node: Build distribution11634
-Node: Build one package12205
-Node: Installing15557
-Node: Installation directories16572
-Node: Linked scripts18388
-Node: Distro builds19869
-Node: Layout and infrastructure22259
-Node: Build system tools23087
-Node: Top-level directories25098
-Node: Autoconf macros27512
-Node: General setup macros28213
-Node: Macros for programs29080
-Node: Macros for compilers29892
-Node: Macros for libraries31326
-Node: Macros for library and header flags31752
-Node: Macros for Windows33632
-Node: Library modules35209
-Node: png library35698
-Node: zlib library37972
-Node: freetype library38487
-Node: kpathsea library39015
-Node: Program modules40414
-Node: t1utils package40842
-Node: xindy package41393
-Node: xdvik package42543
-Node: asymptote43616
-Node: Extending TeX Live44067
-Node: Adding a new program module44844
-Node: Adding a new generic library module46363
-Node: Adding a new TeX-specific library module48576
-Node: Configure options49263
-Node: Global configure options50645
-Node: --disable-native-texlive-build51187
-Node: --prefix --bindir ...52177
-Node: --disable-largefile52717
-Node: --disable-missing53402
-Node: --enable-compiler-warnings=LEVEL53803
-Node: --enable-cxx-runtime-hack54542
-Node: --enable-maintainer-mode54969
-Node: --enable-multiplatform55498
-Node: --enable-shared56036
-Node: --enable-silent-rules56407
-Node: --without-ln-s56863
-Node: --without-x57214
-Node: Program-specific configure options57402
-Node: --enable-PROG --disable-PROG58045
-Node: --disable-all-pkgs58322
-Node: Configure options for texk/web2c59308
-Node: Configure options for texk/bibtex-x61826
-Node: Configure options for texk/dvipdfm-x62369
-Node: Configure options for texk/dvisvgm63142
-Node: Configure options for texk/texlive64028
-Node: Configure options for texk/xdvik64449
-Node: Configure options for utils/xindy65053
-Node: Library-specific configure options65954
-Node: Configure options for kpathsea66965
-Node: Configure options for system poppler67674
-Node: Variables for configure68465
-Node: Cross compilation69893
-Node: Cross configuring71192
-Node: Cross problems72865
-Node: Coding conventions74512
-Node: Declarations and definitions75239
-Node: Const77421
-Node: install-tl79284
-Node: install-tl NAME79625
-Node: install-tl SYNOPSIS79783
-Node: install-tl DESCRIPTION79991
-Node: install-tl REFERENCES80992
-Node: install-tl OPTIONS81508
-Ref: install-tl *-gui* [[=]_module_]81862
-Ref: install-tl text82071
-Ref: install-tl wizard82194
-Ref: install-tl perltk82348
-Ref: install-tl *-no-gui*82782
-Ref: install-tl *-lang* _llcode_82863
-Ref: install-tl *-repository* _url|path_83550
-Ref: install-tl *-select-repository*85361
-Ref: install-tl *-all-options*85797
-Ref: install-tl *-custom-bin* _path_86104
-Ref: install-tl *-debug-translation*86759
-Ref: install-tl *-force-platform* _platform_86978
-Ref: install-tl *-help*, *--help*, *-?*87222
-Ref: install-tl *-in-place*87615
-Ref: install-tl *-logfile* _file_88142
-Ref: install-tl *-no-cls*88493
-Ref: install-tl *-non-admin*88624
-Ref: install-tl *--persistent-downloads*88729
-Ref: install-tl *--no-persistent-downloads*88757
-Ref: install-tl *-portable*89365
-Ref: install-tl *-print-platform*89504
-Ref: install-tl *-profile* _profile_89697
-Ref: install-tl *-q*91191
-Ref: install-tl *-scheme* _scheme_91253
-Ref: install-tl *-v*91727
-Ref: install-tl *-version*, *--version*91888
-Node: install-tl ENVIRONMENT VARIABLES92019
-Ref: install-tl TEXLIVE_INSTALL_ENV_NOCHECK92408
-Ref: install-tl TEXLIVE_INSTALL_NO_CONTEXT_CACHE92610
-Ref: install-tl TEXLIVE_INSTALL_PREFIX92716
-Ref: install-tl TEXLIVE_INSTALL_TEXMFCONFIG92747
-Ref: install-tl TEXLIVE_INSTALL_TEXMFHOME92776
-Ref: install-tl TEXLIVE_INSTALL_TEXMFLOCAL92806
-Ref: install-tl TEXLIVE_INSTALL_TEXMFSYSCONFIG92840
-Ref: install-tl TEXLIVE_INSTALL_TEXMFSYSVAR92871
-Ref: install-tl TEXLIVE_INSTALL_TEXMFVAR92899
-Ref: install-tl NOPERLDOC92954
-Node: install-tl AUTHORS AND COPYRIGHT93018
-Node: tlmgr93376
-Node: tlmgr NAME93813
-Node: tlmgr SYNOPSIS93938
-Node: tlmgr DESCRIPTION94128
-Node: tlmgr EXAMPLES95224
-Ref: tlmgr tlmgr option repository http://mirror.ctan.org/systems/texlive/tlnet95515
-Ref: tlmgr tlmgr update --list95696
-Ref: tlmgr tlmgr update --all95789
-Ref: tlmgr tlmgr info _pkg_95945
-Node: tlmgr OPTIONS96151
-Ref: tlmgr *--repository* _url|path_96671
-Ref: tlmgr *--gui* [_action_]97396
-Ref: tlmgr *--gui-lang* _llcode_97803
-Ref: tlmgr *--debug-translation*98486
-Ref: tlmgr *--machine-readable*98689
-Ref: tlmgr *--no-execute-actions*98957
-Ref: tlmgr *--package-logfile* _file_99150
-Ref: tlmgr *--pause*99405
-Ref: tlmgr *--persistent-downloads*99560
-Ref: tlmgr *--no-persistent-downloads*99588
-Ref: tlmgr *--pin-file*100082
-Ref: tlmgr *--usermode*100300
-Ref: tlmgr *--usertree* _dir_100420
-Node: tlmgr ACTIONS100970
-Node: tlmgr help102202
-Node: tlmgr version102678
-Node: tlmgr backup [--clean[=_N_]] [--backupdir _dir_] [--all | _pkg_]...102996
-Ref: tlmgr *--backupdir* _directory_104090
-Ref: tlmgr *--all*104287
-Ref: tlmgr *--clean*[=_N_]104509
-Ref: tlmgr *--dry-run*104806
-Node: tlmgr candidates _pkg_104926
-Ref: tlmgr *candidates _pkg_* 1105213
-Node: tlmgr check [_option_]... [files|depends|executes|runfiles|all]105357
-Ref: tlmgr *files*105800
-Ref: tlmgr *depends*105935
-Ref: tlmgr *executes*106277
-Ref: tlmgr *runfiles*106395
-Ref: tlmgr *--use-svn*106507
-Node: tlmgr conf [texmf|tlmgr|updmap [--conffile _file_] [--delete] [_key_ [_value_]]]106624
-Node: tlmgr dump-tlpdb [--local|--remote]108696
-Ref: tlmgr *--local*109206
-Ref: tlmgr *--remote*109245
-Node: tlmgr generate [_option_]... _what_109667
-Ref: tlmgr *generate language*109908
-Ref: tlmgr *generate language.dat*109933
-Ref: tlmgr *generate language.def*109958
-Ref: tlmgr *generate language.dat.lua*109987
-Ref: tlmgr *generate fmtutil*110007
-Ref: tlmgr *--dest* _output_file_112244
-Ref: tlmgr *--localcfg* _local_conf_file_112820
-Ref: tlmgr *--rebuild-sys*112943
-Node: tlmgr gui113804
-Node: tlmgr info [_option_...] [collections|schemes|_pkg_...]114048
-Ref: tlmgr *--list*115253
-Ref: tlmgr *--only-installed*115532
-Ref: tlmgr *--taxonomy*115747
-Ref: tlmgr *--keyword*115759
-Ref: tlmgr *--functionality*115777
-Ref: tlmgr *--characterization*115798
-Node: tlmgr init-usertree116011
-Node: tlmgr install [_option_]... _pkg_...116437
-Ref: tlmgr *--file*116801
-Ref: tlmgr *--reinstall*117027
-Ref: tlmgr *--no-depends*117407
-Ref: tlmgr *--no-depends-at-all*117566
-Ref: tlmgr *--dry-run* 1117964
-Ref: tlmgr *--force*118082
-Node: tlmgr option118288
-Ref: tlmgr *option [show]*118461
-Ref: tlmgr *option showall*118479
-Ref: tlmgr *option _key_ [_value_]*118505
-Node: tlmgr paper122353
-Ref: tlmgr *paper [a4|letter]*122538
-Ref: tlmgr *[xdvi|pdftex|dvips|dvipdfmx|context|psutils] paper [_papersize_|--list]*122612
-Node: tlmgr path [--w32mode=user|admin] [add|remove]123639
-Node: tlmgr pinning125122
-Ref: tlmgr pinning show125429
-Ref: tlmgr pinning add _repo_ _pkgglob_...125502
-Ref: tlmgr pinning remove _repo_ _pkgglob_...125621
-Ref: tlmgr pinning remove _repo_ --all125774
-Node: tlmgr platform list|add|remove _platform_...125828
-Node: tlmgr platform set _platform_126076
-Node: tlmgr platform set auto126304
-Ref: tlmgr *--dry-run* 2127421
-Node: tlmgr postaction [--w32mode=user|admin] [--fileassocmode=1|2] [--all] [install|remove] [shortcut|fileassoc|script] [_pkg_]...127530
-Node: tlmgr print-platform128832
-Node: tlmgr restore [--backupdir _dir_] [--all | _pkg_ [_rev_]]129304
-Ref: tlmgr *--all* 1130200
-Ref: tlmgr *--backupdir* _directory_ 1130394
-Ref: tlmgr *--dry-run* 3130550
-Ref: tlmgr *--force* 1130667
-Node: tlmgr remove [_option_]... _pkg_...130695
-Ref: tlmgr *--no-depends* 1131218
-Ref: tlmgr *--no-depends-at-all* 1131280
-Ref: tlmgr *--force* 2131336
-Ref: tlmgr *--dry-run* 4131808
-Node: tlmgr repository131915
-Ref: tlmgr *repository list*132123
-Ref: tlmgr *repository list _path|tag_*132153
-Ref: tlmgr *repository add _path_ [_tag_]*132186
-Ref: tlmgr *repository remove _path|tag_*132218
-Ref: tlmgr *repository set _path_[#_tag_] [_path_[#_tag_] ...]*132272
-Node: tlmgr search [_option_...] _what_133356
-Node: tlmgr search [_option_...] --file _what_133867
-Node: tlmgr search [_option_...] --taxonomy _what_134118
-Node: tlmgr search [_option_...] --keyword _what_134429
-Node: tlmgr search [_option_...] --functionality _what_134747
-Node: tlmgr search [_option_...] --characterization _what_135085
-Node: tlmgr search [_option_...] --all _what_135425
-Ref: tlmgr *--global*135873
-Ref: tlmgr *--word*135985
-Ref: tlmgr *--list* 1136224
-Ref: tlmgr *--file* 1136570
-Ref: tlmgr *--taxonomy* 1136627
-Ref: tlmgr *--keyword* 1136639
-Ref: tlmgr *--functionality* 1136657
-Ref: tlmgr *--characterization* 1136678
-Ref: tlmgr *--all* 2136833
-Node: tlmgr uninstall136916
-Ref: tlmgr *--force* 3137170
-Node: tlmgr update [_option_]... [_pkg_]...137226
-Ref: tlmgr *--all* 3137597
-Ref: tlmgr *--self*139338
-Ref: tlmgr *--dry-run* 5140102
-Ref: tlmgr *--list* [_pkg_]140279
-Ref: tlmgr *--exclude* _pkg_140968
-Ref: tlmgr *--no-auto-remove* [_pkg_]...141661
-Ref: tlmgr *--no-auto-install* [_pkg_]...142112
-Ref: tlmgr *--reinstall-forcibly-removed*142768
-Ref: tlmgr *--backup* and *--backupdir* _directory_143332
-Ref: tlmgr *--no-depends* 2144513
-Ref: tlmgr *--no-depends-at-all* 2144716
-Ref: tlmgr *--force* 4144772
-Node: tlmgr USER MODE145198
-Node: tlmgr user mode install148009
-Node: tlmgr user mode backup; restore; remove; update148956
-Node: tlmgr user mode generate; option; paper149398
-Node: tlmgr CONFIGURATION FILE FOR TLMGR149774
-Node: tlmgr TAXONOMIES150865
-Ref: tlmgr --keyword 2151491
-Ref: tlmgr --functionality 2151576
-Ref: tlmgr --characterization 2151732
-Ref: tlmgr --taxonomy 2151873
-Node: tlmgr MULTIPLE REPOSITORIES152414
-Node: tlmgr Pinning154135
-Node: tlmgr GUI FOR TLMGR156110
-Node: tlmgr Main display157332
-Node: tlmgr Display configuration area157584
-Ref: tlmgr Status157945
-Ref: tlmgr Category158109
-Ref: tlmgr Match158295
-Ref: tlmgr Selection158555
-Ref: tlmgr Display configuration buttons158759
-Node: tlmgr Package list area158942
-Ref: tlmgr a checkbox159526
-Ref: tlmgr package name159662
-Ref: tlmgr local revision (and version)159761
-Ref: tlmgr remote revision (and version)160136
-Ref: tlmgr short description160433
-Node: tlmgr Main display action buttons160478
-Ref: tlmgr Update all installed160744
-Ref: tlmgr Update161116
-Ref: tlmgr Install161166
-Ref: tlmgr Remove161352
-Ref: tlmgr Backup161530
-Node: tlmgr Menu bar161687
-Ref: tlmgr tlmgr menu161884
-Ref: tlmgr Options menu162192
-Ref: tlmgr Actions menu163275
-Ref: tlmgr Help menu163703
-Node: tlmgr MACHINE-READABLE OUTPUT163836
-Node: tlmgr Machine-readable update and install output164646
-Ref: tlmgr location-url _location_165922
-Ref: tlmgr total-bytes _count_166138
-Ref: tlmgr _pkgname_166548
-Ref: tlmgr _status_166758
-Ref: tlmgr d166836
-Ref: tlmgr f166896
-Ref: tlmgr u167075
-Ref: tlmgr r167121
-Ref: tlmgr a167244
-Ref: tlmgr i167422
-Ref: tlmgr I167541
-Ref: tlmgr _localrev_167643
-Ref: tlmgr _serverrev_167750
-Ref: tlmgr _size_167862
-Ref: tlmgr _runtime_168031
-Ref: tlmgr _esttot_168101
-Node: tlmgr Machine-readable option output168134
-Node: tlmgr AUTHORS AND COPYRIGHT168646
-Node: Index168993
+Node: Introduction2183
+Node: Overview of build system3906
+Node: Prerequisites5949
+Node: Building8347
+Node: Build iteration9595
+Node: Build problems10667
+Node: Build in parallel11070
+Node: Build distribution11662
+Node: Build one package12233
+Node: Installing15585
+Node: Installation directories16600
+Node: Linked scripts18416
+Node: Distro builds19897
+Node: Layout and infrastructure22287
+Node: Build system tools23115
+Node: Top-level directories25126
+Node: Autoconf macros27540
+Node: General setup macros28241
+Node: Macros for programs29108
+Node: Macros for compilers29920
+Node: Macros for libraries31354
+Node: Macros for library and header flags31780
+Node: Macros for Windows33660
+Node: Library modules35237
+Node: png library35726
+Node: zlib library38000
+Node: freetype library38515
+Node: kpathsea library39043
+Node: Program modules40442
+Node: t1utils package40870
+Node: xindy package41421
+Node: xdvik package42571
+Node: asymptote43644
+Node: Extending TeX Live44095
+Node: Adding a new program module44872
+Node: Adding a new generic library module48167
+Node: Adding a new TeX-specific library module50380
+Node: Configure options51067
+Node: Global configure options52449
+Node: --disable-native-texlive-build52991
+Node: --prefix --bindir ...53981
+Node: --disable-largefile54521
+Node: --disable-missing55206
+Node: --enable-compiler-warnings=LEVEL55607
+Node: --enable-cxx-runtime-hack56346
+Node: --enable-maintainer-mode56773
+Node: --enable-multiplatform57302
+Node: --enable-shared57840
+Node: --enable-silent-rules58211
+Node: --without-ln-s58667
+Node: --without-x59018
+Node: Program-specific configure options59206
+Node: --enable-PROG --disable-PROG59849
+Node: --disable-all-pkgs60126
+Node: Configure options for texk/web2c61112
+Node: Configure options for texk/bibtex-x63630
+Node: Configure options for texk/dvipdfm-x64173
+Node: Configure options for texk/dvisvgm64946
+Node: Configure options for texk/texlive65832
+Node: Configure options for texk/xdvik66253
+Node: Configure options for utils/xindy66857
+Node: Library-specific configure options67758
+Node: Configure options for kpathsea68769
+Node: Configure options for system poppler69478
+Node: Variables for configure70269
+Node: Cross compilation71697
+Node: Cross configuring72996
+Node: Cross problems74669
+Node: Coding conventions76316
+Node: Declarations and definitions77055
+Node: Const79237
+Node: Continuous integration81100
+Node: install-tl84634
+Node: install-tl NAME84979
+Node: install-tl SYNOPSIS85137
+Node: install-tl DESCRIPTION85345
+Node: install-tl REFERENCES86346
+Node: install-tl OPTIONS86862
+Ref: install-tl *-gui* [[=]_module_]87216
+Ref: install-tl text87425
+Ref: install-tl wizard87548
+Ref: install-tl perltk87702
+Ref: install-tl *-no-gui*88136
+Ref: install-tl *-lang* _llcode_88217
+Ref: install-tl *-repository* _url|path_88904
+Ref: install-tl *-select-repository*90715
+Ref: install-tl *-all-options*91151
+Ref: install-tl *-custom-bin* _path_91458
+Ref: install-tl *-debug-translation*92113
+Ref: install-tl *-force-platform* _platform_92332
+Ref: install-tl *-help*, *--help*, *-?*92576
+Ref: install-tl *-in-place*92969
+Ref: install-tl *-logfile* _file_93496
+Ref: install-tl *-no-cls*93847
+Ref: install-tl *-non-admin*93978
+Ref: install-tl *--persistent-downloads*94083
+Ref: install-tl *--no-persistent-downloads*94111
+Ref: install-tl *-portable*94719
+Ref: install-tl *-print-platform*94858
+Ref: install-tl *-profile* _profile_95051
+Ref: install-tl *-q*96545
+Ref: install-tl *-scheme* _scheme_96607
+Ref: install-tl *-v*97081
+Ref: install-tl *-version*, *--version*97242
+Node: install-tl ENVIRONMENT VARIABLES97373
+Ref: install-tl TEXLIVE_INSTALL_ENV_NOCHECK97762
+Ref: install-tl TEXLIVE_INSTALL_NO_CONTEXT_CACHE97964
+Ref: install-tl TEXLIVE_INSTALL_PREFIX98070
+Ref: install-tl TEXLIVE_INSTALL_TEXMFCONFIG98101
+Ref: install-tl TEXLIVE_INSTALL_TEXMFHOME98130
+Ref: install-tl TEXLIVE_INSTALL_TEXMFLOCAL98160
+Ref: install-tl TEXLIVE_INSTALL_TEXMFSYSCONFIG98194
+Ref: install-tl TEXLIVE_INSTALL_TEXMFSYSVAR98225
+Ref: install-tl TEXLIVE_INSTALL_TEXMFVAR98253
+Ref: install-tl NOPERLDOC98308
+Node: install-tl AUTHORS AND COPYRIGHT98372
+Node: tlmgr98730
+Node: tlmgr NAME99167
+Node: tlmgr SYNOPSIS99292
+Node: tlmgr DESCRIPTION99482
+Node: tlmgr EXAMPLES100578
+Ref: tlmgr tlmgr option repository http://mirror.ctan.org/systems/texlive/tlnet100869
+Ref: tlmgr tlmgr update --list101050
+Ref: tlmgr tlmgr update --all101143
+Ref: tlmgr tlmgr info _pkg_101299
+Node: tlmgr OPTIONS101505
+Ref: tlmgr *--repository* _url|path_102025
+Ref: tlmgr *--gui* [_action_]102750
+Ref: tlmgr *--gui-lang* _llcode_103157
+Ref: tlmgr *--debug-translation*103840
+Ref: tlmgr *--machine-readable*104043
+Ref: tlmgr *--no-execute-actions*104311
+Ref: tlmgr *--package-logfile* _file_104504
+Ref: tlmgr *--pause*104759
+Ref: tlmgr *--persistent-downloads*104914
+Ref: tlmgr *--no-persistent-downloads*104942
+Ref: tlmgr *--pin-file*105436
+Ref: tlmgr *--usermode*105654
+Ref: tlmgr *--usertree* _dir_105774
+Node: tlmgr ACTIONS106324
+Node: tlmgr help107556
+Node: tlmgr version108032
+Node: tlmgr backup [--clean[=_N_]] [--backupdir _dir_] [--all | _pkg_]...108350
+Ref: tlmgr *--backupdir* _directory_109444
+Ref: tlmgr *--all*109641
+Ref: tlmgr *--clean*[=_N_]109863
+Ref: tlmgr *--dry-run*110160
+Node: tlmgr candidates _pkg_110280
+Ref: tlmgr *candidates _pkg_* 1110567
+Node: tlmgr check [_option_]... [files|depends|executes|runfiles|all]110711
+Ref: tlmgr *files*111154
+Ref: tlmgr *depends*111289
+Ref: tlmgr *executes*111631
+Ref: tlmgr *runfiles*111749
+Ref: tlmgr *--use-svn*111861
+Node: tlmgr conf [texmf|tlmgr|updmap [--conffile _file_] [--delete] [_key_ [_value_]]]111978
+Node: tlmgr dump-tlpdb [--local|--remote]114050
+Ref: tlmgr *--local*114560
+Ref: tlmgr *--remote*114599
+Node: tlmgr generate [_option_]... _what_115021
+Ref: tlmgr *generate language*115262
+Ref: tlmgr *generate language.dat*115287
+Ref: tlmgr *generate language.def*115312
+Ref: tlmgr *generate language.dat.lua*115341
+Ref: tlmgr *generate fmtutil*115361
+Ref: tlmgr *--dest* _output_file_117598
+Ref: tlmgr *--localcfg* _local_conf_file_118174
+Ref: tlmgr *--rebuild-sys*118297
+Node: tlmgr gui119158
+Node: tlmgr info [_option_...] [collections|schemes|_pkg_...]119402
+Ref: tlmgr *--list*120607
+Ref: tlmgr *--only-installed*120886
+Ref: tlmgr *--taxonomy*121101
+Ref: tlmgr *--keyword*121113
+Ref: tlmgr *--functionality*121131
+Ref: tlmgr *--characterization*121152
+Node: tlmgr init-usertree121365
+Node: tlmgr install [_option_]... _pkg_...121791
+Ref: tlmgr *--file*122155
+Ref: tlmgr *--reinstall*122381
+Ref: tlmgr *--no-depends*122761
+Ref: tlmgr *--no-depends-at-all*122920
+Ref: tlmgr *--dry-run* 1123318
+Ref: tlmgr *--force*123436
+Node: tlmgr option123642
+Ref: tlmgr *option [show]*123815
+Ref: tlmgr *option showall*123833
+Ref: tlmgr *option _key_ [_value_]*123859
+Node: tlmgr paper127707
+Ref: tlmgr *paper [a4|letter]*127892
+Ref: tlmgr *[xdvi|pdftex|dvips|dvipdfmx|context|psutils] paper [_papersize_|--list]*127966
+Node: tlmgr path [--w32mode=user|admin] [add|remove]128993
+Node: tlmgr pinning130476
+Ref: tlmgr pinning show130783
+Ref: tlmgr pinning add _repo_ _pkgglob_...130856
+Ref: tlmgr pinning remove _repo_ _pkgglob_...130975
+Ref: tlmgr pinning remove _repo_ --all131128
+Node: tlmgr platform list|add|remove _platform_...131182
+Node: tlmgr platform set _platform_131430
+Node: tlmgr platform set auto131658
+Ref: tlmgr *--dry-run* 2132775
+Node: tlmgr postaction [--w32mode=user|admin] [--fileassocmode=1|2] [--all] [install|remove] [shortcut|fileassoc|script] [_pkg_]...132884
+Node: tlmgr print-platform134186
+Node: tlmgr restore [--backupdir _dir_] [--all | _pkg_ [_rev_]]134658
+Ref: tlmgr *--all* 1135554
+Ref: tlmgr *--backupdir* _directory_ 1135748
+Ref: tlmgr *--dry-run* 3135904
+Ref: tlmgr *--force* 1136021
+Node: tlmgr remove [_option_]... _pkg_...136049
+Ref: tlmgr *--no-depends* 1136572
+Ref: tlmgr *--no-depends-at-all* 1136634
+Ref: tlmgr *--force* 2136690
+Ref: tlmgr *--dry-run* 4137162
+Node: tlmgr repository137269
+Ref: tlmgr *repository list*137477
+Ref: tlmgr *repository list _path|tag_*137507
+Ref: tlmgr *repository add _path_ [_tag_]*137540
+Ref: tlmgr *repository remove _path|tag_*137572
+Ref: tlmgr *repository set _path_[#_tag_] [_path_[#_tag_] ...]*137626
+Node: tlmgr search [_option_...] _what_138710
+Node: tlmgr search [_option_...] --file _what_139221
+Node: tlmgr search [_option_...] --taxonomy _what_139472
+Node: tlmgr search [_option_...] --keyword _what_139783
+Node: tlmgr search [_option_...] --functionality _what_140101
+Node: tlmgr search [_option_...] --characterization _what_140439
+Node: tlmgr search [_option_...] --all _what_140779
+Ref: tlmgr *--global*141227
+Ref: tlmgr *--word*141339
+Ref: tlmgr *--list* 1141578
+Ref: tlmgr *--file* 1141924
+Ref: tlmgr *--taxonomy* 1141981
+Ref: tlmgr *--keyword* 1141993
+Ref: tlmgr *--functionality* 1142011
+Ref: tlmgr *--characterization* 1142032
+Ref: tlmgr *--all* 2142187
+Node: tlmgr uninstall142270
+Ref: tlmgr *--force* 3142524
+Node: tlmgr update [_option_]... [_pkg_]...142580
+Ref: tlmgr *--all* 3142951
+Ref: tlmgr *--self*144692
+Ref: tlmgr *--dry-run* 5145456
+Ref: tlmgr *--list* [_pkg_]145633
+Ref: tlmgr *--exclude* _pkg_146322
+Ref: tlmgr *--no-auto-remove* [_pkg_]...147015
+Ref: tlmgr *--no-auto-install* [_pkg_]...147466
+Ref: tlmgr *--reinstall-forcibly-removed*148122
+Ref: tlmgr *--backup* and *--backupdir* _directory_148686
+Ref: tlmgr *--no-depends* 2149867
+Ref: tlmgr *--no-depends-at-all* 2150070
+Ref: tlmgr *--force* 4150126
+Node: tlmgr USER MODE150552
+Node: tlmgr user mode install153363
+Node: tlmgr user mode backup; restore; remove; update154310
+Node: tlmgr user mode generate; option; paper154752
+Node: tlmgr CONFIGURATION FILE FOR TLMGR155128
+Node: tlmgr TAXONOMIES156219
+Ref: tlmgr --keyword 2156845
+Ref: tlmgr --functionality 2156930
+Ref: tlmgr --characterization 2157086
+Ref: tlmgr --taxonomy 2157227
+Node: tlmgr MULTIPLE REPOSITORIES157768
+Node: tlmgr Pinning159489
+Node: tlmgr GUI FOR TLMGR161464
+Node: tlmgr Main display162686
+Node: tlmgr Display configuration area162938
+Ref: tlmgr Status163299
+Ref: tlmgr Category163463
+Ref: tlmgr Match163649
+Ref: tlmgr Selection163909
+Ref: tlmgr Display configuration buttons164113
+Node: tlmgr Package list area164296
+Ref: tlmgr a checkbox164880
+Ref: tlmgr package name165016
+Ref: tlmgr local revision (and version)165115
+Ref: tlmgr remote revision (and version)165490
+Ref: tlmgr short description165787
+Node: tlmgr Main display action buttons165832
+Ref: tlmgr Update all installed166098
+Ref: tlmgr Update166470
+Ref: tlmgr Install166520
+Ref: tlmgr Remove166706
+Ref: tlmgr Backup166884
+Node: tlmgr Menu bar167041
+Ref: tlmgr tlmgr menu167238
+Ref: tlmgr Options menu167546
+Ref: tlmgr Actions menu168629
+Ref: tlmgr Help menu169057
+Node: tlmgr MACHINE-READABLE OUTPUT169190
+Node: tlmgr Machine-readable update and install output170000
+Ref: tlmgr location-url _location_171276
+Ref: tlmgr total-bytes _count_171492
+Ref: tlmgr _pkgname_171902
+Ref: tlmgr _status_172112
+Ref: tlmgr d172190
+Ref: tlmgr f172250
+Ref: tlmgr u172429
+Ref: tlmgr r172475
+Ref: tlmgr a172598
+Ref: tlmgr i172776
+Ref: tlmgr I172895
+Ref: tlmgr _localrev_172997
+Ref: tlmgr _serverrev_173104
+Ref: tlmgr _size_173216
+Ref: tlmgr _runtime_173385
+Ref: tlmgr _esttot_173455
+Node: tlmgr Machine-readable option output173488
+Node: tlmgr AUTHORS AND COPYRIGHT174000
+Node: Index174347
 
 End Tag Table

Modified: branches/stable/source/src/doc/tlbuild.texi
===================================================================
--- branches/stable/source/src/doc/tlbuild.texi	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/doc/tlbuild.texi	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,14 +1,14 @@
 \input texinfo
 @setfilename tlbuild.info
 
- at set version 2017
- at set month-year April 2017
+ at set version 2018
+ at set month-year February 2018
 
 @set mytitle Building @TeX{} Live (@value{version})
 @settitle @value{mytitle}
 
 @macro TL
- at TeX{} Live
+ at TeX{}@tie{}Live
 @end macro
 
 @copying
@@ -15,7 +15,7 @@
 This file documents the @TL{} build system and more.
 
 @noindent
-Copyright @copyright{} 2016--2017 Karl Berry.@*
+Copyright @copyright{} 2016--2018 Karl Berry.@*
 Copyright @copyright{} 2013--2015 Karl Berry & Peter Breitenlohner.
 
 Permission is granted to make and distribute verbatim copies of this
@@ -90,6 +90,7 @@
 * Configure options::           List of all configure options.
 * Cross compilation::           Building on host X for target Y.
 * Coding conventions::          Conventions to follow.
+* Continuous integration::      Automated build testing.
 * install-tl::                  The @TL{} installer.
 * tlmgr::                       The native @TL{} package manager.
 * Index::                       General index.
@@ -118,13 +119,13 @@
 For information on acquiring the TL sources, see
 @url{http://tug.org/texlive/svn}.
 
-This manual does not duplicate the (primarily user-level) information
-found in other TL documentation resources, such as:
+This manual does not duplicate the information found in other TL
+documentation resources, such as:
 
 @itemize
 @item The @TL{} web pages: @url{http://tug.org/texlive}.
 
- at item The web page with an overview of how to build the binaries which 
+ at item The web page describing how to build the binaries which 
 are distributed with @TL{}: @url{http://tug.org/texlive/build.html}.
 
 @item The @TL{} user manual: @url{http://tug.org/texlive/doc.html}, or
@@ -1372,8 +1373,8 @@
 their support files.
 
 
- at node Extending @TeX{} Live
- at section Extending @TeX{} Live
+ at node Extending @TL{}
+ at section Extending @TL{}
 
 @cindex extending @TL{}
 @cindex adding to @TL{}
@@ -1416,10 +1417,9 @@
 
 @pindex withenable.ac at r{, for new modules}
 @findex KPSE_ENABLE_PROG
-In either case, apart from the program sources and build system
-(@file{configure.ac} and @file{Makefile.am}), the subdirectory
- at file{texk/@var{prog}} or @file{utils/@var{prog}} must provide a
-fragment @file{ac/withenable.ac} that contains the M4 macro
+In either case, the subdirectory @file{texk/@var{prog}} or
+ at file{utils/@var{prog}} must provide a fragment
+ at file{ac/withenable.ac} that contains the M4 macro
 @code{KPSE_ENABLE_PROG} defined in @file{m4/kpse-setup.m4} with
 @code{@var{prog}} as the mandatory first argument and three optional
 arguments:
@@ -1432,16 +1432,67 @@
 @code{native} if cross compilation is not possible, @code{x} if the
 program requires X11 libraries);
 
- at item and a comment added to the help text for the @code{configure}
+ at item a comment added to the help text for the @code{configure}
 option @code{--enable- at var{prog}} or @code{--disable- at var{prog}}.
 @end enumerate
 
 If the module requires specific configure options to be seen at the
-top-level, they should be defined in an additional fragment
+top level, they should be defined in an additional fragment
 @file{ac/@var{prog}.ac} included from @file{ac/withenable.ac} and
 @file{configure.ac}.
 
+Usually, the new program is maintained somewhere outside of @TL{}.  In
+that case, we put the upstream sources into a subdirectory
+ at file{@var{prog}-src} (e.g., @file{utils/newprog/newprog-src}).  We do
+not run @code{configure} in this original @code{...-src} directory,
+only in our own directory, but we do compile using the source files in
+ at code{...-src}.
 
+So, these are the files that we must generally create:
+
+ at table @file
+ at item ac/withenable.ac
+The @code{KPSE_ENABLE_PROG} call just explained.
+
+ at item configure.ac
+ at itemx Makefile.am
+By merging the contents of the original @file{configure.ac} (if
+provided) and a comparable program already in TL.  There is no magic
+recipe, it's necessary to think about needs to be done in the original
+vs.@: in @TL{}.
+
+ at item TLpatches/TL-Changes
+Actions taken after getting the original source tree; typically
+removal of derived or unused common files.
+
+ at item TLpatches/patch-...
+If any changes are needed to the original sources, record the patches
+here so they can be applied next time. And send them upstream so that
+perhaps they won't have to be.
+
+ at item ChangeLog
+Record all TL-specific changes, now and in the future.
+
+ at end table
+
+Then, run GNU @code{autoreconf} in the new directory (@pxref{Build
+system tools}).  After that works, @code{svn add} the necessary files,
+notably @file{Makefile.in aclocal.m4 configure}, and @code{svn:ignore}
+the Automake cache @file{autom4te.cache}.  (This is so people checking
+out the TL source tree do not have to run any autotools, but can
+simply run @code{configure}.)
+
+Then, run the TL tool @code{reautoconf} in the top-level TL
+ at code{source/} directory, to incorporate the new program into the
+build tree.
+
+Then, run (and rerun) a build until the program compiles and tests
+successfully, probably involving rerunning autoreconf in the source
+directory, @code{make} in the build directory, etc.
+
+After final success, don't forget to commit.
+
+
 @node Adding a new generic library module
 @subsection Adding a new generic library module
 
@@ -2431,6 +2482,95 @@
 otherwise must be carefully analyzed to make sure that they cannot
 cause the modification of quantities supposed to be constant.
 
+
+ at node Continuous integration
+ at chapter Continuous integration
+
+ at cindex ci
+ at cindex continuous integration
+ at cindex Travis-CI
+
+Overview: the sources of @TL{} are subjected to continuous integration
+testing on Travis-CI
+(@url{https://travis-ci.org/TeX-Live/texlive-source}) via a git-svn
+mirror of the sources that is pushed to Github
+(@url{https://github.com/TeX-Live/texlive-source}). The git-svn mirror
+is updated (currently) at 30 minute intervals, and only the last
+commit pushed is tested on Travis-CI.
+
+ at subheading Transfer from Subversion to Github
+
+git-svn (@url{https://git-scm.com/docs/git-svn}) is used to check out
+the subtree @code{Build/source} of the Subversion repository. The
+author index file used is not maintained in either Git or Subversion
+but can be provided on request.
+
+ at c TODO what should we do here with the author index file? It contains a
+ at c mapping from subversion names to name/email as shown in git.
+
+The initial checkout was done by invoking
+ at example
+git svn --authors-file usermap clone svn://USER@@tug.org/texlive/trunk/Build/source
+ at end example
+
+ at noindent where the @code{usermap} file maps Subversion user names to
+name and emails of the authors. If no user account at @url{tug.org} is
+available, anonymous checkout is possible, too:
+ at example
+git svn --authors-file usermap clone svn://tug.org/texlive/trunk/Build/source
+ at end example
+
+In the following, we will use @emph{admin} to refer to a user who has
+read/write access to the @TL{} subversion repository, and is also an
+administrator of the @code{TeX-Live} Team on Github. The above initial
+checkout has been carried out by @emph{admin} on the server
+ at code{texlive.info}.
+
+On Github (@url{https://github.com}), a new git repository named
+ at code{texlive-source} was created by @emph{admin} within the
+ at code{TeX-Live} ``organization'' (@url{https://github.com/TeX-Live}).
+The remote was added to the checkout with @code{git remote add origin
+git@@github.com:TeX-Live/texlive-source.git}.
+
+To automate the update on Github, a new ssh key was generated and added
+to the @code{texlive-source} repository on Github as deployment
+key. This way pushes using this key can only go to the
+ at code{texlive-source} repository and not anywhere else.
+
+The usage of @code{git-svn} requires a strict discipline to keep a
+linear history in the master branch. Since we are aiming at a pure
+mirror facility, we have decided to further restrict the @code{master}
+branch of the @code{texlive-source} repository on Github to changes by
+ at emph{admin}.
+
+This setup allows other developers to branch off @code{master} and
+push their branches to the Github repository, but all updates need to
+come from the local @code{master} (not the one on Github) to
+Subversion, back to @code{master} on @code{texlive.info}, and from
+there to Github.
+
+ at subheading Automatic update of the Git mirror
+
+ at emph{admin} has installed a cron job on @code{texlive.info} running
+every 30 minute which essentially runs @code{git svn rebase} and
+ at code{git push} in the @code{master} branch of the checkout. The first
+command fetches the changes from the Subversion repository and updates
+the @code{master} branch with them, the second one pushes changes (if
+available) to Github.
+
+ at subheading CI testing on Travis-CI
+
+ at pindex .travis.yml
+The @code{source} tree of @TL{} contains a top-level file
+ at code{.travis.yml} which controls the automatic testing on
+Travis-CI. @emph{admin} has registered to Travis-CI and allowed access
+to the Github's @code{TeX-Live} organization's @code{texlive-source}
+repository. The default settings are to build the last commit of each
+push. No further action is necessary on Travis-CI.
+
+If changes have been pushed via the cron job above, Travis-CI will
+automatically checkout the last pushed commit and try building it.
+
 @c made from pod doc.
 @include tlbuild-incl/install-tl.texi
 @include tlbuild-incl/tlmgr.texi

Modified: branches/stable/source/src/libs/Makefile.in
===================================================================
--- branches/stable/source/src/libs/Makefile.in	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/Makefile.in	2018-02-27 23:34:23 UTC (rev 795)
@@ -120,6 +120,7 @@
 	$(top_srcdir)/../m4/kpse-zziplib-flags.m4 \
 	$(top_srcdir)/../version.ac \
 	$(top_srcdir)/../utils/autosp/ac/withenable.ac \
+	$(top_srcdir)/../utils/axodraw2/ac/withenable.ac \
 	$(top_srcdir)/../utils/devnag/ac/withenable.ac \
 	$(top_srcdir)/../utils/lacheck/ac/withenable.ac \
 	$(top_srcdir)/../utils/m-tx/ac/withenable.ac \
@@ -188,6 +189,7 @@
 	$(top_srcdir)/../libs/libpaper/ac/withenable.ac \
 	$(top_srcdir)/../libs/luajit/ac/withenable.ac \
 	$(top_srcdir)/../libs/lua52/ac/withenable.ac \
+	$(top_srcdir)/../libs/lua53/ac/withenable.ac \
 	$(top_srcdir)/../libs/zlib/ac/withenable.ac \
 	$(top_srcdir)/../texk/ptexenc/ac/withenable.ac \
 	$(top_srcdir)/../texk/kpathsea/ac/withenable.ac \

Modified: branches/stable/source/src/libs/README
===================================================================
--- branches/stable/source/src/libs/README	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/README	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,4 +1,4 @@
-$Id: README 46140 2017-12-26 11:50:03Z kakuto $
+$Id: README 46585 2018-02-10 06:43:26Z kakuto $
 Public domain.  Originally created by Karl Berry, 2005.
 
 Libraries we compile for TeX Live.
@@ -12,7 +12,7 @@
 cairo 1.14.12 - checked 07dec17
   http://cairographics.org/releases/
 
-freetype2 2.8.1 - checked 16sep17
+freetype2 2.9.0 - checked 09jan18
   http://savannah.nongnu.org/download/freetype/
 
 gd 2.2.5 - checked 30aug17
@@ -24,10 +24,10 @@
 graphite2 1.3.10 - checked 20jun17
   http://sourceforge.net/projects/silgraphite/files/graphite2/
 
-harfbuzz 1.7.4 - checked 20dec17
+harfbuzz 1.7.5 - checked 31jan18
   http://www.freedesktop.org/software/harfbuzz/release/
 
-icu 58.2 - checked 13mar17
+icu 60.2 - checked 11jan18
   http://download.icu-project.org/files/icu4c/
 
 libpaper 1.1.24+nmu2 - checked 24oct13
@@ -43,14 +43,15 @@
 luajit 2.1.0-beta2 - checked 09mar16
   http://luajit.org/download/LuaJIT-2.1.0-beta1.tar.gz
 
-mpfr 4.0.0 - checked 26dec17
+mpfr 4.0.1 - checked 10feb18
   http://ftp.gnu.org/gnu/mpfr/
 
 pixman 0.34.0 - checked 04feb16
   http://cairographics.org/releases/
 
-poppler 0.52.0 - checked 17feb17
+poppler 0.62.0 - checked 9jan18
   http://poppler.freedesktop.org/ - used by luatex and xetex
+  (requires C++11)
 
 potrace 1.15 - checked 07aug17
   http://potrace.sourceforge.net
@@ -65,5 +66,5 @@
 zlib 1.2.11 - checked 15jan17
   http://www.zlib.net/ - used by many
 
-zziplib 0.13.66 - checked 20jun17
+zziplib 0.13.68 - checked 06feb18
   http://zziplib.sourceforge.net/ - used by luatex

Modified: branches/stable/source/src/libs/configure
===================================================================
--- branches/stable/source/src/libs/configure	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/configure	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for TeX Live libs 2018/dev.
+# Generated by GNU Autoconf 2.69 for TeX Live libs 2018.
 #
 # Report bugs to <tex-k at tug.org>.
 #
@@ -579,8 +579,8 @@
 # Identity of this package.
 PACKAGE_NAME='TeX Live libs'
 PACKAGE_TARNAME='tex-live-libs'
-PACKAGE_VERSION='2018/dev'
-PACKAGE_STRING='TeX Live libs 2018/dev'
+PACKAGE_VERSION='2018'
+PACKAGE_STRING='TeX Live libs 2018'
 PACKAGE_BUGREPORT='tex-k at tug.org'
 PACKAGE_URL=''
 
@@ -695,6 +695,7 @@
 enable_cxx_runtime_hack
 enable_libtool_hack
 enable_autosp
+enable_axodraw2
 enable_devnag
 enable_lacheck
 enable_m_tx
@@ -731,6 +732,7 @@
 enable_pdftex
 enable_pdftex_synctex
 enable_luatex
+enable_luatex53
 enable_luajittex
 enable_mp
 enable_pmp
@@ -1394,7 +1396,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures TeX Live libs 2018/dev to adapt to many kinds of systems.
+\`configure' configures TeX Live libs 2018 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1464,7 +1466,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of TeX Live libs 2018/dev:";;
+     short | recursive ) echo "Configuration of TeX Live libs 2018:";;
    esac
   cat <<\_ACEOF
 
@@ -1482,6 +1484,7 @@
   --enable-cxx-runtime-hack  link C++ runtime statically
   --enable-libtool-hack   ignore libtool dependency_libs
   --disable-autosp        do not build the autosp package
+  --disable-axodraw2      do not build the axodraw2 package
   --disable-devnag        do not build the devnag package
   --disable-lacheck       do not build the lacheck package
   --disable-m-tx          do not build the m-tx package
@@ -1517,6 +1520,7 @@
   --disable-pdftex          do not compile and install pdfTeX
   --disable-pdftex-synctex    build pdfTeX without SyncTeX support
   --disable-luatex          do not compile and install LuaTeX
+  --disable-luatex53        do not compile and install LuaTeX53
   --disable-luajittex       do not compile and install LuaJITTeX
   --disable-mp              do not compile and install MetaPost
   --disable-pmp             do not compile and install pMetaPost
@@ -1753,7 +1757,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-TeX Live libs configure 2018/dev
+TeX Live libs configure 2018
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1854,7 +1858,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by TeX Live libs $as_me 2018/dev, which was
+It was created by TeX Live libs $as_me 2018, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3360,7 +3364,8 @@
 esac
 
 ## utils/autosp/ac/withenable.ac: configure.ac fragment for TeX Live subdir
-## configure options and TL libraries required for vlna
+## $Id: withenable.ac 46590 2018-02-10 23:30:32Z karl $
+## configure options and TL libraries required for autosp.
 # Check whether --enable-autosp was given.
 if test "${enable_autosp+set}" = set; then :
   enableval=$enable_autosp;
@@ -3377,6 +3382,25 @@
     ;;
 esac
 
+## utils/autosp/ac/withenable.ac: configure.ac fragment for TeX Live subdir
+## $Id: withenable.ac 46590 2018-02-10 23:30:32Z karl $
+## configure options and TL libraries for axodraw2.
+# Check whether --enable-axodraw2 was given.
+if test "${enable_axodraw2+set}" = set; then :
+  enableval=$enable_axodraw2;
+fi
+case $enable_axodraw2 in #(
+  yes|no) :
+     ;; #(
+  *) :
+
+   enable_axodraw2=$enable_all_pkgs
+     { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming \`--enable-axodraw2=$enable_axodraw2'" >&5
+$as_echo "$as_me: Assuming \`--enable-axodraw2=$enable_axodraw2'" >&6;}
+     ac_configure_args="$ac_configure_args '--enable-axodraw2=$enable_axodraw2'"
+    ;;
+esac
+
 ## utils/devnag/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory utils/devnag/
 ## configure options and TL libraries required for devnag
 # Check whether --enable-devnag was given.
@@ -3840,6 +3864,24 @@
   need_zziplib=yes
   need_lua52=yes
 }
+# Check whether --enable-luatex53 was given.
+if test "${enable_luatex53+set}" = set; then :
+  enableval=$enable_luatex53;
+fi
+case $enable_luatex53 in #(
+  yes | no) :
+     ;; #(
+  *) :
+    enable_luatex53=yes ;;
+esac
+
+test "x$enable_web2c:$enable_luatex53" = xyes:yes && {
+  need_poppler=yes
+  need_mpfr=yes
+  need_libpng=yes
+  need_zziplib=yes
+  need_lua53=yes
+}
 # Check whether --enable-luajittex was given.
 if test "${enable_luajittex+set}" = set; then :
   enableval=$enable_luajittex;
@@ -5379,6 +5421,9 @@
 ## libs/lua52/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory libs/lua52/
 ## configure options and TL libraries required for lua52
 
+## libs/lua53/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory libs/lua53/
+## configure options and TL libraries required for lua53
+
 ## libs/zlib/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory libs/zlib/
 ## configure options and TL libraries required for zlib
 
@@ -6061,7 +6106,7 @@
 
 # Define the identity of the package.
  PACKAGE='tex-live-libs'
- VERSION='2018/dev'
+ VERSION='2018'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -6469,6 +6514,10 @@
   test "x$with_system_lua52" != xyes && test "x$need_lua52" = xyes && MAKE_SUBDIRS="lua52 $MAKE_SUBDIRS"
   CONF_SUBDIRS="lua52 $CONF_SUBDIRS"
 fi
+if test -x $srcdir/lua53/configure; then
+  test "x$with_system_lua53" != xyes && test "x$need_lua53" = xyes && MAKE_SUBDIRS="lua53 $MAKE_SUBDIRS"
+  CONF_SUBDIRS="lua53 $CONF_SUBDIRS"
+fi
 if test -x $srcdir/zlib/configure; then
   test "x$with_system_zlib" != xyes && test "x$need_zlib" = xyes && MAKE_SUBDIRS="zlib $MAKE_SUBDIRS"
   CONF_SUBDIRS="zlib $CONF_SUBDIRS"
@@ -7050,7 +7099,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by TeX Live libs $as_me 2018/dev, which was
+This file was extended by TeX Live libs $as_me 2018, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -7107,7 +7156,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-TeX Live libs config.status 2018/dev
+TeX Live libs config.status 2018
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: branches/stable/source/src/libs/libpng/ChangeLog
===================================================================
--- branches/stable/source/src/libs/libpng/ChangeLog	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/libpng/ChangeLog	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,3 +1,8 @@
+2018-01-14  Karl Berry  <karl at freefriends.org>
+
+	* configure.ac (-std=c89): reinstate check, now copying configure
+	block from upstream; reautoconf.
+
 2017-12-02  Karl Berry  <karl at freefriends.org>
 
 	Import ARM support from upstream to TL configure.

Modified: branches/stable/source/src/libs/libpng/configure
===================================================================
--- branches/stable/source/src/libs/libpng/configure	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/libpng/configure	2018-02-27 23:34:23 UTC (rev 795)
@@ -4025,6 +4025,9 @@
 
 
 
+ac_config_headers="$ac_config_headers config.h"
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5039,20 +5042,18 @@
 
 
 
-ac_config_headers="$ac_config_headers config.h"
-
-
-if false; then
 # For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
 # In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
 # This is incompatible with the new default mode, so we test for that and force the
+# "-std=c89" compiler option:
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need to force back C standard to C89" >&5
 $as_echo_n "checking if we need to force back C standard to C89... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#define _POSIX_SOURCE 1
-#include <stdio.h>
 
+      #define _POSIX_SOURCE 1
+      #include <stdio.h>
+
 int
 main ()
 {
@@ -5066,16 +5067,15 @@
 $as_echo "no" >&6; }
 else
 
-if test "x$GCC" != "xyes"; then
-  as_fn_error $? "Forcing back to C89 is required but the flags are unknown for other compilers than GCC" "$LINENO" 5
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+      if test "x$GCC" != "xyes"; then
+         as_fn_error $? "Forcing back to C89 is required but the flags are only known for GCC" "$LINENO" 5
+      fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-CFLAGS="$CFLAGS -std=c89"
+   CFLAGS="$CFLAGS -std=c89"
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 # Checks for header files.
 ac_ext=c

Modified: branches/stable/source/src/libs/libpng/configure.ac
===================================================================
--- branches/stable/source/src/libs/libpng/configure.ac	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/libpng/configure.ac	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,4 +1,4 @@
-dnl $Id: configure.ac 45971 2017-12-02 23:51:48Z karl $
+dnl $Id: configure.ac 46308 2018-01-14 17:25:27Z karl $
 dnl Process this file with autoconf to produce a configure script.
 dnl
 dnl   Copyright 2016-2017 Karl Berry <tex-live at tug.org>
@@ -17,6 +17,8 @@
 
 KPSE_BASIC([libpng])
 
+AC_CONFIG_HEADERS([config.h])
+
 AC_PROG_CC
 AM_PROG_AS
 AC_PROG_RANLIB
@@ -24,23 +26,24 @@
 
 KPSE_COMPILER_VISIBILITY
 
-AC_CONFIG_HEADERS([config.h])
-
-if false; then
 # For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
 # In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
 # This is incompatible with the new default mode, so we test for that and force the 
+# "-std=c89" compiler option:
 AC_MSG_CHECKING([if we need to force back C standard to C89])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _POSIX_SOURCE 1
-#include <stdio.h>
-])],AC_MSG_RESULT(no),[
-if test "x$GCC" != "xyes"; then
-  AC_MSG_ERROR([Forcing back to C89 is required but the flags are unknown for other compilers than GCC])
-fi
-AC_MSG_RESULT(yes)
-CFLAGS="$CFLAGS -std=c89"
+AC_COMPILE_IFELSE(
+   [AC_LANG_PROGRAM([
+      [#define _POSIX_SOURCE 1]
+      [#include <stdio.h>]
+   ])],
+   AC_MSG_RESULT(no),[
+      if test "x$GCC" != "xyes"; then
+         AC_MSG_ERROR(
+            [Forcing back to C89 is required but the flags are only known for GCC])
+      fi
+   AC_MSG_RESULT(yes)
+   CFLAGS="$CFLAGS -std=c89"
 ])
-fi
 
 # Checks for header files.
 AC_HEADER_STDC

Modified: branches/stable/source/src/libs/poppler/ChangeLog
===================================================================
--- branches/stable/source/src/libs/poppler/ChangeLog	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/ChangeLog	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,3 +1,8 @@
+2018-01-08  Karl Berry  <karl at freefriends.org>
+
+	Import poppler-0.62.0.
+	* Makefile.am, configure.ac, version.ac: Adjust.
+
 2017-02-17  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	Import poppler-0.52.0.

Modified: branches/stable/source/src/libs/poppler/Makefile.am
===================================================================
--- branches/stable/source/src/libs/poppler/Makefile.am	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/Makefile.am	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,7 +1,7 @@
-## $Id: Makefile.am 43567 2017-03-21 17:43:10Z karl $
+## $Id: Makefile.am 46370 2018-01-18 23:05:30Z lscarso $
 ## Proxy Makefile.am to build poppler for TeX Live.
 ##
-##   Copyright 2016-2017 Karl Berry <tex-live at tug.org>
+##   Copyright 2016-2018 Karl Berry <tex-live at tug.org>
 ##   Copyright 2011-2015 Peter Breitenlohner <tex-live at tug.org>
 ##
 ##   This file is free software; the copyright holder
@@ -29,7 +29,7 @@
 AM_CPPFLAGS = -I$(top_srcdir)/$(POPPLER_TREE) -I$(GOO_SRC) $(ZLIB_INCLUDES)
 AM_CPPFLAGS += -DPOPPLER_DATADIR='"."'
 AM_CFLAGS = $(VISIBILITY_CFLAGS) $(WARNING_CFLAGS)
-AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) $(NO_WARN_CXXFLAGS)
+AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) $(NO_WARN_CXXFLAGS) $(CXX_FLAGS_RELEASE)
 
 noinst_LIBRARIES = libpoppler.a
 
@@ -125,8 +125,7 @@
 	@POPPLER_TREE@/poppler/UnicodeTypeTable.cc \
 	@POPPLER_TREE@/poppler/ViewerPreferences.cc \
 	@POPPLER_TREE@/poppler/XRef.cc \
-	@POPPLER_TREE@/poppler/XpdfPluginAPI.cc \
-	@POPPLER_TREE@/poppler/strtok_r.cpp
+	@POPPLER_TREE@/poppler/XpdfPluginAPI.cc
 
 $(libpoppler_a_OBJECTS): config.force
 

Modified: branches/stable/source/src/libs/poppler/Makefile.in
===================================================================
--- branches/stable/source/src/libs/poppler/Makefile.in	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/Makefile.in	2018-02-27 23:34:23 UTC (rev 795)
@@ -88,7 +88,8 @@
 POST_UNINSTALL = :
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-common.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../m4/ax_cxx_compile_stdcxx.m4 \
+	$(top_srcdir)/../../m4/kpse-common.m4 \
 	$(top_srcdir)/../../m4/kpse-visibility.m4 \
 	$(top_srcdir)/../../m4/kpse-warnings.m4 \
 	$(top_srcdir)/../../m4/kpse-win32.m4 \
@@ -192,8 +193,7 @@
 	@POPPLER_TREE@/poppler/UnicodeTypeTable.$(OBJEXT) \
 	@POPPLER_TREE@/poppler/ViewerPreferences.$(OBJEXT) \
 	@POPPLER_TREE@/poppler/XRef.$(OBJEXT) \
-	@POPPLER_TREE@/poppler/XpdfPluginAPI.$(OBJEXT) \
-	@POPPLER_TREE@/poppler/strtok_r.$(OBJEXT)
+	@POPPLER_TREE@/poppler/XpdfPluginAPI.$(OBJEXT)
 nodist_libpoppler_a_OBJECTS = $(am__objects_1) $(am__objects_2) \
 	$(am__objects_3)
 libpoppler_a_OBJECTS = $(nodist_libpoppler_a_OBJECTS)
@@ -350,6 +350,7 @@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -443,7 +444,7 @@
 AM_CPPFLAGS = -I$(top_srcdir)/$(POPPLER_TREE) -I$(GOO_SRC) \
 	$(ZLIB_INCLUDES) -DPOPPLER_DATADIR='"."'
 AM_CFLAGS = $(VISIBILITY_CFLAGS) $(WARNING_CFLAGS)
-AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) $(NO_WARN_CXXFLAGS)
+AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) $(NO_WARN_CXXFLAGS) $(CXX_FLAGS_RELEASE)
 noinst_LIBRARIES = libpoppler.a
 nodist_libpoppler_a_SOURCES = \
 	$(goo_libGoo_a_sources) \
@@ -533,8 +534,7 @@
 	@POPPLER_TREE@/poppler/UnicodeTypeTable.cc \
 	@POPPLER_TREE@/poppler/ViewerPreferences.cc \
 	@POPPLER_TREE@/poppler/XRef.cc \
-	@POPPLER_TREE@/poppler/XpdfPluginAPI.cc \
-	@POPPLER_TREE@/poppler/strtok_r.cpp
+	@POPPLER_TREE@/poppler/XpdfPluginAPI.cc
 
 
 # Reconfig
@@ -549,7 +549,7 @@
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
-.SUFFIXES: .cc .cpp .o .obj
+.SUFFIXES: .cc .o .obj
 am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../am/dist_hook.am $(srcdir)/../../am/reconfig.am $(srcdir)/../../am/rebuild.am $(am__configure_deps)
@@ -864,9 +864,6 @@
 @POPPLER_TREE@/poppler/XpdfPluginAPI.$(OBJEXT):  \
 	@POPPLER_TREE@/poppler/$(am__dirstamp) \
 	@POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp)
- at POPPLER_TREE@/poppler/strtok_r.$(OBJEXT):  \
-	@POPPLER_TREE@/poppler/$(am__dirstamp) \
-	@POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp)
 
 libpoppler.a: $(libpoppler_a_OBJECTS) $(libpoppler_a_DEPENDENCIES) $(EXTRA_libpoppler_a_DEPENDENCIES) 
 	$(AM_V_at)-rm -f libpoppler.a
@@ -961,7 +958,6 @@
 @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/ViewerPreferences.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/XRef.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/XpdfPluginAPI.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/strtok_r.Po at am__quote@
 
 .cc.o:
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -979,22 +975,6 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
-.cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
- at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
-
-.cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
- at am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run 'make' without going through this Makefile.
 # To change the values of 'make' variables: instead of editing Makefiles,

Modified: branches/stable/source/src/libs/poppler/TLpatches/ChangeLog
===================================================================
--- branches/stable/source/src/libs/poppler/TLpatches/ChangeLog	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/TLpatches/ChangeLog	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,3 +1,15 @@
+2018-01-15  Karl Berry  <karl at tug.org>
+
+	* patch-04-ctime: add.
+
+2018-01-08  Karl Berry  <karl at freefriends.org>
+
+	Imported poppler-0.62.0 source tree from:
+	  http://poppler.freedesktop.org/
+	* patch-02-LLONG_MAX, patch-03-Object-functions: try removing,
+	seems like the source may have moved on by now, especially
+	what with requiring C++11.
+
 2017-02-17  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	Imported poppler-0.52.0 source tree from:

Modified: branches/stable/source/src/libs/poppler/TLpatches/TL-Changes
===================================================================
--- branches/stable/source/src/libs/poppler/TLpatches/TL-Changes	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/TLpatches/TL-Changes	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,29 +1,21 @@
-Changes applied to the poppler-0.52.0 tree as obtained from:
+Changes applied to the poppler-0.62.0 tree as obtained from:
 	http://poppler.freedesktop.org/
 
-Removed:
-	Makefile.in
-	aclocal.m4
-	compile
-	config.guess
-	config.sub
-	configure
-	depcomp
-	install-sh
-	ltmain.sh
-	missing
-	test-driver
-	fofi/Makefile.in
-	goo/Makefile.in
-	poppler/Makefile.in
-	splash/Makefile.in
+Removed unused dirs:
+	cmake cpp glib m4 qt4 qt5 test utils
 
-Removed unused dirs:
-	cmake
-	cpp
-	glib
-	m4
-	qt4
-	qt5
-	test
-	utils
+General idea:
+update version.ac
+mv poppler-src poppler-prev
+tar xf poppler-*.tar.gz
+mv poppler-0.62.0 poppler-src
+cd poppler-src
+svn status >/tmp/s
+svn add # the ? lines
+svn remove # the ! lines
+# adapt Makefile.am for new files
+# adapt configure.ac as needed
+autoreconf
+make -C .../Work/libs/poppler/
+# until it succeeds
+# try build of everything, luatex/xetex may need updating.

Deleted: branches/stable/source/src/libs/poppler/TLpatches/patch-02-LLONG_MAX
===================================================================
--- branches/stable/source/src/libs/poppler/TLpatches/patch-02-LLONG_MAX	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/TLpatches/patch-02-LLONG_MAX	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,25 +0,0 @@
-diff -ur poppler-0.52.0.orig/goo/GooString.h poppler-0.52.0/goo/GooString.h
---- poppler-0.52.0.orig/goo/GooString.h	Tue Jan 17 06:36:57 2017
-+++ poppler-0.52.0/goo/GooString.h	Tue Mar 21 12:18:41 2017
-@@ -36,6 +36,21 @@
- #endif
- 
- #include <limits.h> // for LLONG_MAX and ULLONG_MAX
-+
-+/* <limits.h> and/or the compiler may or may not define these.  */
-+/* Minimum and maximum values a `signed long long int' can hold.  */
-+#ifndef LLONG_MAX
-+# define LLONG_MAX	9223372036854775807LL
-+#endif
-+#ifndef LLONG_MIN
-+# define LLONG_MIN	(-LLONG_MAX - 1LL)
-+#endif
-+
-+/* Maximum value an `unsigned long long int' can hold.  (Minimum is 0.)  */
-+#ifndef ULLONG_MAX
-+# define ULLONG_MAX	18446744073709551615ULL
-+#endif
-+
- #include <stdarg.h>
- #include <stdlib.h> // for NULL
- #include "gtypes.h"

Deleted: branches/stable/source/src/libs/poppler/TLpatches/patch-03-Object-functions
===================================================================
--- branches/stable/source/src/libs/poppler/TLpatches/patch-03-Object-functions	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/TLpatches/patch-03-Object-functions	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,43 +0,0 @@
-diff -ur poppler-0.52.0.orig/poppler/Object.h poppler-0.52.0/poppler/Object.h
---- poppler-0.52.0.orig/poppler/Object.h	Tue Jan 17 06:36:58 2017
-+++ poppler-0.52.0/poppler/Object.h	Tue Mar 21 12:21:07 2017
-@@ -148,7 +148,7 @@
-   Object *initStream(Stream *streamA);
-   Object *initRef(int numA, int genA)
-     { initObj(objRef); ref.num = numA; ref.gen = genA; return this; }
--  Object *initCmd(char *cmdA)
-+  Object *initCmd(const char *cmdA)
-     { initObj(objCmd); cmd = copyString(cmdA); return this; }
-   Object *initError()
-     { initObj(objError); return this; }
-@@ -195,7 +195,7 @@
-   GBool isName(const char *nameA)
-     { return type == objName && !strcmp(name, nameA); }
-   GBool isDict(const char *dictType);
--  GBool isStream(char *dictType);
-+  GBool isStream(const char *dictType);
-   GBool isCmd(const char *cmdA)
-     { return type == objCmd && !strcmp(cmd, cmdA); }
- 
-@@ -245,7 +245,7 @@
-   Object *dictGetValNF(int i, Object *obj);
- 
-   // Stream accessors.
--  GBool streamIs(char *dictType);
-+  GBool streamIs(const char *dictType);
-   void streamReset();
-   void streamClose();
-   int streamGetChar();
-@@ -352,10 +352,10 @@
- 
- #include "Stream.h"
- 
--inline GBool Object::streamIs(char *dictType)
-+inline GBool Object::streamIs(const char *dictType)
-   { OBJECT_TYPE_CHECK(objStream); return stream->getDict()->is(dictType); }
- 
--inline GBool Object::isStream(char *dictType)
-+inline GBool Object::isStream(const char *dictType)
-   { return type == objStream && streamIs(dictType); }
- 
- inline void Object::streamReset()

Added: branches/stable/source/src/libs/poppler/TLpatches/patch-04-ctime
===================================================================
--- branches/stable/source/src/libs/poppler/TLpatches/patch-04-ctime	                        (rev 0)
+++ branches/stable/source/src/libs/poppler/TLpatches/patch-04-ctime	2018-02-27 23:34:23 UTC (rev 795)
@@ -0,0 +1,13 @@
+	To make time_t work on FreeBSD 11.1, per Mojca.
+	http://tug.org/pipermail/tlbuild/2018q1/003931.html
+	
+--- Form.h	(revision 46316)
++++ Form.h	(working copy)
+@@ -31,6 +31,7 @@
+ 
+ #include <set>
+ #include <vector>
++#include <ctime>
+ 
+ class GooString;
+ class Array;

Modified: branches/stable/source/src/libs/poppler/aclocal.m4
===================================================================
--- branches/stable/source/src/libs/poppler/aclocal.m4	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/aclocal.m4	2018-02-27 23:34:23 UTC (rev 795)
@@ -1186,6 +1186,7 @@
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([../../m4/ax_cxx_compile_stdcxx.m4])
 m4_include([../../m4/kpse-common.m4])
 m4_include([../../m4/kpse-visibility.m4])
 m4_include([../../m4/kpse-warnings.m4])

Modified: branches/stable/source/src/libs/poppler/config.h.in
===================================================================
--- branches/stable/source/src/libs/poppler/config.h.in	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/config.h.in	2018-02-27 23:34:23 UTC (rev 795)
@@ -3,6 +3,12 @@
 /* Use zlib instead of builtin zlib decoder. */
 #undef ENABLE_ZLIB
 
+/* define if the compiler supports basic C++11 syntax */
+#undef HAVE_CXX11
+
+/* Do we have any DCT decoder?. */
+#undef HAVE_DCT_DECODER
+
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */
 #undef HAVE_DIRENT_H
@@ -22,6 +28,12 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Do we have any JPX decoder?. */
+#undef HAVE_JPX_DECODER
+
+/* Define to 1 if you have the `localtime_r' function. */
+#undef HAVE_LOCALTIME_R
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
@@ -49,6 +61,9 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the `strtok_r' function. */
+#undef HAVE_STRTOK_R
+
 /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
    */
 #undef HAVE_SYS_DIR_H

Modified: branches/stable/source/src/libs/poppler/configure
===================================================================
--- branches/stable/source/src/libs/poppler/configure	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/configure	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.52.0.
+# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.62.0.
 #
 # Report bugs to <tex-k at tug.org>.
 #
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='poppler (TeX Live)'
 PACKAGE_TARNAME='poppler--tex-live-'
-PACKAGE_VERSION='0.52.0'
-PACKAGE_STRING='poppler (TeX Live) 0.52.0'
+PACKAGE_VERSION='0.62.0'
+PACKAGE_STRING='poppler (TeX Live) 0.62.0'
 PACKAGE_BUGREPORT='tex-k at tug.org'
 PACKAGE_URL=''
 
@@ -645,6 +645,7 @@
 VISIBILITY_CFLAGS
 LN_S
 RANLIB
+HAVE_CXX11
 WARNING_CXXFLAGS
 am__fastdepCXX_FALSE
 am__fastdepCXX_TRUE
@@ -749,6 +750,8 @@
 enable_multithreaded
 enable_exceptions
 enable_fixedpoint
+enable_dctdecoder
+enable_libopenjpeg
 enable_largefile
 with_system_zlib
 with_zlib_includes
@@ -1306,7 +1309,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures poppler (TeX Live) 0.52.0 to adapt to many kinds of systems.
+\`configure' configures poppler (TeX Live) 0.62.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1373,7 +1376,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of poppler (TeX Live) 0.52.0:";;
+     short | recursive ) echo "Configuration of poppler (TeX Live) 0.62.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1398,6 +1401,8 @@
   --enable-exceptions     use C++ exceptions
   --enable-fixedpoint     use fixed point (instead of floating point)
                           arithmetic
+  --enable-dctdecoder     use dctdecoder
+  --enable-libopenjpeg    use openjpeg decoder
   --disable-largefile     omit support for large files
 
 Optional Packages:
@@ -1486,7 +1491,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-poppler (TeX Live) configure 0.52.0
+poppler (TeX Live) configure 0.62.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2076,7 +2081,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by poppler (TeX Live) $as_me 0.52.0, which was
+It was created by poppler (TeX Live) $as_me 0.62.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3999,7 +4004,7 @@
 
 # Define the identity of the package.
  PACKAGE='poppler--tex-live-'
- VERSION='0.52.0'
+ VERSION='0.62.0'
 
 
 # Some tools Automake needs.
@@ -5348,6 +5353,992 @@
 
 
 
+
+  ax_cxx_compile_alternatives="11 0x"    ax_cxx_compile_cxx11_required=true
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+  ac_success=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5
+$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; }
+if ${ax_cv_cxx_compile_cxx11+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+// If the compiler admits that it is not ready for C++11, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus < 201103L
+
+#error "This is not a C++11 compiler"
+
+#else
+
+namespace cxx11
+{
+
+  namespace test_static_assert
+  {
+
+    template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+  }
+
+  namespace test_final_override
+  {
+
+    struct Base
+    {
+      virtual void f() {}
+    };
+
+    struct Derived : public Base
+    {
+      virtual void f() override {}
+    };
+
+  }
+
+  namespace test_double_right_angle_brackets
+  {
+
+    template < typename T >
+    struct check {};
+
+    typedef check<void> single_type;
+    typedef check<check<void>> double_type;
+    typedef check<check<check<void>>> triple_type;
+    typedef check<check<check<check<void>>>> quadruple_type;
+
+  }
+
+  namespace test_decltype
+  {
+
+    int
+    f()
+    {
+      int a = 1;
+      decltype(a) b = 2;
+      return a + b;
+    }
+
+  }
+
+  namespace test_type_deduction
+  {
+
+    template < typename T1, typename T2 >
+    struct is_same
+    {
+      static const bool value = false;
+    };
+
+    template < typename T >
+    struct is_same<T, T>
+    {
+      static const bool value = true;
+    };
+
+    template < typename T1, typename T2 >
+    auto
+    add(T1 a1, T2 a2) -> decltype(a1 + a2)
+    {
+      return a1 + a2;
+    }
+
+    int
+    test(const int c, volatile int v)
+    {
+      static_assert(is_same<int, decltype(0)>::value == true, "");
+      static_assert(is_same<int, decltype(c)>::value == false, "");
+      static_assert(is_same<int, decltype(v)>::value == false, "");
+      auto ac = c;
+      auto av = v;
+      auto sumi = ac + av + 'x';
+      auto sumf = ac + av + 1.0;
+      static_assert(is_same<int, decltype(ac)>::value == true, "");
+      static_assert(is_same<int, decltype(av)>::value == true, "");
+      static_assert(is_same<int, decltype(sumi)>::value == true, "");
+      static_assert(is_same<int, decltype(sumf)>::value == false, "");
+      static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
+      return (sumf > 0.0) ? sumi : add(c, v);
+    }
+
+  }
+
+  namespace test_noexcept
+  {
+
+    int f() { return 0; }
+    int g() noexcept { return 0; }
+
+    static_assert(noexcept(f()) == false, "");
+    static_assert(noexcept(g()) == true, "");
+
+  }
+
+  namespace test_constexpr
+  {
+
+    template < typename CharT >
+    unsigned long constexpr
+    strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
+    {
+      return *s ? strlen_c_r(s + 1, acc + 1) : acc;
+    }
+
+    template < typename CharT >
+    unsigned long constexpr
+    strlen_c(const CharT *const s) noexcept
+    {
+      return strlen_c_r(s, 0UL);
+    }
+
+    static_assert(strlen_c("") == 0UL, "");
+    static_assert(strlen_c("1") == 1UL, "");
+    static_assert(strlen_c("example") == 7UL, "");
+    static_assert(strlen_c("another\0example") == 7UL, "");
+
+  }
+
+  namespace test_rvalue_references
+  {
+
+    template < int N >
+    struct answer
+    {
+      static constexpr int value = N;
+    };
+
+    answer<1> f(int&)       { return answer<1>(); }
+    answer<2> f(const int&) { return answer<2>(); }
+    answer<3> f(int&&)      { return answer<3>(); }
+
+    void
+    test()
+    {
+      int i = 0;
+      const int c = 0;
+      static_assert(decltype(f(i))::value == 1, "");
+      static_assert(decltype(f(c))::value == 2, "");
+      static_assert(decltype(f(0))::value == 3, "");
+    }
+
+  }
+
+  namespace test_uniform_initialization
+  {
+
+    struct test
+    {
+      static const int zero {};
+      static const int one {1};
+    };
+
+    static_assert(test::zero == 0, "");
+    static_assert(test::one == 1, "");
+
+  }
+
+  namespace test_lambdas
+  {
+
+    void
+    test1()
+    {
+      auto lambda1 = [](){};
+      auto lambda2 = lambda1;
+      lambda1();
+      lambda2();
+    }
+
+    int
+    test2()
+    {
+      auto a = [](int i, int j){ return i + j; }(1, 2);
+      auto b = []() -> int { return '0'; }();
+      auto c = [=](){ return a + b; }();
+      auto d = [&](){ return c; }();
+      auto e = [a, &b](int x) mutable {
+        const auto identity = [](int y){ return y; };
+        for (auto i = 0; i < a; ++i)
+          a += b--;
+        return x + identity(a + b);
+      }(0);
+      return a + b + c + d + e;
+    }
+
+    int
+    test3()
+    {
+      const auto nullary = [](){ return 0; };
+      const auto unary = [](int x){ return x; };
+      using nullary_t = decltype(nullary);
+      using unary_t = decltype(unary);
+      const auto higher1st = [](nullary_t f){ return f(); };
+      const auto higher2nd = [unary](nullary_t f1){
+        return [unary, f1](unary_t f2){ return f2(unary(f1())); };
+      };
+      return higher1st(nullary) + higher2nd(nullary)(unary);
+    }
+
+  }
+
+  namespace test_variadic_templates
+  {
+
+    template <int...>
+    struct sum;
+
+    template <int N0, int... N1toN>
+    struct sum<N0, N1toN...>
+    {
+      static constexpr auto value = N0 + sum<N1toN...>::value;
+    };
+
+    template <>
+    struct sum<>
+    {
+      static constexpr auto value = 0;
+    };
+
+    static_assert(sum<>::value == 0, "");
+    static_assert(sum<1>::value == 1, "");
+    static_assert(sum<23>::value == 23, "");
+    static_assert(sum<1, 2>::value == 3, "");
+    static_assert(sum<5, 5, 11>::value == 21, "");
+    static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
+
+  }
+
+  // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
+  // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
+  // because of this.
+  namespace test_template_alias_sfinae
+  {
+
+    struct foo {};
+
+    template<typename T>
+    using member = typename T::member_type;
+
+    template<typename T>
+    void func(...) {}
+
+    template<typename T>
+    void func(member<T>*) {}
+
+    void test();
+
+    void test() { func<foo>(0); }
+
+  }
+
+}  // namespace cxx11
+
+#endif  // __cplusplus >= 201103L
+
+
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_cxx_compile_cxx11=yes
+else
+  ax_cv_cxx_compile_cxx11=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5
+$as_echo "$ax_cv_cxx_compile_cxx11" >&6; }
+  if test x$ax_cv_cxx_compile_cxx11 = xyes; then
+    ac_success=yes
+  fi
+
+    if test x$ac_success = xno; then
+    for alternative in ${ax_cxx_compile_alternatives}; do
+      switch="-std=gnu++${alternative}"
+      cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh`
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
+$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; }
+if eval \${$cachevar+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_CXX="$CXX"
+         CXX="$CXX $switch"
+         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+// If the compiler admits that it is not ready for C++11, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus < 201103L
+
+#error "This is not a C++11 compiler"
+
+#else
+
+namespace cxx11
+{
+
+  namespace test_static_assert
+  {
+
+    template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+  }
+
+  namespace test_final_override
+  {
+
+    struct Base
+    {
+      virtual void f() {}
+    };
+
+    struct Derived : public Base
+    {
+      virtual void f() override {}
+    };
+
+  }
+
+  namespace test_double_right_angle_brackets
+  {
+
+    template < typename T >
+    struct check {};
+
+    typedef check<void> single_type;
+    typedef check<check<void>> double_type;
+    typedef check<check<check<void>>> triple_type;
+    typedef check<check<check<check<void>>>> quadruple_type;
+
+  }
+
+  namespace test_decltype
+  {
+
+    int
+    f()
+    {
+      int a = 1;
+      decltype(a) b = 2;
+      return a + b;
+    }
+
+  }
+
+  namespace test_type_deduction
+  {
+
+    template < typename T1, typename T2 >
+    struct is_same
+    {
+      static const bool value = false;
+    };
+
+    template < typename T >
+    struct is_same<T, T>
+    {
+      static const bool value = true;
+    };
+
+    template < typename T1, typename T2 >
+    auto
+    add(T1 a1, T2 a2) -> decltype(a1 + a2)
+    {
+      return a1 + a2;
+    }
+
+    int
+    test(const int c, volatile int v)
+    {
+      static_assert(is_same<int, decltype(0)>::value == true, "");
+      static_assert(is_same<int, decltype(c)>::value == false, "");
+      static_assert(is_same<int, decltype(v)>::value == false, "");
+      auto ac = c;
+      auto av = v;
+      auto sumi = ac + av + 'x';
+      auto sumf = ac + av + 1.0;
+      static_assert(is_same<int, decltype(ac)>::value == true, "");
+      static_assert(is_same<int, decltype(av)>::value == true, "");
+      static_assert(is_same<int, decltype(sumi)>::value == true, "");
+      static_assert(is_same<int, decltype(sumf)>::value == false, "");
+      static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
+      return (sumf > 0.0) ? sumi : add(c, v);
+    }
+
+  }
+
+  namespace test_noexcept
+  {
+
+    int f() { return 0; }
+    int g() noexcept { return 0; }
+
+    static_assert(noexcept(f()) == false, "");
+    static_assert(noexcept(g()) == true, "");
+
+  }
+
+  namespace test_constexpr
+  {
+
+    template < typename CharT >
+    unsigned long constexpr
+    strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
+    {
+      return *s ? strlen_c_r(s + 1, acc + 1) : acc;
+    }
+
+    template < typename CharT >
+    unsigned long constexpr
+    strlen_c(const CharT *const s) noexcept
+    {
+      return strlen_c_r(s, 0UL);
+    }
+
+    static_assert(strlen_c("") == 0UL, "");
+    static_assert(strlen_c("1") == 1UL, "");
+    static_assert(strlen_c("example") == 7UL, "");
+    static_assert(strlen_c("another\0example") == 7UL, "");
+
+  }
+
+  namespace test_rvalue_references
+  {
+
+    template < int N >
+    struct answer
+    {
+      static constexpr int value = N;
+    };
+
+    answer<1> f(int&)       { return answer<1>(); }
+    answer<2> f(const int&) { return answer<2>(); }
+    answer<3> f(int&&)      { return answer<3>(); }
+
+    void
+    test()
+    {
+      int i = 0;
+      const int c = 0;
+      static_assert(decltype(f(i))::value == 1, "");
+      static_assert(decltype(f(c))::value == 2, "");
+      static_assert(decltype(f(0))::value == 3, "");
+    }
+
+  }
+
+  namespace test_uniform_initialization
+  {
+
+    struct test
+    {
+      static const int zero {};
+      static const int one {1};
+    };
+
+    static_assert(test::zero == 0, "");
+    static_assert(test::one == 1, "");
+
+  }
+
+  namespace test_lambdas
+  {
+
+    void
+    test1()
+    {
+      auto lambda1 = [](){};
+      auto lambda2 = lambda1;
+      lambda1();
+      lambda2();
+    }
+
+    int
+    test2()
+    {
+      auto a = [](int i, int j){ return i + j; }(1, 2);
+      auto b = []() -> int { return '0'; }();
+      auto c = [=](){ return a + b; }();
+      auto d = [&](){ return c; }();
+      auto e = [a, &b](int x) mutable {
+        const auto identity = [](int y){ return y; };
+        for (auto i = 0; i < a; ++i)
+          a += b--;
+        return x + identity(a + b);
+      }(0);
+      return a + b + c + d + e;
+    }
+
+    int
+    test3()
+    {
+      const auto nullary = [](){ return 0; };
+      const auto unary = [](int x){ return x; };
+      using nullary_t = decltype(nullary);
+      using unary_t = decltype(unary);
+      const auto higher1st = [](nullary_t f){ return f(); };
+      const auto higher2nd = [unary](nullary_t f1){
+        return [unary, f1](unary_t f2){ return f2(unary(f1())); };
+      };
+      return higher1st(nullary) + higher2nd(nullary)(unary);
+    }
+
+  }
+
+  namespace test_variadic_templates
+  {
+
+    template <int...>
+    struct sum;
+
+    template <int N0, int... N1toN>
+    struct sum<N0, N1toN...>
+    {
+      static constexpr auto value = N0 + sum<N1toN...>::value;
+    };
+
+    template <>
+    struct sum<>
+    {
+      static constexpr auto value = 0;
+    };
+
+    static_assert(sum<>::value == 0, "");
+    static_assert(sum<1>::value == 1, "");
+    static_assert(sum<23>::value == 23, "");
+    static_assert(sum<1, 2>::value == 3, "");
+    static_assert(sum<5, 5, 11>::value == 21, "");
+    static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
+
+  }
+
+  // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
+  // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
+  // because of this.
+  namespace test_template_alias_sfinae
+  {
+
+    struct foo {};
+
+    template<typename T>
+    using member = typename T::member_type;
+
+    template<typename T>
+    void func(...) {}
+
+    template<typename T>
+    void func(member<T>*) {}
+
+    void test();
+
+    void test() { func<foo>(0); }
+
+  }
+
+}  // namespace cxx11
+
+#endif  // __cplusplus >= 201103L
+
+
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  eval $cachevar=yes
+else
+  eval $cachevar=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+         CXX="$ac_save_CXX"
+fi
+eval ac_res=\$$cachevar
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+      if eval test x\$$cachevar = xyes; then
+        CXX="$CXX $switch"
+        if test -n "$CXXCPP" ; then
+          CXXCPP="$CXXCPP $switch"
+        fi
+        ac_success=yes
+        break
+      fi
+    done
+  fi
+
+    if test x$ac_success = xno; then
+                for alternative in ${ax_cxx_compile_alternatives}; do
+      for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
+        cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh`
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
+$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; }
+if eval \${$cachevar+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_CXX="$CXX"
+           CXX="$CXX $switch"
+           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+// If the compiler admits that it is not ready for C++11, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus < 201103L
+
+#error "This is not a C++11 compiler"
+
+#else
+
+namespace cxx11
+{
+
+  namespace test_static_assert
+  {
+
+    template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+  }
+
+  namespace test_final_override
+  {
+
+    struct Base
+    {
+      virtual void f() {}
+    };
+
+    struct Derived : public Base
+    {
+      virtual void f() override {}
+    };
+
+  }
+
+  namespace test_double_right_angle_brackets
+  {
+
+    template < typename T >
+    struct check {};
+
+    typedef check<void> single_type;
+    typedef check<check<void>> double_type;
+    typedef check<check<check<void>>> triple_type;
+    typedef check<check<check<check<void>>>> quadruple_type;
+
+  }
+
+  namespace test_decltype
+  {
+
+    int
+    f()
+    {
+      int a = 1;
+      decltype(a) b = 2;
+      return a + b;
+    }
+
+  }
+
+  namespace test_type_deduction
+  {
+
+    template < typename T1, typename T2 >
+    struct is_same
+    {
+      static const bool value = false;
+    };
+
+    template < typename T >
+    struct is_same<T, T>
+    {
+      static const bool value = true;
+    };
+
+    template < typename T1, typename T2 >
+    auto
+    add(T1 a1, T2 a2) -> decltype(a1 + a2)
+    {
+      return a1 + a2;
+    }
+
+    int
+    test(const int c, volatile int v)
+    {
+      static_assert(is_same<int, decltype(0)>::value == true, "");
+      static_assert(is_same<int, decltype(c)>::value == false, "");
+      static_assert(is_same<int, decltype(v)>::value == false, "");
+      auto ac = c;
+      auto av = v;
+      auto sumi = ac + av + 'x';
+      auto sumf = ac + av + 1.0;
+      static_assert(is_same<int, decltype(ac)>::value == true, "");
+      static_assert(is_same<int, decltype(av)>::value == true, "");
+      static_assert(is_same<int, decltype(sumi)>::value == true, "");
+      static_assert(is_same<int, decltype(sumf)>::value == false, "");
+      static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
+      return (sumf > 0.0) ? sumi : add(c, v);
+    }
+
+  }
+
+  namespace test_noexcept
+  {
+
+    int f() { return 0; }
+    int g() noexcept { return 0; }
+
+    static_assert(noexcept(f()) == false, "");
+    static_assert(noexcept(g()) == true, "");
+
+  }
+
+  namespace test_constexpr
+  {
+
+    template < typename CharT >
+    unsigned long constexpr
+    strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
+    {
+      return *s ? strlen_c_r(s + 1, acc + 1) : acc;
+    }
+
+    template < typename CharT >
+    unsigned long constexpr
+    strlen_c(const CharT *const s) noexcept
+    {
+      return strlen_c_r(s, 0UL);
+    }
+
+    static_assert(strlen_c("") == 0UL, "");
+    static_assert(strlen_c("1") == 1UL, "");
+    static_assert(strlen_c("example") == 7UL, "");
+    static_assert(strlen_c("another\0example") == 7UL, "");
+
+  }
+
+  namespace test_rvalue_references
+  {
+
+    template < int N >
+    struct answer
+    {
+      static constexpr int value = N;
+    };
+
+    answer<1> f(int&)       { return answer<1>(); }
+    answer<2> f(const int&) { return answer<2>(); }
+    answer<3> f(int&&)      { return answer<3>(); }
+
+    void
+    test()
+    {
+      int i = 0;
+      const int c = 0;
+      static_assert(decltype(f(i))::value == 1, "");
+      static_assert(decltype(f(c))::value == 2, "");
+      static_assert(decltype(f(0))::value == 3, "");
+    }
+
+  }
+
+  namespace test_uniform_initialization
+  {
+
+    struct test
+    {
+      static const int zero {};
+      static const int one {1};
+    };
+
+    static_assert(test::zero == 0, "");
+    static_assert(test::one == 1, "");
+
+  }
+
+  namespace test_lambdas
+  {
+
+    void
+    test1()
+    {
+      auto lambda1 = [](){};
+      auto lambda2 = lambda1;
+      lambda1();
+      lambda2();
+    }
+
+    int
+    test2()
+    {
+      auto a = [](int i, int j){ return i + j; }(1, 2);
+      auto b = []() -> int { return '0'; }();
+      auto c = [=](){ return a + b; }();
+      auto d = [&](){ return c; }();
+      auto e = [a, &b](int x) mutable {
+        const auto identity = [](int y){ return y; };
+        for (auto i = 0; i < a; ++i)
+          a += b--;
+        return x + identity(a + b);
+      }(0);
+      return a + b + c + d + e;
+    }
+
+    int
+    test3()
+    {
+      const auto nullary = [](){ return 0; };
+      const auto unary = [](int x){ return x; };
+      using nullary_t = decltype(nullary);
+      using unary_t = decltype(unary);
+      const auto higher1st = [](nullary_t f){ return f(); };
+      const auto higher2nd = [unary](nullary_t f1){
+        return [unary, f1](unary_t f2){ return f2(unary(f1())); };
+      };
+      return higher1st(nullary) + higher2nd(nullary)(unary);
+    }
+
+  }
+
+  namespace test_variadic_templates
+  {
+
+    template <int...>
+    struct sum;
+
+    template <int N0, int... N1toN>
+    struct sum<N0, N1toN...>
+    {
+      static constexpr auto value = N0 + sum<N1toN...>::value;
+    };
+
+    template <>
+    struct sum<>
+    {
+      static constexpr auto value = 0;
+    };
+
+    static_assert(sum<>::value == 0, "");
+    static_assert(sum<1>::value == 1, "");
+    static_assert(sum<23>::value == 23, "");
+    static_assert(sum<1, 2>::value == 3, "");
+    static_assert(sum<5, 5, 11>::value == 21, "");
+    static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
+
+  }
+
+  // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
+  // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
+  // because of this.
+  namespace test_template_alias_sfinae
+  {
+
+    struct foo {};
+
+    template<typename T>
+    using member = typename T::member_type;
+
+    template<typename T>
+    void func(...) {}
+
+    template<typename T>
+    void func(member<T>*) {}
+
+    void test();
+
+    void test() { func<foo>(0); }
+
+  }
+
+}  // namespace cxx11
+
+#endif  // __cplusplus >= 201103L
+
+
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  eval $cachevar=yes
+else
+  eval $cachevar=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+           CXX="$ac_save_CXX"
+fi
+eval ac_res=\$$cachevar
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+        if eval test x\$$cachevar = xyes; then
+          CXX="$CXX $switch"
+          if test -n "$CXXCPP" ; then
+            CXXCPP="$CXXCPP $switch"
+          fi
+          ac_success=yes
+          break
+        fi
+      done
+      if test x$ac_success = xyes; then
+        break
+      fi
+    done
+  fi
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+  if test x$ax_cxx_compile_cxx11_required = xtrue; then
+    if test x$ac_success = xno; then
+      as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5
+    fi
+  fi
+  if test x$ac_success = xno; then
+    HAVE_CXX11=0
+    { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5
+$as_echo "$as_me: No compiler with C++11 support was found" >&6;}
+  else
+    HAVE_CXX11=1
+
+$as_echo "#define HAVE_CXX11 1" >>confdefs.h
+
+  fi
+
+
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
@@ -5452,7 +6443,6 @@
 fi
 
 
-
 echo 'dbg:_KPSE_COMPILER_VISIBILITY called.' >&5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for C to hide external symbols" >&5
 $as_echo_n "checking CFLAGS for C to hide external symbols... " >&6; }
@@ -5984,9 +6974,12 @@
   as_fn_error $? "Sorry, your compiler has no \`long long' with at least 8 bytes." "$LINENO" 5
 fi
 
-test "x$GXX" = xyes && NO_WARN_CXXFLAGS='-Wno-write-strings'
+if test "x$GXX" = xyes; then
+  NO_WARN_CXXFLAGS='-Wno-write-strings'
+fi
 
 
+
 # Check whether --enable-opi was given.
 if test "${enable_opi+set}" = set; then :
   enableval=$enable_opi; if test "x$enableval" = xyes; then
@@ -6031,7 +7024,29 @@
 fi
 
 
+# Check whether --enable-dctdecoder was given.
+if test "${enable_dctdecoder+set}" = set; then :
+  enableval=$enable_dctdecoder; if test "x$enableval" = xlibjpeg; then
 
+$as_echo "#define HAVE_DCT_DECODER 1" >>confdefs.h
+
+fi
+
+fi
+
+
+# Check whether --enable-libopenjpeg was given.
+if test "${enable_libopenjpeg+set}" = set; then :
+  enableval=$enable_libopenjpeg; if test "x$enableval" = xopenjpeg2; then
+
+$as_echo "#define HAVE_JPX_DECODER 1" >>confdefs.h
+
+fi
+
+fi
+
+
+
 for ac_header in strings.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default"
@@ -6203,8 +7218,8 @@
 fi
 
 
-
-for ac_func in gettimeofday gmtime_r mkstemp popen rand_r timegm
+for ac_func in gettimeofday gmtime_r localtime_r mkstemp popen rand_r \
+                timegm strtok_r
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -6579,7 +7594,7 @@
 
 
 cat >>confdefs.h <<_ACEOF
-#define POPPLER_VERSION "0.52.0"
+#define POPPLER_VERSION "0.62.0"
 _ACEOF
 
 
@@ -7273,7 +8288,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by poppler (TeX Live) $as_me 0.52.0, which was
+This file was extended by poppler (TeX Live) $as_me 0.62.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -7339,7 +8354,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-poppler (TeX Live) config.status 0.52.0
+poppler (TeX Live) config.status 0.62.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: branches/stable/source/src/libs/poppler/configure.ac
===================================================================
--- branches/stable/source/src/libs/poppler/configure.ac	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/configure.ac	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,6 +1,8 @@
+dnl $Id: configure.ac 46373 2018-01-18 23:12:02Z karl $
 dnl Process this file with autoconf to produce a configure script.
 dnl
-dnl   Copyright (C) 2011-2013 Peter Breitenlohner <tex-live at tug.org>
+dnl   Copyright 2018 Karl Berry <tex-live at tug.org>
+dnl   Copyright 2011-2013 Peter Breitenlohner <tex-live at tug.org>
 dnl
 dnl   This file is free software; the copyright holder
 dnl   gives unlimited permission to copy and/or distribute it,
@@ -17,6 +19,7 @@
 
 AC_PROG_CC
 AC_PROG_CXX
+AX_CXX_COMPILE_STDCXX([11])
 AC_PROG_RANLIB
 AC_PROG_LN_S
 
@@ -27,7 +30,10 @@
   AC_MSG_ERROR([Sorry, your compiler has no `long long' with at least 8 bytes.])
 fi
 
-test "x$GXX" = xyes && NO_WARN_CXXFLAGS='-Wno-write-strings'
+if test "x$GXX" = xyes; then
+  NO_WARN_CXXFLAGS='-Wno-write-strings'
+fi
+
 AC_SUBST([NO_WARN_CXXFLAGS])  
 
 dnl ##### Optional features.
@@ -63,14 +69,30 @@
 fi
 ])
 
+AC_ARG_ENABLE([dctdecoder],
+              AS_HELP_STRING([--enable-dctdecoder],
+                             [use dctdecoder]),
+              [if test "x$enableval" = xlibjpeg; then
+  AC_DEFINE([HAVE_DCT_DECODER], 1, [Do we have any DCT decoder?.])
+fi
+])
+
+AC_ARG_ENABLE([libopenjpeg],
+              AS_HELP_STRING([--enable-libopenjpeg],
+                             [use openjpeg decoder]),
+              [if test "x$enableval" = xopenjpeg2; then
+  AC_DEFINE([HAVE_JPX_DECODER], 1, [Do we have any JPX decoder?.])
+fi
+])
+
 dnl **** Checks for header files ****
 
 AC_CHECK_HEADERS([strings.h])
 AC_HEADER_DIRENT
 
-dnl **** Checks for library functions ****
-
-AC_CHECK_FUNCS([gettimeofday gmtime_r mkstemp popen rand_r timegm])
+dnl Checks for library functions (from goo/glibc.h and more).
+AC_CHECK_FUNCS([gettimeofday gmtime_r localtime_r mkstemp popen rand_r \
+                timegm strtok_r])
 AC_SYS_LARGEFILE
 AC_FUNC_FSEEKO
 AC_CHECK_FUNC([ftell64], [AC_CHECK_FUNCS([fseek64])])

Modified: branches/stable/source/src/libs/poppler/include/Makefile.in
===================================================================
--- branches/stable/source/src/libs/poppler/include/Makefile.in	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/include/Makefile.in	2018-02-27 23:34:23 UTC (rev 795)
@@ -87,7 +87,8 @@
 POST_UNINSTALL = :
 subdir = include
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-common.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../m4/ax_cxx_compile_stdcxx.m4 \
+	$(top_srcdir)/../../m4/kpse-common.m4 \
 	$(top_srcdir)/../../m4/kpse-visibility.m4 \
 	$(top_srcdir)/../../m4/kpse-warnings.m4 \
 	$(top_srcdir)/../../m4/kpse-win32.m4 \
@@ -208,6 +209,7 @@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@

Modified: branches/stable/source/src/libs/poppler/include/fofi/Makefile.in
===================================================================
--- branches/stable/source/src/libs/poppler/include/fofi/Makefile.in	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/include/fofi/Makefile.in	2018-02-27 23:34:23 UTC (rev 795)
@@ -87,7 +87,8 @@
 POST_UNINSTALL = :
 subdir = include/fofi
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-common.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../m4/ax_cxx_compile_stdcxx.m4 \
+	$(top_srcdir)/../../m4/kpse-common.m4 \
 	$(top_srcdir)/../../m4/kpse-visibility.m4 \
 	$(top_srcdir)/../../m4/kpse-warnings.m4 \
 	$(top_srcdir)/../../m4/kpse-win32.m4 \
@@ -148,6 +149,7 @@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@

Modified: branches/stable/source/src/libs/poppler/include/goo/Makefile.in
===================================================================
--- branches/stable/source/src/libs/poppler/include/goo/Makefile.in	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/include/goo/Makefile.in	2018-02-27 23:34:23 UTC (rev 795)
@@ -87,7 +87,8 @@
 POST_UNINSTALL = :
 subdir = include/goo
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-common.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../m4/ax_cxx_compile_stdcxx.m4 \
+	$(top_srcdir)/../../m4/kpse-common.m4 \
 	$(top_srcdir)/../../m4/kpse-visibility.m4 \
 	$(top_srcdir)/../../m4/kpse-warnings.m4 \
 	$(top_srcdir)/../../m4/kpse-win32.m4 \
@@ -148,6 +149,7 @@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 GREP = @GREP@
+HAVE_CXX11 = @HAVE_CXX11@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@

Modified: branches/stable/source/src/libs/poppler/poppler-src/CMakeLists.txt
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/CMakeLists.txt	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/CMakeLists.txt	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,6 +1,6 @@
 project(poppler)
 
-cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
 
 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
 
@@ -10,12 +10,20 @@
 find_package(PkgConfig)
 include(MacroEnsureVersion)
 include(MacroBoolTo01)
-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)
 CHECK_FILE_OFFSET_BITS()
 
+include(GNUInstallDirs)
+
 find_package (ECM 1.6.0 QUIET NO_MODULE)
 if (ECM_FOUND)
     include("${ECM_MODULE_DIR}/ECMEnableSanitizers.cmake")
@@ -22,35 +30,42 @@
 endif()
 
 set(POPPLER_MAJOR_VERSION "0")
-set(POPPLER_MINOR_VERSION "52")
+set(POPPLER_MINOR_VERSION "62")
 set(POPPLER_MICRO_VERSION "0")
 set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}")
 
+set (CMAKE_CXX_STANDARD 11)
+set (CMAKE_CXX_EXTENSIONS OFF)
+
 # command line switches
 option(ENABLE_XPDF_HEADERS "Install unsupported xpdf headers." OFF)
 option(BUILD_GTK_TESTS "Whether compile the GTK+ test programs." ON)
-option(BUILD_QT4_TESTS "Whether compile the Qt4 test programs." ON)
 option(BUILD_QT5_TESTS "Whether compile the Qt5 test programs." ON)
 option(BUILD_CPP_TESTS "Whether compile the CPP test programs." ON)
 option(ENABLE_SPLASH "Build the Splash graphics backend." ON)
 option(ENABLE_UTILS "Compile poppler command line utils." ON)
 option(ENABLE_CPP "Compile poppler cpp wrapper." ON)
-set(ENABLE_LIBOPENJPEG "auto" CACHE STRING "Use libopenjpeg for JPX streams. Possible values: auto, openjpeg1, openjpeg2. 'auto' prefers openjpeg1 over openjpeg2 if both are available. Unset to not use openjpeg.")
-set(ENABLE_CMS "auto" CACHE STRING "Use color management system. Possible values: auto, lcms1, lcms2. 'auto' prefers lcms2 over lcms1 if both are available. Unset to disable color management system.")
-option(ENABLE_LIBCURL "Build libcurl based HTTP support." OFF)
+option(ENABLE_GLIB "Compile poppler glib wrapper." ON)
+option(ENABLE_GTK_DOC "Whether to generate glib API documentation." OFF)
+option(ENABLE_QT5 "Compile poppler qt5 wrapper." ON)
+set(ENABLE_LIBOPENJPEG "openjpeg2" CACHE STRING "Use libopenjpeg for JPX streams. Possible values: openjpeg2, unmaintained, none. 'unmaintained' gives you the internal unmaintained decoder. Use at your own risk. 'none' compiles no JPX decoder at all. Default: openjpeg2")
+set(ENABLE_CMS "lcms2" CACHE STRING "Use color management system. Possible values: lcms2, none. 'none' disables color management system.")
+set(ENABLE_DCTDECODER "libjpeg" CACHE STRING "Use libjpeg for DCT streams. Possible values: libjpeg, unmaintained, none. will use libjpeg if available or fail if not. 'unmaintained' gives you the internal unmaintained decoder. Use at your own risk. 'none' compiles no DCT decoder at all. Default: libjpeg")
+option(ENABLE_LIBCURL "Build libcurl based HTTP support." ON)
 option(ENABLE_ZLIB "Build with zlib." ON)
 option(ENABLE_ZLIB_UNCOMPRESS "Use zlib to uncompress flate streams (not totally safe)." OFF)
 option(SPLASH_CMYK "Include support for CMYK rasterization." OFF)
 option(USE_FIXEDPOINT "Use fixed point arithmetic in the Splash backend" OFF)
 option(USE_FLOAT "Use single precision arithmetic in the Splash backend" OFF)
+option(BUILD_SHARED_LIBS "Build poppler as a shared library" ON)
 if(WIN32)
   option(ENABLE_RELOCATABLE "Do not hardcode the poppler library location (on Windows)." ON)
-else(WIN32)
+else()
   set(ENABLE_RELOCATABLE OFF)
-endif(WIN32)
+endif()
+option(EXTRA_WARN "Enable extra compile warnings" OFF)
 
-set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
-set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share" CACHE STRING "Share directory name")
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
 
 set(TESTDATADIR "${CMAKE_SOURCE_DIR}/../test" CACHE STRING "Specify test data dir.")
 if(NOT (EXISTS ${TESTDATADIR} AND EXISTS ${TESTDATADIR}/test-poppler.c))
@@ -73,9 +88,9 @@
 
 if(WIN32)
   set(_default_fontconfiguration "win32")
-else(WIN32)
+else()
   set(_default_fontconfiguration "fontconfig")
-endif(WIN32)
+endif()
 set(FONT_CONFIGURATION "${_default_fontconfiguration}" CACHE STRING "The font configuration backend (win32|fontconfig).")
 string(TOLOWER "${FONT_CONFIGURATION}" font_configuration)
 set(WITH_FONTCONFIGURATION_WIN32 OFF)
@@ -84,17 +99,19 @@
   set(WITH_FONTCONFIGURATION_WIN32 ON)
 elseif(font_configuration STREQUAL "fontconfig")
   set(WITH_FONTCONFIGURATION_FONTCONFIG ON)
-else(font_configuration STREQUAL "win32")
+else()
   message(FATAL_ERROR "Invalid font configuration setting: ${FONT_CONFIGURATION}")
-endif(font_configuration STREQUAL "win32")
+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)
 
 # setting the minimum required versions for some components
-set(QT4_MIN_VERSION "4.7.0")
 set(CAIRO_VERSION "1.10.0")
 set(GLIB_REQUIRED "2.41")
 
@@ -102,31 +119,39 @@
 find_package(Freetype REQUIRED)
 if(WITH_FONTCONFIGURATION_FONTCONFIG)
   find_package(Fontconfig REQUIRED)
-endif(WITH_FONTCONFIGURATION_FONTCONFIG)
+endif()
 macro_optional_find_package(JPEG)
 macro_optional_find_package(PNG)
 macro_optional_find_package(TIFF)
 macro_optional_find_package(NSS3)
-if(JPEG_FOUND)
-  set(ENABLE_LIBJPEG ${JPEG_FOUND})
-endif(JPEG_FOUND)
-macro_optional_find_package(Qt4)
-if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
+if(ENABLE_DCTDECODER STREQUAL "libjpeg")
+  if(JPEG_FOUND)
+    set(ENABLE_LIBJPEG ${JPEG_FOUND})
+  else()
+    message(FATAL_ERROR "Install libjpeg before trying to build poppler. You can also decide to use the internal unmaintained DCT decoder or none at all.")
+  endif()
+  set(HAVE_DCT_DECODER ON)
+elseif(ENABLE_DCTDECODER STREQUAL "unmaintained")
+  set(ENABLE_LIBJPEG OFF)
+  set(HAVE_DCT_DECODER ON)
+elseif(ENABLE_DCTDECODER STREQUAL "none")
+  set(ENABLE_LIBJPEG OFF)
+  set(HAVE_DCT_DECODER OFF)
+else()
+  message(FATAL_ERROR "Invalid ENABLE_DCTDECODER value.")
+endif()
+
+if (ENABLE_QT5)
   find_package(Qt5Core)
   find_package(Qt5Gui)
   find_package(Qt5Xml)
   find_package(Qt5Widgets)
   find_package(Qt5Test)
-  if (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Xml_FOUND AND Qt5Widgets_FOUND AND Qt5Test_FOUND)
-    set(QT5_FOUND true)
-  else ()
+  if (NOT (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Xml_FOUND AND Qt5Widgets_FOUND AND Qt5Test_FOUND))
     message("-- Package Qt5Core or Qt5Gui or Qt5Xml or Qt5Widgets or Qt5Test not found")
-    set(QT5_FOUND false)
+    set(ENABLE_QT5 OFF)
   endif()
-else(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
-  set(QT5_FOUND false)
-  message("-- CMake >= 2.8.8 is needed to enable Qt5")
-endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
+endif()
 
 macro_optional_find_package(Cairo ${CAIRO_VERSION})
 if(CAIRO_FOUND)
@@ -135,9 +160,13 @@
   set(CAIRO_REQ "cairo")
   set(POPPLER_GLIB_DISABLE_DEPRECATED "")
   set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "")
-  macro_optional_find_package(GLIB)
-  if(GLIB_FOUND)
-    set(ENABLE_GLIB ON)
+  if(ENABLE_GLIB)
+    macro_optional_find_package(GLIB)
+    if(NOT GLIB_FOUND)
+      set(ENABLE_GLIB OFF)
+    endif()
+  endif()
+  if(ENABLE_GLIB)
     # Check for introspection
     macro_optional_find_package(GObjectIntrospection 0.9.12)
     set(HAVE_INTROSPECTION ${INTROSPECTION_FOUND})
@@ -144,85 +173,72 @@
     set(POPPLER_GLIB_DISABLE_DEPRECATED "${POPPLER_GLIB_DISABLE_DEPRECATED} -DG_DISABLE_DEPRECATED")
     set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "${POPPLER_GLIB_DISABLE_SINGLE_INCLUDES} -DG_DISABLE_SINGLE_INCLUDES")
     macro_optional_find_package(GTK)
-  endif(GLIB_FOUND)
-else(CAIRO_FOUND)
+  endif()
+else()
   set(CAIRO_FEATURE "#undef POPPLER_HAS_CAIRO")
-endif(CAIRO_FOUND)
+  set(ENABLE_GLIB OFF)
+endif()
 if(ENABLE_CPP)
   macro_optional_find_package(Iconv)
   set(ENABLE_CPP ${ICONV_FOUND})
   set(HAVE_ICONV ${ICONV_FOUND})
-endif(ENABLE_CPP)
+endif()
 if(ENABLE_ZLIB)
   find_package(ZLIB)
-  if(ZLIB_FOUND)
-    set(HAVE_LIBZ ${ZLIB_FOUND})
-  endif(ZLIB_FOUND)
   set(ENABLE_ZLIB ${ZLIB_FOUND})
-endif(ENABLE_ZLIB)
+endif()
 if(ENABLE_ZLIB_UNCOMPRESS AND NOT ENABLE_ZLIB)
   message("Warning: ENABLE_ZLIB_UNCOMPRESS requires ENABLE_ZLIB")
   set(ENABLE_ZLIB_UNCOMPRESS FALSE)
-endif(ENABLE_ZLIB_UNCOMPRESS AND NOT ENABLE_ZLIB)
-set(USE_OPENJPEG1 FALSE)
-set(USE_OPENJPEG2 FALSE)
+endif()
 set(WITH_OPENJPEG FALSE)
-if(ENABLE_LIBOPENJPEG STREQUAL "auto")
+if(ENABLE_LIBOPENJPEG STREQUAL "openjpeg2")
   find_package(LIBOPENJPEG2)
-  set(USE_OPENJPEG2 ${LIBOPENJPEG2_FOUND})
   set(WITH_OPENJPEG ${LIBOPENJPEG2_FOUND})
   if(NOT LIBOPENJPEG2_FOUND)
-    find_package(LIBOPENJPEG)
-    set(USE_OPENJPEG1 ${LIBOPENJPEG_FOUND})
-    set(WITH_OPENJPEG ${LIBOPENJPEG_FOUND})  
+    message(FATAL_ERROR "Install libopenjpeg2 before trying to build poppler. You can also decide to use the internal unmaintained JPX decoder or none at all.")
   endif()
-elseif(ENABLE_LIBOPENJPEG STREQUAL "openjpeg1")
-  find_package(LIBOPENJPEG)
-  set(USE_OPENJPEG1 ${LIBOPENJPEG_FOUND})
-  set(WITH_OPENJPEG ${LIBOPENJPEG_FOUND})
-elseif(ENABLE_LIBOPENJPEG STREQUAL "openjpeg2")
-  find_package(LIBOPENJPEG2)
-  set(USE_OPENJPEG2 ${LIBOPENJPEG2_FOUND})
-  set(WITH_OPENJPEG ${LIBOPENJPEG2_FOUND})
+  set(HAVE_JPX_DECODER ON)
+elseif(ENABLE_LIBOPENJPEG STREQUAL "unmaintained")
+  set(WITH_OPENJPEG OFF)
+  set(HAVE_JPX_DECODER ON)
+elseif(ENABLE_LIBOPENJPEG STREQUAL "none")
+  set(WITH_OPENJPEG OFF)
+  set(HAVE_JPX_DECODER OFF)
+else()
+  message(FATAL_ERROR "Invalid ENABLE_LIBOPENJPEG value: ${ENABLE_LIBOPENJPEG}")
 endif()
 set(ENABLE_LIBOPENJPEG "${WITH_OPENJPEG}")
-if(ENABLE_CMS STREQUAL "auto")
+if(ENABLE_CMS STREQUAL "lcms2")
   find_package(LCMS2)
   set(USE_CMS ${LCMS2_FOUND})
-  if(NOT LCMS2_FOUND)
-    find_package(LCMS)
-    set(USE_CMS ${LCMS_FOUND})
-    set(USE_LCMS1 ${LCMS_FOUND})
-  endif(NOT LCMS2_FOUND)
-elseif(ENABLE_CMS STREQUAL "lcms1")
-  find_package(LCMS)
-  set(USE_CMS ${LCMS_FOUND})
-  set(USE_LCMS1 ${LCMS_FOUND})
-elseif(ENABLE_CMS STREQUAL "lcms2")
-  find_package(LCMS2)
-  set(USE_CMS ${LCMS2_FOUND})
+elseif(NOT ENABLE_CMS STREQUAL "none")
+  message(FATAL_ERROR "Invalid ENABLE_CMS value: ${ENABLE_CMS}")
 endif()
 if(ENABLE_LIBCURL)
   find_package(CURL)
-  include_directories(${CURL_INCLUDE_DIR})
-  set(POPPLER_HAS_CURL_SUPPORT ON)
-endif(ENABLE_LIBCURL)
+  if(CURL_FOUND)
+    include_directories(${CURL_INCLUDE_DIR})
+    set(POPPLER_HAS_CURL_SUPPORT ON)
+  else()
+    set(ENABLE_LIBCURL OFF)
+  endif()
+endif()
 
-add_definitions(-DHAVE_CONFIG_H=1)
 if(MINGW)
   # Use mingw's ansi stdio extensions
   add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
-endif(MINGW)
+endif()
 if(FONTCONFIG_FOUND)
   add_definitions(${FONTCONFIG_DEFINITIONS})
   include_directories(${FONTCONFIG_INCLUDE_DIR})
-endif(FONTCONFIG_FOUND)
+endif()
 if(WITH_FONTCONFIGURATION_WIN32)
   if(MINGW)
     # Set the minimum required Internet Explorer version to 5.0
     add_definitions(-D_WIN32_IE=0x0500)
-  endif(MINGW)
-endif(WITH_FONTCONFIGURATION_WIN32)
+  endif()
+endif()
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}/fofi
@@ -232,43 +248,32 @@
   ${CMAKE_CURRENT_BINARY_DIR}/poppler
   ${FREETYPE_INCLUDE_DIRS}
 )
-set(HAVE_FREETYPE_H ON)
-if(CMAKE_USE_PTHREADS_INIT)
-  set(HAVE_PTHREAD ON)
-endif(CMAKE_USE_PTHREADS_INIT)
 
 if(ENABLE_ZLIB)
   include_directories(${ZLIB_INCLUDE_DIR})
-endif(ENABLE_ZLIB)
+endif()
 
 if (NSS3_FOUND)
   add_definitions(${NSS3_CFLAGS})
   set(ENABLE_NSS3 ON)
-endif(NSS3_FOUND)
+endif()
 if(JPEG_FOUND)
   include_directories(${JPEG_INCLUDE_DIR})
-  set(ENABLE_LIBJPEG ON)
-endif(JPEG_FOUND)
+endif()
 if(PNG_FOUND)
   include_directories(${PNG_INCLUDE_DIR})
   set(ENABLE_LIBPNG ON)
-endif(PNG_FOUND)
+endif()
 if(TIFF_FOUND)
   include_directories(${TIFF_INCLUDE_DIR})
   set(ENABLE_LIBTIFF ON)
-endif(TIFF_FOUND)
-if(LIBOPENJPEG_FOUND)
-  include_directories(${LIBOPENJPEG_INCLUDE_DIR})
-endif(LIBOPENJPEG_FOUND)
+endif()
 if(LIBOPENJPEG2_FOUND)
   include_directories(${LIBOPENJPEG2_INCLUDE_DIRS})
 endif()
-if(LCMS_FOUND)
-  include_directories(${LCMS_INCLUDE_DIR})
-endif(LCMS_FOUND)
 if(LCMS2_FOUND)
   include_directories(${LCMS2_INCLUDE_DIR})
-endif(LCMS2_FOUND)
+endif()
 
 # Recent versions of poppler-data install a .pc file.
 # Use it to determine the encoding data path, if available.
@@ -280,28 +285,19 @@
                   OUTPUT_VARIABLE _output_var OUTPUT_STRIP_TRAILING_WHITESPACE)
   if(_result_var STREQUAL "0" AND NOT _output_var STREQUAL "")
     set(POPPLER_DATADIR "${_output_var}")
-  endif(_result_var STREQUAL "0" AND NOT _output_var STREQUAL "")
-endif(POPPLER_DATA_FOUND)
+  endif()
+endif()
 if(NOT DEFINED POPPLER_DATADIR)
   set(POPPLER_DATADIR "${CMAKE_INSTALL_PREFIX}/share/poppler")
-endif(NOT DEFINED POPPLER_DATADIR)
+endif()
 
-if(DEFINED COMPILE_WARNINGS)
-else(DEFINED COMPILE_WARNINGS)
-  set(COMPILE_WARNINGS "yes")
-endif(DEFINED COMPILE_WARNINGS)
-string(TOLOWER "${COMPILE_WARNINGS}" _comp_warnings)
-if(_comp_warnings STREQUAL "no")
-  set(CMAKE_CXX_FLAGS "${DEFAULT_COMPILE_WARNINGS_NO} ${CMAKE_CXX_FLAGS}")
-endif(_comp_warnings STREQUAL "no")
-if(_comp_warnings STREQUAL "yes")
+if(EXTRA_WARN)
   set(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}")
-  set(CMAKE_CXX_FLAGS "${DEFAULT_COMPILE_WARNINGS_YES} ${CMAKE_CXX_FLAGS}")
-endif(_comp_warnings STREQUAL "yes")
-if(_comp_warnings STREQUAL "kde")
+  set(CMAKE_CXX_FLAGS "${DEFAULT_COMPILE_WARNINGS_EXTRA} ${CMAKE_CXX_FLAGS}")
+else()
   set(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}")
-  set(CMAKE_CXX_FLAGS "${DEFAULT_COMPILE_WARNINGS_KDE} ${CMAKE_CXX_FLAGS}")
-endif(_comp_warnings STREQUAL "kde")
+  set(CMAKE_CXX_FLAGS "${DEFAULT_COMPILE_WARNINGS} ${CMAKE_CXX_FLAGS}")
+endif()
 
 
 include(ConfigureChecks.cmake)
@@ -326,6 +322,7 @@
   goo/gstrtod.cc
   goo/grandom.cc
   goo/glibc.cc
+  goo/glibc_strtok_r.cc
   fofi/FoFiBase.cc
   fofi/FoFiEncodings.cc
   fofi/FoFiTrueType.cc
@@ -380,7 +377,6 @@
   poppler/Stream.cc
   poppler/StructTreeRoot.cc
   poppler/StructElement.cc
-  poppler/strtok_r.cpp
   poppler/UnicodeMap.cc
   poppler/UnicodeTypeTable.cc
   poppler/UTF.cc
@@ -415,16 +411,13 @@
     splash/SplashPattern.cc
     splash/SplashScreen.cc
     splash/SplashState.cc
-    splash/SplashT1Font.cc
-    splash/SplashT1FontEngine.cc
-    splash/SplashT1FontFile.cc
     splash/SplashXPath.cc
     splash/SplashXPathScanner.cc
   )
-endif(ENABLE_SPLASH)
+endif()
 if(FONTCONFIG_FOUND)
   set(poppler_LIBS ${poppler_LIBS} ${FONTCONFIG_LIBRARIES})
-endif(FONTCONFIG_FOUND)
+endif()
 
 if(JPEG_FOUND)
   set(poppler_SRCS ${poppler_SRCS}
@@ -431,18 +424,18 @@
     poppler/DCTStream.cc
   )
   set(poppler_LIBS ${poppler_LIBS} ${JPEG_LIBRARIES})
-endif(JPEG_FOUND)
+endif()
 if(ENABLE_ZLIB)
   set(poppler_SRCS ${poppler_SRCS}
     poppler/FlateEncoder.cc
   )
   set(poppler_LIBS ${poppler_LIBS} ${ZLIB_LIBRARIES})
-endif(ENABLE_ZLIB)
+endif()
 if(ENABLE_ZLIB_UNCOMPRESS)
   set(poppler_SRCS ${poppler_SRCS}
     poppler/FlateStream.cc
   )
-endif(ENABLE_ZLIB_UNCOMPRESS)
+endif()
 if(ENABLE_LIBCURL)
   set(poppler_SRCS ${poppler_SRCS}
     poppler/CurlCachedFile.cc
@@ -449,24 +442,17 @@
     poppler/CurlPDFDocBuilder.cc
   )
   set(poppler_LIBS ${poppler_LIBS} ${CURL_LIBRARIES})
-endif(ENABLE_LIBCURL)
+endif()
 if (ENABLE_NSS3)
   set(poppler_SRCS ${poppler_SRCS}
     poppler/SignatureHandler.cc
   )
   set(poppler_LIBS ${poppler_LIBS} ${NSS3_LIBRARIES})
-endif(ENABLE_NSS3)  
-if(LIBOPENJPEG_FOUND)
+endif()
+if (LIBOPENJPEG2_FOUND)
   set(poppler_SRCS ${poppler_SRCS}
     poppler/JPEG2000Stream.cc
   )
-  set(poppler_LIBS ${poppler_LIBS} ${LIBOPENJPEG_LIBRARIES})
-  add_definitions(-DUSE_OPENJPEG1)
-elseif (LIBOPENJPEG2_FOUND)
-  set(poppler_SRCS ${poppler_SRCS}
-    poppler/JPEG2000Stream.cc
-  )
-  add_definitions(-DUSE_OPENJPEG2)
   set(poppler_LIBS ${poppler_LIBS} ${LIBOPENJPEG2_LIBRARIES})
 else ()
   set(poppler_SRCS ${poppler_SRCS}
@@ -474,25 +460,19 @@
   )
 endif()
 if(USE_CMS)
-  if(LCMS_FOUND)
-    set(poppler_LIBS ${poppler_LIBS} ${LCMS_LIBRARIES})
-  endif(LCMS_FOUND)
-  if(LCMS2_FOUND)
-    set(poppler_LIBS ${poppler_LIBS} ${LCMS2_LIBRARIES})
-  endif(LCMS2_FOUND)
-endif(USE_CMS)
+  set(poppler_LIBS ${poppler_LIBS} ${LCMS2_LIBRARIES})
+endif()
 if(WIN32)
+  # use clean APIs
+  add_definitions(-DWIN32_LEAN_AND_MEAN)
   # gdi32 is needed under win32
   set(poppler_LIBS ${poppler_LIBS} gdi32)
-endif(WIN32)
+endif()
 if(PNG_FOUND)
   set(poppler_LIBS ${poppler_LIBS} ${PNG_LIBRARIES})
-endif(PNG_FOUND)
+endif()
 if(TIFF_FOUND)
   set(poppler_LIBS ${poppler_LIBS} ${TIFF_LIBRARIES})
-endif(TIFF_FOUND)
-if(HAVE_PTHREAD)
-  set(poppler_LIBS ${poppler_LIBS} ${CMAKE_THREAD_LIBS_INIT})
 endif()
 
 if(MSVC)
@@ -499,12 +479,19 @@
 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 set(CMAKE_CXX_FLAGS "/Zc:wchar_t- ${CMAKE_CXX_FLAGS}")
 add_library(poppler STATIC ${poppler_SRCS})
-else(MSVC)
-add_library(poppler SHARED ${poppler_SRCS})
-endif(MSVC)
-set_target_properties(poppler PROPERTIES VERSION 66.0.0 SOVERSION 66)
+else()
+add_library(poppler ${poppler_SRCS})
+endif()
+set_target_properties(poppler PROPERTIES VERSION 73.0.0 SOVERSION 73)
+if(MINGW)
+    get_target_property(POPPLER_SOVERSION poppler SOVERSION)
+    set_target_properties(poppler PROPERTIES SUFFIX "-${POPPLER_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+endif()
 target_link_libraries(poppler LINK_PRIVATE ${poppler_LIBS})
-install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
+if(CMAKE_USE_PTHREADS_INIT)
+   target_link_libraries(poppler LINK_PRIVATE Threads::Threads)
+endif()
+install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
 if(ENABLE_XPDF_HEADERS)
   install(FILES
@@ -524,7 +511,6 @@
     poppler/FontEncodingTables.h
     poppler/FontInfo.h
     poppler/Form.h
-    poppler/Function.cc
     poppler/Function.h
     poppler/Gfx.h
     poppler/GfxFont.h
@@ -562,6 +548,7 @@
     poppler/StructElement.h
     poppler/StructTreeRoot.h
     poppler/UnicodeMap.h
+    poppler/UnicodeMapFuncs.h
     poppler/UnicodeMapTables.h
     poppler/UnicodeTypeTable.h
     poppler/UnicodeCClassTables.h
@@ -579,7 +566,6 @@
     poppler/StdinCachedFile.h
     poppler/StdinPDFDocBuilder.h
     poppler/UTF.h
-    poppler/UTF8.h
     poppler/XpdfPluginAPI.h
     poppler/Sound.h
     ${CMAKE_CURRENT_BINARY_DIR}/poppler/poppler-config.h
@@ -603,17 +589,17 @@
     install(FILES
       goo/PNGWriter.h
       DESTINATION include/poppler/goo)
-  endif(PNG_FOUND)
+  endif()
   if(TIFF_FOUND)
     install(FILES
       goo/TiffWriter.h
       DESTINATION include/poppler/goo)
-  endif(TIFF_FOUND)
+  endif()
   if(JPEG_FOUND)
     install(FILES
       goo/JpegWriter.h
       DESTINATION include/poppler/goo)
-  endif(JPEG_FOUND)
+  endif()
   install(FILES
     fofi/FoFiBase.h
     fofi/FoFiEncodings.h
@@ -627,15 +613,11 @@
       poppler/CurlCachedFile.h
       poppler/CurlPDFDocBuilder.h
       DESTINATION include/poppler)
-  endif(ENABLE_LIBCURL)
-  if(LIBOPENJPEG_FOUND)
+  endif()
+  if(LIBOPENJPEG2_FOUND)
     install(FILES
       poppler/JPEG2000Stream.h
       DESTINATION include/poppler)
-  elseif(LIBOPENJPEG2_FOUND)
-    install(FILES
-      poppler/JPEG2000Stream.h
-      DESTINATION include/poppler)
   else()
     install(FILES
       poppler/JPXStream.h
@@ -663,66 +645,57 @@
       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
       DESTINATION include/poppler/splash)
-  endif(ENABLE_SPLASH)
-endif(ENABLE_XPDF_HEADERS)
+  endif()
+endif()
 
 
 if(ENABLE_UTILS)
   add_subdirectory(utils)
-endif(ENABLE_UTILS)
+endif()
 if(ENABLE_GLIB)
   add_subdirectory(glib)
-endif(ENABLE_GLIB)
+endif()
 add_subdirectory(test)
-if(QT4_FOUND)
-  add_subdirectory(qt4)
-endif(QT4_FOUND)
-if(QT5_FOUND)
+if(ENABLE_QT5)
   add_subdirectory(qt5)
-endif(QT5_FOUND)
+endif()
 if(ENABLE_CPP)
   add_subdirectory(cpp)
-endif(ENABLE_CPP)
+endif()
 
 set(PKG_CONFIG_VERSION_0_18 TRUE)
 if(PKG_CONFIG_EXECUTABLE)
   exec_program(${PKG_CONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _output_VAR)
   macro_ensure_version("0.18" "${_output_VAR}" PKG_CONFIG_VERSION_0_18)
-endif(PKG_CONFIG_EXECUTABLE)
+endif()
 if(PKG_CONFIG_VERSION_0_18)
   set(PC_REQUIRES "")
   set(PC_REQUIRES_PRIVATE "Requires.private: poppler = ${POPPLER_VERSION}")
-else(PKG_CONFIG_VERSION_0_18)
+else()
   set(PC_REQUIRES "poppler = ${POPPLER_VERSION}")
   set(PC_REQUIRES_PRIVATE "")
-endif(PKG_CONFIG_VERSION_0_18)
+endif()
 
-poppler_create_install_pkgconfig(poppler.pc lib${LIB_SUFFIX}/pkgconfig)
+poppler_create_install_pkgconfig(poppler.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
 if(ENABLE_SPLASH)
-  poppler_create_install_pkgconfig(poppler-splash.pc lib${LIB_SUFFIX}/pkgconfig)
-endif(ENABLE_SPLASH)
-if(QT4_FOUND)
-  poppler_create_install_pkgconfig(poppler-qt4.pc lib${LIB_SUFFIX}/pkgconfig)
-endif(QT4_FOUND)
-if(QT5_FOUND)
-  poppler_create_install_pkgconfig(poppler-qt5.pc lib${LIB_SUFFIX}/pkgconfig)
-endif(QT5_FOUND)
+  poppler_create_install_pkgconfig(poppler-splash.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+endif()
+if(ENABLE_QT5)
+  poppler_create_install_pkgconfig(poppler-qt5.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+endif()
 if(ENABLE_GLIB)
-  poppler_create_install_pkgconfig(poppler-glib.pc lib${LIB_SUFFIX}/pkgconfig)
-endif(ENABLE_GLIB)
+  poppler_create_install_pkgconfig(poppler-glib.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+endif()
 if(CAIRO_FOUND)
-  poppler_create_install_pkgconfig(poppler-cairo.pc lib${LIB_SUFFIX}/pkgconfig)
-endif(CAIRO_FOUND)
+  poppler_create_install_pkgconfig(poppler-cairo.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+endif()
 if(ENABLE_CPP)
-  poppler_create_install_pkgconfig(poppler-cpp.pc lib${LIB_SUFFIX}/pkgconfig)
-endif(ENABLE_CPP)
+  poppler_create_install_pkgconfig(poppler-cpp.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+endif()
 
 
 message("Building Poppler with support for:")
@@ -732,12 +705,11 @@
   message("      with CMYK support")
 endif()
 show_end_message_yesno("cairo output" CAIRO_FOUND)
-show_end_message_yesno("qt4 wrapper" QT4_FOUND)
-show_end_message_yesno("qt5 wrapper" QT5_FOUND)
+show_end_message_yesno("qt5 wrapper" ENABLE_QT5)
 show_end_message_yesno("glib wrapper" ENABLE_GLIB)
 show_end_message_yesno("  introspection" INTROSPECTION_FOUND)
+show_end_message_yesno("  gtk-doc" ENABLE_GTK_DOC)
 show_end_message_yesno("cpp wrapper" ENABLE_CPP)
-show_end_message("use gtk-doc" "not supported with this CMake build system")
 show_end_message_yesno("use libjpeg" ENABLE_LIBJPEG)
 show_end_message_yesno("use libpng" ENABLE_LIBPNG)
 show_end_message_yesno("use libtiff" ENABLE_LIBTIFF)
@@ -745,39 +717,45 @@
 show_end_message_yesno("use zlib uncompress" ENABLE_ZLIB_UNCOMPRESS)
 show_end_message_yesno("use nss3" ENABLE_NSS3)
 show_end_message_yesno("use curl" ENABLE_LIBCURL)
-show_end_message_yesno("use libopenjpeg" WITH_OPENJPEG)
-if(USE_OPENJPEG1)
-  message("      with openjpeg1")
-endif()
-if(USE_OPENJPEG2)
-  message("      with openjpeg2")
-endif()
-show_end_message_yesno("use cms" USE_CMS)
-if(LCMS_FOUND)
-  message("      with lcms1")
-endif(LCMS_FOUND)
-if(LCMS2_FOUND)
-  message("      with lcms2")
-endif(LCMS2_FOUND)
+show_end_message_yesno("use libopenjpeg2" WITH_OPENJPEG)
+show_end_message_yesno("use lcms2" USE_CMS)
 show_end_message_yesno("command line utils" ENABLE_UTILS)
 show_end_message("test data dir" ${TESTDATADIR})
 
 if(NOT ENABLE_SPLASH AND NOT CAIRO_FOUND)
   message("Warning: There is no rendering backend enabled")
-endif(NOT ENABLE_SPLASH AND NOT CAIRO_FOUND)
+endif()
 
 if(USE_FIXEDPOINT AND USE_FLOAT)
   message("Warning: Single precision and fixed point options should not be enabled at the same time")
-endif(USE_FIXEDPOINT AND USE_FLOAT)
+endif()
 
-if(NOT ENABLE_LIBJPEG)
+if(NOT ENABLE_LIBJPEG AND HAVE_DCT_DECODER)
   message("Warning: Using libjpeg is recommended. The internal DCT decoder is unmaintained.")
-endif(NOT ENABLE_LIBJPEG)
+endif()
 
+if(NOT HAVE_DCT_DECODER)
+  message("Warning: You're not compiling any DCT decoder. Some files will fail to display properly.")
+endif()
+
 if(ENABLE_ZLIB_UNCOMPRESS)
   message("Warning: Using zlib is not totally safe")
-endif(ENABLE_ZLIB_UNCOMPRESS)
+endif()
 
-if(NOT WITH_OPENJPEG)
+if(NOT WITH_OPENJPEG AND HAVE_JPX_DECODER)
   message("Warning: Using libopenjpeg2 is recommended. The internal JPX decoder is unmaintained.")
-endif(NOT WITH_OPENJPEG)
+endif()
+
+if(NOT HAVE_JPX_DECODER)
+  message("Warning: You're not compiling any JPX decoder. Some files will fail to display properly.")
+endif()
+
+set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${POPPLER_VERSION})
+add_custom_target(dist
+    COMMAND
+        COMMAND git log --stat | fmt --split-only > ${CMAKE_BINARY_DIR}/ChangeLog
+        COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar
+        COMMAND tar -C ${CMAKE_BINARY_DIR} -rf ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar ChangeLog --transform='s,,${ARCHIVE_NAME}/,'
+        COMMAND tar -C ${CMAKE_BINARY_DIR} -rf ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar glib/reference/html --transform='s,,${ARCHIVE_NAME}/,'
+        COMMAND xz -9 ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

Added: branches/stable/source/src/libs/poppler/poppler-src/COPYING3
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/COPYING3	                        (rev 0)
+++ branches/stable/source/src/libs/poppler/poppler-src/COPYING3	2018-02-27 23:34:23 UTC (rev 795)
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.

Modified: branches/stable/source/src/libs/poppler/poppler-src/ChangeLog
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/ChangeLog	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/ChangeLog	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,3 +1,4098 @@
+commit 72e0a3a087f160d819f7697a8536bbee12240c7a
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Dec 3 20:25:06 2017 +0100
+
+    0.62.0
+
+ CMakeLists.txt         |  6 +++---
+ NEWS                   | 26 ++++++++++++++++++++++++++
+ cpp/Doxyfile           |  2 +-
+ qt5/src/CMakeLists.txt |  2 +-
+ qt5/src/Doxyfile       |  2 +-
+ 5 files changed, 32 insertions(+), 6 deletions(-)
+
+commit 90958363fd5e8c5e74a889e0c2140c71a0c09eb6
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Dec 3 20:23:09 2017 +0100
+
+    Add missing (C)
+
+ poppler/Error.cc          | 2 +-
+ poppler/UTF.cc            | 2 +-
+ poppler/UTF.h             | 2 +-
+ poppler/UnicodeMapFuncs.h | 1 +
+ utils/JSInfo.cc           | 2 +-
+ utils/pdfdetach.cc        | 2 +-
+ utils/pdffonts.cc         | 2 +-
+ utils/pdfseparate.cc      | 1 +
+ utils/pdfsig.cc           | 1 +
+ utils/pdftohtml.cc        | 1 +
+ utils/pdftotext.cc        | 1 +
+ utils/printencodings.cc   | 1 +
+ 12 files changed, 12 insertions(+), 6 deletions(-)
+
+commit f007ab6beb2616850488271da5162f4ef0dbe789
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sat Dec 2 14:13:50 2017 +1030
+
+    INSTALL: add debug options
+
+    also ensure cmake commands are lowercase to be consistent with our
+    code style.
+
+ INSTALL | 38 +++++++++++++++++++++++++++++++++-----
+ 1 file changed, 33 insertions(+), 5 deletions(-)
+
+commit cef42ac807f4da7ae91be1b6b81b50adb9684975
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sat Dec 2 14:01:42 2017 +1030
+
+    Fix UTF test fail
+
+    The buffer size was not large enough. Increase it and add an assert to
+    check the buffer size.
+
+ qt5/tests/check_utf_conversion.cpp | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+commit fb4c69d270a618bb23791e52f46ec73c86574294
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Dec 1 23:44:17 2017 +0100
+
+    Remove the Qt4 frontend
+
+ .gitignore                                   |    2 -
+ CMakeLists.txt                               |   17 -
+ cmake/modules/FindQt4.cmake                  | 1311 -------
+ poppler-qt4.pc.cmake                         |   12 -
+ qt4/.gitignore                               |    4 -
+ qt4/CMakeLists.txt                           |    6 -
+ qt4/demos/.gitignore                         |    4 -
+ qt4/demos/CMakeLists.txt                     |   28 -
+ qt4/demos/abstractinfodock.cpp               |   57 -
+ qt4/demos/abstractinfodock.h                 |   48 -
+ qt4/demos/documentobserver.cpp               |   50 -
+ qt4/demos/documentobserver.h                 |   50 -
+ qt4/demos/embeddedfiles.cpp                  |   82 -
+ qt4/demos/embeddedfiles.h                    |   44 -
+ qt4/demos/fonts.cpp                          |   72 -
+ qt4/demos/fonts.h                            |   43 -
+ qt4/demos/info.cpp                           |   72 -
+ qt4/demos/info.h                             |   43 -
+ qt4/demos/main_viewer.cpp                    |   33 -
+ qt4/demos/metadata.cpp                       |   50 -
+ qt4/demos/metadata.h                         |   43 -
+ qt4/demos/navigationtoolbar.cpp              |  144 -
+ qt4/demos/navigationtoolbar.h                |   65 -
+ qt4/demos/optcontent.cpp                     |   69 -
+ qt4/demos/optcontent.h                       |   47 -
+ qt4/demos/pageview.cpp                       |  101 -
+ qt4/demos/pageview.h                         |   53 -
+ qt4/demos/permissions.cpp                    |   66 -
+ qt4/demos/permissions.h                      |   43 -
+ qt4/demos/thumbnails.cpp                     |   84 -
+ qt4/demos/thumbnails.h                       |   48 -
+ qt4/demos/toc.cpp                            |   88 -
+ qt4/demos/toc.h                              |   43 -
+ qt4/demos/viewer.cpp                         |  319 --
+ qt4/demos/viewer.h                           |   73 -
+ qt4/src/.gitignore                           |    9 -
+ qt4/src/ArthurOutputDev.cc                   |  812 ----
+ qt4/src/ArthurOutputDev.h                    |  170 -
+ qt4/src/CMakeLists.txt                       |   54 -
+ qt4/src/Doxyfile                             | 1637 ---------
+ qt4/src/Mainpage.dox                         |   85 -
+ qt4/src/poppler-annotation-helper.h          |  181 -
+ qt4/src/poppler-annotation-private.h         |  112 -
+ qt4/src/poppler-annotation.cc                | 5089
+ --------------------------
+ qt4/src/poppler-annotation.h                 | 1375 -------
+ qt4/src/poppler-base-converter.cc            |  105 -
+ qt4/src/poppler-converter-private.h          |   49 -
+ qt4/src/poppler-document.cc                  |  850 -----
+ qt4/src/poppler-embeddedfile-private.h       |   42 -
+ qt4/src/poppler-embeddedfile.cc              |  135 -
+ qt4/src/poppler-export.h                     |   20 -
+ qt4/src/poppler-fontinfo.cc                  |  150 -
+ qt4/src/poppler-form.cc                      |  416 ---
+ qt4/src/poppler-form.h                       |  343 --
+ qt4/src/poppler-link-extractor-private.h     |   57 -
+ qt4/src/poppler-link-extractor.cc            |   84 -
+ qt4/src/poppler-link-private.h               |   57 -
+ qt4/src/poppler-link.cc                      |  710 ----
+ qt4/src/poppler-link.h                       |  641 ----
+ qt4/src/poppler-media.cc                     |  168 -
+ qt4/src/poppler-media.h                      |  100 -
+ qt4/src/poppler-movie.cc                     |  110 -
+ qt4/src/poppler-optcontent-private.h         |  124 -
+ qt4/src/poppler-optcontent.cc                |  456 ---
+ qt4/src/poppler-optcontent.h                 |   84 -
+ qt4/src/poppler-page-private.h               |   57 -
+ qt4/src/poppler-page-transition-private.h    |   28 -
+ qt4/src/poppler-page-transition.cc           |  101 -
+ qt4/src/poppler-page-transition.h            |  158 -
+ qt4/src/poppler-page.cc                      |  810 ----
+ qt4/src/poppler-pdf-converter.cc             |  115 -
+ qt4/src/poppler-private.cc                   |  296 --
+ qt4/src/poppler-private.h                    |  241 --
+ qt4/src/poppler-ps-converter.cc              |  280 --
+ qt4/src/poppler-qiodeviceoutstream-private.h |   47 -
+ qt4/src/poppler-qiodeviceoutstream.cc        |   64 -
+ qt4/src/poppler-qt4.h                        | 1990 ----------
+ qt4/src/poppler-sound.cc                     |  132 -
+ qt4/src/poppler-textbox.cc                   |   63 -
+ qt4/tests/.gitignore                         |   33 -
+ qt4/tests/CMakeLists.txt                     |   67 -
+ qt4/tests/README.unittest                    |   23 -
+ qt4/tests/check_actualtext.cpp               |   33 -
+ qt4/tests/check_attachments.cpp              |  157 -
+ qt4/tests/check_dateConversion.cpp           |  142 -
+ qt4/tests/check_fonts.cpp                    |  248 --
+ qt4/tests/check_goostring.cpp                |  127 -
+ qt4/tests/check_lexer.cpp                    |  107 -
+ qt4/tests/check_links.cpp                    |   98 -
+ qt4/tests/check_metadata.cpp                 |  275 --
+ qt4/tests/check_optcontent.cpp               |  446 ---
+ qt4/tests/check_pagelabelinfo.cpp            |   43 -
+ qt4/tests/check_pagelayout.cpp               |   49 -
+ qt4/tests/check_pagemode.cpp                 |   73 -
+ qt4/tests/check_password.cpp                 |   88 -
+ qt4/tests/check_permissions.cpp              |   44 -
+ qt4/tests/check_search.cpp                   |  175 -
+ qt4/tests/check_strings.cpp                  |  250 --
+ qt4/tests/poppler-attachments.cpp            |   39 -
+ qt4/tests/poppler-fonts.cpp                  |   89 -
+ qt4/tests/poppler-forms.cpp                  |  166 -
+ qt4/tests/poppler-texts.cpp                  |   40 -
+ qt4/tests/stress-poppler-dir.cpp             |   67 -
+ qt4/tests/stress-poppler-qt4.cpp             |   74 -
+ qt4/tests/stress-threads-qt4.cpp             |  309 --
+ qt4/tests/test-password-qt4.cpp              |  136 -
+ qt4/tests/test-poppler-qt4.cpp               |  235 --
+ qt4/tests/test-render-to-file.cpp            |   69 -
+ 108 files changed, 25623 deletions(-)
+
+commit bb0011b74093cfbf5a21b72861ac46a2b8699c0e
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Dec 1 23:37:38 2017 +0100
+
+    Make the disable for ENABLE_CMS be none
+
+    as it is for ENABLE_LIBOPENJPEG and for ENABLE_DCTDECODER
+
+ CMakeLists.txt | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+commit 0ea5ad393601f0b1c060268cf1c310b47f928f7b
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Dec 1 23:35:28 2017 +0100
+
+    Stop supporting openjpeg1, you really want to use openjpeg2 :)
+
+ CMakeLists.txt            |  54 ++---------------
+ config.h.cmake            |   6 --
+ poppler/JPEG2000Stream.cc | 145
+ ----------------------------------------------
+ 3 files changed, 5 insertions(+), 200 deletions(-)
+
+commit ce8e17e4fa96b7dd639c72818bba5a26c16cc1cb
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Dec 1 23:19:39 2017 +0100
+
+    Stop supporting lcms1, you really want to use lcms2 :)
+
+ CMakeLists.txt      | 36 ++++++------------------------------
+ config.h.cmake      |  3 ---
+ poppler/Gfx.cc      |  5 -----
+ poppler/GfxState.cc | 40 ----------------------------------------
+ 4 files changed, 6 insertions(+), 78 deletions(-)
+
+commit 42d8d7ffd8b5393dc3103a45932b70bc8ca61c2e
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Nov 22 21:50:24 2017 +0100
+
+    Open files that state 8 bits as third field of W
+
+    Even we only really accept 32 bits since it is really strange to have
+    more than 2^31 generations
+
+    Bug #103469
+
+ poppler/XRef.cc | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+commit 6ab81a63323e8339647f883649bf74f9d96820ae
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Tue Nov 7 17:25:27 2017 +0100
+
+    Document the meaning of the 'type' integer of a shading
+
+ poppler/GfxState.h | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+commit 0a9d6debdb3d4e28d9125a007244bca0c1cd760a
+Author: Jean Ghali <jghali at libertysurf.fr>
+Date:   Fri Nov 17 23:13:56 2017 +0100
+
+    Include glibc.h where needed
+
+    at least for strtok_r
+
+ fofi/FoFiType1.cc            | 2 ++
+ poppler/CharCodeToUnicode.cc | 2 ++
+ poppler/GlobalParams.cc      | 2 ++
+ poppler/PDFDoc.cc            | 2 ++
+ poppler/UnicodeMap.cc        | 2 ++
+ 5 files changed, 10 insertions(+)
+
+commit e0302537ec0919d9f3dbf180ebbc6e2653b1049b
+Author: Albert Astals Cid <albert.astals.cid at kdab.com>
+Date:   Wed Nov 15 10:44:14 2017 +0100
+
+    qt5: Add API to let the rendering process callback to get a partial
+    rendering
+
+    Bug #103372
+
+ qt5/src/poppler-page.cc | 254
+ +++++++++++++++++++++++++++++++++---------------
+ qt5/src/poppler-qt5.h   |  78 +++++++++++++++
+ 2 files changed, 254 insertions(+), 78 deletions(-)
+
+commit 33b8e6220d06a26378d7d21c88ead6e2280c2e52
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Wed Nov 15 19:58:53 2017 +1030
+
+    fix MSC macro
+
+ poppler/GlobalParams.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit a6dd3f957f5979fa34a05ba963862de7d0d9df61
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sun Nov 12 10:33:07 2017 +1030
+
+    Support unicode on windows console
+
+    The Win32Console should be used in programs that require unicode
+    support for command line arguments and stdio ouput on windows. On
+    windows it gets the command line arguments from GetCommandLineW and
+    converts to UTF-8, and redefines the stdio output functions to convert
+    UTF-8 to calls to WriteConsoleW. On other platforms this class is a
+    no-op.
+
+ poppler/PDFDoc.cc                  |   9 +-
+ poppler/UTF.cc                     | 287
+ ++++++++++++++++++++++++++++++++++++-
+ poppler/UTF.h                      |  39 +++++
+ qt5/tests/CMakeLists.txt           |   1 +
+ qt5/tests/check_utf_conversion.cpp |  87 +++++++++++
+ utils/CMakeLists.txt               |   1 +
+ utils/JSInfo.cc                    |   1 +
+ utils/Win32Console.cc              | 167 +++++++++++++++++++++
+ utils/Win32Console.h               |  63 ++++++++
+ utils/pdfdetach.cc                 |   2 +
+ utils/pdffonts.cc                  |   2 +
+ utils/pdfimages.cc                 |   2 +
+ utils/pdfinfo.cc                   |   2 +
+ utils/pdfseparate.cc               |   2 +
+ utils/pdfsig.cc                    |   2 +
+ utils/pdftocairo-win32.cc          |   1 +
+ utils/pdftocairo.cc                |   2 +
+ utils/pdftohtml.cc                 |   2 +
+ utils/pdftoppm.cc                  |   2 +
+ utils/pdftops.cc                   |   2 +
+ utils/pdftotext.cc                 |   2 +
+ 21 files changed, 676 insertions(+), 2 deletions(-)
+
+commit 49107ffcd4d3c9b18fc950d37bede08f89bcfcda
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sun Nov 12 10:33:07 2017 +1030
+
+    Fix some mingw warnings
+
+    - Include poppler-config.h for mingw PRINTF_FORMAT
+    - Only redefine strcasecmp for MSVC
+    - Recent versions of MSVC have snprintf and vsnprintf
+
+ poppler/Error.cc        |  1 +
+ poppler/GlobalParams.cc |  2 +-
+ poppler/PDFDoc.cc       |  1 +
+ test/perf-test.cc       | 15 +++------------
+ 4 files changed, 6 insertions(+), 13 deletions(-)
+
+commit 4f687665c39da743e802fc71ba05fb5966095293
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sun Nov 12 10:33:07 2017 +1030
+
+    sort encoding list
+
+    makes it easier to find encodings listed by -listenc
+
+ utils/printencodings.cc | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+commit 5c394f71f03d27507db3446ad34f299393fa3621
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sun Nov 12 10:33:07 2017 +1030
+
+    Move UTF8.h to UnicodeMapFuncs.h and rename UCS2 to UTF16
+
+    UTF8.h is not exclusively UTF-8 code. Renaming to UnicodeMapFuncs.h
+    identifies the file as containing maps for UnicodeMap and is
+    consistent with the name UnicodeMapTables.h.
+
+    The mapUCS2 code was changed to support UTF-16 in 979ef1ca without
+    changing the name.
+
+ CMakeLists.txt                        | 2 +-
+ poppler/GlobalParams.cc               | 4 ++--
+ poppler/{UTF8.h => UnicodeMapFuncs.h} | 6 +++---
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+commit 9ff60568ab420e86295bfa81cef9375d7c5600b8
+Author: Thomas Zajic <zlatko at gmx.at>
+Date:   Tue Nov 14 22:25:37 2017 +0100
+
+    pdfsig: install man page
+
+ utils/CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit d63ddd1fb762e536dd78f24bd3e3ddbc3504e1eb
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Tue Nov 14 20:05:33 2017 +0100
+
+    Use GfxLabColorSpace::transform only when USE_CMS is set
+
+    The recent commit e84338a44f27afb9872cb108fc29683b35ac55f7
+    introduced an unqualified use of GfxLabColorSpace::transform,
+    even though that member only exists if USE_CMS is set.
+
+    Fix this by adding the appropriate preprocessor conditionals.
+
+ poppler/GfxState.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 19909998a2f1f703c9978510ae1fc3baed84de31
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sat Nov 11 05:38:25 2017 +1030
+
+    glib demo: fix warning
+
+ glib/demo/selections.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit e84338a44f27afb9872cb108fc29683b35ac55f7
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Nov 13 00:37:00 2017 +0100
+
+    GfxLabColorSpace::parse: Fix crash in broken documents
+
+    Bug #103582
+
+ poppler/GfxState.cc | 28 ++++++++++++++++++----------
+ 1 file changed, 18 insertions(+), 10 deletions(-)
+
+commit fea27db14358c8342c9f5bdbe6cb3bff02cebc2b
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Nov 12 19:54:52 2017 +0100
+
+    Fix leak if parseDA fails
+
+ poppler/Form.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit faeb48920d64a776911a259bcf1bb6231ac1d24c
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Nov 12 19:14:32 2017 +0100
+
+    0.61.1
+
+ CMakeLists.txt   |  2 +-
+ NEWS             | 11 +++++++++++
+ cpp/Doxyfile     |  2 +-
+ qt4/src/Doxyfile |  2 +-
+ qt5/src/Doxyfile |  2 +-
+ 5 files changed, 15 insertions(+), 4 deletions(-)
+
+commit 155597a09b2c7fcbd0eea2b5a2021a5b65476e4c
+Author: Jeroen Ooms <jeroenooms at gmail.com>
+Date:   Sat Nov 4 05:33:09 2017 -0700
+
+    Fix for corrupted image files on Windows
+
+    Bug #102494
+
+ cpp/poppler-image.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit c45efa2d7e0db8a4ace0e8c6955b3fa48dc6d070
+Author: Adam Sampson <ats at offog.org>
+Date:   Sun Nov 5 11:45:00 2017 +0000
+
+    Fix incorrect paths in .pc files.
+
+    The change in 67c3878ef10449b241c37d1022e2518029860335 used the
+    CMAKE_INSTALL_x variables instead of CMAKE_INSTALL_FULL_x; the former
+    contain things like "include" instead of full paths, so the resulting
+    .pc files break packages that depend on poppler. Use the latter.
+
+    Also fix a missing @ in the qt5 file.
+
+    Bug #103578
+
+ poppler-cairo.pc.cmake  | 4 ++--
+ poppler-cpp.pc.cmake    | 4 ++--
+ poppler-glib.pc.cmake   | 4 ++--
+ poppler-qt4.pc.cmake    | 4 ++--
+ poppler-qt5.pc.cmake    | 4 ++--
+ poppler-splash.pc.cmake | 4 ++--
+ poppler.pc.cmake        | 4 ++--
+ 7 files changed, 14 insertions(+), 14 deletions(-)
+
+commit 7ccedf2b082e4d46257fb247e1f6e1197d66eead
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Wed Nov 8 21:07:45 2017 +1030
+
+    cairo: don't overflow y * stride when accessing image data
+
+ poppler/CairoOutputDev.cc | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+commit 6ae4293fce77290f4fbdc643c999809d5924bf2c
+Author: Roland Hieber <r.hieber at pengutronix.de>
+Date:   Wed Nov 8 08:22:01 2017 +0100
+
+    CMake: add the custom buildtests target only once
+
+    Make BUILDTESTS_ADDED a global property, so the `buildtests` target
+    gets added only once. As far as I understood, this seems to fulfil
+    the requirements of CMP0002.
+
+    Bug #103003
+
+ cmake/modules/PopplerMacros.cmake | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+commit aaa9c5308766a88d0512b87051d7c7082f152a9f
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Nov 3 11:25:02 2017 +0100
+
+    Poppler 0.61
+
+ CMakeLists.txt   |  6 +++---
+ NEWS             | 20 ++++++++++++++++++++
+ cpp/Doxyfile     |  2 +-
+ qt4/src/Doxyfile |  2 +-
+ qt5/src/Doxyfile |  2 +-
+ 5 files changed, 26 insertions(+), 6 deletions(-)
+
+commit 79b704b4017cf66dc3c39b49425c8b02760e5165
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Nov 3 11:14:10 2017 +0100
+
+    Update (C) for commits since last release
+
+ fofi/FoFiTrueType.cc           |  2 +-
+ goo/FixedPoint.cc              | 14 ++++++++++++++
+ goo/FixedPoint.h               | 15 +++++++++++++++
+ goo/GooMutex.h                 |  1 +
+ goo/GooString.cc               |  2 +-
+ goo/GooString.h                |  1 +
+ goo/gfile.cc                   |  2 +-
+ goo/gfile.h                    |  2 +-
+ goo/glibc.h                    |  2 +-
+ goo/glibc_strtok_r.cc          |  1 +
+ poppler/Annot.cc               |  2 +-
+ poppler/Annot.h                |  2 +-
+ poppler/Array.cc               |  1 +
+ poppler/Array.h                |  1 +
+ poppler/CMap.cc                |  1 +
+ poppler/CMap.h                 |  2 +-
+ poppler/CairoFontEngine.cc     |  2 +-
+ poppler/CairoFontEngine.h      |  2 +-
+ poppler/CairoRescaleBox.cc     |  2 +-
+ poppler/Catalog.cc             |  2 +-
+ poppler/Catalog.h              |  2 +-
+ poppler/CharCodeToUnicode.cc   |  2 +-
+ poppler/CharCodeToUnicode.h    |  1 +
+ poppler/DCTStream.cc           |  1 +
+ poppler/Decrypt.cc             |  2 +-
+ poppler/Dict.cc                |  1 +
+ poppler/Dict.h                 |  1 +
+ poppler/FlateEncoder.cc        |  1 +
+ poppler/FlateStream.cc         |  1 +
+ poppler/GlobalParams.cc        |  2 +-
+ poppler/GlobalParams.h         |  2 +-
+ poppler/GlobalParamsWin.cc     |  2 +-
+ poppler/Object.h               |  2 +-
+ poppler/OutputDev.cc           |  2 +-
+ poppler/OutputDev.h            |  2 +-
+ poppler/PDFDoc.cc              |  2 +-
+ poppler/PDFDoc.h               |  2 +-
+ poppler/PDFDocFactory.cc       |  1 +
+ poppler/PSOutputDev.cc         |  2 +-
+ poppler/PSOutputDev.h          |  2 +-
+ poppler/Page.cc                |  2 +-
+ poppler/Page.h                 |  2 +-
+ poppler/SplashOutputDev.cc     |  2 +-
+ poppler/SplashOutputDev.h      |  2 +-
+ poppler/StructTreeRoot.cc      |  1 +
+ poppler/TextOutputDev.cc       |  2 +-
+ poppler/TextOutputDev.h        |  2 +-
+ poppler/UnicodeMap.cc          |  1 +
+ poppler/UnicodeMap.h           | 14 ++++++++++++++
+ poppler/XRef.cc                |  2 +-
+ poppler/XRef.h                 |  2 +-
+ poppler/poppler-config.h.cmake |  1 +
+ qt4/src/ArthurOutputDev.cc     |  1 +
+ qt4/src/poppler-document.cc    |  1 +
+ qt4/src/poppler-page.cc        |  1 +
+ qt5/src/ArthurOutputDev.cc     |  1 +
+ qt5/src/poppler-document.cc    |  1 +
+ qt5/src/poppler-page.cc        |  1 +
+ splash/Splash.cc               |  2 +-
+ splash/Splash.h                |  2 +-
+ splash/SplashFTFont.cc         |  1 +
+ splash/SplashFTFont.h          |  1 +
+ splash/SplashFTFontEngine.cc   |  1 +
+ splash/SplashFTFontEngine.h    |  1 +
+ splash/SplashFTFontFile.cc     |  2 +-
+ splash/SplashFTFontFile.h      |  1 +
+ splash/SplashFontEngine.cc     |  1 +
+ splash/SplashFontEngine.h      |  1 +
+ splash/SplashMath.h            |  1 +
+ splash/SplashState.cc          |  1 +
+ splash/SplashState.h           |  1 +
+ splash/SplashTypes.h           |  1 +
+ splash/SplashXPath.cc          |  1 +
+ utils/pdfimages.cc             |  2 +-
+ utils/pdftocairo-win32.cc      |  2 +-
+ utils/pdftoppm.cc              |  2 +-
+ utils/pdftops.cc               |  2 +-
+ 77 files changed, 117 insertions(+), 40 deletions(-)
+
+commit b8b6a7c9240d1b98e79463ea93245127ac56e764
+Author: Sandro Mani <manisandro at gmail.com>
+Date:   Fri Nov 3 10:37:25 2017 +0100
+
+    mingw: change library names to include the soversion
+
+    Bug #103157
+
+ CMakeLists.txt         | 4 ++++
+ cpp/CMakeLists.txt     | 4 ++++
+ glib/CMakeLists.txt    | 4 ++++
+ qt4/src/CMakeLists.txt | 4 ++++
+ qt5/src/CMakeLists.txt | 4 ++++
+ 5 files changed, 20 insertions(+)
+
+commit f6ad64878d91cbd0c19531c7ff669af0e0fa0912
+Author: Sandro Mani <manisandro at gmail.com>
+Date:   Tue Oct 31 00:24:11 2017 +0100
+
+    Install pkg-config files also on mingw
+
+ cmake/modules/PopplerMacros.cmake | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 67c3878ef10449b241c37d1022e2518029860335
+Author: Emilio Pozuelo Monfort <pochu27 at gmail.com>
+Date:   Tue Oct 31 00:20:29 2017 +0100
+
+    cmake: support GNUInstallDirs
+
+    This allows users to set various install directories, e.g.
+    libdir, includedir, mandir...
+
+    Bug #103211
+
+ CMakeLists.txt                                 | 21 ++++++++++-----------
+ cmake/modules/GObjectIntrospectionMacros.cmake |  4 ++--
+ cpp/CMakeLists.txt                             |  2 +-
+ glib/CMakeLists.txt                            |  2 +-
+ glib/reference/CMakeLists.txt                  |  2 +-
+ poppler-cairo.pc.cmake                         |  5 ++---
+ poppler-cpp.pc.cmake                           |  5 ++---
+ poppler-glib.pc.cmake                          |  5 ++---
+ poppler-qt4.pc.cmake                           |  5 ++---
+ poppler-qt5.pc.cmake                           |  5 ++---
+ poppler-splash.pc.cmake                        |  5 ++---
+ poppler.pc.cmake                               |  5 ++---
+ qt4/src/CMakeLists.txt                         |  2 +-
+ qt5/src/CMakeLists.txt                         |  2 +-
+ utils/CMakeLists.txt                           | 22
+ +++++++++++-----------
+ 15 files changed, 42 insertions(+), 50 deletions(-)
+
+commit 4d109589e5d2ac989d4fd7ac318ddf976f3106ed
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Sun Oct 29 20:28:52 2017 +0100
+
+    Fix leak in ArthurOutputDev::updateFont
+
+    Bug #103508
+
+ qt5/src/ArthurOutputDev.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit b9ae2fd75c147988653093d0ecbf66188d81f8fc
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sun Oct 22 18:29:31 2017 +1030
+
+    glib demo: correct the previous warnings fix
+
+    Bug 103050
+
+ glib/demo/utils.c | 20 +++++++++++++-------
+ 1 file changed, 13 insertions(+), 7 deletions(-)
+
+commit d72f0383b959d8495a452d2d32377e588b15ad65
+Author: Kay Dohmann <k.dohmann at gmx.net>
+Date:   Mon Oct 23 23:31:13 2017 +0200
+
+    Tweak LZWStream::processNextCode
+
+    Fixes file attached at bug 103174 and doesn't seem to cause any
+    regression in the files we have around
+
+    Bug #103174
+
+ poppler/Stream.cc | 16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+commit e0926ca8a94bafa6d5bfd694064c5e30da2b79db
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Thu Oct 5 18:32:40 2017 +0200
+
+    Properly implement saveState / restoreState
+
+    Not all of the internal state was actually saved/restored in
+    those methods, which lead to inconsistencies between the
+    ArthurOutputDev state and the GfxState object.
+
+    Bug #103118
+
+ qt5/src/ArthurOutputDev.cc | 14 ++++++++++++++
+ qt5/src/ArthurOutputDev.h  |  9 +++++++++
+ 2 files changed, 23 insertions(+)
+
+commit ebf6d1ca736fecad49fbf543875c794770bd4d57
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Fri Sep 15 11:18:58 2017 +0200
+
+    Clean up the remaining Splash code in Arthur backend
+
+    - remove some goto-style error handling
+    - use nullptr
+    - use std::unique_ptr (fixes a leak)
+    - remove unused data member m_currentFont
+    - remove some unused forward declarations
+
+    Bug #103117
+
+ qt5/src/ArthurOutputDev.cc | 48
+ +++++++++++++++++-----------------------------
+ qt5/src/ArthurOutputDev.h  |  4 ----
+ 2 files changed, 18 insertions(+), 34 deletions(-)
+
+commit 0a8174945379142348ce1006ce88cb1a75c01c96
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Oct 22 12:45:05 2017 +0200
+
+    isfinite -> std::isfinite
+
+    Fixes build on the travis CI
+
+ poppler/SplashOutputDev.cc | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+commit 9c7b557da043c897292219a16f419ba9650e6dfc
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Mon Oct 2 20:22:02 2017 +1030
+
+    Fix mingw warnings
+
+ poppler/Annot.cc               |  6 +++---
+ poppler/DCTStream.cc           |  6 ++++--
+ poppler/GlobalParams.cc        | 29 +++++++++++++++++------------
+ poppler/XRef.cc                |  1 +
+ poppler/poppler-config.h.cmake |  3 +--
+ 5 files changed, 26 insertions(+), 19 deletions(-)
+
+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.
+
+ CMakeLists.txt | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+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
+
+ poppler/Gfx.cc | 8 --------
+ 1 file changed, 8 deletions(-)
+
+commit 6e3e639c632f8527f9dc75061605e4a55f2faae9
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Mon Oct 2 16:59:31 2017 +1030
+
+    Use <cmath> for isfinite()
+
+ poppler/SplashOutputDev.cc | 21 +--------------------
+ 1 file changed, 1 insertion(+), 20 deletions(-)
+
+commit f9cef28b504445c7976baa0a51676204f95397fc
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Mon Oct 2 15:13:42 2017 +1030
+
+    c++11 has long long
+
+ fofi/FoFiTrueType.cc |  1 +
+ fofi/FoFiType1.cc    |  1 +
+ goo/GooString.cc     | 36 ------------------------------------
+ goo/GooString.h      | 13 -------------
+ poppler/Object.h     |  1 +
+ poppler/PDFDoc.cc    |  1 +
+ 6 files changed, 4 insertions(+), 49 deletions(-)
+
+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.
+
+ poppler/TextOutputDev.cc       | 2 +-
+ poppler/poppler-config.h.cmake | 6 ------
+ 2 files changed, 1 insertion(+), 7 deletions(-)
+
+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.
+
+ CMakeLists.txt                                | 2 +-
+ ConfigureChecks.cmake                         | 1 +
+ config.h.cmake                                | 3 +++
+ goo/glibc.h                                   | 4 ++++
+ poppler/strtok_r.cpp => goo/glibc_strtok_r.cc | 4 +++-
+ poppler/poppler-config.h.cmake                | 8 --------
+ 6 files changed, 12 insertions(+), 10 deletions(-)
+
+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
+
+ config.h.cmake                 |  8 ++++++++
+ poppler/poppler-config.h.cmake | 15 ---------------
+ 2 files changed, 8 insertions(+), 15 deletions(-)
+
+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
+
+ CMakeLists.txt | 3 ---
+ config.h.cmake | 3 ---
+ 2 files changed, 6 deletions(-)
+
+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
+
+ CMakeLists.txt | 5 ++++-
+ goo/GooMutex.h | 6 +++++-
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+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.
+
+ CMakeLists.txt       | 11 +++++------
+ glib/CMakeLists.txt  |  4 ++--
+ utils/CMakeLists.txt |  4 ++--
+ 3 files changed, 9 insertions(+), 10 deletions(-)
+
+commit e01e6db4e0643b7b318a3d7dc49442bb2d6ade00
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sun Oct 1 20:51:13 2017 +1030
+
+    HAVE_PTHREAD is not used
+
+ config.h.cmake | 3 ---
+ 1 file changed, 3 deletions(-)
+
+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.
+
+ ConfigureChecks.cmake |  6 ------
+ config.h.cmake        | 36 ------------------------------------
+ 2 files changed, 42 deletions(-)
+
+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
+
+ CMakeLists.txt             | 1 -
+ poppler/CairoRescaleBox.cc | 2 --
+ 2 files changed, 3 deletions(-)
+
+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
+
+ ConfigureChecks.cmake      |  1 -
+ config.h.cmake             |  3 ---
+ goo/gtypes_p.h             | 30 ------------------------------
+ poppler/CairoOutputDev.cc  |  2 +-
+ poppler/CairoRescaleBox.cc |  2 +-
+ poppler/Decrypt.cc         |  2 +-
+ utils/pdftocairo-win32.h   |  2 +-
+ utils/pdftocairo.cc        |  2 +-
+ 8 files changed, 5 insertions(+), 39 deletions(-)
+
+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
+
+ cmake/modules/PopplerMacros.cmake |  2 +-
+ goo/FixedPoint.h                  |  2 +-
+ goo/TiffWriter.cc                 |  2 +-
+ goo/gfile.cc                      | 20 ++++++++---------
+ goo/gfile.h                       | 10 ++++-----
+ poppler/Annot.cc                  | 12 +++++-----
+ 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/Catalog.cc                |  6 ++---
+ poppler/Catalog.h                 |  2 +-
+ poppler/CharCodeToUnicode.cc      | 16 +++++++-------
+ poppler/CharCodeToUnicode.h       |  4 ++--
+ poppler/Dict.cc                   |  8 +++----
+ poppler/Dict.h                    |  2 +-
+ poppler/FlateStream.cc            |  2 +-
+ poppler/Gfx.cc                    |  4 ++--
+ poppler/GlobalParams.cc           | 12 +++++-----
+ poppler/GlobalParams.h            |  4 ++--
+ poppler/GlobalParamsWin.cc        |  2 +-
+ poppler/OutputDev.cc              |  2 +-
+ poppler/OutputDev.h               |  2 +-
+ poppler/PDFDoc.cc                 |  6 ++---
+ poppler/PDFDoc.h                  |  2 +-
+ poppler/PDFDocFactory.cc          |  4 ++--
+ poppler/PSOutputDev.cc            | 24 ++++++++++----------
+ poppler/PSOutputDev.h             |  8 +++----
+ poppler/Page.cc                   |  6 ++---
+ poppler/Page.h                    |  2 +-
+ poppler/Stream.cc                 |  8 +++----
+ poppler/Stream.h                  |  2 +-
+ poppler/TextOutputDev.cc          | 14 ++++++------
+ poppler/TextOutputDev.h           | 14 ++++++------
+ poppler/UnicodeMap.cc             | 16 +++++++-------
+ poppler/UnicodeMap.h              |  4 ++--
+ poppler/XRef.cc                   | 10 ++++-----
+ poppler/XRef.h                    |  2 +-
+ utils/ImageOutputDev.cc           |  4 ++--
+ utils/pdfimages.cc                |  4 ++--
+ utils/pdftocairo.cc               | 46
+ +++++++++++++++++++--------------------
+ utils/pdftoppm.cc                 |  6 ++---
+ utils/pdftops.cc                  |  6 ++---
+ 46 files changed, 171 insertions(+), 171 deletions(-)
+
+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.
+
+ CMakeLists.txt                 |  1 -
+ config.h.cmake                 |  3 ---
+ poppler/SplashOutputDev.cc     |  8 --------
+ poppler/poppler-config.h.cmake |  7 +------
+ qt4/src/ArthurOutputDev.cc     |  2 --
+ qt5/src/ArthurOutputDev.cc     |  2 --
+ splash/SplashFTFont.cc         |  4 ----
+ splash/SplashFTFont.h          |  4 ----
+ splash/SplashFTFontEngine.cc   |  4 ----
+ splash/SplashFTFontEngine.h    |  4 ----
+ splash/SplashFTFontFile.cc     |  4 ----
+ splash/SplashFTFontFile.h      |  4 ----
+ splash/SplashFontEngine.cc     | 20 --------------------
+ splash/SplashFontEngine.h      |  6 ------
+ utils/pdftoppm.cc              |  2 --
+ 15 files changed, 1 insertion(+), 74 deletions(-)
+
+commit e0428ef002e9c8d6e2046fcdeeedcf7462367501
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sun Oct 1 18:02:15 2017 +1030
+
+    Remove unused t1lib code
+
+ CMakeLists.txt                 |   6 -
+ poppler/SplashOutputDev.cc     |   3 -
+ poppler/poppler-config.h.cmake |   2 +-
+ qt4/src/ArthurOutputDev.cc     |   3 -
+ qt5/src/ArthurOutputDev.cc     |   3 -
+ splash/SplashFontEngine.cc     |  30 ----
+ splash/SplashFontEngine.h      |   6 -
+ splash/SplashT1Font.cc         | 309
+ -----------------------------------------
+ splash/SplashT1Font.h          |  69 ---------
+ splash/SplashT1FontEngine.cc   | 138 ------------------
+ splash/SplashT1FontEngine.h    |  50 -------
+ splash/SplashT1FontFile.cc     | 134 ------------------
+ splash/SplashT1FontFile.h      |  70 ----------
+ 13 files changed, 1 insertion(+), 822 deletions(-)
+
+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.
+
+ goo/gfile.cc            | 4 ++--
+ goo/gfile.h             | 2 +-
+ poppler/GlobalParams.cc | 4 ++--
+ splash/SplashMath.h     | 6 +++---
+ 4 files changed, 8 insertions(+), 8 deletions(-)
+
+commit e38ffea64dc9c113607168e298c7ccdf8edaa61e
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sun Oct 1 17:25:19 2017 +1030
+
+    Fix some -Wundef warnings
+
+ goo/FixedPoint.cc           |   2 +-
+ poppler/GlobalParams.cc     |   2 +-
+ poppler/PSOutputDev.cc      |   8 +--
+ poppler/SplashOutputDev.cc  | 158
+ ++++++++++++++++++++++----------------------
+ poppler/SplashOutputDev.h   |   2 +-
+ qt4/src/poppler-document.cc |   2 +-
+ qt4/src/poppler-page.cc     |   4 +-
+ 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      |   6 +-
+ splash/SplashFontEngine.h   |   4 +-
+ splash/SplashMath.h         |  42 ++++++------
+ splash/SplashState.cc       |  10 +--
+ splash/SplashState.h        |   2 +-
+ splash/SplashTypes.h        |  16 ++---
+ splash/SplashXPath.cc       |   6 +-
+ utils/pdftoppm.cc           |  12 ++--
+ utils/pdftops.cc            |   6 +-
+ 22 files changed, 198 insertions(+), 198 deletions(-)
+
+commit 9bb84057624c3b2f8fc5d137e70ae34efa46fe31
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sun Oct 1 13:27:10 2017 +1030
+
+    glib demo: fix deprecated warnings
+
+ glib/demo/utils.c | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+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.
+
+ cmake/modules/PopplerMacros.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+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
+
+ poppler/FlateEncoder.cc   | 1 -
+ poppler/StructTreeRoot.cc | 4 ++--
+ 2 files changed, 2 insertions(+), 3 deletions(-)
+
+commit 88571e7877f729eec2f7a3552b0fa6cc913ae1a6
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Oct 19 18:11:49 2017 +0200
+
+    Move setPSCenter from GlobalParams to PSOutputDev
+
+ poppler/GlobalParams.cc | 16 ----------------
+ poppler/GlobalParams.h  |  3 ---
+ poppler/PSOutputDev.cc  |  3 ++-
+ poppler/PSOutputDev.h   |  4 +++-
+ utils/pdftops.cc        |  8 ++++----
+ 5 files changed, 9 insertions(+), 25 deletions(-)
+
+commit 5b8fe4ee986673f15fcf8f58409cc85e8bf7ca12
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Oct 19 17:49:06 2017 +0200
+
+    Remove various never called internal setters from GlobalParams.h
+
+    TextKeepTinyChars: false, simplify if in TextOutputDev
+    DisableFreeTypeHinting: didn't actually have a getter :D
+    StrokeAdjust: true, adjust the code in Cairo/SplashOutputDev to
+    use gTrue
+    ScreenType: unset, simplify switch in SplashOutputDev
+    ScreenSize: -1, simplify code in SplashOutputDev
+    ScreenDotRadius: -1, simplify code in SplashOutputDev
+    ScreenGamma: 1.0, simplify code in SplashOutputDev
+    ScreenBlackThreshold: 0.0, simplify code in SplashOutputDev
+    ScreenWhiteThreshold: 1.0, simplify code in SplashOutputDev
+    MinLineWidth: 0.0, define it as static const in SplashOutputDev
+    since was used in various places
+    MapNumericCharNames: true, remove GfxFont.cc if guard
+    MapUnknownCharNames: true, remove GfxFont.cc if guard
+
+ poppler/CairoOutputDev.cc  |   2 +-
+ poppler/GfxFont.cc         |  94 +++++++++++-----------
+ poppler/GlobalParams.cc    | 193
+ ---------------------------------------------
+ poppler/GlobalParams.h     |  44 -----------
+ poppler/SplashOutputDev.cc |  66 +++++-----------
+ poppler/TextOutputDev.cc   |   3 +-
+ 6 files changed, 68 insertions(+), 334 deletions(-)
+
+commit 19ebd40547186a8ea6da08c8d8e2a6d6b7e84f5d
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Oct 13 00:55:49 2017 +0200
+
+    CairoOutputDev: Fix crash in broken files
+
+    Bug #103016
+
+ poppler/CairoOutputDev.cc | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+commit 7ee9dadef37b20bca707a6b1e858e17d191e368b
+Author: Jason Crain <jason at inspiresomeone.us>
+Date:   Thu Oct 5 15:32:13 2017 -0500
+
+    TextOutputDev: Fix crash in fuzzed file
+
+    This file crashes pdftotext because it positions texts past INT_MIN,
+    leading to overflow in subsequent calculations.
+
+    Bug #103116
+
+ poppler/TextOutputDev.cc | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+commit 369cd504e70e55378c6395355056fa8676679e56
+Author: David Tardon <dtardon at redhat.com>
+Date:   Fri Oct 6 08:07:35 2017 +0200
+
+    do not install Function.cc, as it's not a header
+
+ CMakeLists.txt | 1 -
+ 1 file changed, 1 deletion(-)
+
+commit f09a9923bb65755e183694c5f1be6af4a50e96e6
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Oct 5 19:15:44 2017 +0200
+
+    Poppler 0.60.1
+
+ CMakeLists.txt   | 2 +-
+ NEWS             | 7 +++++++
+ cpp/Doxyfile     | 2 +-
+ qt4/src/Doxyfile | 2 +-
+ qt5/src/Doxyfile | 2 +-
+ 5 files changed, 11 insertions(+), 4 deletions(-)
+
+commit e816c7a47caa0c3f5261d467333f8c2eb6a2ad51
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Oct 5 18:51:49 2017 +0200
+
+    FindLIBOPENJPEG.cmake: Add CheckCXXSourceCompiles
+
+    Since we use check_cxx_source_compiles
+
+ cmake/modules/FindLIBOPENJPEG.cmake | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit f538b74a38acb53b877e000a64647ce8043133ac
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Tue Oct 3 00:04:17 2017 +0200
+
+    qt5: ArthurOutputDev: Add missing 'return' in error paths
+
+ qt5/src/ArthurOutputDev.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit c2ba8fd8cf51af48a9e789d29e9fd5512d1688e3
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Oct 2 23:46:49 2017 +0200
+
+    Poppler 0.60.0
+
+ CMakeLists.txt         |  4 ++--
+ NEWS                   | 28 ++++++++++++++++++++++++++++
+ cpp/Doxyfile           |  2 +-
+ qt4/src/Doxyfile       |  2 +-
+ qt5/src/CMakeLists.txt |  2 +-
+ qt5/src/Doxyfile       |  2 +-
+ 6 files changed, 34 insertions(+), 6 deletions(-)
+
+commit 9432e0bfc4c4f2e16b7c152aa8b04d6d19ed4898
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Oct 2 23:29:21 2017 +0200
+
+    Add missing (C)
+
+ cpp/poppler-private.cpp      | 1 +
+ fofi/FoFiTrueType.cc         | 2 +-
+ goo/GooString.cc             | 2 +-
+ goo/GooString.h              | 2 +-
+ goo/JpegWriter.cc            | 1 +
+ goo/gmem.h                   | 2 +-
+ poppler/CairoOutputDev.cc    | 2 +-
+ poppler/CurlPDFDocBuilder.cc | 2 +-
+ poppler/Decrypt.cc           | 2 +-
+ poppler/GfxState.h           | 2 +-
+ poppler/GlobalParams.cc      | 2 +-
+ poppler/PSOutputDev.cc       | 2 +-
+ poppler/PSOutputDev.h        | 2 +-
+ poppler/UnicodeMap.cc        | 1 +
+ qt4/src/poppler-link.cc      | 2 +-
+ qt4/src/poppler-private.cc   | 2 +-
+ qt5/src/poppler-link.cc      | 2 +-
+ qt5/src/poppler-private.cc   | 2 +-
+ qt5/src/poppler-qt5.h        | 1 +
+ splash/Splash.cc             | 2 +-
+ splash/SplashFTFontFile.cc   | 1 +
+ splash/SplashFTFontFile.h    | 1 +
+ utils/pdfseparate.cc         | 2 +-
+ 23 files changed, 23 insertions(+), 17 deletions(-)
+
+commit da02d7c683f1788d38cccb3716edd1ba011cb94c
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Oct 2 23:05:59 2017 +0200
+
+    remove m4 gtk-doc.make and add comments to poppler-features.h.cmake
+
+ glib/poppler-features.h.cmake |  55 ++++++++
+ gtk-doc.make                  | 305
+ ----------------------------------------
+ m4/.gitignore                 |   5 -
+ m4/ax_pthread.m4              | 317
+ ------------------------------------------
+ m4/define-dir.m4              |  34 -----
+ m4/gtk-doc.m4                 |  88 ------------
+ m4/iconv.m4                   | 180 ------------------------
+ m4/introspection.m4           |  94 -------------
+ m4/libjpeg.m4                 | 114 ---------------
+ 9 files changed, 55 insertions(+), 1137 deletions(-)
+
+commit f871b82edfd632f79ec7bdd0b4d560cd348d8b1a
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Fri Sep 8 23:27:45 2017 +0200
+
+    qt5: ArthurOutputDev: Fix several small bugs related to dash pattern
+    handling
+
+ qt5/src/ArthurOutputDev.cc | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+commit 3ec5e86ca000653525650a99755c85e512a04bdc
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Fri Sep 29 21:24:23 2017 +0200
+
+    qt5: ArthurOutputDev: Implement the drawSoftMaskedImage method
+
+ qt5/src/ArthurOutputDev.cc | 67
+ ++++++++++++++++++++++++++++++++++++++++++++++
+ qt5/src/ArthurOutputDev.h  |  9 +++++++
+ 2 files changed, 76 insertions(+)
+
+commit 376ae2f8b8a92fd7bd751fbfcd0aa46530b59ca4
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 30 11:27:44 2017 +0200
+
+    Remove the gir-girs target
+
+    It depends on the same files (subset) as the gir-typelibs target
+    meaning that sometimes when doing a parallel build you'd get the
+    two commands trying to generate the same file at once and bad
+    things happen
+
+ cmake/modules/GObjectIntrospectionMacros.cmake | 1 -
+ 1 file changed, 1 deletion(-)
+
+commit 19eedc6fb693a62f305e13079501e3105f869f3c
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 30 11:12:31 2017 +0200
+
+    Fix crash in broken files
+
+    Bug #103045
+
+ fofi/FoFiTrueType.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 5df4a8b0ad56b11c9be3b362e33810c5af57952b
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Sep 26 23:49:41 2017 +0200
+
+    Enable libcurl support by default
+
+ CMakeLists.txt | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+commit 2c92c7b6a828c9db8a38f079ea7a3d51c12a481d
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Sep 25 19:33:44 2017 +0200
+
+    Fix infinite recursion on broken files
+
+    Bug #102969
+
+ poppler/Gfx.cc      | 46 ++++++++++++++++++++++++++++++++++------------
+ poppler/GfxState.cc | 33 ++++++++++++++++++---------------
+ poppler/GfxState.h  | 15 +++++++++------
+ 3 files changed, 61 insertions(+), 33 deletions(-)
+
+commit d3f12611b30e6421f05603a9838ed9131b1aa61e
+Author: Bernd Kuhls <berndkuhls at hotmail.com>
+Date:   Sun Sep 24 23:56:29 2017 +0200
+
+    include ctype.h for isdigit
+
+    Bug #102951
+
+ poppler/Form.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit a1a4be92323ae45f1ecc16595438520309554eb0
+Author: Carlos Garcia Campos <carlosgc at gnome.org>
+Date:   Sun Sep 24 13:21:58 2017 +0200
+
+    cairo: do not use the custom downscaling for rendering images when
+    using cairo >= 1.14
+
+ poppler/CairoOutputDev.cc | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+commit 3b64fc488e7ff10634aa2dd76ad4f152ebfe7edc
+Author: Carlos Garcia Campos <carlosgc at gnome.org>
+Date:   Sun Sep 24 12:39:06 2017 +0200
+
+    regtest: change default value of utils dir to ../build/utils
+
+ regtest/main.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit deba5f3c57929a96105d822c8cba46e5334694c7
+Author: Carlos Garcia Campos <carlosgc at gnome.org>
+Date:   Sun Sep 24 12:31:43 2017 +0200
+
+    cairo: Do not extend the pattern in drawImageMaskRegular
+
+    This is causing some documents with tiling patterns to take ages
+    to render,
+    since we switched to use drawImageMaskRegular in 00a536a4. This patch
+    applies the same changes made in 7d8dfb09 and db87dc7f for
+    drawImageMaskPrescaled to drawImageMaskRegular.
+
+ poppler/CairoOutputDev.cc | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+commit cceb80b353ca748d1e04373d238195fd548319b8
+Author: Carlos Garcia Campos <cgarcia at igalia.com>
+Date:   Sun Sep 24 08:24:44 2017 +0200
+
+    glib: Make g-ir-scanner always link to the libs in build directory
+
+    It was using the installed libraries, causing a build failure when
+    there's new API added to the poppler core.
+
+ glib/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 2afde7084ab55893182c2da59c429b48eb5d5a35
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 22 18:18:54 2017 +0200
+
+    Remove GlobalParams::splashResolution
+
+    Noone was setting or getting the variable
+
+ poppler/GlobalParams.h | 1 -
+ 1 file changed, 1 deletion(-)
+
+commit df783c5d10490e94e911316a6f42bb2d91a22dea
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 22 18:18:50 2017 +0200
+
+    Add a const to the static structure
+
+ poppler/GlobalParamsWin.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit a309cbfdd831b37461284b95763ca5a872e6af2b
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 22 18:18:46 2017 +0200
+
+    Remove GlobalParams::setPSFile
+
+    It had a setter but not a getter so wasn't used for anything
+
+ poppler/GlobalParams.cc | 13 -------------
+ poppler/GlobalParams.h  |  2 --
+ 2 files changed, 15 deletions(-)
+
+commit 7af5f7cadbdb89e0eaab148940c2c65cb12cc6d6
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 22 18:18:42 2017 +0200
+
+    Remove GlobalParams::ccFontFiles
+
+    it was never filled so it was basically a noop
+
+ poppler/GfxFont.cc      | 10 ----------
+ poppler/GlobalParams.cc | 14 --------------
+ poppler/GlobalParams.h  |  3 ---
+ 3 files changed, 27 deletions(-)
+
+commit b5f8be7ede64e55d44ed484797a66ca068ba955f
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 22 18:18:39 2017 +0200
+
+    Remove GlobalParams::fontDirs
+
+    It was only read but never filled so it was basically a noop
+
+ poppler/GlobalParams.cc | 31 +------------------------------
+ poppler/GlobalParams.h  |  1 -
+ 2 files changed, 1 insertion(+), 31 deletions(-)
+
+commit 3463537624a24e3bdcaa42c135d337c6cd452ea5
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 22 18:18:22 2017 +0200
+
+    Remove GlobalParams::getPSResidentFont*
+
+    There was no way to set its contents so it's basically a noop
+
+ poppler/GfxFont.cc      | 38 ----------------------
+ poppler/GlobalParams.cc | 85
+ -------------------------------------------------
+ poppler/GlobalParams.h  | 29 -----------------
+ poppler/PSOutputDev.cc  |  6 ----
+ 4 files changed, 158 deletions(-)
+
+commit 851bc59c6f4b007333d064af5c6992702b92cdf6
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Sep 21 20:45:52 2017 +0200
+
+    Remove the autotools based build system
+
+ .gitignore                       |   20 +-
+ INSTALL                          |  244 ++------
+ INSTALL.cmake                    |   76 ---
+ Makefile.am                      |  133 -----
+ autogen.sh                       |  117 ----
+ configure.ac                     | 1154
+ --------------------------------------
+ cpp/Makefile.am                  |   74 ---
+ cpp/tests/Makefile.am            |   21 -
+ fofi/Makefile.am                 |   28 -
+ glib/Makefile.am                 |  122 ----
+ glib/demo/Makefile.am            |   56 --
+ glib/poppler-features.h.in       |   88 ---
+ glib/reference/Makefile.am       |   92 ---
+ glib/reference/version.xml.in    |    1 -
+ goo/Makefile.am                  |   69 ---
+ poppler-cairo-uninstalled.pc.in  |    6 -
+ poppler-cairo.pc.in              |    9 -
+ poppler-cpp-uninstalled.pc.in    |    7 -
+ poppler-cpp.pc.in                |   13 -
+ poppler-glib-uninstalled.pc.in   |    7 -
+ poppler-glib.pc.in               |   13 -
+ poppler-qt4-uninstalled.pc.in    |    7 -
+ poppler-qt4.pc.in                |   13 -
+ poppler-qt5-uninstalled.pc.in    |    7 -
+ poppler-qt5.pc.in                |   13 -
+ poppler-splash-uninstalled.pc.in |    7 -
+ poppler-splash.pc.in             |    9 -
+ poppler-uninstalled.pc.in        |    6 -
+ poppler.pc.in                    |   11 -
+ poppler/Makefile.am              |  348 ------------
+ poppler/poppler-config.h.in      |  196 -------
+ qt4/Makefile.am                  |    1 -
+ qt4/demos/Makefile.am            |   65 ---
+ qt4/src/Makefile.am              |   76 ---
+ qt4/tests/Makefile.am            |  141 -----
+ qt5/Makefile.am                  |    1 -
+ qt5/demos/Makefile.am            |   65 ---
+ qt5/src/Makefile.am              |   78 ---
+ qt5/tests/Makefile.am            |  141 -----
+ splash/Makefile.am               |   73 ---
+ test/Makefile.am                 |   67 ---
+ utils/Makefile.am                |  155 -----
+ 42 files changed, 43 insertions(+), 3787 deletions(-)
+
+commit 1a33f60da2996ea64c1b903580885697940cf046
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Sep 21 20:32:25 2017 +0200
+
+    Add some constness to the basic classes
+
+ goo/GooString.cc  |   2 +-
+ goo/GooString.h   |   2 +-
+ poppler/Array.cc  |   8 +--
+ poppler/Array.h   |  12 ++---
+ poppler/Dict.cc   |  18 +++----
+ poppler/Dict.h    |  26 +++++-----
+ poppler/Object.cc |   4 +-
+ poppler/Object.h  | 152
+ +++++++++++++++++++++++++++---------------------------
+ 8 files changed, 112 insertions(+), 112 deletions(-)
+
+commit 135843fa8398364e0559c2b0b96f9be4a44572c5
+Author: Carlos Garcia Campos <cgarcia at igalia.com>
+Date:   Wed Sep 20 19:38:14 2017 +0200
+
+    Add gtk-doc support to CMake build
+
+ CMakeLists.txt                |   4 +-
+ glib/CMakeLists.txt           |   4 +
+ glib/reference/CMakeLists.txt |  12 ++
+ gtkdoc.py                     | 440
+ ++++++++++++++++++++++++++++++++++++++++++
+ make-glib-api-docs            |  66 +++++++
+ 5 files changed, 525 insertions(+), 1 deletion(-)
+
+commit e51db61a33cdbe6307f048b65912a85f6cd1ec5b
+Author: William Bader <william at newspapersystems.com>
+Date:   Wed Sep 20 19:36:46 2017 +0200
+
+    PSOutputDev: Fix wrong text generation
+
+    This patch moves the code to update the max valid glyph hash into its
+    own function and updates the max valid glyph only if the new value is
+    higher than the previous value.
+    This fixes a problem with pages that have multiple copies of the same
+    font with different glyph counts. If poppler processed the font
+    with the
+    smaller count last, and then the PDF wrote text in the font with the
+    larger count, pdftops would not show the glyphs above the maximum
+    of the
+    smaller font.
+
+    Bug #102760
+
+ poppler/PSOutputDev.cc | 16 ++++++++++------
+ poppler/PSOutputDev.h  |  1 +
+ 2 files changed, 11 insertions(+), 6 deletions(-)
+
+commit 6665839b5ce2e4f6fb2acc682ce2f91ed2404ce8
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Sep 20 19:36:29 2017 +0200
+
+    qt5: The tests don't need GUI
+
+ qt5/tests/check_actualtext.cpp     | 2 +-
+ qt5/tests/check_attachments.cpp    | 2 +-
+ qt5/tests/check_dateConversion.cpp | 2 +-
+ qt5/tests/check_fonts.cpp          | 2 +-
+ qt5/tests/check_goostring.cpp      | 2 +-
+ qt5/tests/check_lexer.cpp          | 2 +-
+ qt5/tests/check_links.cpp          | 2 +-
+ qt5/tests/check_metadata.cpp       | 2 +-
+ qt5/tests/check_optcontent.cpp     | 2 +-
+ qt5/tests/check_pagelabelinfo.cpp  | 2 +-
+ qt5/tests/check_pagelayout.cpp     | 2 +-
+ qt5/tests/check_pagemode.cpp       | 2 +-
+ qt5/tests/check_password.cpp       | 2 +-
+ qt5/tests/check_permissions.cpp    | 2 +-
+ qt5/tests/check_search.cpp         | 2 +-
+ qt5/tests/check_strings.cpp        | 2 +-
+ 16 files changed, 16 insertions(+), 16 deletions(-)
+
+commit 26a067d4a84f80eeb892e30a5ab608d0fbea1de5
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Sep 20 10:36:04 2017 +0200
+
+    Remove the moc includes
+
+    Some people are having trouble with them and automoc really should
+    be taking care of this so no need to have the include. Let's hope this
+    doesn't break some other people :D
+
+ qt5/demos/abstractinfodock.cpp  | 1 -
+ qt5/demos/embeddedfiles.cpp     | 1 -
+ qt5/demos/fonts.cpp             | 1 -
+ qt5/demos/info.cpp              | 1 -
+ qt5/demos/metadata.cpp          | 1 -
+ qt5/demos/navigationtoolbar.cpp | 1 -
+ qt5/demos/optcontent.cpp        | 1 -
+ qt5/demos/pageview.cpp          | 1 -
+ qt5/demos/permissions.cpp       | 1 -
+ qt5/demos/thumbnails.cpp        | 1 -
+ qt5/demos/toc.cpp               | 1 -
+ qt5/demos/viewer.cpp            | 1 -
+ qt5/src/poppler-optcontent.cc   | 1 -
+ 13 files changed, 13 deletions(-)
+
+commit 939465c40902d72e0c05d4f3a27ee67e4a007ed7
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Sep 19 21:19:03 2017 +0200
+
+    Fix crash in broken files
+
+    Bug #102854
+
+ poppler/Stream.cc | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+commit a8aa61f774503c9ebd840e148c4fa31a6959600d
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Sep 19 21:17:49 2017 +0200
+
+    autotools: Fix build
+
+ qt5/src/Makefile.am | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit 6b82904b717994c887f33bfc72e4999363fc8e72
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Sep 17 23:03:48 2017 +0200
+
+    Fix printf-like format warnings
+
+ poppler/Stream.h  | 2 +-
+ test/perf-test.cc | 2 ++
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+commit b26924e32128b7ba57260e9fdc54be1893bcff77
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Sep 17 02:06:32 2017 +0200
+
+    A few more static markers
+
+ test/perf-test.cc         | 2 +-
+ utils/pdftocairo-win32.cc | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 4a4e291246f238731429729e10633ee1f627eb77
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Sep 17 01:58:36 2017 +0200
+
+    Make newer gcc happy about fallthrough
+
+    on HtmlOutputDev.cc fixes a leak when printHtml is false
+
+ fofi/FoFiTrueType.cc       | 2 ++
+ poppler/Annot.cc           | 4 ++--
+ poppler/SplashOutputDev.cc | 8 ++++++++
+ splash/Splash.cc           | 2 ++
+ utils/HtmlOutputDev.cc     | 9 ++++-----
+ 5 files changed, 18 insertions(+), 7 deletions(-)
+
+commit 0790dd3afb8370aebca8e7e154bbd2b5ae5cd5a2
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 16 18:01:49 2017 +0200
+
+    Fix missing-declarations warnings
+
+    ... and add it to default warning set
+
+ cmake/modules/PopplerMacros.cmake |  2 +-
+ cpp/tests/poppler-dump.cpp        |  2 +-
+ glib/poppler-action.cc            |  1 +
+ goo/JpegWriter.cc                 |  2 +-
+ goo/gmem.h                        |  2 +-
+ poppler/Annot.cc                  |  6 ++--
+ poppler/Decrypt.cc                |  2 +-
+ poppler/TextOutputDev.cc          |  2 +-
+ qt4/src/poppler-link.cc           |  2 +-
+ qt4/src/poppler-private.cc        |  6 ++--
+ qt4/tests/check_links.cpp         |  4 +--
+ qt4/tests/poppler-forms.cpp       | 14 ++++-----
+ qt5/src/poppler-link.cc           |  2 +-
+ qt5/src/poppler-private.cc        |  6 ++--
+ qt5/tests/check_links.cpp         |  4 +--
+ qt5/tests/poppler-forms.cpp       | 18 ++++++------
+ test/perf-test-preview-dummy.cc   |  4 +++
+ test/perf-test.cc                 | 62
+ +++++++++++++++++++--------------------
+ utils/pdfinfo.cc                  |  4 +--
+ utils/pdfseparate.cc              |  2 +-
+ utils/pdfsig.cc                   |  6 ++--
+ utils/pdftotext.cc                |  2 +-
+ utils/pdfunite.cc                 |  6 ++--
+ 23 files changed, 83 insertions(+), 78 deletions(-)
+
+commit afd91b148d3d0ba025821740ff4c075b1de2fdc5
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 16 17:47:42 2017 +0200
+
+    Fix warning: format ‘%x’ expects argument of type ‘unsigned
+    int*’, but argument 3 has type ‘int*’
+
+ poppler/UnicodeMap.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit a0ed20f3fb8025706ad9a580f6a692316bf6df66
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 16 17:45:42 2017 +0200
+
+    -Woverflow fixes
+
+ cpp/poppler-private.cpp    |  4 ++--
+ glib/poppler-document.cc   |  3 +--
+ goo/GooString.cc           |  6 ++++++
+ goo/GooString.h            |  1 +
+ poppler/Annot.cc           |  9 +++------
+ poppler/Form.cc            | 13 +++++--------
+ qt4/src/poppler-private.cc |  4 ++--
+ qt5/src/poppler-private.cc |  4 ++--
+ 8 files changed, 22 insertions(+), 22 deletions(-)
+
+commit d51cc34d7d51b6ddb7bfba318ed12bcbe763be6a
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 16 17:35:15 2017 +0200
+
+    -pedantic fixes
+
+ glib/poppler-media.cc             |  2 +-
+ glib/poppler-movie.cc             |  2 +-
+ glib/poppler-structure-element.cc |  2 +-
+ goo/glibc.h                       |  2 +-
+ poppler/StructElement.cc          | 14 +++++++-------
+ utils/JSInfo.cc                   |  2 +-
+ 6 files changed, 12 insertions(+), 12 deletions(-)
+
+commit 804a823a67fedc3e633e89f817232d3c15715b56
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sat Sep 16 20:16:58 2017 +0930
+
+    cmake: restructure the warnings into a "default" and "extra" group
+
+    Most of the previous warnings are now in default. Extra warnings that
+    should be fixed but currently result in a lot of warnings are in the
+    extra group.
+
+    The old no/yes/kde COMPILE_WARNINGS option has been replaced with the
+    boolean option EXTRA_WARN (default off) to enable the extra warnings.
+
+ CMakeLists.txt                    | 18 +++++-------------
+ cmake/modules/PopplerMacros.cmake | 32 ++++++++++++++++++++++++--------
+ 2 files changed, 29 insertions(+), 21 deletions(-)
+
+commit 6d40d4bad46ce1b53624feca7410b35e4fe0048d
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 15 01:07:59 2017 +0200
+
+    CurlPDFDocBuilder don't crash if given a url that doesn't exist
+
+ poppler/CurlPDFDocBuilder.cc | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+commit cc43c720e857548175a9e35b0686a1a7a8957f50
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Fri Aug 18 11:51:06 2017 +0200
+
+    Replace Splash font rendering by Qt font rendering
+
+    Previously, the Arthur backend would use Splash code to do
+    its font rendering.  That was not a satisfactory solution:
+    Qt can do font rendering directly.  Also, the Splash font
+    rendering in the Arthur code had a few bugs, which lead
+    to legible-but-not-pretty fonts.
+
+    This patch replaces the Splash font rendering by Qt font
+    rendering.  Some Splash code will have to remain, because
+    Qt seems unable to do the proper charcode-to-glyph-index
+    transformations.
+
+    I took a lot of inspiration from Mihai Niculescu's patch at
+
+      https://lists.freedesktop.org/archives/poppler/2013-June/010370.html
+
+    That's why the patch adds Mihai's name in the copyright list.
+
+ qt5/src/ArthurOutputDev.cc | 254
+ +++++++++++++++++++++++++--------------------
+ qt5/src/ArthurOutputDev.h  |  31 +++++-
+ splash/SplashFTFontFile.cc |   4 +
+ splash/SplashFTFontFile.h  |   3 +
+ 4 files changed, 177 insertions(+), 115 deletions(-)
+
+commit da63c35549e8852a410946ab016a3f25ac701bdf
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Sep 14 19:14:41 2017 +0200
+
+    FoFiType1C::convertToType0: Fix crash in broken files
+
+    Bug #102724
+
+ fofi/FoFiType1C.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 504b3590182175390f474657a372e78fb1508262
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Sep 14 19:14:23 2017 +0200
+
+    Splash::scaleImage: Do not try to scale if srcHeight or srcWidth
+    are < 1
+
+    Bug #102719
+
+ splash/Splash.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 500ce88a3b5b0bd556ac6941ba66a86cae44663a
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Wed Sep 13 12:12:29 2017 +0200
+
+    Fix two minor typos
+
+ qt5/tests/test-render-to-file.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 80f9819b6233f9f9b5fd44f0e4cad026e5d048c2
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Sep 13 23:09:45 2017 +0200
+
+    isImageInterpolationRequired: Fix divide by 0 on broken documents
+
+    Bug #102688
+
+ splash/Splash.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit aaf5327649e8f7371c9d3270e7813c43ddfd47ee
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Sep 13 23:01:03 2017 +0200
+
+    Gfx::doShowText: Fix infinite recursion on broken files
+
+    Bug #102701
+
+ poppler/Gfx.cc     | 25 +++++++++++++++++++++++--
+ poppler/Gfx.h      |  1 +
+ poppler/GfxFont.cc |  8 ++++++++
+ poppler/GfxFont.h  |  1 +
+ 4 files changed, 33 insertions(+), 2 deletions(-)
+
+commit 476394e7a025e02e4897da2e765df2c895d0708f
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Sep 13 22:58:14 2017 +0200
+
+    XRef::parseEntry: Fix crash in broken file
+
+    Bug #102687
+
+ poppler/XRef.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 0f891b85169dabd3d23348aba40266547bd4bcf6
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Wed Sep 13 20:12:52 2017 +0930
+
+    pdfinfo: don't truncate dest name
+
+ utils/pdfinfo.cc | 1 -
+ 1 file changed, 1 deletion(-)
+
+commit 951e7b3c1f337ceaf490edce3c575f89c45cb6d4
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Wed Sep 13 19:24:07 2017 +0930
+
+    cmake: ensure user cflags/cxxflags are appended to end
+
+ cmake/modules/PopplerMacros.cmake | 44
+ +++++++++++++++++++++------------------
+ 1 file changed, 24 insertions(+), 20 deletions(-)
+
+commit a5c616a65a77bf597836cced6f987e5b93480ca5
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Mon Sep 11 20:55:01 2017 +0930
+
+    cmake INSTALL file
+
+ INSTALL.cmake | 76
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 76 insertions(+)
+
+commit a5e5649ecf16fa05770620dbbd4985935dc2bbff
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Sep 11 12:35:16 2017 +0200
+
+    Fix crash in FoFiType1C::convertToType0 in broken files
+
+    Bug #102653
+
+ fofi/FoFiType1C.cc | 435
+ +++++++++++++++++++++++++++--------------------------
+ 1 file changed, 220 insertions(+), 215 deletions(-)
+
+commit 325887ebef8ea1c6ef9d3607a59d95ffea383986
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Sep 10 17:41:47 2017 +0200
+
+    Make JBIG2Stream::readGenericBitmap return cleanly on error
+
+    instead of causing abort
+
+    Also fixes warning when compiled with newer gcc
+
+ poppler/JBIG2Stream.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit f253a28f4c5bb65c363d31b8b46f984c660499ee
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 8 19:05:36 2017 +0200
+
+    qt5: in development -> is stable
+
+    The API itself is done-ish even if it gets improvements from time to
+    time. In development seems to imply "don't use me yet"
+
+ qt5/src/Mainpage.dox | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 1316c7a41f4dd7276f404f775ebb5fef2d24ab1c
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 8 18:29:42 2017 +0200
+
+    Annot: Fix crash on broken files
+
+    Bug #102607
+
+ poppler/Annot.cc | 42 +++++++++++++++++++++++-------------------
+ 1 file changed, 23 insertions(+), 19 deletions(-)
+
+commit 2532df6060092e9fab7f041ae9598aff9cdd94bb
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 8 18:28:15 2017 +0200
+
+    Annot: Fix crash on broken files
+
+    Bug #102601
+
+ poppler/Annot.cc | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+commit 6472d8493f7e82cc78b41da20a2bf19fcb4e0a7d
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 8 18:26:05 2017 +0200
+
+    SplashOutputDev: Fix crash on broken files
+
+    Bug #102604
+
+ poppler/SplashOutputDev.cc | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+commit 3ab44e2a77b560198c1e1616cfb39c1ac7374e29
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 8 18:21:40 2017 +0200
+
+    Remove unmaintained TODO file
+
+ TODO | 40 ----------------------------------------
+ 1 file changed, 40 deletions(-)
+
+commit dfcf997e6fbca31dbe051fbd9c32aca818825e38
+Author: Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
+Date:   Wed Sep 6 11:03:52 2017 +0200
+
+    Added methods to get and set the font size of text fields
+
+    Fixes bug #101692
+
+ poppler/Annot.cc        | 24 +++----------
+ poppler/Form.cc         | 92
+ +++++++++++++++++++++++++++++++++++++++++++++++++
+ poppler/Form.h          | 16 +++++++++
+ qt5/src/poppler-form.cc | 12 ++++++-
+ qt5/src/poppler-form.h  | 10 ++++++
+ 5 files changed, 134 insertions(+), 20 deletions(-)
+
+commit 0bda8bb8eda838316a61238441665abfd24eb020
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Thu Sep 7 19:55:54 2017 +0200
+
+    Disable glib if cairo is not found
+
+ CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 118cd73a3c4eba78bbfed16cfc2996dec5491944
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Sep 6 19:42:26 2017 +0200
+
+    cmake: Give people the option to build poppler as a static library
+
+ CMakeLists.txt | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit 766a32ff59dadd9ae4639d8a79861a17be6aec52
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Tue Sep 5 20:55:45 2017 +0930
+
+    cmake: add options to disable glib/qt4/qt5
+
+ CMakeLists.txt | 54
+ ++++++++++++++++++++++++++++++++++--------------------
+ 1 file changed, 34 insertions(+), 20 deletions(-)
+
+commit 101aba9a8d6623bca419946262fea6b46a790454
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Sep 5 19:34:12 2017 +0200
+
+    cmake: Fix build when using a cairo different than the system one
+
+ glib/demo/CMakeLists.txt | 2 +-
+ test/CMakeLists.txt      | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+commit 1d3f00e8c53dbbd3a8409993b7b66667df434b5d
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Tue Sep 5 06:39:49 2017 +0930
+
+    ignore build directory
+
+ .gitignore | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 340a99f580b9f7b6add831e9a0252574bfea66f2
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Fri Sep 1 22:16:49 2017 +0200
+
+    Control whether renderToImage shows annotations
+
+    I'd like to control whether the renderToImage and renderToPainter
+    methods show annotations or not. To this end, this patch introduces
+    a new value 'HideAnnotations' to the Document::RenderHint enum.
+
+ qt5/src/poppler-page.cc | 36 ++++++++++++++++++++++++++++++++++--
+ qt5/src/poppler-qt5.h   |  3 ++-
+ 2 files changed, 36 insertions(+), 3 deletions(-)
+
+commit dd80c182cbcb188af0dd590f222ba9bbb31e3fb7
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Sep 4 19:36:06 2017 +0200
+
+    Fix building with old clang
+
+ poppler/StructElement.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit a22cd0badbc177f8a2eedb0386895ddf3379c618
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Sep 3 23:35:08 2017 +0200
+
+    Initial make dist support in cmake
+
+ .gitattributes | 5 +++++
+ CMakeLists.txt | 9 +++++++++
+ 2 files changed, 14 insertions(+)
+
+commit 85bfedad416906b1a5dff377d470387692b5ca70
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Sep 3 22:54:32 2017 +0200
+
+    Poppler 0.59
+
+ CMakeLists.txt      |  4 ++--
+ NEWS                | 15 +++++++++++++++
+ configure.ac        |  2 +-
+ cpp/Doxyfile        |  2 +-
+ poppler/Makefile.am |  2 +-
+ qt4/src/Doxyfile    |  2 +-
+ qt5/src/Doxyfile    |  2 +-
+ 7 files changed, 22 insertions(+), 7 deletions(-)
+
+commit 98b4c23cf6f6eb0dbc167ed0606932b0d8de39f1
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Sep 3 22:50:31 2017 +0200
+
+    Update (C)
+
+ utils/pdfinfo.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 5c8dfc90603111aea36add20c88abde79a351d85
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Sep 3 22:32:09 2017 +0200
+
+    Remove the old if/else cmake syntax
+
+    that was weird and forced you to replicate the if clause in the
+    else and
+    endif
+
+ CMakeLists.txt           | 154
+ +++++++++++++++++++++++------------------------
+ cpp/tests/CMakeLists.txt |   2 +-
+ glib/CMakeLists.txt      |   2 +-
+ qt4/src/CMakeLists.txt   |   2 +-
+ qt4/tests/CMakeLists.txt |   8 +--
+ qt5/src/CMakeLists.txt   |   2 +-
+ qt5/tests/CMakeLists.txt |   8 +--
+ test/CMakeLists.txt      |  10 +--
+ utils/CMakeLists.txt     |  10 +--
+ 9 files changed, 99 insertions(+), 99 deletions(-)
+
+commit 251bb42e9af251c86b8fec120e14972ac7c07106
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Sep 3 22:23:18 2017 +0200
+
+    Remove the check for cmake >= 2.8.8 since we're requiring 3.1 already
+
+ CMakeLists.txt | 25 ++++++++++---------------
+ 1 file changed, 10 insertions(+), 15 deletions(-)
+
+commit 3ea09e735f81a2a16a204388bc474871aaa10271
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sat Sep 2 17:50:58 2017 +0930
+
+    Fix warning when compiling with cygwin
+
+    ImageOutputDev.cc:532:14: warning: ‘f’ may be used uninitialized
+    in this function [-Wmaybe-uninitialized]
+
+ utils/ImageOutputDev.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 6ef21aea5bb8b87f9a7e9217c316cd5e10612a62
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sat Sep 2 17:50:35 2017 +0930
+
+    Fix cygwin 32-bit compile
+
+    poppler/goo/gfile.cc: In function ‘GBool openTempFile(GooString**,
+    FILE**, const char*)’:
+    poppler/goo/gfile.cc:409:37: error: ‘mkstemp’ was not declared
+    in this scope
+       fd = mkstemp((*name)->getCString());
+                                         ^
+    poppler/goo/gfile.cc:417:39: error: ‘fdopen’ was not declared
+    in this scope
+       if (fd < 0 || !(*f = fdopen(fd, mode))) {
+                                           ^
+    poppler/goo/gfile.cc: In function ‘int Gfseek(FILE*, Goffset,
+    int)’:
+    poppler/goo/gfile.cc:558:34: error: ‘fseeko’ was not declared
+    in this scope
+       return fseeko(f, offset, whence);
+                                      ^
+    poppler/goo/gfile.cc: In function ‘Goffset Gftell(FILE*)’:
+    poppler/goo/gfile.cc:572:18: error: ‘ftello’ was not declared
+    in this scope
+       return ftello(f);
+                      ^
+
+ cmake/modules/PopplerMacros.cmake | 2 +-
+ configure.ac                      | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 048237db6a7122a5769a15c7dd3ae3680e06e9bb
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 2 22:59:32 2017 +0200
+
+    pdfunite: Fix API porting error that caused abort in some cases
+
+    We need to check for xRef->getTrailerDict() existing before accessing
+    xRef->getDocInfo();
+
+ poppler/PDFDoc.cc | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+commit 4459d817194431f4f00553d5ad67b960a37e4c9d
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sat Sep 2 20:16:44 2017 +0930
+
+    pdfinfo: use GooString.append instead of sprintf/strcat
+
+    https://lists.freedesktop.org/archives/poppler/2017-September/012437.html
+
+ utils/pdfinfo.cc | 46 +++++++++++++++++++++++-----------------------
+ 1 file changed, 23 insertions(+), 23 deletions(-)
+
+commit 267ff8af69ae7e8526d9bfe5063207c87a9b70b5
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 2 13:27:33 2017 +0200
+
+    Fix infinite recursion in NameTree parsing in broken files
+
+ poppler/Catalog.cc | 16 +++++++++++++---
+ poppler/Catalog.h  |  2 +-
+ 2 files changed, 14 insertions(+), 4 deletions(-)
+
+commit c5487b653b1c37882af32a25296611e64d7ba867
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 2 11:55:17 2017 +0200
+
+    pdfinfo: -dests don't crash in broken documents
+
+    That have pages that don't have ref
+
+ utils/pdfinfo.cc | 38 ++++++++++++++++++++------------------
+ 1 file changed, 20 insertions(+), 18 deletions(-)
+
+commit 10660b359dc960f4b0f3728243c64eec79c39851
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 2 11:50:00 2017 +0200
+
+    pdfinfo: Fix memory leaks when using -dests
+
+ utils/pdfinfo.cc | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+commit ea6174def73f7478ae76843bb88ef85c5a6150f9
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Sep 2 11:31:51 2017 +0200
+
+    pdfinfo: Fix crash if getDest* returns nullptr
+
+ utils/pdfinfo.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 73e12716f3e4643c2ea13421902b8220596454d7
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 1 20:11:27 2017 +0200
+
+    Poppler 0.58
+
+ CMakeLists.txt      |  4 ++--
+ NEWS                | 30 ++++++++++++++++++++++++++++++
+ configure.ac        |  2 +-
+ cpp/Doxyfile        |  2 +-
+ poppler/Makefile.am |  2 +-
+ qt4/src/Doxyfile    |  2 +-
+ qt5/src/Doxyfile    |  2 +-
+ 7 files changed, 37 insertions(+), 7 deletions(-)
+
+commit 8a5c7be5b5772672b34638532793cf62be78e9b8
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Sep 1 20:02:17 2017 +0200
+
+    Add missing includes
+
+ goo/JpegWriter.cc          | 2 +-
+ goo/JpegWriter.h           | 2 +-
+ goo/gfile.cc               | 1 +
+ goo/gfile.h                | 1 +
+ poppler/CairoOutputDev.cc  | 2 +-
+ poppler/Gfx.cc             | 2 +-
+ poppler/GlobalParams.cc    | 1 +
+ poppler/GlobalParamsWin.cc | 2 ++
+ poppler/Outline.cc         | 1 +
+ poppler/Stream.cc          | 2 +-
+ poppler/Stream.h           | 2 +-
+ splash/SplashBitmap.cc     | 2 +-
+ splash/SplashBitmap.h      | 2 +-
+ utils/pdftocairo.cc        | 2 +-
+ 14 files changed, 15 insertions(+), 9 deletions(-)
+
+commit 26f64a2a34a9273897c34045ea7af5e8c3c603cb
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Aug 31 15:37:07 2017 +0200
+
+    cmake: enable glib for windows too
+
+    There's no need to not having it enabled
+
+ cmake/modules/FindGLIB.cmake | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+commit 90bc39daf9d3276b166b4c88e1d2c1988aa41c71
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Mon Aug 28 10:25:12 2017 +0200
+
+    Document some parameters of the drawChar method
+
+    Thanks to Adrian Johnson, who explained their meaning to me.
+
+ poppler/OutputDev.h | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+commit 59e6e9b3e4d77229051cafeeeb65a82e9a966204
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Aug 27 12:54:03 2017 +0200
+
+    Add missing inlcudes when compiling with cmake+mingw
+
+ utils/pdftocairo-win32.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 13cf327cd512ebc26c8bd31cdd80d61027634bcb
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Aug 27 12:51:19 2017 +0200
+
+    cmake: Use -std=c++11 instead of -std=gnu++11
+
+ CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 1602610ce2bbab2feb0177f0876e1ed0ee40a472
+Author: Tobias C. Berner <tcberner at freebsd.org>
+Date:   Sun Aug 27 12:16:05 2017 +0200
+
+    Include time.h for time_t
+
+ qt5/src/poppler-form.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit 40cb9f4bf6f35ea62bc7b9e5c23008f98ebd4b36
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Aug 24 11:14:34 2017 +0200
+
+    Fix build with mingw
+
+ config.h.cmake             |  6 ++++++
+ poppler/GlobalParamsWin.cc | 21 ++++++---------------
+ poppler/Link.cc            | 14 ++------------
+ poppler/PDFDoc.cc          |  4 +---
+ 4 files changed, 15 insertions(+), 30 deletions(-)
+
+commit 5be33ba49071a9ffeb62be93e5dc01267318d1c2
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Wed Aug 23 21:00:09 2017 +0930
+
+    Fix Outline title
+
+ poppler/Outline.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 1b84a71ee2550ae4b14cb1e40576de1f022eb2e8
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Tue Aug 22 11:43:08 2017 +0200
+
+    Use Qt::SvgMiterJoin instead of Qt::MiterJoin
+
+    The two differ in what happens when the miter limit is exceeded.
+    According to
+
+      https://bugreports.qt.io/browse/QTBUG-52640
+
+    Qt::SvgMiterJoin is what the pdf standard requires.
+
+    Closes: https://bugs.freedesktop.org/show_bug.cgi?id=102356
+
+ qt5/src/ArthurOutputDev.cc | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+commit 0793b6740121f4af07360800bebdc6238fc43087
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Sun Aug 13 19:47:15 2017 +0200
+
+    Document the updateCTM method
+
+ poppler/OutputDev.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+commit 488d28ec9507eb99c7cb4cd2cafb54995a8bc9f8
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Wed Aug 16 21:01:07 2017 +0930
+
+    pdfimages: support listing/extracting inline images
+
+    The difficulty with extracting inline images is that inline images do
+    not provide any way of determining the length or end of image data
+    without decoding the image. We can get the length by using ImageStream
+    to decode the data then check the stream position. But then we are
+    still unable to extract the undecoded image data because embedded
+    streams can only be read once.
+
+    Since inline images tend to be small the solution implemented is to
+    modify EmbedStream to keep a copy of the data read from it in memory
+    and then allow the data to be read again.
+
+    Two new functions have been added to EmbedStream. rewind() will cause
+    EmbedStream.getChar() to stop recording data and switch to replaying
+    the saved data, returning EOF when the end of the saved data is
+    reached. The restore() function will make getChar() switch back to
+    reading from the parent stream.
+
+    ImageOutputDev can now extract or get the image size by first using
+    ImageStream to read data from the embedded stream. After calling
+    rewind() the undecoded image data can be read from the embedded stream
+    until EOF is returned. Then restore() is called so that Gfx can read
+    the 'EI' from the end of the embedded stream.
+
+    Bug 25625
+
+ poppler/Gfx.cc          |  2 +-
+ poppler/Stream.cc       | 96
+ +++++++++++++++++++++++++++++++++++++++++++------
+ poppler/Stream.h        | 14 ++++++--
+ utils/ImageOutputDev.cc | 67 ++++++++++++++++++++++++++++++----
+ utils/ImageOutputDev.h  |  1 +
+ 5 files changed, 159 insertions(+), 21 deletions(-)
+
+commit b9030a069756c84669ed6f408399cc7e2ce4fd10
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sun Jul 16 12:23:28 2017 +0930
+
+    pdftoppm: add -jpegopt for setting jpeg compression parameters
+
+    Bug 45727
+
+ splash/SplashBitmap.cc | 25 ++++++++++++----
+ splash/SplashBitmap.h  | 15 ++++++++--
+ utils/pdftoppm.1       | 15 ++++++++++
+ utils/pdftoppm.cc      | 80
+ ++++++++++++++++++++++++++++++++++++++++++++++----
+ 4 files changed, 120 insertions(+), 15 deletions(-)
+
+commit dd54243f00557e84dba887403912d12463c8b1e9
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sat Jul 15 21:26:29 2017 +0930
+
+    pdftocairo: add -jpegopt for setting jpeg compression parameters
+
+    Bug 45727
+
+ goo/JpegWriter.cc   | 10 ++++++++
+ goo/JpegWriter.h    |  2 ++
+ utils/pdftocairo.1  | 17 ++++++++++++-
+ utils/pdftocairo.cc | 71
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 99 insertions(+), 1 deletion(-)
+
+commit 00a536a455e4dd396c6b8b74d3e6a5c82d987eed
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Wed Aug 16 21:21:58 2017 +0930
+
+    cairo 1.14 now has high quality downscaling
+
+    The filter needs to be GOOD or BEST to activate the high quality
+    downscaling.
+
+ poppler/CairoOutputDev.cc | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+commit 535bc8eeaf8d354a84129fe00c3a5e3ac0a85aa3
+Author: Christoph Cullmann <cullmann at kde.org>
+Date:   Wed Aug 16 21:11:36 2017 +0930
+
+    win32: call ANSI functions directly
+
+    to be able to compile with different -DUNICODE variants
+
+    Bug 100312
+
+ goo/gfile.cc               | 14 +++++++-------
+ goo/gfile.h                |  2 +-
+ poppler/GlobalParams.cc    |  2 +-
+ poppler/GlobalParamsWin.cc | 20 ++++++++++----------
+ 4 files changed, 19 insertions(+), 19 deletions(-)
+
+commit a8d670b59b0301040e716f3a11a78fce1177337d
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Tue Aug 15 21:35:27 2017 +0930
+
+    pdfinfo: add -dests option to print named destinations
+
+    Bug 97262
+
+ utils/pdfinfo.1  |   4 ++
+ utils/pdfinfo.cc | 140
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 143 insertions(+), 1 deletion(-)
+
+commit 6d3239a2fd04595fecfb81a8703794877f4d8dec
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Tue Aug 15 20:09:25 2017 +0200
+
+    Fix build with autotools
+
+ qt5/src/Makefile.am | 1 +
+ utils/Makefile.am   | 4 ++++
+ 2 files changed, 5 insertions(+)
+
+commit b56a697c58bcf09063827b9c109be9c04a033b8a
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Aug 15 12:25:26 2017 +0200
+
+    Improvements to the previous Signature commit
+
+     * Remove FormWidgetSignature::setFormSignatureType, the API was
+     weird,
+    make it be an output parameter of getCheckedSignature
+
+     * include cleanup
+
+     * Make validation time mandatory, marking to use -1 for *now*
+
+     * Remove setFormSignatureType noone uses
+
+     * Fix compilation wihtout NSS3
+
+     * Don't static cast between NSS3 HASH_HashType and poppler-qt5
+     HashAlgorithm
+
+     * Actually pass validationTime down in FormFieldSignature::validate
+
+     * Add since markers to poppler-qt5 functions/enums
+
+     * Fix spacing
+
+     * Remove SignatureValidationInfo::signingDateTime that returns
+    QDateTime, having two functions that return the same is a bit
+    confusing,
+    and we're not filling the timezone info anyway, so let it be a time_t
+
+ poppler/Form.cc            | 17 ++++---------
+ poppler/Form.h             | 20 ++++++----------
+ poppler/SignatureHandler.h |  5 ++--
+ poppler/SignatureInfo.cc   |  7 +++++-
+ poppler/SignatureInfo.h    |  4 ++--
+ qt5/src/poppler-form.cc    | 52 ++++++++++++++++++++++------------------
+ qt5/src/poppler-form.h     | 59
+ +++++++++++++++++++++++++++++-----------------
+ utils/pdfsig.cc            | 25 +++++---------------
+ 8 files changed, 96 insertions(+), 93 deletions(-)
+
+commit a81700dfa638872fe9641289971ca9a2b50b42ad
+Author: Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
+Date:   Tue Aug 15 10:27:26 2017 +0200
+
+    Various signature related improvements
+
+    Export signature via Qt5 interface.
+    Add support for signatures of SubFilter "ETSI.CAdES.detached".
+    Add an optional validation time to method validateSignature().
+    Print full Subject Distinguished Name, signing time, hash algorithm
+    and a statement wether the total document is signed in pdfsig.
+
+    Fixes bug #99271
+
+ poppler/Form.cc             | 178
+ ++++++++++++++++++++++++++++++++++++++++++--
+ poppler/Form.h              |  34 ++++++++-
+ poppler/SignatureHandler.cc |  34 ++++++++-
+ poppler/SignatureHandler.h  |   5 +-
+ poppler/SignatureInfo.cc    |  33 +++++++-
+ poppler/SignatureInfo.h     |   9 ++-
+ qt5/src/poppler-form.cc     | 112 ++++++++++++++++++++++++++++
+ qt5/src/poppler-form.h      |  58 +++++++++++++++
+ utils/pdfsig.1              |   6 +-
+ utils/pdfsig.cc             |  73 ++++++++++++++++++
+ 10 files changed, 523 insertions(+), 19 deletions(-)
+
+commit e15a0df15b89e1c7ba98cd7bbbf8ef97e541d231
+Author: Hannah von Reth <vonreth at kde.org>
+Date:   Sun Aug 13 20:26:44 2017 +0200
+
+    Remove old/wrong cmake code for MSVC
+
+ cpp/CMakeLists.txt | 3 ---
+ 1 file changed, 3 deletions(-)
+
+commit 236f4ff4f516cb68a2d102627b0a3da73578c67f
+Author: Hannah von Reth <vonreth at kde.org>
+Date:   Sun Aug 13 20:24:15 2017 +0200
+
+    Use WIN32_LEAN_AND_MEAN on Windows
+
+ CMakeLists.txt | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit 1abf98b76ba134adc44883cd2ae345f769ca0d5a
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Sat Aug 12 16:42:40 2017 +0200
+
+    qt5: ArthurOutputDev: Properly set the QPainter transformation
+
+    Previously, the code did not touch the QPainter world transformation
+    matrix.  Rather, the code contained ad hoc coordinate transformations
+    scattered throughout the code.  This patch does a cleanup: the
+    QPainter
+    transformation matrix is set properly, and the hand-coded
+    transformations are removed.  This should not affect the rendering
+    output, but it makes the current (and future!) code simpler to
+    read and write.
+
+ qt5/src/ArthurOutputDev.cc | 56
+ ++++++++++++++++++++++++----------------------
+ qt5/src/ArthurOutputDev.h  |  4 ++++
+ 2 files changed, 33 insertions(+), 27 deletions(-)
+
+commit 2baaa02087ef66b97bf3c4bce49785a10632178f
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Aug 13 12:35:39 2017 +0200
+
+    Revert part of last commit, we wants tests not to fail :)
+
+ qt5/tests/check_metadata.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 3af2e18fc31f18efb36408281ca5879f284edaa4
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Fri Aug 11 22:55:41 2017 +0200
+
+    Fix copy'n'paste bugs: Qt4 -> Qt5
+
+ qt5/src/ArthurOutputDev.h    | 2 +-
+ qt5/src/poppler-annotation.h | 2 +-
+ qt5/tests/check_metadata.cpp | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+commit a9581e624fa62b3905b790ac10d1349b1f96048a
+Author: Roland Hieber <r.hieber at pengutronix.de>
+Date:   Fri Aug 11 11:44:26 2017 +0200
+
+    Form.h: fix error: 'vector' in namespace 'std' does not name a type
+
+    Bug #102147
+
+    Original error message while compiling with
+    OSELAS.Toolchain-2016.06.1-arm-v7a-linux-gnueabi,
+    gcc-5.4.0-glibc-2.23-binutils-2.26-kernel-4.6-sanitized:
+
+            make[5]: Entering directory
+            '/ptx/work/dude/WORK_B/rhi/OSELAS.BSP-Miele-PST/platform-cpu20/build-target/poppler-0.57.0/qt4/src'
+              CXX      libpoppler_qt4_la-poppler-form.lo
+            In file included from poppler-form.cc:26:0:
+            ../../poppler/Form.h:544:14: error: 'vector' in namespace
+            'std' does not name a template type
+            ../../poppler/Form.h:556:8: error: 'vector' in namespace
+            'std' does not name a template type
+            Makefile:735: recipe for target
+            'libpoppler_qt4_la-poppler-form.lo' failed
+
+    configure arguments were:
+
+            --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+            --libdir=/usr/lib --host=arm-v7a-linux-gnueabi
+            --build=x86_64-host-linux-gnu --enable-option-checking
+            --disable-silent-rules --disable-dependency-tracking
+            --enable-shared --enable-fast-install --enable-libtool-lock
+            --enable-xpdf-headers --enable-build-type=release
+            --disable-single-precision --enable-fixedpoint --enable-cmyk
+            --disable-relocatable --enable-libopenjpeg=none
+            --disable-libnss
+            --disable-libtiff --enable-largefile --enable-zlib
+            --disable-zlib-uncompress --enable-libcurl
+            --enable-dctdecoder=libjpeg --enable-libpng
+            --disable-splash-output --enable-cairo-output
+            --enable-poppler-glib --disable-introspection
+            --disable-gtk-doc
+            --disable-gtk-doc-html --disable-gtk-doc-pdf
+            --enable-poppler-qt4 --disable-poppler-qt5
+            --enable-poppler-cpp
+            --disable-gtk-test --enable-utils --disable-compile-warnings
+            --enable-cms=lcms1 --without-x
+            --with-font-configuration=fontconfig --without-libiconv-prefix
+            --with-testdatadir=
+
+    Signed-off-by: Roland Hieber <r.hieber at pengutronix.de>
+
+ poppler/Form.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit f0ecbc6f988aa19ffb2b7e583dca4e609f2f6c65
+Author: Thomas Freitag <Thomas.Freitag at alfa.de>
+Date:   Thu Aug 10 09:17:27 2017 +0200
+
+    Tweak which cmap we use
+
+    Bug #101855
+
+ poppler/GfxFont.cc | 20 +++++++++-----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+commit 7e844eae94bc4eda1c6dcc3460840b25f4ca7898
+Author: Oliver Sander <oliver.sander at tu-dresden.de>
+Date:   Wed Aug 9 11:09:50 2017 +0200
+
+    qt5: Arthur: initialize the image with the paper color
+
+    Bug #102129
+
+ qt5/src/poppler-page.cc | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+commit d7b800933e1b57c180247708991f5c3a282f8305
+Author: Jason Alan Palmer <jalanpalmer at gmail.com>
+Date:   Wed Aug 9 00:41:05 2017 +0200
+
+    cpp: Fix page.text() not taking page orientation into account
+
+    Bug #94517
+
+ cpp/poppler-page.cpp       | 10 +++++++++-
+ cpp/tests/poppler-dump.cpp |  3 ++-
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+commit cd04a81343fd5cba824a891f25c01eeffee5f906
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Aug 8 22:42:46 2017 +0200
+
+    Fix use of uninitialized value use
+
+    Bug #102117
+
+ poppler/XRef.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit fe97135ffb18eaaec7d23a7394641ba103bfe48d
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Aug 1 19:30:28 2017 +0200
+
+    Make the openjpeg1 code compile with the new Object API
+
+ poppler/JPEG2000Stream.cc | 13 ++++---------
+ 1 file changed, 4 insertions(+), 9 deletions(-)
+
+commit e5ff049c3d11e6ea24b624807730acd21a6ef4d5
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Aug 1 01:07:00 2017 +0200
+
+    Gfx::doImage: Simplify memory management
+
+    of maskColorMap by using a std::unique_ptr
+
+    Fixes a memory leak reported by Coverity
+
+ poppler/Gfx.cc | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+commit 19eda068ae1866e4f46efc9534b34779007fdc16
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Aug 1 00:53:52 2017 +0200
+
+    Fix memory leak on corner case condition
+
+ poppler/Parser.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit dbe7a5da3dce56210bd4ca2deaf8f5ad4a9d0529
+Merge: 687474e1 c167f35b
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Aug 1 00:12:13 2017 +0200
+
+    Merge remote-tracking branch 'origin/master' into better_object
+
+commit c167f35b8c3fd7e94fa97385949b2c133d918ed4
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Jul 31 23:39:37 2017 +0200
+
+    Poppler 0.57
+
+ CMakeLists.txt      |  4 ++--
+ NEWS                | 14 ++++++++++++++
+ configure.ac        |  2 +-
+ cpp/Doxyfile        |  2 +-
+ poppler/Makefile.am |  2 +-
+ qt4/src/Doxyfile    |  2 +-
+ qt5/src/Doxyfile    |  2 +-
+ 7 files changed, 21 insertions(+), 7 deletions(-)
+
+commit be0384d2220a75d2666b1fd2228e156b1595a57f
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Jul 31 23:34:57 2017 +0200
+
+    Add missing (C)
+
+ poppler/StructTreeRoot.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 0e7f6cb1c42db3d65395365833472ff859def87a
+Author: Jannick <thirdedition at gmx.net>
+Date:   Mon Jul 31 19:53:12 2017 +0200
+
+    Fix some warnings in some unusual #ifdef combinations
+
+    Bug #101812
+
+ poppler/PSOutputDev.cc | 2 +-
+ poppler/Stream.cc      | 5 ++---
+ 2 files changed, 3 insertions(+), 4 deletions(-)
+
+commit f55d6a64dd3f69fa9c1ba984218809cc50c9b052
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Jul 31 19:45:32 2017 +0200
+
+    Add missing (C)
+
+ utils/pdfseparate.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 543b0ea219191122fee0583ce62c19e31de34109
+Author: Roland Hieber <r.hieber at pengutronix.de>
+Date:   Mon Jul 17 11:35:32 2017 +0200
+
+    configure.ac: fix --disable-FEATURE actually enabling the feature
+
+    Forwarded: https://bugs.freedesktop.org/show_bug.cgi?id=101818
+
+    A frequently seen antipattern is to use
+    AC_ARG_ENABLE(feature, help, action-if-given, action-if-not-given) as
+    AC_ARG_ENABLE(feature, help, action-if-enabled, action-if-disabled).
+    However, action-if-given is also evaluated for --disable-FEATURE (with
+    enableval=no), which results in --disable-FEATURE and --enable-FEATURE
+    doing the same in this case.
+
+    Rewrite the single-precision, fixedpoint and cmyk arguments
+    accordingly
+    so the user is not confused if they explicitely want to disable those
+    options.
+
+    Signed-off-by: Roland Hieber <r.hieber at pengutronix.de>
+
+ configure.ac | 32 ++++++++++++++++++++++++++------
+ 1 file changed, 26 insertions(+), 6 deletions(-)
+
+commit 92ad743b63c3e82211ea0b2e4d4471dd3f71cebc
+Author: Léonard Michelet <leonard.michelet at smile.fr>
+Date:   Mon Jul 31 19:40:06 2017 +0200
+
+    pdfseparate: minor improvement to the documentation
+
+    Bug #101800
+
+ utils/pdfseparate.1  | 7 ++++---
+ utils/pdfseparate.cc | 2 +-
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+commit 0a2096743fa749a8a7d4caa714eecbe8a9661619
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Jul 31 16:52:46 2017 +0200
+
+    Add some more overrides
+
+ poppler/CurlCachedFile.h    | 4 ++--
+ poppler/CurlPDFDocBuilder.h | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+commit 687474e17db59482dc4538740701bdb32bc9d6bd
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Jul 31 16:47:31 2017 +0200
+
+    Build++
+
+ poppler/CurlPDFDocBuilder.cc | 5 +----
+ poppler/Stream.cc            | 2 +-
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+commit 66e718e753a527289ce86cd206fcffd23fc28d81
+Merge: 9cecd78f 213ae24b
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Jul 31 16:39:53 2017 +0200
+
+    Merge remote-tracking branch 'origin/master' into better_object
+
+commit 213ae24b4df97f557e771060e37197d0e57f6f7f
+Author: Jannick <thirdedition at gmx.net>
+Date:   Sun Jul 16 19:51:49 2017 +0200
+
+    added override tag to function declarations
+
+ poppler/FlateStream.h | 16 ++++++++--------
+ poppler/JPXStream.h   | 16 ++++++++--------
+ poppler/Stream.h      | 16 ++++++++--------
+ 3 files changed, 24 insertions(+), 24 deletions(-)
+
+commit ab371fe60568947e355d89e28d489f7f9a1a7404
+Author: Jason Crain <jason at inspiresomeone.us>
+Date:   Sun Jul 16 12:07:54 2017 -0500
+
+    pdftohtml: skip control characters
+
+    W3C disallows them and they cause a warning in PHP.
+
+    https://bugs.freedesktop.org/show_bug.cgi?id=101770
+
+ utils/HtmlFonts.cc | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+commit 0f4ea2f18b1953ccc88bcbd6b16ede828b44e561
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Mon Jul 10 21:06:30 2017 +0930
+
+    Fix parsing of Type 1 fonts with newlines in encoding sequences
+
+    Adobe Type 1 font spec states that the encoding sequences should be of
+    the form:
+
+      dup index /name put
+
+    The bug 101728 test case has the encoding sequences in the form:
+
+      dup
+      index /name put
+
+    Make the Type 1 parse handle encoding sequences split over more than
+    one line.
+
+    Bug 101728
+
+ fofi/FoFiType1.cc | 40 +++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 35 insertions(+), 5 deletions(-)
+
+commit 75fff6556eaf0ef3a6fcdef2c2229d0b6d1c58d9
+Author: Caolán McNamara <caolanm at redhat.com>
+Date:   Wed Jul 12 14:12:46 2017 +0100
+
+    CVE-2017-9865 (fdo#100774) avoid stack buffer overflow
+
+    in GfxImageColorMap:getGray
+
+    by passing first arg to getGray of maximum possibly required size
+
+    and similar in HtmlOutputDev::drawPngImage
+
+ utils/HtmlOutputDev.cc  | 6 ++++--
+ utils/ImageOutputDev.cc | 6 ++++--
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+commit 5d0c23a9f6cdc3fd216335124788958f46932158
+Author: Jan-Erik S <janerik234678 at gmail.com>
+Date:   Sat Jul 29 18:23:39 2017 +0200
+
+    Fix crash in broken document
+
+ poppler/StructTreeRoot.cc | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+commit 852fd28674e14f25c6902c0adab19909f73f2632
+Author: David Faure <faure at kde.org>
+Date:   Sat Jul 29 18:18:23 2017 +0200
+
+    Set RUNPATH for poppler shared libs
+
+    Bug #101945
+
+ CMakeLists.txt | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit 771c82623e8e1e0c92b8ca6f7c2b8a81ccbb60d3
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Jul 3 22:44:42 2017 +0200
+
+    pdfunite: fix crash in broken documents
+
+    Bug #101208
+
+ poppler/PDFDoc.cc | 70
+ +++++++++++++++++++++++++++++++++++++++++--------------
+ poppler/PDFDoc.h  | 21 +++++++----------
+ 2 files changed, 62 insertions(+), 29 deletions(-)
+
+commit 02d9b182b80d5745b79480b0b8d0eb49b0be304e
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Jun 21 22:49:26 2017 +0200
+
+    Poppler 0.56
+
+ CMakeLists.txt   | 2 +-
+ NEWS             | 8 ++++++++
+ configure.ac     | 2 +-
+ cpp/Doxyfile     | 2 +-
+ qt4/src/Doxyfile | 2 +-
+ qt5/src/Doxyfile | 2 +-
+ 6 files changed, 13 insertions(+), 5 deletions(-)
+
+commit 3a2759aa2a98c2157cb35731b95e393b8882f8d3
+Author: Jose Aliste <jaliste at src.gnome.org>
+Date:   Tue May 16 18:44:49 2017 -0400
+
+    Check numComps is between reasonable bounds
+
+    Before this patch, some PDF might crash because of an overflow
+    if numComps does not lie between 0 and 4.
+    This is a security fix for CVE-2017-0319.
+
+ poppler/Stream.cc | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+commit d9c88e1c8892c79b8865a0dabdcc0d3ffd55c195
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Jun 21 00:56:38 2017 +0200
+
+    Fix crash in malformed documents
+
+ poppler/GfxState.cc | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+commit 55db66c69fd56826b8523710046deab1a8d14ba2
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Jun 21 00:55:20 2017 +0200
+
+    Fix crash in malformed documents
+
+ poppler/JBIG2Stream.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 5266fa426d73c5dbdb3dd903d50885097833acc6
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Jun 20 23:58:26 2017 +0200
+
+    Fix crash in malformed document
+
+    Bug #101526
+
+ poppler/Stream.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 112b8ab16128c6e7f80fe7c1890f7b63abd85cce
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Jun 20 23:51:16 2017 +0200
+
+    Fix crash in broken documents
+
+    Fixes bug #101525
+
+ poppler/JBIG2Stream.cc | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+commit 4e68bf998f886cab8a45fa315164d8ba7aa0dee4
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Jun 20 23:43:23 2017 +0200
+
+    Fix crash on broken documents
+
+    Fixes bug #101524
+
+ poppler/JBIG2Stream.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 558cdb4a4efbb2227f4009f5d87cdd94bfb40107
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Jun 20 23:37:26 2017 +0200
+
+    Fix crash in malformed documents
+
+    Fixes bug #101523
+
+ poppler/GfxFont.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit f7030a0176ed0ab484a401acc26072060e420679
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Jun 19 23:45:24 2017 +0200
+
+    Fix crash on broken documents
+
+    Bug #101505
+
+ goo/GooHash.cc | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+commit e465d36b8ecf46b80af4ac6b941ae56eb4883a89
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Jun 19 23:35:29 2017 +0200
+
+    Fix crash on malformed files
+
+    Bug #101502
+
+ poppler/GfxState.cc | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+commit e2ab2fa9d8c41e0115b2c276a2594cd2f7c217e6
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Jun 19 23:18:51 2017 +0200
+
+    Fix crash on malformed files
+
+    Bug #101500
+
+ poppler/Function.cc | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+commit 17e4111da1ae5c9798ca0c040bf75c01bbb72a8a
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Jun 17 17:47:23 2017 +0200
+
+    Break earlier on reaching recursion limit
+
+    Bug #101379
+
+ poppler/Parser.cc | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+commit 8e1a2474c5513f7b2f4718258ca90e2d6e03f127
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Jun 17 12:35:41 2017 +0200
+
+    pdftohmtl: Initialize rotSkewMat
+
+    Fixes uninitialized memory read at bug #100314
+
+ utils/HtmlFonts.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit dd7b0eec87ffc389ee3ba7319442e681e19b15ba
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Jun 17 12:33:35 2017 +0200
+
+    Remove unused constructor
+
+ utils/HtmlFonts.h | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+commit 5b05222ccd18a121ea2ae1d67b8b5d4947cdfce0
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Jun 17 12:33:06 2017 +0200
+
+    Fix crash in malformed file
+
+    Bug #101429
+
+ poppler/Annot.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit e1b5053e54b0ef7d6b09f3b9c97883db533d509a
+Author: Even Rouault <even.rouault at spatialys.com>
+Date:   Fri Jun 16 00:21:53 2017 +0200
+
+    Fix crash on broken file
+
+    Fixes bug #101366
+
+ poppler/SplashOutputDev.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit 9e05af3da0ce14c48f0652e01718960c6bc7b4b0
+Author: Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
+Date:   Wed Jun 14 23:19:48 2017 +0200
+
+    FormFieldButton::setState() shouldn't check the field is readOnly
+
+    Bug #101419
+
+ poppler/Form.cc | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+commit 9cecd78ff12a145fd7a61d226d54fd8f9ce19638
+Merge: b5ca57db 23a2f6a2
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Jun 17 18:35:14 2017 +0200
+
+    Merge remote-tracking branch 'origin/master' into better_object
+
+commit 23a2f6a2492a0957489eac31b6700b4d68180bdb
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Jun 17 17:47:23 2017 +0200
+
+    Break earlier on reaching recursion limit
+
+    Bug #101379
+
+ poppler/Parser.cc | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+commit 5323bc8baf9add8c28a0a6970ab94b6386f38d14
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Jun 17 12:35:41 2017 +0200
+
+    pdftohmtl: Initialize rotSkewMat
+
+    Fixes uninitialized memory read at bug #100314
+
+ utils/HtmlFonts.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 67159370014e5cb3ef296b256bf410e0468fe71e
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Jun 17 12:33:35 2017 +0200
+
+    Remove unused constructor
+
+ utils/HtmlFonts.h | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+commit d52bba350acb3023ebdba8537854206641cd0998
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat Jun 17 12:33:06 2017 +0200
+
+    Fix crash in malformed file
+
+    Bug #101429
+
+ poppler/Annot.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit db254b4b5b1ac2dae46b9fd5ad23af311e481489
+Author: Even Rouault <even.rouault at spatialys.com>
+Date:   Fri Jun 16 00:21:53 2017 +0200
+
+    Fix crash on broken file
+
+    Fixes bug #101366
+
+ poppler/SplashOutputDev.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit 9fc5ed2176da68442927127bea8c427800eb244c
+Author: Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
+Date:   Wed Jun 14 23:19:48 2017 +0200
+
+    FormFieldButton::setState() should check the field isn't readOnly
+
+    Bug #101419
+
+ poppler/Form.cc | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+commit 5c9b08a875b07853be6c44e43ff5f7f059df666a
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat May 27 00:09:17 2017 +0200
+
+    pdfunite: Fix crash with broken documents
+
+    Sometimes we can't parse pages so check before accessing them
+
+    Thanks to Jiaqi Peng for the report
+
+    Fixes bugs #101153 and #101149
+
+ utils/pdfunite.cc | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+commit ff05069f34a00d67cdddb033f6240a3407e90057
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun May 21 23:39:38 2017 +0200
+
+    Poppler 0.55.0
+
+ CMakeLists.txt   |  2 +-
+ NEWS             | 16 ++++++++++++++++
+ configure.ac     |  2 +-
+ cpp/Doxyfile     |  2 +-
+ qt4/src/Doxyfile |  2 +-
+ qt5/src/Doxyfile |  2 +-
+ 6 files changed, 21 insertions(+), 5 deletions(-)
+
+commit 680b3f6b80e6d342a6b6e3fe8f1953857784f737
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun May 21 23:20:56 2017 +0200
+
+    Update (C)
+
+ poppler/Object.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 0bf38541443cb8dee4d9a5197fdfcf91f6043a2d
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun May 21 23:20:38 2017 +0200
+
+    Don't forget to ship this file ^_^
+
+ Makefile.am | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit aa03a71c3a1127cffd19bb0f596c4b361a7f2269
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun May 21 22:37:23 2017 +0200
+
+    Fix abort in files with broken Decode arrays
+
+    Fixes KDE bug #379835
+
+ poppler/GfxState.cc | 18 ++++++++++++------
+ poppler/Object.h    |  7 +++++++
+ 2 files changed, 19 insertions(+), 6 deletions(-)
+
+commit 65c5a5266462244130f110599ac5d1011a04216e
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun May 21 18:42:15 2017 +0200
+
+    Fail by default if libopenjpeg2/1 is not available
+
+    You can "force" to use the unmaintained JPX decoder or none at all
+
+ CMakeLists.txt    | 30 +++++++++++++++++++++++++++---
+ config.h.cmake    |  3 +++
+ configure.ac      | 29 +++++++++++++++++++++++++----
+ poppler/Stream.cc |  5 +++++
+ 4 files changed, 60 insertions(+), 7 deletions(-)
+
+commit ea6d3200ae26775dcc26ed80fad18ca51e7f7f07
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun May 21 18:08:41 2017 +0200
+
+    Fix openjpeg text
+
+    We've prefered openjpeg2 over 1 for a while
+
+ CMakeLists.txt | 2 +-
+ configure.ac   | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit b286a6b5b1a63563263072305da04604cb022488
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun May 21 17:45:00 2017 +0200
+
+    Fail by default if libjpeg is not available
+
+    You can "force" to use the unmaintained DCT decoder or none at all
+
+ CMakeLists.txt    | 29 +++++++++++++++++++++++------
+ config.h.cmake    |  3 +++
+ configure.ac      | 40 +++++++++++++++++++++++++++++++---------
+ poppler/Stream.cc |  7 ++++++-
+ 4 files changed, 63 insertions(+), 16 deletions(-)
+
+commit b5ca57dbfecd9e680b3bd4b293b0eac400d24cfb
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat May 13 01:05:43 2017 +0200
+
+    Fix memory leak in XRef::constructXRef
+
+ poppler/XRef.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit b21c5f7741bb0af47c64c042a8586d922d26b47a
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat May 13 00:13:43 2017 +0200
+
+    Use initNullAfterMalloc since this is after a greallocn
+
+ poppler/XRef.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit e98ca09fafadbf7d37b838ed2f8953dc6a53a034
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sat May 13 00:01:05 2017 +0200
+
+    Forgot to add my (C) here
+
+ poppler/Rendition.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 47aa71cf39764135f3e3a39cbfb8efc50de1ac28
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri May 12 23:38:26 2017 +0200
+
+    Make Dict incRef/decRef private
+
+ poppler/Catalog.cc | 40 +++++++++++-----------------------------
+ poppler/Catalog.h  |  2 +-
+ poppler/Dict.h     |  9 +++++----
+ poppler/PDFDoc.cc  | 37 ++++++++++++++++---------------------
+ poppler/PDFDoc.h   |  7 +++----
+ poppler/Page.cc    | 17 ++++++++---------
+ poppler/Page.h     |  2 +-
+ utils/pdfunite.cc  | 12 +++++-------
+ 8 files changed, 50 insertions(+), 76 deletions(-)
+
+commit 0d7aa8c8aa491e005f78b019eff78f400764a61c
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri May 12 23:10:53 2017 +0200
+
+    Make Array incRef/decRef private
+
+ poppler/Array.h   |  9 +++++----
+ poppler/PDFDoc.cc | 14 +++++++-------
+ 2 files changed, 12 insertions(+), 11 deletions(-)
+
+commit b1f4e35fa2da8909dee07529ce1dd9445639793b
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri May 12 23:03:28 2017 +0200
+
+    Make Stream incRef/decRef private
+
+    Object handles it for us
+
+    Also remove incRef/decRef from OutStream
+
+ glib/poppler-action.cc     |  2 +-
+ glib/poppler-attachment.cc | 15 ++++---------
+ glib/poppler-media.cc      | 19 +++++++----------
+ poppler/FileSpec.h         |  1 +
+ poppler/Rendition.cc       | 53
+ +++++++++++++++++++++++-----------------------
+ poppler/Rendition.h        |  6 ++++--
+ poppler/Stream.cc          |  1 -
+ poppler/Stream.h           | 18 ++++++----------
+ 8 files changed, 50 insertions(+), 65 deletions(-)
+
+commit d34e5304a9094d505ffce8ec4069d4ddf2ee5950
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri May 12 22:41:03 2017 +0200
+
+    Get rid of another incRef() call
+
+ poppler/Annot.cc | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+commit a7f2baa21a09454cb393dce806896e62e548f63e
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri May 12 22:38:41 2017 +0200
+
+    Pass the Object around instead of the Dict
+
+    Saves an awkard incRef call
+
+ poppler/Annot.cc | 198
+ +++++++++++++++++++++++++++----------------------------
+ poppler/Annot.h  |  46 ++++++-------
+ poppler/Form.cc  |   2 +-
+ 3 files changed, 122 insertions(+), 124 deletions(-)
+
+commit 0321bca7a3f6f5bd8b8f3e6ad13f4441e53c909b
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri May 12 22:25:36 2017 +0200
+
+    SplashOutputDev::doUpdateFont - Fix crash on broken file
+
+ poppler/SplashOutputDev.cc | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+commit 96ff78d63d2173671d07f62910b1d85c5fc509ff
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed May 10 11:20:56 2017 +0200
+
+    cpp: Return nullptr if the page at index can't be fethed
+
+    That is the same of what the glib/qt frontends do.
+
+    Bug #100981
+
+ cpp/poppler-document.cpp   | 13 ++++++++++++-
+ cpp/tests/poppler-dump.cpp | 18 +++++++++++++-----
+ 2 files changed, 25 insertions(+), 6 deletions(-)
+
+commit d83b11300386c7f0364acff06bd809e9efcbe4ca
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue May 9 16:08:18 2017 +0200
+
+    JPXStreamPrivate::init2 - Fix memory leak in broken files
+
+ poppler/JPEG2000Stream.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 270866ebac7920503c0856a5dd1e7937ab68dd5f
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue May 9 14:34:57 2017 +0200
+
+    GfxDeviceNColorSpace::parse - Fix memory leak on broken files
+
+ poppler/GfxState.cc | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+commit 22123c836b35c1e8a1feb831899aacd991597c45
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue May 9 10:59:21 2017 +0200
+
+    TextPool::addWord - Fix memory leak on broken files
+
+ poppler/TextOutputDev.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit d7a102f49e2ea63c1cf3ed79134ce6fc2b2c6a59
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue May 9 10:50:27 2017 +0200
+
+    FoFiType1::parse - Fix memory leak on broken files
+
+ fofi/FoFiType1.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 9773c1534668d84b8267c3e5c9d612076fa231a5
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue May 9 00:38:07 2017 +0200
+
+    New Object API
+
+    Implement the move operators and copy construtor
+
+    Almost all the init() functions are gone and we just have simple
+    constructors now
+
+    Also made free() public since you're not supposed to call it anymore,
+    unless you're being evil and malloc'ing Objects like Array/Dict/XRef
+
+    This has a huge reaction chain, most importantly we
+    don't get objects by passing a pointer Object parameter, we
+    just get the object as a return value, which is a much clearer API
+     -  aobj->copy(&obj);
+     +  obj = aobj->copy();
+    before I was never sure what was being copied into what
+
+    Comes with a huge diff, I probably made some mistake in the porting
+    since there was lots of copy & paste involved
+
+ cpp/poppler-document.cpp            |   14 +-
+ cpp/poppler-page.cpp                |    5 +-
+ glib/poppler-action.cc              |   27 +-
+ glib/poppler-attachment.cc          |    4 +-
+ glib/poppler-document.cc            |   30 +-
+ glib/poppler-input-stream.cc        |   10 +-
+ glib/poppler-input-stream.h         |    4 +-
+ glib/poppler-movie.cc               |    5 +-
+ glib/poppler-page.cc                |   13 +-
+ glib/poppler-structure-element.cc   |   37 +-
+ poppler/Annot.cc                    | 1779
+ +++++++++++++++--------------------
+ poppler/Annot.h                     |   27 +-
+ poppler/Array.cc                    |   34 +-
+ poppler/Array.h                     |    8 +-
+ poppler/CMap.cc                     |   12 +-
+ poppler/CairoFontEngine.cc          |    6 +-
+ poppler/CairoOutputDev.cc           |    5 +-
+ poppler/Catalog.cc                  |  383 +++-----
+ poppler/Catalog.h                   |    2 +-
+ poppler/DCTStream.cc                |    8 +-
+ poppler/Dict.cc                     |   49 +-
+ poppler/Dict.h                      |   12 +-
+ poppler/FileSpec.cc                 |  133 ++-
+ poppler/FileSpec.h                  |    5 +-
+ poppler/FontInfo.cc                 |   43 +-
+ poppler/Form.cc                     |  337 +++----
+ poppler/Form.h                      |    2 +-
+ poppler/Function.cc                 |  225 ++---
+ poppler/Gfx.cc                      |  767 ++++++---------
+ poppler/Gfx.h                       |   14 +-
+ poppler/GfxFont.cc                  |  350 +++----
+ poppler/GfxFont.h                   |    4 +-
+ poppler/GfxState.cc                 |  794 ++++++----------
+ poppler/Hints.cc                    |   25 +-
+ poppler/JBIG2Stream.cc              |    5 +-
+ poppler/JPEG2000Stream.cc           |   17 +-
+ poppler/Lexer.cc                    |   74 +-
+ poppler/Lexer.h                     |    7 +-
+ poppler/Linearization.cc            |   57 +-
+ poppler/Link.cc                     |  197 ++--
+ poppler/Movie.cc                    |  112 +--
+ poppler/Movie.h                     |    2 +-
+ poppler/Object.cc                   |   67 +-
+ poppler/Object.h                    |  153 ++-
+ poppler/OptionalContent.cc          |  144 +--
+ poppler/Outline.cc                  |   49 +-
+ poppler/PDFDoc.cc                   |  371 +++-----
+ poppler/PDFDoc.h                    |    8 +-
+ poppler/PSOutputDev.cc              |  406 +++-----
+ poppler/Page.cc                     |  192 ++--
+ poppler/Page.h                      |   17 +-
+ poppler/PageLabelInfo.cc            |   52 +-
+ poppler/PageTransition.cc           |   34 +-
+ poppler/Parser.cc                   |   96 +-
+ poppler/Parser.h                    |    9 +-
+ poppler/PopplerCache.cc             |   21 +-
+ poppler/PopplerCache.h              |    4 +-
+ poppler/Rendition.cc                |  169 ++--
+ poppler/SecurityHandler.cc          |   85 +-
+ poppler/Sound.cc                    |   40 +-
+ poppler/Sound.h                     |    5 +-
+ poppler/SplashOutputDev.cc          |   15 +-
+ poppler/StdinPDFDocBuilder.cc       |    7 +-
+ poppler/Stream.cc                   |  133 +--
+ poppler/Stream.h                    |   24 +-
+ poppler/StructElement.cc            |  244 ++---
+ poppler/StructTreeRoot.cc           |   74 +-
+ poppler/ViewerPreferences.cc        |   43 +-
+ poppler/XRef.cc                     |  404 +++-----
+ poppler/XRef.h                      |   16 +-
+ qt4/src/poppler-annotation-helper.h |   39 +-
+ qt4/src/poppler-document.cc         |   13 +-
+ qt4/src/poppler-form.cc             |    7 +-
+ qt4/src/poppler-optcontent.cc       |   17 +-
+ qt4/src/poppler-page.cc             |   18 +-
+ qt4/src/poppler-private.h           |    6 +-
+ qt4/tests/check_lexer.cpp           |   63 +-
+ qt4/tests/check_optcontent.cpp      |  114 +--
+ qt5/src/poppler-annotation-helper.h |   39 +-
+ qt5/src/poppler-document.cc         |   11 +-
+ qt5/src/poppler-form.cc             |    5 +-
+ qt5/src/poppler-optcontent.cc       |   17 +-
+ qt5/src/poppler-page.cc             |   16 +-
+ qt5/src/poppler-private.h           |    6 +-
+ qt5/tests/check_lexer.cpp           |   91 +-
+ qt5/tests/check_optcontent.cpp      |  114 +--
+ test/pdf-fullrewrite.cc             |   21 +-
+ utils/pdfinfo.cc                    |   21 +-
+ utils/pdftohtml.cc                  |   13 +-
+ utils/pdftotext.cc                  |   24 +-
+ utils/pdfunite.cc                   |  208 ++--
+ 91 files changed, 3539 insertions(+), 5850 deletions(-)
+
+commit 3c29ded4bee5eadb829ed46af2ec92be57b0077b
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri May 5 23:32:32 2017 +0200
+
+    Make Object free itself on init and destruction
+
+    Will make for a *much* easier way to code.
+
+    Patches with more std::move coming on top.
+
+    Most things seem to work though i'm pretty sure some things are
+    broken.
+
+    NEEDS TESTING
+
+ poppler/Annot.cc           |  3 +-
+ poppler/Array.cc           |  5 +--
+ poppler/Array.h            |  4 ++-
+ poppler/Catalog.cc         | 29 ++++++++++-------
+ poppler/Catalog.h          |  6 ++--
+ poppler/DCTStream.cc       |  8 ++---
+ poppler/DCTStream.h        |  4 +--
+ poppler/Dict.cc            | 29 ++++++++---------
+ poppler/Dict.h             |  4 ++-
+ poppler/Form.cc            |  1 -
+ poppler/Gfx.cc             | 25 ++++++---------
+ poppler/Movie.cc           | 30 +++++++++++-------
+ poppler/Movie.h            |  2 ++
+ poppler/Object.cc          | 51 +++++++++++++++++++++++++++---
+ poppler/Object.h           | 79
+ +++++++++++++++++++++++++++++-----------------
+ poppler/OptionalContent.cc |  2 +-
+ poppler/Page.cc            |  4 +--
+ poppler/Page.h             |  6 ++--
+ poppler/Parser.cc          |  4 +--
+ poppler/Stream.cc          | 36 ++++++++++++++-------
+ poppler/Stream.h           |  8 ++---
+ poppler/StructElement.cc   | 10 ++----
+ poppler/XRef.cc            | 19 ++++++++---
+ utils/pdfunite.cc          |  4 +--
+ 24 files changed, 234 insertions(+), 139 deletions(-)
+
+commit d73bcd3721f3b53bb97241cc53a6abf807aff782
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri May 5 15:12:42 2017 +0200
+
+    auto_ptr -> unique_ptr
+
+ cpp/poppler-document.cpp     | 25 +++++++++++++------------
+ cpp/poppler-image.cpp        |  9 +++++----
+ cpp/poppler-page.cpp         |  3 ++-
+ cpp/tests/poppler-dump.cpp   |  9 +++++----
+ cpp/tests/poppler-render.cpp |  5 +++--
+ qt4/tests/check_fonts.cpp    |  4 ++--
+ qt4/tests/check_links.cpp    |  4 ++--
+ qt5/tests/check_fonts.cpp    |  4 ++--
+ qt5/tests/check_links.cpp    |  4 ++--
+ 9 files changed, 36 insertions(+), 31 deletions(-)
+
+commit 9ad9d92591a6389f84919ff2de3668c2b6158dc9
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri May 5 00:57:35 2017 +0200
+
+    Fix memory leak in error condition
+
+    Coverity was complaining we missed one delete in one of the error
+    conditions, so just made colorMap not be newer, no need to care about
+    deletes ;)
+
+ poppler/Gfx.cc | 18 ++++++++----------
+ 1 file changed, 8 insertions(+), 10 deletions(-)
+
+commit cdab9a2dc27a10c84550db28fac8dbdcdcd4d29d
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri May 5 00:47:45 2017 +0200
+
+    Move the bits sanity checking a bit higher in the function
+
+    Saves some time and makes the code simpler as we have to delete one
+    thing less
+
+ poppler/Gfx.cc | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+commit b2545e9368a58a6987614f75d39da4568a076881
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu May 4 21:24:23 2017 +0200
+
+    Fix regression in GfxIndexedColorSpace::mapColorToBase
+
+    The bounds check was off by one, making file from bug 100931 render
+    incorrectly. Bug #100931
+
+ poppler/GfxState.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 09000ce81397eba1eed383f730e48b92b932e0b4
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu May 4 18:35:16 2017 +0200
+
+    Minor optimization
+
+    Do not create a timer for every single operation since we hardly
+    run the
+    profileCommands if branch
+
+ poppler/Gfx.cc | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+commit b21b041f7948680c03109f0c404400a9dbc4544c
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Apr 25 19:48:24 2017 +0200
+
+    Fix memory leak when reconstructing broken files
+
+    Need to free the catalog variable if we're going to fetch over
+    it again
+
+    Bug #100776
+
+ poppler/XRef.cc | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+commit 278439531b13b0b047dbe3a75aa3f1b3407c8bd4
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Tue Apr 25 19:42:15 2017 +0200
+
+    Fix memory leak (and probably logic bug) parsing broken XRef entries
+
+    Don't need to get obj1 again to ask if it's an int64 instead of an int
+
+    Bug #100775
+
+ poppler/XRef.cc | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+commit 478be219772a6c298baad568da3643895cd50d35
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Apr 21 16:29:44 2017 +0200
+
+    Poppler 0.54
+
+ CMakeLists.txt      |  2 +-
+ NEWS                | 14 ++++++++++++++
+ configure.ac        |  2 +-
+ cpp/Doxyfile        |  2 +-
+ glib/CMakeLists.txt |  2 +-
+ glib/Makefile.am    |  2 +-
+ gtk-doc.make        |  1 +
+ qt4/src/Doxyfile    |  2 +-
+ qt5/src/Doxyfile    |  2 +-
+ 9 files changed, 22 insertions(+), 7 deletions(-)
+
+commit d627a38b3a25906b356413a1de29aaad9f7a0f28
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Fri Apr 21 16:03:49 2017 +0200
+
+    Update (C)
+
+ poppler/XRef.cc           | 2 +-
+ qt5/src/poppler-private.h | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+commit 3a13817da1fff5244267bbc7dee178ac665de4e0
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Fri Apr 21 19:23:07 2017 +0930
+
+    pdfimages: don't fail listing if inline image data contains 'EI'
+
+    Normally when listing images we don't read the image data. But for
+    inline images we should read the image data to advance the stream
+    position to the end of the image data. If we don't advance the stream
+    position and the image data happens to contain 'EI', Gfx will resume
+    reading the content stream from the middle of the image data.
+
+    Bug 100737
+
+ utils/ImageOutputDev.cc | 61
+ ++++++++++++++++++++++++++++++++++++-------------
+ 1 file changed, 45 insertions(+), 16 deletions(-)
+
+commit e3779c849c86685c9bc294af407b364daf4b2202
+Author: Carlos Garcia Campos <carlosgc at gnome.org>
+Date:   Sat Apr 8 09:56:59 2017 +0200
+
+    glib: Fix return value in API doc comment of
+    poppler_movie_get_play_mode
+
+ glib/poppler-movie.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit cc7809e73c71e0e6b7db29dc8a12cfb573448b77
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Apr 5 23:18:52 2017 +0200
+
+    Make XRef reconstruction a bit better
+
+    Also detect streams whose endstream is on the middle of a line and
+    not only at the beginning
+
+    Bug #100509
+
+ poppler/XRef.cc | 30 +++++++++++++++++++-----------
+ 1 file changed, 19 insertions(+), 11 deletions(-)
+
+commit 2bbd110113f789c56609b3288258f667e0f3851a
+Author: Carlos Garcia Campos <carlosgc at gnome.org>
+Date:   Sun Apr 2 15:49:48 2017 +0200
+
+    glib-demo: Show play mode in movie properties view
+
+ glib/demo/utils.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit dad9b36e0e91524e8e342cf924026c37fcb1730e
+Author: Francesco Poli (wintermute) <invernomuto at paranoici.org>
+Date:   Sun Apr 2 15:28:20 2017 +0200
+
+    glib: Expose movie play mode
+
+    With this patch the movie play mode can be queried via the glib
+    interface. An enum value is obtained that reports whether the movie
+    should be played once, in loop, and so forth...
+
+    https://bugs.freedesktop.org/show_bug.cgi?id=99625
+
+ glib/poppler-movie.cc               | 35
+ +++++++++++++++++++++++++++++++++++
+ glib/poppler-movie.h                | 31 ++++++++++++++++++++++++++-----
+ glib/reference/poppler-sections.txt |  4 ++++
+ 3 files changed, 65 insertions(+), 5 deletions(-)
+
+commit 0dbec24428d96ae78be8ca06b230d68cde445614
+Author: Christoph Cullmann <cullmann at kde.org>
+Date:   Wed Mar 22 23:45:41 2017 +0100
+
+    qt5: Compile with -DQT_NO_CAST_FROM_BYTEARRAY
+
+    Bug #100311
+
+ qt5/src/poppler-private.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 7ba4eb3ac3f23236e3df1ef992160d702dc5e4e9
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Mar 22 23:42:57 2017 +0100
+
+    Poppler 0.53
+
+ CMakeLists.txt         |  4 ++--
+ NEWS                   | 18 ++++++++++++++++++
+ configure.ac           |  2 +-
+ cpp/Doxyfile           |  2 +-
+ poppler/Makefile.am    |  2 +-
+ qt4/src/Doxyfile       |  2 +-
+ qt5/src/CMakeLists.txt |  2 +-
+ qt5/src/Doxyfile       |  2 +-
+ qt5/src/Makefile.am    |  2 +-
+ 9 files changed, 27 insertions(+), 9 deletions(-)
+
+commit 411c963a9fe7d0d51bc96f046792688a020bfc66
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Mar 19 12:40:37 2017 +0100
+
+    Update (C)
+
+ goo/PNGWriter.cc        | 2 +-
+ goo/PNGWriter.h         | 2 +-
+ goo/TiffWriter.cc       | 2 +-
+ goo/TiffWriter.h        | 2 +-
+ poppler/GfxState.h      | 2 +-
+ utils/ImageOutputDev.cc | 2 +-
+ utils/ImageOutputDev.h  | 2 +-
+ 7 files changed, 7 insertions(+), 7 deletions(-)
+
+commit 96333f6dcd93afadea35f9301c7a919545037ed4
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Mar 8 23:33:00 2017 +0100
+
+    Add override markers
+
+ cmake/modules/PopplerMacros.cmake            |   4 +
+ fofi/FoFiIdentifier.cc                       |  42 +--
+ fofi/FoFiTrueType.h                          |   2 +-
+ fofi/FoFiType1.h                             |   2 +-
+ glib/poppler-cached-file-loader.h            |   4 +-
+ glib/poppler-input-stream.h                  |  34 +--
+ goo/JpegWriter.h                             |  10 +-
+ goo/NetPBMWriter.h                           |   8 +-
+ goo/PNGWriter.h                              |   8 +-
+ goo/TiffWriter.h                             |  10 +-
+ poppler/Annot.h                              |  50 ++--
+ poppler/CairoFontEngine.h                    |   6 +-
+ poppler/CairoOutputDev.cc                    |   2 +-
+ poppler/CairoOutputDev.h                     | 344 +++++++++++-----------
+ poppler/DCTStream.h                          |  18 +-
+ poppler/Decrypt.h                            |  24 +-
+ poppler/FlateEncoder.h                       |  16 +-
+ poppler/Form.h                               |  18 +-
+ poppler/Function.h                           |  52 ++--
+ poppler/GfxFont.h                            |  20 +-
+ poppler/GfxState.cc                          |   2 +-
+ poppler/GfxState.h                           | 366
+ +++++++++++------------
+ poppler/JBIG2Stream.cc                       |  16 +-
+ poppler/JBIG2Stream.h                        |  22 +-
+ poppler/JPEG2000Stream.h                     |  24 +-
+ poppler/Link.h                               |  66 ++---
+ poppler/LocalPDFDocBuilder.h                 |   5 +-
+ poppler/MarkedContentOutputDev.h             |  22 +-
+ poppler/PSOutputDev.cc                       |  16 +-
+ poppler/PSOutputDev.h                        | 142 ++++-----
+ poppler/PopplerCache.cc                      |   2 +-
+ poppler/PreScanOutputDev.h                   | 110 +++----
+ poppler/SecurityHandler.h                    |  30 +-
+ poppler/SplashOutputDev.cc                   |   2 +-
+ poppler/SplashOutputDev.h                    | 210 ++++++-------
+ poppler/StdinCachedFile.h                    |   5 +-
+ poppler/StdinPDFDocBuilder.h                 |   5 +-
+ poppler/Stream.h                             | 422
+ +++++++++++++--------------
+ poppler/TextOutputDev.cc                     |  38 +--
+ poppler/TextOutputDev.h                      |  46 +--
+ poppler/XRef.cc                              |   2 +-
+ poppler/XRef.h                               |  12 +-
+ qt4/CMakeLists.txt                           |   3 +
+ qt4/src/poppler-annotation.h                 |   8 +-
+ qt4/src/poppler-link.h                       |   2 +-
+ qt5/demos/abstractinfodock.h                 |   6 +-
+ qt5/demos/embeddedfiles.h                    |   6 +-
+ qt5/demos/fonts.h                            |   4 +-
+ qt5/demos/info.h                             |   4 +-
+ qt5/demos/metadata.h                         |   4 +-
+ qt5/demos/navigationtoolbar.h                |   6 +-
+ qt5/demos/optcontent.h                       |   6 +-
+ qt5/demos/pageview.h                         |   6 +-
+ qt5/demos/permissions.h                      |   4 +-
+ qt5/demos/thumbnails.h                       |   4 +-
+ qt5/demos/toc.h                              |   4 +-
+ qt5/demos/viewer.h                           |   2 +-
+ qt5/src/ArthurOutputDev.cc                   |   2 +-
+ qt5/src/ArthurOutputDev.h                    |  90 +++---
+ qt5/src/poppler-annotation.cc                |  56 ++--
+ qt5/src/poppler-annotation.h                 |  84 +++---
+ qt5/src/poppler-form.h                       |  16 +-
+ qt5/src/poppler-link-extractor-private.h     |  10 +-
+ qt5/src/poppler-link.h                       |  24 +-
+ qt5/src/poppler-optcontent.h                 |  18 +-
+ qt5/src/poppler-qiodeviceoutstream-private.h |  10 +-
+ qt5/src/poppler-qt5.h                        |   6 +-
+ qt5/tests/stress-threads-qt5.cpp             |   4 +-
+ qt5/tests/test-password-qt5.cpp              |   4 +-
+ qt5/tests/test-poppler-qt5.cpp               |   6 +-
+ splash/SplashFTFont.h                        |  12 +-
+ splash/SplashFTFontFile.h                    |   6 +-
+ splash/SplashPattern.h                       |  12 +-
+ test/gtk-test.cc                             |   6 +-
+ utils/HtmlOutputDev.h                        |  56 ++--
+ utils/ImageOutputDev.h                       |  62 ++--
+ utils/pdftohtml.cc                           |  12 +-
+ 77 files changed, 1404 insertions(+), 1400 deletions(-)
+
+commit da490581b1b4d50efdba1e25115697e17bb0ef51
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Mar 8 22:07:34 2017 +0100
+
+    Compile in C++11 mode
+
+    I tried using AX_CXX_COMPILE_STDCXX_11 for the autotools side but
+    could not get it to fill CXXFLAGS or any other variable i could find,
+    help welcome
+
+ CMakeLists.txt | 4 +++-
+ configure.ac   | 1 +
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+commit aa8633267d1d0e2079bb4a2b82bc7b36a4d306f5
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Mar 6 22:45:52 2017 +0100
+
+    pdfinfo: Fix memory leak when printing JS
+
+ utils/JSInfo.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit d30e66cf39ef69a81bdd91e21203c876f38d9a09
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Mar 6 22:43:27 2017 +0100
+
+    pdfinfo: fix leak when printing JS
+
+ utils/JSInfo.cc | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+commit a7632c5db6875828500dce7c984ec933d5349f26
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Mar 6 22:34:20 2017 +0100
+
+    pdftohtml: fix small memory leak when constructing some filenames
+
+ utils/HtmlOutputDev.cc | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+commit 8ebec831c2abea9f13761474990c0d94346c1a35
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Mon Mar 6 22:24:06 2017 +0100
+
+    SplashOutputDev: Fix memory leak when rendering images with colormap
+    and matte color
+
+ poppler/SplashOutputDev.cc | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+commit cfaeeadbc642a297486481d9efd6068fd9ef7ea3
+Author: Adrian Johnson <ajohnson at redneon.com>
+Date:   Sat Mar 4 10:54:29 2017 +1030
+
+    pdfimages: support 16bpc png and tiff images
+
+    bug 99988
+
+ goo/PNGWriter.cc        |  4 ++++
+ goo/PNGWriter.h         |  3 ++-
+ goo/TiffWriter.cc       |  6 ++++++
+ goo/TiffWriter.h        |  3 ++-
+ poppler/GfxState.h      |  4 ++++
+ utils/ImageOutputDev.cc | 38 +++++++++++++++++++++++++++++++++++++-
+ utils/ImageOutputDev.h  |  1 +
+ 7 files changed, 56 insertions(+), 3 deletions(-)
+
+commit 1b0653ce395242547b2b34b99034a19cd2d3ea6b
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Mar 2 01:00:12 2017 +0100
+
+    Qt5: Expose Form additional actions
+
+ qt5/src/poppler-form.cc | 20 ++++++++++++++++++++
+ qt5/src/poppler-form.h  | 19 +++++++++++++++++++
+ 2 files changed, 39 insertions(+)
+
+commit a4c6433c423bd0dcc5056d9ee0375188fea9a0bc
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Mar 2 00:56:43 2017 +0100
+
+    Update (C) of previous commit
+
+ poppler/Form.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 0151e6e3824a6db907d871a2e56f5c20c001b588
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Mar 2 00:56:27 2017 +0100
+
+    Qt5: expose form calculate order
+
+ qt5/src/poppler-document.cc | 18 +++++++++++++++++-
+ qt5/src/poppler-qt5.h       |  9 ++++++++-
+ 2 files changed, 25 insertions(+), 2 deletions(-)
+
+commit 0ae3d40a79c25feb5cb9bce6fc8cc48c30bfd1b6
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Mar 2 00:52:21 2017 +0100
+
+    Parse AcroForm CO (calculateOrder)
+
+ poppler/Form.cc | 19 +++++++++++++++++++
+ poppler/Form.h  |  4 ++++
+ 2 files changed, 23 insertions(+)
+
+commit bbfc56b3c9a1e613e6db008a56c9c3333ae1427a
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Thu Mar 2 00:45:44 2017 +0100
+
+    Make FormWidget* setters ignore isReadOnly
+
+    isReadOnly is for the user but poppler needs to be able to set the
+    value for example for fields whose value is autocalculated
+
+ poppler/Form.cc | 23 +----------------------
+ 1 file changed, 1 insertion(+), 22 deletions(-)
+
+commit f853145556a61a3d1104d6fd62261924d9fc9e50
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Sun Feb 19 23:25:47 2017 +0100
+
+    There's no config file
+
+ poppler/GlobalParams.h | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+commit c7a7c34fcb875414eb3092df84f8e8e8e523648d
+Author: Albert Astals Cid <aacid at kde.org>
+Date:   Wed Feb 15 23:26:10 2017 +0100
+
+    Poppler 0.52.0
+
+ CMakeLists.txt   |  2 +-
+ NEWS             | 16 ++++++++++++++++
+ configure.ac     |  2 +-
+ cpp/Doxyfile     |  2 +-
+ qt4/src/Doxyfile |  2 +-
+ qt5/src/Doxyfile |  2 +-
+ 6 files changed, 21 insertions(+), 5 deletions(-)
+
 commit baad9bd0406f63cffa8054c5831ccc3cb5d207e3
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Feb 15 23:05:55 2017 +0100
@@ -2301,7 +6396,7 @@
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 commit 9d33825e6f6167f07b2739645b93249b2bc043da
-Merge: a8853b1 f3e3ebe
+Merge: a8853b1d f3e3ebe5
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Mar 2 00:37:11 2016 +0100
 
@@ -6231,7 +10326,7 @@
  1 file changed, 1 insertion(+)
 
 commit 8ce31485faa26994c52f4d032cc5a8355aba23d1
-Merge: 4589ce1 303287e
+Merge: 4589ce17 303287eb
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Sep 26 00:40:43 2014 +0200
 
@@ -6271,7 +10366,7 @@
  1 file changed, 4 insertions(+), 1 deletion(-)
 
 commit fe67324d450c356b7c876cf50da705156112513a
-Merge: e62e18e f74a596
+Merge: e62e18e1 f74a5964
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu Aug 21 21:39:52 2014 +0200
 
@@ -6378,7 +10473,7 @@
  1 file changed, 1 insertion(+), 4 deletions(-)
 
 commit b72a534d6c7d8bc026812b68f9d9ac6bf9a2200a
-Merge: f2e4154 ef3f758
+Merge: f2e4154e ef3f7585
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Aug 3 01:06:57 2014 +0200
 
@@ -6532,7 +10627,7 @@
  4 files changed, 38 insertions(+), 6 deletions(-)
 
 commit ce782112746f629a8e7be6f2daf6ece6ab19917d
-Merge: 2c0cb68 26372cf
+Merge: 2c0cb689 26372cfa
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Jul 20 20:35:13 2014 +0200
 
@@ -6591,7 +10686,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 2c0cb689910e8579bf428b3999bcac0cb27b0e51
-Merge: 0b639cd 1161e72
+Merge: 0b639cd2 1161e728
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Jul 12 17:21:07 2014 +0200
 
@@ -6619,7 +10714,7 @@
  1 file changed, 5 insertions(+), 2 deletions(-)
 
 commit 0b639cd2ac1071f5b741031a78d8e2bc18d2b7d7
-Merge: bb16c71 a5ad55b
+Merge: bb16c716 a5ad55b7
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Jul 11 00:32:46 2014 +0200
 
@@ -6684,7 +10779,7 @@
  2 files changed, 1 insertion(+), 19 deletions(-)
 
 commit 74c72223cf609e7c24594f95cab6f9865ad562ac
-Merge: f8f7b3a 47a947f
+Merge: f8f7b3a6 47a947f1
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Jul 11 00:23:04 2014 +0200
 
@@ -6702,7 +10797,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit f8f7b3a61bc7eb1e569c25a630b5e127b5dcae62
-Merge: 805ff76 aa6205d
+Merge: 805ff761 aa6205d1
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Jul 9 00:23:22 2014 +0200
 
@@ -6835,7 +10930,7 @@
  2 files changed, 2 insertions(+), 1 deletion(-)
 
 commit 8a5e59c6ea7ccd0ecbdb4b37bf3fe4e74e1c0e8e
-Merge: 1b70533 310fbee
+Merge: 1b705331 310fbeec
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Jun 18 00:37:03 2014 +0200
 
@@ -7026,7 +11121,7 @@
  3 files changed, 22 insertions(+), 6 deletions(-)
 
 commit 2dd9b95fd910023a7d9d23f2c2e41dcab91d3c31
-Merge: fed71eb b36d27b
+Merge: fed71ebd b36d27b4
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Jun 6 21:43:49 2014 +0200
 
@@ -7113,7 +11208,7 @@
  8 files changed, 137 insertions(+), 10 deletions(-)
 
 commit d2892cd893e4379914a08e66682ed5c423743a41
-Merge: 0844220 7e9fc61
+Merge: 08442203 7e9fc61e
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed May 7 22:27:41 2014 +0200
 
@@ -7134,7 +11229,7 @@
  1 file changed, 4 insertions(+), 1 deletion(-)
 
 commit 0844220347f984c3d9b04fe53e690ee0e8c74afe
-Merge: 84278d8 0a6c1ff
+Merge: 84278d8a 0a6c1ff7
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed May 7 21:56:07 2014 +0200
 
@@ -7155,7 +11250,7 @@
  3 files changed, 162 insertions(+), 4 deletions(-)
 
 commit 84278d8adbb1f6e9a28588fcb4db30c9ef70adde
-Merge: 7b94b11 5b2cdef
+Merge: 7b94b119 5b2cdef4
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun May 4 22:21:25 2014 +0200
 
@@ -7173,7 +11268,7 @@
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 commit 7b94b119f07713af7b8b9f1ac3ea3f1d35c1e240
-Merge: c859d2b bae836c
+Merge: c859d2b8 bae836cd
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun May 4 16:21:24 2014 +0200
 
@@ -7413,7 +11508,7 @@
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 commit 07621ebbda8ab85cf4cd76a6092efc67aa14454d
-Merge: 8d3a2c9 9fcd46a
+Merge: 8d3a2c9d 9fcd46ac
 Author: Pino Toscano <pino at kde.org>
 Date:   Sat Apr 5 15:49:31 2014 +0200
 
@@ -9001,7 +13096,7 @@
  1 file changed, 4 insertions(+), 4 deletions(-)
 
 commit 381ae2877acace4e8908b07ee5fb442bc19bf814
-Merge: 64100e7 a2f0e4b
+Merge: 64100e7f a2f0e4b1
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Jan 3 00:04:29 2014 +0100
 
@@ -9093,7 +13188,7 @@
  1 file changed, 7 insertions(+), 1 deletion(-)
 
 commit 8e24fcc0d296e07327e9cbe297f627bfc6471ee3
-Merge: 85efba3 b02f873
+Merge: 85efba38 b02f8731
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Dec 18 21:51:57 2013 +0100
 
@@ -9270,7 +13365,7 @@
  5 files changed, 82 insertions(+), 20 deletions(-)
 
 commit f77bc21813ae7234ec4ce94ce4e92230fe5c174a
-Merge: 06e9dc9 58e04a0
+Merge: 06e9dc91 58e04a08
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Dec 7 16:56:11 2013 +0000
 
@@ -9721,7 +13816,7 @@
  1 file changed, 15 insertions(+), 55 deletions(-)
 
 commit 770a7ac9833a3c4f4f0399093272d4d0bdc7923b
-Merge: e7a0f2b 9ae29c7
+Merge: e7a0f2b9 9ae29c7a
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu Nov 21 23:58:29 2013 +0100
 
@@ -9805,7 +13900,7 @@
  4 files changed, 80 insertions(+)
 
 commit c01cee165392ba8297e4168111a66d2acb272a99
-Merge: 07c2554 47605a8
+Merge: 07c25548 47605a8a
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon Nov 18 22:58:28 2013 +0100
 
@@ -9871,7 +13966,7 @@
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 commit 4da94680d4d2d6b1bd3351d476a20f9c7ae565bc
-Merge: 3ea3d7c 78c407a
+Merge: 3ea3d7c6 78c407ac
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Nov 15 20:27:00 2013 +0100
 
@@ -9959,7 +14054,7 @@
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 commit 33e703ac9bb6cf69664d6c6fddd3bebd56336074
-Merge: 8294d18 7c74bcc
+Merge: 8294d18e 7c74bccd
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Nov 15 19:50:10 2013 +0100
 
@@ -10095,7 +14190,7 @@
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 commit 9f09b9596f1fc52481914019d68c8f9b85b5c438
-Merge: bd893d4 61f79b8
+Merge: bd893d4a 61f79b84
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu Oct 24 01:03:02 2013 +0200
 
@@ -10117,7 +14212,7 @@
  1 file changed, 30 insertions(+), 1 deletion(-)
 
 commit bd893d4a543a6cc3a525655f37def38440944f28
-Merge: 93e8b05 daa0990
+Merge: 93e8b05f daa0990a
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu Oct 10 02:19:34 2013 +0200
 
@@ -10314,7 +14409,7 @@
  2 files changed, 113 insertions(+)
 
 commit 9bc8f3240698d5a8ae4c0129e768840664d28c22
-Merge: a2742c8 e2fe851
+Merge: a2742c8f e2fe8513
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Oct 1 19:19:32 2013 +0200
 
@@ -10333,7 +14428,7 @@
  1 file changed, 46 insertions(+), 6 deletions(-)
 
 commit a2742c8fce0594ccbdb036dd0c29c6e15d2229f3
-Merge: 6b30a52 06dabe1
+Merge: 6b30a521 06dabe1e
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon Sep 30 19:32:41 2013 +0200
 
@@ -10363,7 +14458,7 @@
  1 file changed, 1 insertion(+)
 
 commit 6b30a5214e39993025cf2fb9f221e1360de7fa9c
-Merge: 4966b6f dc344b4
+Merge: 4966b6f4 dc344b41
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Sep 21 10:38:45 2013 +0200
 
@@ -10379,7 +14474,7 @@
  1 file changed, 7 insertions(+)
 
 commit 4966b6f4193cc9d13f63e92bdc2aac0c8b78298d
-Merge: 0f074b1 1e612d3
+Merge: 0f074b16 1e612d33
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Sep 21 10:15:28 2013 +0200
 
@@ -10397,7 +14492,7 @@
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 commit 0f074b16317d874fe58d7042f8434282786ca757
-Merge: d277432 b8682d8
+Merge: d2774325 b8682d86
 Author: Pino Toscano <pino at kde.org>
 Date:   Mon Sep 16 19:53:10 2013 +0200
 
@@ -10666,7 +14761,7 @@
  4 files changed, 355 insertions(+), 17 deletions(-)
 
 commit d006ac567e59e82c4c6cb42c5e429a4aa516ac0b
-Merge: d391af7 ed3585e
+Merge: d391af7e ed3585ef
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Aug 25 19:36:33 2013 +0200
 
@@ -10745,7 +14840,7 @@
  14 files changed, 322 insertions(+), 1 deletion(-)
 
 commit c2453fc1307ebb222747f976e1311ecc5e99abfa
-Merge: 3bb8c2e 70298a0
+Merge: 3bb8c2e3 70298a02
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Aug 20 19:53:17 2013 +0200
 
@@ -10764,7 +14859,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 3bb8c2e34039cf473bf72ed9dab55664deab3ab7
-Merge: 71c1d16 fc78330
+Merge: 71c1d162 fc783300
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Aug 20 00:41:13 2013 +0200
 
@@ -10784,7 +14879,7 @@
  1 file changed, 19 insertions(+), 11 deletions(-)
 
 commit 71c1d162477a243db07b62ef3c056a2946f8986e
-Merge: 7d1de78 678c767
+Merge: 7d1de78a 678c7675
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Aug 18 16:41:20 2013 +0200
 
@@ -10791,7 +14886,7 @@
     Merge remote-tracking branch 'origin/poppler-0.24'
 
 commit 7d1de78ad79162217ee0ca6c2e99ce51017a327d
-Merge: 7e0d969 fbea224
+Merge: 7e0d969d fbea2241
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Aug 18 16:40:34 2013 +0200
 
@@ -10842,7 +14937,7 @@
  1 file changed, 2 insertions(+), 6 deletions(-)
 
 commit 7e0d969dc2439637ab16e609df8223504316f87d
-Merge: 6efc0c7 ef64206
+Merge: 6efc0c7a ef642065
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Aug 17 01:13:30 2013 +0200
 
@@ -10940,7 +15035,7 @@
  2 files changed, 27 insertions(+), 2 deletions(-)
 
 commit 8a1740b0b6ee4b217ecbe9d0046e4afa491e9f17
-Merge: b27588c c3f953d
+Merge: b27588c4 c3f953dc
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon Aug 12 22:47:44 2013 +0200
 
@@ -10965,7 +15060,7 @@
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 commit b8b5773386ee4f57e72c2b867421cdff8a2eab5a
-Merge: 5f9d385 62d079b
+Merge: 5f9d385d 62d079b4
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu Aug 8 20:47:05 2013 +0200
 
@@ -10985,7 +15080,7 @@
  1 file changed, 6 insertions(+), 9 deletions(-)
 
 commit 5f9d385dbec3148614b84ae24cae47177e18dbfc
-Merge: af450a8 86dbc5f
+Merge: af450a88 86dbc5f6
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu Aug 8 20:41:25 2013 +0200
 
@@ -11590,7 +15685,7 @@
  1 file changed, 4 insertions(+), 4 deletions(-)
 
 commit e27c1057caf4d878a0dc43c92c9e0b565db8fe40
-Merge: c55b577 ee8cfbc
+Merge: c55b577c ee8cfbc7
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Jun 25 19:17:13 2013 +0200
 
@@ -12044,7 +16139,7 @@
  1 file changed, 18 insertions(+)
 
 commit 07992075a6d1d29db57f997f67d5a4a6deacbbb4
-Merge: 4a0bd6f 25f453e
+Merge: 4a0bd6fd 25f453ef
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Jun 9 12:17:53 2013 +0200
 
@@ -12090,7 +16185,7 @@
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 commit 4a0bd6fdb2e9e3c589e1bdb282e7c2bfca8567b1
-Merge: bbd27c9 17a16a2
+Merge: bbd27c92 17a16a27
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Jun 9 12:06:10 2013 +0200
 
@@ -12309,7 +16404,7 @@
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 commit 01a825f3f9f5dcf686fc123d2cf80b9c525d0d89
-Merge: a57f937 b4b1310
+Merge: a57f9378 b4b13102
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Jun 1 13:47:29 2013 +0200
 
@@ -12370,7 +16465,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 30282d3fdbbb3029d9a0f838b2cd979bb962235c
-Merge: 61f6658 56044ef
+Merge: 61f66588 56044ef4
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon May 27 00:20:12 2013 +0200
 
@@ -12431,7 +16526,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 71d327194293cb3d1a0e274eaf4451c7afe81e8a
-Merge: 7b2df1f 6a98b56
+Merge: 7b2df1f9 6a98b56f
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri May 17 23:04:12 2013 +0200
 
@@ -12461,7 +16556,7 @@
  2 files changed, 167 insertions(+)
 
 commit 54f539b4436a1a3e0eab2ef0904c302865082982
-Merge: b3d8f51 3a6e2de
+Merge: b3d8f510 3a6e2de1
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu May 16 21:27:47 2013 +0200
 
@@ -12565,7 +16660,7 @@
  1 file changed, 1 insertion(+)
 
 commit 30a519f21dd5df8d41a43a58b2cbd95fe657df73
-Merge: 998a9e7 0c0aef2
+Merge: 998a9e7c 0c0aef20
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon May 13 20:40:04 2013 +0200
 
@@ -12605,7 +16700,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 998a9e7c982a72b0e931304b719de40f30094d12
-Merge: 5e73cb0 73d09cd
+Merge: 5e73cb05 73d09cd5
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon May 13 19:30:26 2013 +0200
 
@@ -12626,7 +16721,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 5e73cb059e27f68b329513de609d52e84d73f8af
-Merge: 5e9654a b3e44fc
+Merge: 5e9654a3 b3e44fc5
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue May 7 22:00:02 2013 +0200
 
@@ -12644,7 +16739,7 @@
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 commit 5e9654a3eb28b2c8b0985545778dd0e45829f8e1
-Merge: eeecd97 a107428
+Merge: eeecd971 a107428e
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu Apr 25 20:45:34 2013 +0200
 
@@ -12753,7 +16848,7 @@
  1 file changed, 19 insertions(+), 18 deletions(-)
 
 commit fd648e83e60db7157b7273ffddc02308b0c5813b
-Merge: 970e9f6 53b9cec
+Merge: 970e9f63 53b9cec6
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Apr 21 23:30:16 2013 +0200
 
@@ -12782,7 +16877,7 @@
  1 file changed, 3 insertions(+), 5 deletions(-)
 
 commit f8bf602620b3c7570f483ac66fc4d6a76a81a882
-Merge: bbd27dc 62a5b4d
+Merge: bbd27dc4 62a5b4d5
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Apr 14 16:40:51 2013 +0200
 
@@ -12808,7 +16903,7 @@
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 commit bbd27dc4ce7b24af890d80f597f74e5d7ee0215a
-Merge: ea3698c 5bc0080
+Merge: ea3698cf 5bc00809
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Apr 12 00:10:27 2013 +0200
 
@@ -12861,7 +16956,7 @@
  4 files changed, 4 insertions(+), 4 deletions(-)
 
 commit ea3698cfffc9c132081f5691287ef1fd17911b2a
-Merge: fcc1468 aaaea5d
+Merge: fcc14682 aaaea5d0
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Apr 10 20:42:01 2013 +0200
 
@@ -12880,7 +16975,7 @@
  2 files changed, 4 insertions(+), 4 deletions(-)
 
 commit fcc14682899ff4981bfece74dbc8c290a625b05c
-Merge: f11e216 e6559a0
+Merge: f11e2162 e6559a0d
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Apr 7 17:44:12 2013 +0200
 
@@ -12904,7 +16999,7 @@
  4 files changed, 15 insertions(+), 6 deletions(-)
 
 commit f11e21627121c3ff81c0ec7f4d71936a2dd590c3
-Merge: e1ffa91 b9fdb0c
+Merge: e1ffa910 b9fdb0cb
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Apr 6 23:26:54 2013 +0200
 
@@ -12953,7 +17048,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 94bee4601cbbda0e7c6205a04650e0510f198aee
-Merge: 42368fb b312210
+Merge: 42368fb9 b312210b
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Apr 6 23:19:25 2013 +0200
 
@@ -13154,7 +17249,7 @@
  2 files changed, 25 insertions(+), 8 deletions(-)
 
 commit 8cbdbc64897a34beb226d4dc4c58095f10013f29
-Merge: 2bce2cf a01e2d4
+Merge: 2bce2cf2 a01e2d41
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Mar 20 22:37:06 2013 +0100
 
@@ -13184,7 +17279,7 @@
  2 files changed, 36 insertions(+)
 
 commit b2d07cbf0c2f94bd25e1422e366ff78031815867
-Merge: 80cf78f 3206950
+Merge: 80cf78f2 32069506
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon Mar 18 21:06:59 2013 +0100
 
@@ -13220,7 +17315,7 @@
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 commit 80cf78f2020e2f4cf33ed49fe522c6861d710588
-Merge: b21780e 72c8312
+Merge: b21780e6 72c8312d
 Author: Adrian Johnson <ajohnson at redneon.com>
 Date:   Mon Mar 18 20:02:08 2013 +1030
 
@@ -13247,7 +17342,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 75849a0d7c205c048714b90883695b6bebd2298c
-Merge: ec7140b 5a51812
+Merge: ec7140b3 5a51812b
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Mar 12 20:27:59 2013 +0100
 
@@ -13280,7 +17375,7 @@
  6 files changed, 22 insertions(+), 6 deletions(-)
 
 commit ec7140b3f56b034fbbc53cb8066ba01fe9f60f47
-Merge: c86062f 5db6585
+Merge: c86062f9 5db6585c
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Mar 8 16:41:21 2013 +0100
 
@@ -13314,7 +17409,7 @@
  4 files changed, 30 insertions(+), 10 deletions(-)
 
 commit c86062f982d6eb08cb27b654b6317c71ab77c692
-Merge: 677e5b2 4e142b6
+Merge: 677e5b26 4e142b60
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon Mar 4 20:13:36 2013 +0100
 
@@ -13390,7 +17485,7 @@
  14 files changed, 145 insertions(+), 237 deletions(-)
 
 commit 1f4a012f7570ffd2120e3e8c2236de5408f3dda3
-Merge: 15d4039 a766740
+Merge: 15d40392 a766740c
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Mar 1 19:16:52 2013 +0100
 
@@ -13408,7 +17503,7 @@
  1 file changed, 10 insertions(+), 4 deletions(-)
 
 commit 15d40392a29dded8a29c2dc9d7c15b402515e033
-Merge: be5d9af 39882df
+Merge: be5d9af3 39882dfe
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu Feb 28 19:46:59 2013 +0100
 
@@ -13467,7 +17562,7 @@
  11 files changed, 139 insertions(+), 45 deletions(-)
 
 commit 60c5e072d4b930507469e6e8c234971725a4aa26
-Merge: 0d42a6d 8d62625
+Merge: 0d42a6da 8d626256
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Feb 20 21:08:53 2013 +0100
 
@@ -13485,7 +17580,7 @@
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 commit 0d42a6dab479d27de1ecb2b47ad3f7568b1ee638
-Merge: 7eb7880 8fb243b
+Merge: 7eb78809 8fb243bf
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Feb 20 00:00:09 2013 +0100
 
@@ -13512,7 +17607,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 7eb7880907cb7b6bd1032013d6ce4c49aa3525c4
-Merge: 2c84acb 1389aa4
+Merge: 2c84acbf 1389aa41
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Feb 19 22:26:37 2013 +0100
 
@@ -13528,7 +17623,7 @@
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 commit 2c84acbfd02eeeaf0d20542798e907cb011c1e57
-Merge: 401c35b ffd33e7
+Merge: 401c35b7 ffd33e7b
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Feb 19 11:32:11 2013 +0100
 
@@ -13562,7 +17657,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 94364adade4dc27e5d80bc14511d4f2b7ea4ab0d
-Merge: 164805b 47f30fa
+Merge: 164805b4 47f30fa9
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon Feb 18 20:34:34 2013 +0100
 
@@ -13594,7 +17689,7 @@
  6 files changed, 198 insertions(+), 160 deletions(-)
 
 commit 527b91a0ef97906041ffe57e88f0d26e1c407af0
-Merge: df35562 95609be
+Merge: df355624 95609be5
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon Feb 18 19:49:14 2013 +0100
 
@@ -13613,7 +17708,7 @@
  1 file changed, 4 insertions(+), 4 deletions(-)
 
 commit df3556240d5e4b4546b3c42b29be6d2be83a2802
-Merge: 4dacd7c 5c7057c
+Merge: 4dacd7cd 5c7057c6
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Feb 12 23:55:24 2013 +0100
 
@@ -13630,7 +17725,7 @@
  2 files changed, 10 insertions(+), 10 deletions(-)
 
 commit 4dacd7cdeb19d16fe7737c71e34904c7363c6b63
-Merge: 7f2c255 9fc4b9f
+Merge: 7f2c255f 9fc4b9f7
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Feb 12 22:59:56 2013 +0100
 
@@ -13669,7 +17764,7 @@
  11 files changed, 110 insertions(+), 24 deletions(-)
 
 commit c2ebcbea2267f861c491c0cd6c1fbf2dc2aff7d2
-Merge: 48ed05d dca21f8
+Merge: 48ed05d9 dca21f86
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Feb 10 12:01:13 2013 +0100
 
@@ -14703,7 +18798,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit c7ae96b162e8a05269a54c31f8e7c411edc84553
-Merge: 1f279c3 b1dacd1
+Merge: 1f279c32 b1dacd1e
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Dec 1 21:26:24 2012 +0100
 
@@ -15439,7 +19534,7 @@
  8 files changed, 22 insertions(+), 8 deletions(-)
 
 commit 98b7cfd289abb53a745a88d6ec99e95df477fc8f
-Merge: 40efa72 d254174
+Merge: 40efa729 d254174e
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Nov 9 00:38:19 2012 +0100
 
@@ -15679,7 +19774,7 @@
  1 file changed, 438 insertions(+), 438 deletions(-)
 
 commit 77a980472e76b568346a49057b0217111a14a4cd
-Merge: 74d6217 46fb365
+Merge: 74d6217b 46fb3653
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Oct 23 00:23:53 2012 +0200
 
@@ -15737,7 +19832,7 @@
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 commit f38194cfae8f8690bc3767cbdcf140519564366c
-Merge: 80cf434 5312984
+Merge: 80cf4347 5312984b
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Fri Oct 19 00:02:02 2012 +0200
 
@@ -15764,7 +19859,7 @@
  2 files changed, 38 insertions(+)
 
 commit 0b3ff2dc4e1ba37dd66f5913b10a9d69e31c40ce
-Merge: fb5cb0f 528b64b
+Merge: fb5cb0fb 528b64bb
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Oct 17 00:28:40 2012 +0200
 
@@ -16040,7 +20135,7 @@
  2 files changed, 8 insertions(+)
 
 commit 042d332c1c9f628e3bfaabf3da9e04436a8677b5
-Merge: 7b9a9f8 e044814
+Merge: 7b9a9f80 e044814c
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu Oct 4 00:53:01 2012 +0200
 
@@ -16058,7 +20153,7 @@
  1 file changed, 4 insertions(+)
 
 commit 7b9a9f809d07303fe5adff9210731613df8b2adf
-Merge: 3b0962c 9451b7a
+Merge: 3b0962cd 9451b7a6
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Oct 3 01:24:04 2012 +0200
 
@@ -16076,7 +20171,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 3b0962cd14b15ce92c0916f58ed5ba00aebe80b0
-Merge: a9d7ea2 42908e6
+Merge: a9d7ea2e 42908e6e
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Oct 2 19:51:48 2012 +0200
 
@@ -16094,7 +20189,7 @@
  1 file changed, 8 insertions(+), 7 deletions(-)
 
 commit a9d7ea2eb549acbf6ca7e2a299ffed46ff3d8758
-Merge: 397d7b4 9bb6845
+Merge: 397d7b45 9bb68456
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Sep 26 15:31:29 2012 +0200
 
@@ -16115,7 +20210,7 @@
  1 file changed, 1 insertion(+)
 
 commit 397d7b4597ad4bc8ab41fd7a99078473a3c93eb0
-Merge: 6013d49 2c0f70a
+Merge: 6013d49d 2c0f70af
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Sep 26 15:00:04 2012 +0200
 
@@ -16198,7 +20293,7 @@
  1 file changed, 8 insertions(+)
 
 commit 6013d49d852c58c4c23f787fd7dd64731c0918f1
-Merge: b97c28c 671df5d
+Merge: b97c28c4 671df5da
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Sep 26 00:53:28 2012 +0200
 
@@ -16214,7 +20309,7 @@
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 commit b97c28c42a18d1c2a8fabea52c092d948811d582
-Merge: 32bb874 f8c116f
+Merge: 32bb8741 f8c116f1
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Sep 25 23:22:23 2012 +0200
 
@@ -16383,7 +20478,7 @@
  3 files changed, 48 insertions(+), 34 deletions(-)
 
 commit e8b6d2ac3a874dd5de166b52625fa628004ea5fe
-Merge: 7cb4072 9f51baa
+Merge: 7cb40726 9f51baaf
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Sep 16 14:08:34 2012 +0200
 
@@ -16408,7 +20503,7 @@
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 commit 7cb40726f9e80ee2b2f27ca6ce151b46c6ec091d
-Merge: e980d11 c6d7084
+Merge: e980d110 c6d7084d
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Sep 16 13:50:19 2012 +0200
 
@@ -16430,7 +20525,7 @@
  3 files changed, 131 insertions(+), 2 deletions(-)
 
 commit e980d11061c19f13c75f93506e07903b4d1c7f97
-Merge: b72c02d 3658088
+Merge: b72c02d1 36580883
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Sep 15 20:41:50 2012 +0200
 
@@ -16603,7 +20698,7 @@
  14 files changed, 1415 insertions(+), 487 deletions(-)
 
 commit cb2ed646c4ef4161e443ee0a377d1111b3be28ff
-Merge: f3a1b76 3ce4d21
+Merge: f3a1b765 3ce4d213
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Sep 11 19:29:19 2012 +0200
 
@@ -16679,7 +20774,7 @@
  6 files changed, 19 insertions(+), 6 deletions(-)
 
 commit 1b40cdd9f863cd3868db85b5ccfa77a8350c56d6
-Merge: 6c40a55 b3e86db
+Merge: 6c40a553 b3e86dbd
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon Sep 10 18:49:52 2012 +0200
 
@@ -16698,7 +20793,7 @@
  2 files changed, 14 insertions(+), 4 deletions(-)
 
 commit 6c40a553a3c8825931c59797059392fd110531cc
-Merge: 17fc1bf 558a7d9
+Merge: 17fc1bfa 558a7d9b
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Sep 9 23:27:40 2012 +0200
 
@@ -16807,7 +20902,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 17fc1bfa8013cafe3b348f0cc07ef08bf9c7dd9a
-Merge: e0118be a4f5911
+Merge: e0118be3 a4f59113
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Sep 9 12:52:49 2012 +0200
 
@@ -16832,7 +20927,7 @@
  1 file changed, 8 insertions(+)
 
 commit e0118be3ba38bd00fa2a9c20c5b4cd82e820ba0b
-Merge: 2c41430 ccd3db5
+Merge: 2c414307 ccd3db5a
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Sep 8 18:15:43 2012 +0200
 
@@ -21346,7 +25441,7 @@
  9 files changed, 308 insertions(+), 167 deletions(-)
 
 commit b505920db6d3dac58c7e9f4f8917f4c4449b08a0
-Merge: 9250449 a631281
+Merge: 9250449a a6312817
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Feb 14 19:18:54 2012 +0100
 
@@ -21490,7 +25585,7 @@
  12 files changed, 26 insertions(+), 49 deletions(-)
 
 commit ea6bc19564865e04431d9154802ae7fba975a716
-Merge: e17f095 92ce79f
+Merge: e17f0956 92ce79f4
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon Feb 6 01:18:25 2012 +0100
 
@@ -23215,7 +27310,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 718c735aed540aa49b8dde250ca886c6ad93f5b6
-Merge: 6721916 69707f0
+Merge: 6721916c 69707f0a
 Author: Carlos Garcia Campos <carlosgc at gnome.org>
 Date:   Sat Sep 24 09:38:52 2011 +0200
 
@@ -23313,7 +27408,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 6721916c92d720947b3285c85fdbe6610c6bf013
-Merge: 8456a6e e23f6b9
+Merge: 8456a6e1 e23f6b9c
 Author: Carlos Garcia Campos <carlosgc at gnome.org>
 Date:   Sun Sep 18 16:31:10 2011 +0200
 
@@ -23435,7 +27530,7 @@
  2 files changed, 91 insertions(+), 25 deletions(-)
 
 commit 258d56ba85902a8ab50eec3fe66dd6425226fa59
-Merge: 72a7736 12c6239
+Merge: 72a77363 12c6239c
 Author: Carlos Garcia Campos <carlosgc at gnome.org>
 Date:   Sun Sep 18 11:12:38 2011 +0200
 
@@ -25122,7 +29217,7 @@
  4 files changed, 69 insertions(+), 66 deletions(-)
 
 commit f298e7f844105f2d9a36144e59be86c341e37507
-Merge: 2a6bd7a 0ca5453
+Merge: 2a6bd7aa 0ca5453f
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Aug 30 16:21:58 2011 +0200
 
@@ -33711,7 +37806,7 @@
  1 file changed, 7 insertions(+), 2 deletions(-)
 
 commit 0819acd52a2ce74f0e176626d7b2233e10232d53
-Merge: c4ddbe8 92738eb
+Merge: c4ddbe89 92738ebb
 Author: Pino Toscano <pino at kde.org>
 Date:   Mon Mar 22 21:43:01 2010 +0100
 
@@ -35115,7 +39210,7 @@
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 commit a18dab9e53a20a76eb46fa3a868fffdd3c754ce2
-Merge: fa09892 f3862f7
+Merge: fa098929 f3862f7d
 Author: Pino Toscano <pino at kde.org>
 Date:   Sun Feb 21 19:56:38 2010 +0100
 
@@ -41537,7 +45632,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit bfb975466f0ff78e9e292b6af7cac66e4c331456
-Merge: 3e27892 ea3546f
+Merge: 3e278925 ea3546f8
 Author: Pino Toscano <pino at kde.org>
 Date:   Mon Dec 22 00:29:38 2008 +0100
 
@@ -42649,7 +46744,7 @@
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 commit a29984ab777c64a1cb286b667a6a91ad9b191f40
-Merge: f399afe 6865872
+Merge: f399afe6 68658721
 Author: Pino Toscano <pino at kde.org>
 Date:   Sun Sep 28 23:39:08 2008 +0200
 
@@ -43271,7 +47366,7 @@
  1 file changed, 3 insertions(+)
 
 commit 630aa133017d15ddc7bf96c79f43c5b60fa9749a
-Merge: b2bc9b3 de82255
+Merge: b2bc9b3f de822554
 Author: Pino Toscano <pino at kde.org>
 Date:   Tue Sep 2 01:25:55 2008 +0200
 
@@ -43576,7 +47671,7 @@
  4 files changed, 5 insertions(+), 5 deletions(-)
 
 commit 22f6af73961686895f207fe13022a21333455862
-Merge: 12a9e42 6d6913a
+Merge: 12a9e427 6d6913a7
 Author: Pino Toscano <pino at kde.org>
 Date:   Sun Aug 24 19:03:24 2008 +0200
 
@@ -45064,7 +49159,7 @@
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 commit f9c7e8037b7165b6271ce7aea0d315053c4d66a5
-Merge: 59d33d8 f5fec4f
+Merge: 59d33d8e f5fec4fd
 Author: Pino Toscano <pino at kde.org>
 Date:   Sat Apr 26 18:09:59 2008 +0200
 
@@ -45366,7 +49461,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit bc2b2ffd2144f951c311e968fba4bc50b7c43ff3
-Merge: cd5afe6 bacc1dd
+Merge: cd5afe6d bacc1dd9
 Author: Iñigo Martínez <inigomartinez at gmail.com>
 Date:   Sat Apr 12 17:40:49 2008 +0200
 
@@ -46270,7 +50365,7 @@
  1 file changed, 4 insertions(+), 3 deletions(-)
 
 commit 0b2c3bb25c908b07e760d824dbfe93c6051812aa
-Merge: 362fe01 9c472f7
+Merge: 362fe013 9c472f76
 Author: Iñigo Martínez <inigomartinez at gmail.com>
 Date:   Wed Mar 12 00:23:58 2008 +0100
 
@@ -46311,7 +50406,7 @@
  4 files changed, 11 insertions(+), 10 deletions(-)
 
 commit d7e642732ced592362d9787bddadb7a110dcc5a5
-Merge: 3642f0c 2d6c605
+Merge: 3642f0c4 2d6c6053
 Author: Iñigo Martínez <inigomartinez at gmail.com>
 Date:   Tue Mar 11 23:41:59 2008 +0100
 
@@ -46358,7 +50453,7 @@
  2 files changed, 620 insertions(+)
 
 commit 43e5dd941d4bc35c4eebbad66c13235639e0c1a0
-Merge: aab1768 4fdd254
+Merge: aab17684 4fdd2543
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Tue Mar 11 22:31:22 2008 +0100
 
@@ -46445,7 +50540,7 @@
  1 file changed, 40 insertions(+), 5 deletions(-)
 
 commit 94ceb3cae79dc7786fa59fd889a87160780ed5df
-Merge: 0f9e843 35f34bd
+Merge: 0f9e8430 35f34bd4
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Mar 9 23:34:11 2008 +0100
 
@@ -46589,7 +50684,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit 5b2f8f21fca63508570a0c77c6f7221a322e6e57
-Merge: 7e65118 4254f12
+Merge: 7e651186 4254f123
 Author: Pino Toscano <pino at kde.org>
 Date:   Wed Feb 27 22:10:12 2008 +0100
 
@@ -46614,7 +50709,7 @@
  2 files changed, 39 insertions(+), 6 deletions(-)
 
 commit 4254f1237ebed09b8e1c85f935a20bde3d8f36ff
-Merge: ed6c0c2 0569ae7
+Merge: ed6c0c26 0569ae76
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Feb 27 20:44:27 2008 +0100
 
@@ -46664,7 +50759,7 @@
  4 files changed, 6 insertions(+), 6 deletions(-)
 
 commit 0569ae76b6af1723b4606af189242a23199f387d
-Merge: f395531 d8eba8c
+Merge: f395531a d8eba8c1
 Author: Brad Hards <bradh at kde.org>
 Date:   Thu Feb 28 06:26:09 2008 +1100
 
@@ -47304,7 +51399,7 @@
  5 files changed, 102 insertions(+), 6 deletions(-)
 
 commit 3c407efe9f1f0cc3f6366d3a2b6e9b687656cc95
-Merge: 51f0cea 7f4acb8
+Merge: 51f0cea0 7f4acb87
 Author: Pino Toscano <pino at kde.org>
 Date:   Mon Feb 18 21:30:42 2008 +0100
 
@@ -47630,7 +51725,7 @@
  1 file changed, 1 insertion(+)
 
 commit 9cfe10ab7f51d329647e102e446baaef043d8cc6
-Merge: e918729 7d65b4d
+Merge: e9187292 7d65b4da
 Author: Pino Toscano <pino at kde.org>
 Date:   Wed Feb 13 20:53:43 2008 +0100
 
@@ -47719,7 +51814,7 @@
  2 files changed, 4 insertions(+), 4 deletions(-)
 
 commit 7574cb71f24ce5b32427f243c39b6029fb58ec81
-Merge: e798802 4e45e5c
+Merge: e798802f 4e45e5ca
 Author: Pino Toscano <pino at kde.org>
 Date:   Wed Feb 13 01:07:31 2008 +0100
 
@@ -47867,7 +51962,7 @@
  3 files changed, 115 insertions(+)
 
 commit 278b33f25df418ef12798100002845a3e2ceebd3
-Merge: c730b33 fdb0a4a
+Merge: c730b33f fdb0a4a2
 Author: Pino Toscano <pino at kde.org>
 Date:   Mon Feb 11 00:57:24 2008 +0100
 
@@ -47938,7 +52033,7 @@
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 commit d3275e4263372b534c276f81d0c997ecb6675487
-Merge: c2186c1 5347a97
+Merge: c2186c18 5347a97e
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sat Feb 9 23:57:03 2008 +0100
 
@@ -47978,7 +52073,7 @@
  2 files changed, 37 insertions(+), 2 deletions(-)
 
 commit afb255366d56551bdc307766199bef9c5021d3ac
-Merge: 8c44b17 8cb0e75
+Merge: 8c44b175 8cb0e752
 Author: Pino Toscano <pino at kde.org>
 Date:   Sat Feb 9 17:58:49 2008 +0100
 
@@ -48015,7 +52110,7 @@
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 commit 5fb0c9d31c1abf2e6ad306c112fbd2a7c33d8772
-Merge: 2655663 2255c85
+Merge: 26556636 2255c85e
 Author: Carlos Garcia Campos <carlosgc at gnome.org>
 Date:   Sat Feb 9 13:15:15 2008 +0100
 
@@ -48036,7 +52131,7 @@
  4 files changed, 79 insertions(+), 7 deletions(-)
 
 commit 2255c85e4939a0752083dca21984ff4398baf8d2
-Merge: 5ba9287 56c9246
+Merge: 5ba92876 56c92460
 Author: Pino Toscano <pino at kde.org>
 Date:   Sat Feb 9 12:49:45 2008 +0100
 
@@ -48165,7 +52260,7 @@
  3 files changed, 11 insertions(+), 11 deletions(-)
 
 commit 1aeba15b5eb9b30943259824678ebc9e4f56e870
-Merge: a489063 22d10c1
+Merge: a4890637 22d10c19
 Author: Pino Toscano <pino at kde.org>
 Date:   Fri Feb 8 01:39:16 2008 +0100
 
@@ -48278,7 +52373,7 @@
  1 file changed, 13 insertions(+), 13 deletions(-)
 
 commit c31990dfe50c7a0e3999e6d967699fce5ccb3339
-Merge: 7701e2a 6d58cda
+Merge: 7701e2a5 6d58cda8
 Author: Pino Toscano <pino at kde.org>
 Date:   Tue Feb 5 00:38:00 2008 +0100
 
@@ -48305,7 +52400,7 @@
  1 file changed, 4 insertions(+), 1 deletion(-)
 
 commit aa0435f1544fe1adcf10173e34eaeaf2a7a703c7
-Merge: b43f4e9 37600b5
+Merge: b43f4e9a 37600b5e
 Author: Pino Toscano <pino at kde.org>
 Date:   Mon Feb 4 20:56:53 2008 +0100
 
@@ -48491,7 +52586,7 @@
  4 files changed, 13 insertions(+), 8 deletions(-)
 
 commit 77b91c852ad3d5554afc03aee92a1d928f233401
-Merge: 0babb0e 0533696
+Merge: 0babb0eb 05336967
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Mon Jan 28 20:44:34 2008 +0100
 
@@ -48927,7 +53022,7 @@
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 commit 348f4f9d9d5b0f91da6f46e0fcefec80255d4179
-Merge: 8a8a4f0 4eca2e0
+Merge: 8a8a4f01 4eca2e04
 Author: Albert Astals Cid <tsdgeos at bluebox.localdomain>
 Date:   Sat Jan 5 23:03:06 2008 +0100
 
@@ -49223,7 +53318,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit e807f9c72c7f0c5cc0655918f676f4af54739442
-Merge: bf57117 e2ea743
+Merge: bf57117d e2ea7430
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Dec 9 18:07:30 2007 +0100
 
@@ -49271,7 +53366,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 commit bb0ec68f21d355081ff75aad641bc3809141e398
-Merge: 5a34cdd b925ea2
+Merge: 5a34cddf b925ea23
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Thu Dec 6 18:38:54 2007 +0100
 
@@ -49448,7 +53543,7 @@
  1 file changed, 15 insertions(+), 6 deletions(-)
 
 commit 944d327fd7036332a33b4ad6476ceca7a650ef6e
-Merge: fb1d1f4 c340255
+Merge: fb1d1f45 c340255f
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Wed Nov 7 23:52:47 2007 +0100
 
@@ -49496,7 +53591,7 @@
  2 files changed, 46 insertions(+), 1 deletion(-)
 
 commit 570fe464a2aae4f22d0b47cce73b8bc36b116e9f
-Merge: 1c7b7a0 7875067
+Merge: 1c7b7a0c 78750679
 Author: Brad Hards <bradh at kde.org>
 Date:   Mon Nov 5 15:55:39 2007 +1100
 
@@ -49616,7 +53711,7 @@
  1 file changed, 8 deletions(-)
 
 commit d694e1dd042fb97fbc62046b69cafe30d6f9ea58
-Merge: ba5b31c 432e657
+Merge: ba5b31c6 432e657a
 Author: Albert Astals Cid <aacid at kde.org>
 Date:   Sun Nov 4 13:26:47 2007 +0100
 
@@ -49745,7 +53840,7 @@
  3 files changed, 522 insertions(+), 1 deletion(-)
 
 commit 6bd637dc135045b20abf024d394538d7a3160795
-Merge: c01ab71 25b273d
+Merge: c01ab714 25b273db
 Author: Albert Astals Cid <tsdgeos at bluebox.localdomain>
 Date:   Tue Oct 23 23:27:01 2007 +0200
 
@@ -50006,7 +54101,7 @@
  5 files changed, 527 insertions(+), 4 deletions(-)
 
 commit d0c0f26d2c95232c216e3daa15e98a3aff14ac27
-Merge: 59d55f7 38d5bb1
+Merge: 59d55f73 38d5bb15
 Author: Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 Date:   Tue Sep 25 03:33:52 2007 -0700
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/ConfigureChecks.cmake
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/ConfigureChecks.cmake	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/ConfigureChecks.cmake	2018-02-27 23:34:23 UTC (rev 795)
@@ -13,15 +13,9 @@
 
 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)
 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)
@@ -35,10 +29,10 @@
 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)
+check_function_exists(strtok_r HAVE_STRTOK_R)
 
 macro(CHECK_FOR_DIR include var)
   check_c_source_compiles(

Modified: branches/stable/source/src/libs/poppler/poppler-src/INSTALL
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/INSTALL	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/INSTALL	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,236 +1,104 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
-Software Foundation, Inc.
-
-This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
-
 Basic Installation
 ==================
 
-These are generic installation instructions.
+mkdir build
+cd build
+cmake ..
+make
+make install
 
-   The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
 
-   It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring.  (Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.)
+CMake configuration options can be set using the -D option. eg
 
-   If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
+  cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=release
 
-   The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'.  You only need
-`configure.ac' if you want to change it or regenerate `configure' using
-a newer version of `autoconf'.
 
-The simplest way to compile this package is:
+Build Options
+=============
 
-  1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.  If you're
-     using `csh' on an old version of System V, you might need to type
-     `sh ./configure' instead to prevent `csh' from trying to execute
-     `configure' itself.
+Set install prefix:
 
-     Running `configure' takes awhile.  While running, it prints some
-     messages telling which features it is checking for.
+  -DCMAKE_INSTALL_PREFIX=<path>
 
-  2. Type `make' to compile the package.
+Set build type. This sets the standard compiler flags for the build
+type.
 
-  3. Optionally, type `make check' to run any self-tests that come with
-     the package.
+  -DCMAKE_BUILD_TYPE=debug  or  -DCMAKE_BUILD_TYPE=release
 
-  4. Type `make install' to install the programs and any data files and
-     documentation.
+Set compiler flags:
 
-  5. You can remove the program binaries and object files from the
-     source code directory by typing `make clean'.  To also remove the
-     files that `configure' created (so you can compile the package for
-     a different kind of computer), type `make distclean'.  There is
-     also a `make maintainer-clean' target, but that is intended mainly
-     for the package's developers.  If you use it, you may have to get
-     all sorts of other programs in order to regenerate files that came
-     with the distribution.
+  -DCMAKE_CXX_FLAGS=<flags>   or set CXXFLAGS environment variable
 
-Compilers and Options
-=====================
+Set linker flags:
 
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about.  Run `./configure --help' for
-details on some of the pertinent environment variables.
+  -DCMAKE_LD_FLAGS=<flags>   or set LDFLAGS environment variable
 
-   You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment.  Here
-is an example:
 
-     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
-
-   *Note Defining Variables::, for more details.
-
-Compiling For Multiple Architectures
-====================================
-
-You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory.  To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'.  `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
-   If you have to use a `make' that does not support the `VPATH'
-variable, you have to compile the package for one architecture at a
-time in the source code directory.  After you have installed the
-package for one architecture, use `make distclean' before reconfiguring
-for another architecture.
-
-Installation Names
-==================
-
-By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc.  You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PREFIX'.
-
-   You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PREFIX', the package will
-use PREFIX as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
-   In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files.  Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
-   If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
 Optional Features
 =================
 
-Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System).  The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
+  -D<FEATURE>=<ON|OFF>
 
-   For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
+eg
 
-Specifying the System Type
-==========================
+  -DENABLE_SPLASH=ON -DBUILD_GTK_TESTS=OFF
 
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
-`--build=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
+A list of all options can be display with the commmand:
 
-     CPU-COMPANY-SYSTEM
+  egrep '^ *(option|set.*STRING)' CMakeLists.txt
 
-where SYSTEM can have one of these forms:
+Alternatively, the options can be edited by running "ccmake ." in the
+build directory.
 
-     OS KERNEL-OS
 
-   See the file `config.sub' for the possible values of each field.  If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the machine type.
+Cross Compiling
+===============
 
-   If you are _building_ compiler tools for cross-compiling, you should
-use the `--target=TYPE' option to select the type of system they will
-produce code for.
+A toolchain file is required to specify the target specific compiler
+tools. Run cmake with the option:
 
-   If you want to _use_ a cross compiler, that generates code for a
-platform different from the build platform, you should specify the
-"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
+  -DCMAKE_TOOLCHAIN_FILE=<Toolchain file>
 
-Sharing Defaults
-================
+A sample toolchain for a 64-bit mingw build is shown below. Replace
+/path/to/win/root with the install prefix for the target environment.
 
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
+  set(CMAKE_SYSTEM_NAME Windows)
+  set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
+  set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
+  set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
+  set(CMAKE_FIND_ROOT_PATH  /usr/x86_64-w64-mingw32 /path/to/win/root )
+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 
-Defining Variables
-==================
 
-Variables not defined in a site shell script can be set in the
-environment passed to `configure'.  However, some packages may run
-configure again during the build, and the customized values of these
-variables may be lost.  In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'.  For example:
+Debugging Options
+=================
 
-     ./configure CC=/usr/local2/bin/gcc
+Debug Build Types
+-----------------
+Release build with debugging information:
+  -DCMAKE_BUILD_TYPE=relwithdebinfo
 
-causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).  Here is a another example:
+Debug build with optimization except for some code re-ordering optimizations:
+  -DCMAKE_BUILD_TYPE=debug
 
-     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+Debug build with no optimization:
+  -DCMAKE_BUILD_TYPE=debugfull
 
-Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
-configuration-related scripts to be executed by `/bin/bash'.
+Release build with debugging and profiling information:
+  -DCMAKE_BUILD_TYPE=profile
 
-`configure' Invocation
-======================
 
-`configure' recognizes the following options to control how it operates.
+Address Sanitizer
+-----------------
+Ensure the extra cmake modules are available (may be a separate
+package) then use -DECM_ENABLE_SANITIZERS to specify the santizers. eg
 
-`--help'
-`-h'
-     Print a summary of the options to `configure', and exit.
+  -DECM_ENABLE_SANITIZERS='address;leak;undefined'
 
-`--version'
-`-V'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
-
-`--cache-file=FILE'
-     Enable the cache: use and save the results of the tests in FILE,
-     traditionally `config.cache'.  FILE defaults to `/dev/null' to
-     disable caching.
-
-`--config-cache'
-`-C'
-     Alias for `--cache-file=config.cache'.
-
-`--quiet'
-`--silent'
-`-q'
-     Do not print messages saying which checks are being made.  To
-     suppress all normal output, redirect it to `/dev/null' (any error
-     messages will still be shown).
-
-`--srcdir=DIR'
-     Look for the package's source code in directory DIR.  Usually
-     `configure' can determine that directory automatically.
-
-`configure' also accepts some other, not widely useful, options.  Run
-`configure --help' for more details.
-
+Some options may only be available with clang. Use
+-DCMAKE_CXX_COMPILER=clang++ to build with clang.

Deleted: branches/stable/source/src/libs/poppler/poppler-src/Makefile.am
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/Makefile.am	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/Makefile.am	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,132 +0,0 @@
-ACLOCAL_AMFLAGS = -I m4
-DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --with-testdatadir=$(TESTDATADIR)
-
-if BUILD_SPLASH_OUTPUT
-splash_subdir = splash
-splash_pc_file = poppler-splash.pc
-endif
-
-if BUILD_CAIRO_OUTPUT
-cairo_pc_file = poppler-cairo.pc
-endif
-
-if BUILD_POPPLER_GLIB
-glib_subdir = glib
-glib_pc_file = poppler-glib.pc
-endif
-
-if BUILD_POPPLER_QT5
-qt5_subdir = qt5
-qt5_pc_file = poppler-qt5.pc
-endif
-
-if BUILD_POPPLER_QT4
-qt4_subdir = qt4
-qt4_pc_file = poppler-qt4.pc
-endif
-
-
-if BUILD_POPPLER_CPP
-cpp_subdir = cpp
-cpp_pc_file = poppler-cpp.pc
-endif
-
-SUBDIRS = goo fofi $(splash_subdir) poppler utils $(glib_subdir) test $(qt4_subdir) $(qt5_subdir) $(cpp_subdir)
-
-EXTRA_DIST =					\
-	README-XPDF				\
-	poppler.pc.in				\
-	poppler-uninstalled.pc.in		\
-	poppler-cairo.pc.in			\
-	poppler-cairo-uninstalled.pc.in		\
-	poppler-splash.pc.in			\
-	poppler-splash-uninstalled.pc.in	\
-	poppler-qt4.pc.in			\
-	poppler-qt4-uninstalled.pc.in		\
-	poppler-qt5.pc.in			\
-	poppler-qt5-uninstalled.pc.in		\
-	poppler-cpp.pc.in			\
-	poppler-cpp-uninstalled.pc.in
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA =				\
-	poppler.pc				\
-	$(cairo_pc_file)			\
-	$(splash_pc_file)			\
-	$(glib_pc_file)				\
-	$(qt4_pc_file)				\
-	$(qt5_pc_file)				\
-	$(cpp_pc_file)
-
-# Add CMake buildsystem files here so they get added on make dist
-EXTRA_DIST +=							\
-	cpp/tests/CMakeLists.txt				\
-	cpp/CMakeLists.txt					\
-	glib/demo/CMakeLists.txt				\
-	glib/CMakeLists.txt					\
-	glib/poppler-features.h.cmake				\
-	qt4/src/CMakeLists.txt					\
-	qt4/tests/CMakeLists.txt				\
-	qt4/CMakeLists.txt					\
-	qt4/demos/CMakeLists.txt				\
-	qt5/src/CMakeLists.txt					\
-	qt5/tests/CMakeLists.txt				\
-	qt5/CMakeLists.txt					\
-	qt5/demos/CMakeLists.txt				\
-	test/CMakeLists.txt					\
-	utils/CMakeLists.txt					\
-	CMakeLists.txt						\
-	ConfigureChecks.cmake					\
-	cmake/modules/CheckFileOffsetBits.c			\
-	cmake/modules/CheckFileOffsetBits.cmake			\
-	cmake/modules/COPYING-CMAKE-SCRIPTS			\
-	cmake/modules/FindCairo.cmake				\
-	cmake/modules/FindFontconfig.cmake			\
-	cmake/modules/FindGLIB.cmake				\
-	cmake/modules/FindGObjectIntrospection.cmake		\
-	cmake/modules/FindGTK.cmake				\
-	cmake/modules/FindIconv.cmake				\
-	cmake/modules/FindLCMS.cmake				\
-	cmake/modules/FindLCMS2.cmake				\
-        cmake/modules/FindNSS3.cmake				\
-	cmake/modules/FindQt4.cmake				\
-	cmake/modules/GObjectIntrospectionMacros.cmake		\
-	cmake/modules/MacroBoolTo01.cmake			\
-	cmake/modules/MacroEnsureVersion.cmake			\
-	cmake/modules/MacroOptionalFindPackage.cmake		\
-	cmake/modules/MacroPushRequiredVars.cmake		\
-	cmake/modules/PopplerDefaults.cmake			\
-	cmake/modules/PopplerMacros.cmake			\
-	cmake/modules/FindLIBOPENJPEG.cmake			\
-	config.h.cmake						\
-	poppler-cairo.pc.cmake					\
-	poppler/poppler-config.h.cmake				\
-	poppler-cpp.pc.cmake					\
-	poppler-glib.pc.cmake					\
-	poppler-qt4.pc.cmake					\
-	poppler-qt5.pc.cmake					\
-	poppler-splash.pc.cmake					\
-	poppler.pc.cmake
-
-
-
-distclean-local:
-	if test "$(srcdir)" = "."; then :; else \
-		rm -f ChangeLog; \
-	fi
-
-ChangeLog:
-	$(AM_V_GEN) if test -d "$(srcdir)/.git"; then \
-	  (GIT_DIR=$(top_srcdir)/.git ./missing --run git log --stat) | fmt --split-only > $@.tmp \
-	  && mv -f $@.tmp $@ \
-	  || ($(RM) $@.tmp; \
-	      echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
-	      (test -f $@ || echo git log is required to generate this file >> $@)); \
-	else \
-	  test -f $@ || \
-	  (echo A git checkout and git log is required to generate ChangeLog >&2 && \
-	  echo A git checkout and git log is required to generate this file >> $@); \
-	fi
-
-.PHONY: ChangeLog
-

Modified: branches/stable/source/src/libs/poppler/poppler-src/NEWS
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/NEWS	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/NEWS	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,3 +1,210 @@
+Release 0.62.0
+        core:
+         * Stop supporting lcms1, you really want to use lcms2 :)
+         * Stop supporting openjpeg1, you really want to use openjpeg2 :)
+         * Open files that state 8 bits as third field of W. Bug #103469
+         * GfxLabColorSpace::parse: Fix crash in broken documents. Bug #103582
+         * Fix leak if parseDA fails
+         * Include glibc.h where needed
+         * Document the meaning of the 'type' integer of a shading
+         * Fix UTF test fail
+         * INSTALL: add debug options
+
+        qt5:
+         * Add API to let the rendering process callback to get a partial rendering. Bug #103372
+
+        qt4:
+         * Remove the Qt4 frontend
+
+        utils:
+         * Support unicode on windows console
+         * pdfsig: install man page
+         * sort encoding list
+
+        glib:
+         * demo: fix warning
+
+Release 0.61.1
+        core:
+         * CairoOutputDev: don't overflow y * stride when accessing image data
+
+        cpp:
+         * Fix for corrupted image files on Windows. Bug #102494
+
+        build system:
+         * Fix incorrect paths in .pc files. Bug #103578
+         * add the custom buildtests target only once. Bug #103003
+
+Release 0.61.0
+        core:
+         * Fix crashes in broken files
+         * Cleanup unused functions from GlobalParams
+         * Tweak LZWStream::processNextCode error handling. Bug #103174
+         * Warning fixes
+         * Remove t1lib code
+
+        qt5:
+         * Clean up the remaining Splash code in Arthur backend. Bug #103117
+         * ArthurOutputDev: Properly implement saveState/restoreState. Bug #103118
+         * Fix leak in ArthurOutputDev::updateFont. Bug #103508
+
+        build system:
+         * Use GNUInstallDirs. Bug #103211
+         * mingw: Install pkg-config files
+         * mingw: change library names to include the soversion. Bug #103157
+         * Fix installing a .cc file as header
+         * Use -pthread flag instead of -lpthread
+
+Release 0.60.1
+        qt5:
+         * ArthurOutputDev: Add missing 'return' in error paths
+
+        build system:
+         * FindLIBOPENJPEG.cmake: Add CheckCXXSourceCompiles
+
+Release 0.60.0
+        core:
+         * Enable libcurl support by default
+         * PSOutputDev: Fix wrong text generation. Bug #102760
+         * Added methods to get and set the font size of text fields. Bug #101692
+         * CairoOutputDev: Do not extend the pattern in drawImageMaskRegular
+         * CairoOutputDev: do not use the custom downscaling for rendering images when using cairo >= 1.14
+         * Fix build with old clang
+         * Fix various crashes in broken files
+         * Fix some warnings
+         * Add some constness to the basic classes
+         * Remove unused functions from GlobalParams
+
+        qt5:
+         * Added methods to get and set the font size of text fields. Bug #101692
+         * Add whether renderToImage shows annotations
+         * ArthurOutputDev: Replace Splash font rendering by Qt font rendering
+         * ArthurOutputDev: Implement the drawSoftMaskedImage method
+         * ArthurOutputDev: Fix several small bugs related to dash pattern handling
+         * Fix two minor typos
+
+        build system:
+         * cmake is now the default build system
+         * autotools based build system has been removed
+
+         utils:
+         * pdfinfo: don't truncate dest name
+
+Release 0.59.0
+        core:
+         * Fix infinite recursion in NameTree parsing in broken files
+
+        utils:
+         * pdfunite: Fix API porting error that caused abort in some cases
+         * pdfinfo: Fix crashes and memory leaks when using -dests
+         * pdfinfo: use GooString.append instead of sprintf/strcat
+         * pdfimages: Fix warning when compiling with cygwin
+
+        build system:
+         * Fix cygwin 32-bit compile
+         * cmake tweaks
+
+
+Release 0.58.0
+        core:
+         * CairoOutputDev: cairo 1.14 now has high quality downscaling
+         * Signature related improvements. Bug #99271
+         * Tweak which cmap we use. Bug #101855
+         * Memory leak fixes
+         * Substantial rework of the internals
+         * win32: call ANSI functions directly. Bug #100312
+         * Add some documentation
+
+        qt5:
+         * Expose signature information.
+         * ArthurOutputDev: initialize the image with the paper color. Bug #102129
+         * Fix copy'n'paste bugs: Qt4 -> Qt5
+         * ArthurOutputDev: Properly set the QPainter transformation
+         * ArthurOutputDev: Use Qt::SvgMiterJoin instead of Qt::MiterJoin. Bug #102356
+
+        utils:
+         * pdfinfo: add -dests option to print named destinations. Bug #97262
+         * pdftocairo: add -jpegopt for setting jpeg compression parameters. Bug #45727
+         * pdftoppm: add -jpegopt for setting jpeg compression parameters. Bug #45727
+         * pdfimages: support listing/extracting inline images. Bug #25625
+
+        build system:
+         * cmake: Various Windows fixes
+         * cmake: Use -std=c++11 instead of -std=gnu++11
+
+        cpp:
+         * Fix page.text() not taking page orientation into account. Bug #94517
+
+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
+         * Fix crashes on multiple broken files
+
+        utils:
+         * pdfunite: Fix crash with broken documents. Bugs #101153 #101149
+
+Release 0.55.0
+        core:
+         * Fix abort in files with broken Decode arrays. KDE bug #379835
+         * Fix memory leak (and probably logic bug) parsing broken XRef entries. Bug #100775
+         * Fix memory leak when reconstructing broken files. Bug #100776
+         * Minor optimization
+         * Fix regression in GfxIndexedColorSpace::mapColorToBase. Bug #100931
+         * Fix memory leak in error condition
+
+        cpp:
+         * Return nullptr if the page at index can't be fetched. Bug #100981
+
+        build system:
+         * Fail by default if libjpeg is not available
+         * Fail by default if libopenjpeg2/1 is not available
+
+Release 0.54.0
+        core:
+         * Make XRef reconstruction a bit better. Bug #100509
+
+        glib:
+         * Expose movie play mode. Bug #99625
+         * demo: Show play mode in movie properties view
+
+        qt5:
+         * Compile with -DQT_NO_CAST_FROM_BYTEARRAY. Bug #100311
+
+        utils:
+         * pdfimages: don't fail listing if inline image data contains 'EI'. Bug #100737
+
+Release 0.53.0
+        core:
+         * Form support improvements
+         * SplashOutputDev: Fix memory leak when rendering images with colormap and matte color
+         * Minor fix in GlobalParams documentation
+
+        qt5:
+         * Expose form calculate order
+         * Expose Form additional actions
+
+        utils:
+         * pdfimages: support 16bpc png and tiff images. Bug #99988
+         * pdftohtml: fix small memory leak when constructing some filenames
+         * pdfinfo: fix leak when printing JS
+
+        build sytem:
+         * Compile in C++11 mode
+
 Release 0.52.0
         core:
          * Fix assert on reading some OCGs. Bug #99768

Added: branches/stable/source/src/libs/poppler/poppler-src/README.contributors
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/README.contributors	                        (rev 0)
+++ branches/stable/source/src/libs/poppler/poppler-src/README.contributors	2018-02-27 23:34:23 UTC (rev 795)
@@ -0,0 +1,21 @@
+If you want to become or are a poppler contributor, this is a README for you, keep reading!
+
+Licensing
+---------
+Only send patches to poppler if you agree to license (or relicense) them under
+GPLv2 and later (or something more permissive that can be "upgraded" to GPLv2
+and later). If you do not agree to this license, please explain the problem / bug
+and how you would solve it in words instead of code.
+
+By default all patches attached to the bugzilla or sent to the mailing list will
+be assumed to agree with the licensing expressed here.
+
+Channels of contact
+-------------------
+Poppler has three main channels of contact:
+ * The poppler mailing list http://lists.freedesktop.org/mailman/listinfo/poppler
+ * The poppler bug tracker (bugzilla) http://bugs.freedesktop.org
+ * The #poppler channel at the freenode network
+Do not hesitate to drop by talk to people there.
+
+And keep hacking on poppler!


Property changes on: branches/stable/source/src/libs/poppler/poppler-src/README.contributors
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Deleted: branches/stable/source/src/libs/poppler/poppler-src/TODO
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/TODO	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/TODO	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,40 +0,0 @@
-* general items:
-	- Investigate better (that is, normal) text selection.
-	- Use PDF font descriptors to create an FcPattern.
-	- Add simle performance benchmark that takes a pdf and renders
-	  every page 100 times or so.  Start keeping track of
-	  performance.
-	- make color space conversion stuff more sane (right now we
-	  hack around some of it in the cairo backend)
-	- move away from getChar to a more read(2) like interface
-
-* core:
-	- use libtiff for ccitt decoding?
-
-* Qt4 frontend:
-	- expose Rendition media through the MovieObject API
-	- use Q_GLOBAL_STATIC for GlobalParams?
-	- use QSettings or another system for loading/saving Document/global settings?
-	- expose API for lcms/color management system
-	- make the ArthurOutputDev optional
-
-* glib frontend:
-        - Sound/Movie actions support
-	- API to create annotations
-
-* new frontends:
-	- Java/JNI-based frontend for Android
-
-* cairo backend:
-  	- Implement linear/radial gradients with cairo gradients
-	- PDF Blend Modes
-	- Make the cairo backend feature complete and optimize the
-	  heck out of it.
-
-Jeff Muizelaar's TODO:
-	Short Term:
-	- factor out some of the color conversion code from CairoOutputDev and ArthurOutputDev.
-	- fix patterned text fills.
-	Long Term:
-	- use cairo glyph cache for type3 fonts.
-	- try to use cairo pattern support.

Modified: branches/stable/source/src/libs/poppler/poppler-src/config.h.cmake
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/config.h.cmake	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/config.h.cmake	2018-02-27 23:34:23 UTC (rev 795)
@@ -30,6 +30,12 @@
 /* Use cairo for rendering. */
 #cmakedefine HAVE_CAIRO 1
 
+/* Do we have any DCT decoder?. */
+#cmakedefine HAVE_DCT_DECODER 1
+
+/* Do we have any JPX decoder?. */
+#cmakedefine HAVE_JPX_DECODER 1
+
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */
 #cmakedefine HAVE_DIRENT_H 1
@@ -40,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
 
@@ -70,12 +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
-
 /* Define to 1 if you have the `z' library (-lz). */
 #cmakedefine HAVE_LIBZ 1
 
@@ -82,45 +79,30 @@
 /* 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
 
+/* Define to 1 if you have the `strcpy_s' function. */
+#cmakedefine HAVE_STRCPY_S 1
+
+/* 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
 
-/* Define to 1 if you have the <openjpeg.h> header file. */
-#cmakedefine HAVE_OPENJPEG_H 1
-
 /* 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
 
-/* 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
-
-/* 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
@@ -135,15 +117,9 @@
 /* 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
 
-/* 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
 
@@ -186,9 +162,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
 
@@ -201,9 +174,6 @@
 /* Use single precision arithmetic in the Splash backend */
 #cmakedefine USE_FLOAT 1
 
-/* Defines if use lcms1 */
-#cmakedefine USE_LCMS1 1
-
 /* Version number of package */
 #define VERSION "${POPPLER_VERSION}"
 
@@ -216,23 +186,19 @@
 /* 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
 #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@
 

Deleted: branches/stable/source/src/libs/poppler/poppler-src/config.h.in
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/config.h.in	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/config.h.in	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,284 +0,0 @@
-/* config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define if building universal (internal helper macro) */
-#undef AC_APPLE_UNIVERSAL_BUILD
-
-/* Build against libcurl. */
-#undef ENABLE_LIBCURL
-
-/* Use libjpeg instead of builtin jpeg decoder. */
-#undef ENABLE_LIBJPEG
-
-/* Use libopenjpeg instead of builtin jpeg2000 decoder. */
-#undef ENABLE_LIBOPENJPEG
-
-/* Build against libpng. */
-#undef ENABLE_LIBPNG
-
-/* Build against libtiff. */
-#undef ENABLE_LIBTIFF
-
-/* Build Poppler against NSS for digital signature support. */
-#undef ENABLE_NSS3
-
-/* Do not hardcode the library location */
-#undef ENABLE_RELOCATABLE
-
-/* Build against zlib. */
-#undef ENABLE_ZLIB
-
-/* Use zlib instead of builtin zlib decoder to uncompress flate streams. */
-#undef ENABLE_ZLIB_UNCOMPRESS
-
-/* Use cairo for rendering. */
-#undef HAVE_CAIRO
-
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
-   */
-#undef HAVE_DIRENT_H
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Have FreeType2 include files */
-#undef HAVE_FREETYPE_H
-
-/* Define to 1 if you have the `fseek64' function. */
-#undef HAVE_FSEEK64
-
-/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
-#undef HAVE_FSEEKO
-
-/* Define to 1 if you have the `ftell64' function. */
-#undef HAVE_FTELL64
-
-/* Defines if gettimeofday is available on your system */
-#undef HAVE_GETTIMEOFDAY
-
-/* Defines if gmtime_r is available on your system */
-#undef HAVE_GMTIME_R
-
-/* Define if you have the iconv() function and it works. */
-#undef HAVE_ICONV
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the `tiff' library (-ltiff). */
-#undef HAVE_LIBTIFF
-
-/* Define to 1 if you have the `z' library (-lz). */
-#undef HAVE_LIBZ
-
-/* Defines if localtime_r is available on your system */
-#undef HAVE_LOCALTIME_R
-
-/* Define to 1 if you have the `lseek64' function. */
-#undef HAVE_LSEEK64
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `mkstemp' function. */
-#undef HAVE_MKSTEMP
-
-/* Define to 1 if you have the `mkstemps' function. */
-#undef HAVE_MKSTEMPS
-
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
-#undef HAVE_NDIR_H
-
-/* Define to 1 if you have the <openjpeg.h> header file. */
-#undef HAVE_OPENJPEG_H
-
-/* Define to 1 if you have the `popen' function. */
-#undef HAVE_POPEN
-
-/* Define to 1 if you have the `pread64' function. */
-#undef HAVE_PREAD64
-
-/* Define if you have POSIX threads libraries and header files. */
-#undef HAVE_PTHREAD
-
-/* Have PTHREAD_PRIO_INHERIT. */
-#undef HAVE_PTHREAD_PRIO_INHERIT
-
-/* Defines if rand_r is available on your system */
-#undef HAVE_RAND_R
-
-/* Use splash for rendering. */
-#undef HAVE_SPLASH
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the `strcat_s' function. */
-#undef HAVE_STRCAT_S
-
-/* Define to 1 if you have the `strcpy_s' function. */
-#undef HAVE_STRCPY_S
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
-   */
-#undef HAVE_SYS_DIR_H
-
-/* Define to 1 if you have the <sys/mman.h> header file. */
-#undef HAVE_SYS_MMAN_H
-
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
-   */
-#undef HAVE_SYS_NDIR_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <tiffio.h> header file. */
-#undef HAVE_TIFFIO_H
-
-/* Defines if timegm is available on your system */
-#undef HAVE_TIMEGM
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if you have the <zlib.h> header file. */
-#undef HAVE_ZLIB_H
-
-/* Define as const if the declaration of iconv() needs const. */
-#undef ICONV_CONST
-
-/* Define to the sub-directory where libtool stores uninstalled libraries. */
-#undef LT_OBJDIR
-
-/* Enable multithreading support. */
-#undef MULTITHREADED
-
-/* Generate OPI comments in PS output. */
-#undef OPI_SUPPORT
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Poppler data dir */
-#undef POPPLER_DATADIR
-
-/* Support for curl based doc builder is compiled in. */
-#undef POPPLER_HAS_CURL_SUPPORT
-
-/* Defines the poppler version */
-#undef POPPLER_VERSION
-
-/* Define to necessary symbol if this constant uses a non-standard name on
-   your system. */
-#undef PTHREAD_CREATE_JOINABLE
-
-/* Include support for CMYK rasterization */
-#undef SPLASH_CMYK
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Enable word list support. */
-#undef TEXTOUT_WORD_LIST
-
-/* Defines if use cms */
-#undef USE_CMS
-
-/* Use fixed point arithmetic in the Splash backend */
-#undef USE_FIXEDPOINT
-
-/* Use single precision arithmetic in the Splash backend */
-#undef USE_FLOAT
-
-/* Defines if use lcms1 */
-#undef USE_LCMS1
-
-/* Defined if using openjpeg1 */
-#undef USE_OPENJPEG1
-
-/* Defined if using openjpeg2 */
-#undef USE_OPENJPEG2
-
-/* Version number of package */
-#undef VERSION
-
-/* Use fontconfig font configuration backend */
-#undef WITH_FONTCONFIGURATION_FONTCONFIG
-
-/* Use win32 font configuration backend */
-#undef WITH_FONTCONFIGURATION_WIN32
-
-/* OpenJPEG with the OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG flag. */
-#undef WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG
-
-/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
-   significant byte first (like Motorola and SPARC, unlike Intel). */
-#if defined AC_APPLE_UNIVERSAL_BUILD
-# if defined __BIG_ENDIAN__
-#  define WORDS_BIGENDIAN 1
-# endif
-#else
-# ifndef WORDS_BIGENDIAN
-#  undef WORDS_BIGENDIAN
-# endif
-#endif
-
-/* 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
-
-
-/* Enable large inode numbers on Mac OS X 10.5.  */
-#ifndef _DARWIN_USE_64_BIT_INODE
-# define _DARWIN_USE_64_BIT_INODE 1
-#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
-/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
-#undef _LARGEFILE_SOURCE
-
-/* Define for large files, on AIX-style hosts. */
-#undef _LARGE_FILES

Deleted: branches/stable/source/src/libs/poppler/poppler-src/configure.ac
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/configure.ac	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/configure.ac	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,1090 +0,0 @@
-m4_define([poppler_version_major],[0])
-m4_define([poppler_version_minor],[52])
-m4_define([poppler_version_micro],[0])
-m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro])
-
-AC_PREREQ(2.59)
-AC_INIT([poppler],[poppler_version],[https://bugs.freedesktop.org/enter_bug.cgi?product=poppler])
-AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE([1.7 foreign])
-m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
-AC_CONFIG_HEADERS([config.h poppler/poppler-config.h])
-AC_C_BIGENDIAN
-
-dnl ##### Initialize libtool.
-AC_LIBTOOL_WIN32_DLL
-define([AC_LIBTOOL_LANG_F77_CONFIG], [:])
-AC_PROG_LIBTOOL
-
-dnl ##### Checks for programs.
-AC_PROG_CC
-AC_PROG_CXX
-AC_ISC_POSIX
-AC_PROG_CC_STDC
-#if test -z "$CXX" -a "$CC" = "gcc"; then
-#  CXX="gcc"
-#fi
-AC_PROG_CXX
-AC_PROG_INSTALL
-
-dnl ##### Check for pkgconfig
-PKG_PROG_PKG_CONFIG
-
-dnl ##### Export the version
-AC_DEFINE_UNQUOTED([POPPLER_VERSION], ["poppler_version"], [Defines the poppler version])
-
-dnl Enable these unconditionally.
-AC_DEFINE([OPI_SUPPORT], [1], [Generate OPI comments in PS output.])
-AC_DEFINE([MULTITHREADED], [1], [Enable multithreading support.])
-AC_DEFINE([TEXTOUT_WORD_LIST], [1], [Enable word list support.])
-
-dnl Check for OS specific flags
-win32_libs=""
-create_shared_lib=""
-auto_import_flags=""
-case "$host_os" in
-  cygwin*)
-    create_shared_lib="-no-undefined"
-  ;;
-  mingw*)
-    os_win32=yes
-    win32_libs="-lgdi32 -lwinspool -lcomdlg32"
-    create_shared_lib="-no-undefined"
-    auto_import_flags="-Wl,--enable-auto-import"
-
-    # Use mingw's ansi stdio extensions
-    CXXFLAGS="$CXXFLAGS -D__USE_MINGW_ANSI_STDIO=1"
-  ;;
-esac
-
-AC_SUBST(win32_libs)
-AC_SUBST(create_shared_lib)
-AC_SUBST(auto_import_flags)
-
-AX_PTHREAD()
-
-dnl Install xpdf headers
-AC_ARG_ENABLE(xpdf-headers,
-	      AC_HELP_STRING([--enable-xpdf-headers],
-	                     [Install unsupported xpdf headers.]),
-              enable_xpdf_headers=$enableval,
-              enable_xpdf_headers="no")
-AM_CONDITIONAL(ENABLE_XPDF_HEADERS, test x$enable_xpdf_headers = xyes)
-
-dnl ##### Emulate cmake -DCMAKE_BUILD_TYPE=Release using options from cmake/modules/PopplerMacros.cmake
-
-AC_ARG_ENABLE(build-type,
-              AC_HELP_STRING([--enable-build-type=@<:@relwithdebinfo/release/debug/debugfull/profile@:>@],
-                             [Build with options similar to 'cmake -DCMAKE_BUILD_TYPE=' values.]),
-              [enable_build_type=no;
-              case "$enableval" in
-              relwithdebinfo|release|debug|debugfull|profile) enable_build_type="$enableval" ;;
-              *) AC_MSG_ERROR([bad value $enableval for --enable-build-type option.
-                               Options are relwithdebinfo, release, debug, debugfull, and profile.]) ;;
-              esac],
-              enable_build_type=no)
-
-if test "x$GCC" = "xyes"; then
-    case "$enable_build_type" in
-    relwithdebinfo)
-        CFLAGS="-O2 -g $CFLAGS"
-        CXXFLAGS="-O2 -g $CXXFLAGS"
-        ;;
-    release)
-        CFLAGS="-O2 $CFLAGS -g0 -DNDEBUG"
-        CXXFLAGS="-O2 $CXXFLAGS -g0 -DNDEBUG"
-        ;;
-    debug)
-        CFLAGS="-O2 -g $CFLAGS -fno-reorder-blocks -fno-schedule-insns -fno-inline"
-        CXXFLAGS="-O2 -g $CXXFLAGS -fno-reorder-blocks -fno-schedule-insns -fno-inline"
-        ;;
-    debugfull)
-        CFLAGS="$CFLAGS -g3 -fno-inline"
-        CXXFLAGS="$CXXFLAGS -g3 -fno-inline"
-        ;;
-    profile)
-        CFLAGS="$CFLAGS -g3 -fno-inline -ftest-coverage -fprofile-arcs"
-        CXXFLAGS="$CXXFLAGS -g3 -fno-inline -ftest-coverage -fprofile-arcs"
-        LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage -lgcov"
-        ;;
-    *)
-        enable_build_type=no
-        ;;
-    esac
-else
-    case "$enable_build_type" in
-    relwithdebinfo|release|debug|debugfull|profile)
-        echo "  Warning: --enable-build-type ignored for non-gcc compiler."
-        ;;
-    esac
-    enable_build_type=no
-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_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_ARG_ENABLE(cmyk,
-[  --enable-cmyk           Include support for CMYK rasterization],
-AC_DEFINE(SPLASH_CMYK, [1], [Include support for CMYK rasterization]))
-
-dnl Relocation support
-AC_ARG_ENABLE(relocatable,
-    AC_HELP_STRING([--disable-relocatable],
-                   [Hardcode the poppler library location (on Windows).]),
-    enable_relocatable=$enableval,
-    [if test x$os_win32 = xyes; then
-         # default to yes on native Windows.
-         enable_relocatable="yes"
-     else
-         # default to no everywhere else.
-         enable_relocatable="no"
-     fi
-    ]
-)
-
-if test x$enable_relocatable = xyes; then
-    if test x$os_win32 = xyes; then
-     AC_DEFINE([ENABLE_RELOCATABLE],
-               [1],[Do not hardcode the library location])
-    else
-        AC_MSG_ERROR(
-               [Invalid setting for relocatable, only supported on windows])
-
-    fi
-fi
-
-dnl ##### Check for installed poppler-data. Use the same datarootdir as default otherwise.
-PKG_CHECK_EXISTS(poppler-data,
-                 [POPPLER_DATADIR=`$PKG_CONFIG --variable=poppler_datadir poppler-data`
-                  AC_DEFINE_DIR(POPPLER_DATADIR, "{POPPLER_DATADIR}", [Poppler data dir])],
-                 [AC_DEFINE_DIR(POPPLER_DATADIR, "{datarootdir}/poppler", [Poppler data dir])]
-                 )
-
-dnl ##### Checks for header files.
-AC_PATH_XTRA
-AC_HEADER_DIRENT
-AC_CHECK_HEADERS([stdint.h])
-
-dnl ##### Switch over to C++.  This will make the checks below a little
-dnl ##### bit stricter (requiring function prototypes in include files).
-dnl ##### (99% of xpdf is written in C++.)
-AC_LANG_CPLUSPLUS
-
-AC_CHECK_DECL(gettimeofday, [AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defines if gettimeofday is available on your system]))],[],[#include <sys/time.h>])
-AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, [Defines if localtime_r is available on your system]))
-AC_CHECK_FUNC(gmtime_r, AC_DEFINE(HAVE_GMTIME_R, 1, [Defines if gmtime_r is available on your system]))
-AC_CHECK_FUNC(timegm, AC_DEFINE(HAVE_TIMEGM, 1, [Defines if timegm is available on your system]))
-AC_CHECK_FUNC(rand_r, AC_DEFINE(HAVE_RAND_R, 1, [Defines if rand_r is available on your system]))
-
-dnl ##### Check for extra libraries needed by X.  (LynxOS needs this.)
-AC_CHECK_FUNC(nanosleep,,)
-dnl try in librt if not found in current LIBS
-if test x$ac_cv_func_nanosleep = xno
-then
-   AC_CHECK_LIB(rt,nanosleep, X_EXTRA_LIBS="$X_EXTRA_LIBS -lrt")
-fi
-
-dnl try in libposix4, if not found so far
-if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
-then
-   AC_CHECK_LIB(posix4,nanosleep, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix4")
-fi
-
-
-dnl ##### Test for libopenjpeg. Versions prior to 1.4 do not provide a pkgconfig file.
-openjpeg1="no"
-openjpeg2="no"
-AC_ARG_ENABLE(libopenjpeg,
-	      AC_HELP_STRING([--enable-libopenjpeg=@<:@auto/openjpeg1/openjpeg2/none@:>@],
-                             [Use openjpeg for JPEG2000 images. 'auto' prefers openjpeg1 over openjpeg2 if both are available due to regressions in openjpeg2 [[default=auto]]]),
-              [enable_libopenjpeg=$enableval],
-              [enable_libopenjpeg="auto"])
-
-openjpeg_header=yes
-
-dnl test for libopenjpeg2
-if test x$enable_libopenjpeg = xopenjpeg2 || test x$enable_libopenjpeg = xauto; then
-  PKG_CHECK_MODULES(LIBOPENJPEG, libopenjp2,
-                    [openjpeg2=yes],[openjpeg2=no])
-fi
-
-dnl test for libopenjpeg1
-if test x$openjpeg2 = xno; then
-  if test x$enable_libopenjpeg = xopenjpeg1 || test x$enable_libopenjpeg = xauto; then
-    PKG_CHECK_MODULES(LIBOPENJPEG, libopenjpeg,
-      [openjpeg1="yes"],
-      [AC_CHECK_LIB([openjpeg], [opj_cio_open],
-        [openjpeg1="yes"
-         LIBOPENJPEG_LIBS="-lopenjpeg"],[openjpeg_header=no])
-       AC_CHECK_HEADERS([openjpeg.h],,
-		        [openjpeg_header="no"])])
-  fi
-fi
-
-
-if test x$enable_libopenjpeg = xopenjpeg1 && test x$openjpeg1 = xno; then
-  if test x$openjpeg_header = xno; then
-    AC_MSG_ERROR("*** libopenjpeg headers not found ***")
-  else
-    AC_MSG_ERROR("*** libopenjpeg library not found ***")
-  fi
-fi
-
-if test x$enable_libopenjpeg = xopenjpeg2 && test x$openjpeg2 = xno; then
-  AC_MSG_ERROR("*** libopenjp2 library not found ***")
-fi
-
-if test x$openjpeg1 = xyes || test x$openjpeg2 = xyes; then
-  enable_libopenjpeg=yes
-  if test x$openjpeg1 = xyes; then
-    AC_DEFINE(USE_OPENJPEG1, 1, [Defined if using openjpeg1])
-  fi
-  if test x$openjpeg2 = xyes; then
-    AC_DEFINE(USE_OPENJPEG2, 1, [Defined if using openjpeg2])
-  fi
-
-  AC_SUBST(LIBOPENJPEG_CFLAGS)
-  AC_SUBST(LIBOPENJPEG_LIBS)
-  AC_DEFINE(ENABLE_LIBOPENJPEG)
-  PKG_CHECK_EXISTS(libopenjpeg >= 1.5,
-      [AC_DEFINE(WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG, 1, [OpenJPEG with the OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG flag.])],
-      [PKG_CHECK_EXISTS(libopenjpeg1 >= 1.5,
-       [AC_DEFINE(WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG, 1, [OpenJPEG with the OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG flag.])],
-       [])
-      ])
-else
-  enable_libopenjpeg=no
-fi
-
-dnl Test for NSS
-AC_ARG_ENABLE(libnss,
-        AC_HELP_STRING([--disable-libnss],
-                       [Do not build against libnss3.]),
-              enable_libnss=$enableval,
-              enable_libnss="try")
-
-if test x$enable_libnss != xno; then
-  PKG_CHECK_MODULES(NSS3, nss, [enable_nss="yes"],
-      [enable_nss="no"])
-fi
-
-if test x$enable_nss = xyes; then
-  AC_DEFINE(ENABLE_NSS3, 1, [Build against NSS.])
-fi
-
-AM_CONDITIONAL(BUILD_LIBOPENJPEG, test x$openjpeg1 = xyes || test x$openjpeg2 = xyes)
-AH_TEMPLATE([ENABLE_LIBOPENJPEG],
-	    [Use libopenjpeg instead of builtin jpeg2000 decoder.])
-
-AM_CONDITIONAL(BUILD_NSS, test x$enable_nss = xyes)
-AH_TEMPLATE([ENABLE_NSS3], [Build Poppler against NSS for digital signature support.])
-
-dnl ##### Test for libtiff
-AC_ARG_ENABLE(libtiff,
-		AC_HELP_STRING([--disable-libtiff],
-				[Don't build against libtiff.]),
-		enable_libtiff=$enableval,
-		enable_libtiff="try")
-
-AC_ARG_VAR([LIBTIFF_CFLAGS], [C compiler flags for LIBTIFF])
-AC_ARG_VAR([LIBTIFF_LIBS], [linker flags to link LIBTIFF (default is -ltiff)])
-ac_save_CPPFLAGS="$CPPFLAGS"
-ac_save_CXXFLAGS="$CXXFLAGS"
-ac_save_LIBS="$LDFLAGS"
-CPPFLAGS="$CPPFLAGS $LIBTIFF_CFLAGS"
-CXXFLAGS="$CXXFLAGS $LIBTIFF_CFLAGS"
-LIBS="$LIBS $LIBTIFF_LIBS"
-if test x$enable_libtiff = xyes; then
-  if test x"$LIBTIFF_LIBS" != x; then
-    AC_CHECK_FUNC([TIFFOpen],,
-		  AC_MSG_ERROR("*** libtiff library not found ***"))
-  else
-    AC_CHECK_LIB([tiff], [TIFFOpen],,
-		  AC_MSG_ERROR("*** libtiff library not found ***"))
-  fi
-  AC_CHECK_HEADERS([tiffio.h],,
-		AC_MSG_ERROR("*** libtiff headers not found ***"))
-elif test x$enable_libtiff = xtry; then
-  if test x"$LIBTIFF_LIBS" != x; then
-    AC_CHECK_FUNC([TIFFOpen],
-		  [enable_libtiff="yes"],
-		  [enable_libtiff="no"])
-  else
-    AC_CHECK_LIB([tiff], [TIFFOpen],
-		 [enable_libtiff="yes"],
-		 [enable_libtiff="no"])
-  fi
-  AC_CHECK_HEADERS([tiffio.h],,
-		[enable_libtiff="no"])
-fi
-CPPFLAGS="$ac_save_CPPFLAGS"
-CXXFLAGS="$ac_save_CXXFLAGS"
-LIBS="$ac_save_LIBS"
-
-if test x$enable_libtiff = xyes; then
-  if test x"$LIBTIFF_LIBS" = x; then
-    LIBTIFF_LIBS="-ltiff"
-  fi
-  AC_SUBST(LIBTIFF_CFLAGS)
-  AC_SUBST(LIBTIFF_LIBS)
-  AC_DEFINE(ENABLE_LIBTIFF)
-fi
-
-AM_CONDITIONAL(BUILD_LIBTIFF, test x$enable_libtiff = xyes)
-AH_TEMPLATE([ENABLE_LIBTIFF], [Build against libtiff.])
-if test x$enable_libtiff = xyes; then
-  AC_DEFINE(ENABLE_LIBTIFF, 1, [Build against libtiff.])
-fi
-
-dnl ##### Checks for library functions.
-AC_CHECK_FUNCS(popen mkstemp mkstemps)
-AC_CHECK_FUNCS(strcpy_s strcat_s)
-
-dnl ##### Back to C for the library tests.
-AC_LANG_C
-
-dnl ##### Check for fseeko/ftello or fseek64/ftell64
-dnl The LARGEFILE and FSEEKO macros have to be called in C, not C++, mode.
-AC_SYS_LARGEFILE
-AC_FUNC_FSEEKO
-AC_CHECK_FUNCS(fseek64, xpdf_cv_func_fseek64=yes, xpdf_cv_func_fseek64=no)
-AC_CHECK_FUNCS(ftell64, xpdf_cv_func_ftell64=yes, xpdf_cv_func_ftell64=no)
-if test "$xpdf_cv_func_fseek64" = yes -a "$xpdf_cv_func_ftell64" = yes; then
-  AC_DEFINE(HAVE_FSEEK64)
-fi
-AC_CHECK_FUNCS(pread64 lseek64)
-
-dnl Test for zlib
-AC_ARG_ENABLE(zlib,
-	      AC_HELP_STRING([--disable-zlib],
-			     [Don't build against zlib.]),
-	      enable_zlib=$enableval,
-	      enable_zlib="try")
-
-AC_ARG_ENABLE([zlib_uncompress],
-	      AS_HELP_STRING([--enable-zlib-uncompress],
-			     [Use zlib to uncompress flate streams (not totally safe)]),
-              enable_zlib_uncompress=$enableval,
-              enable_zlib_uncompress="no")
-
-if test x$enable_zlib = xyes; then
-   AC_CHECK_LIB([z], [inflate],,
-        AC_MSG_ERROR("*** zlib library not found ***"))
-   AC_CHECK_HEADERS([zlib.h],,
-	AC_MSG_ERROR("*** zlib headers not found ***"))
-elif test x$enable_zlib = xtry; then
-   AC_CHECK_LIB([z], [inflate],
-	        [enable_zlib="yes"],
-		[enable_zlib="no"])
-   AC_CHECK_HEADERS([zlib.h],,
-		[enable_zlib="no"])
-fi
-
-if test x$enable_zlib = xyes; then
-    ZLIB_LIBS="-lz"
-    AC_SUBST(ZLIB_LIBS)
-    AC_DEFINE(ENABLE_ZLIB, 1, [Build against zlib.])
-
-    if test x$enable_zlib_uncompress = xyes; then
-        AC_DEFINE(ENABLE_ZLIB_UNCOMPRESS, 1,
-             [Use zlib instead of builtin zlib decoder to uncompress flate streams.])
-    fi
-else
-    if test x$enable_zlib_uncompress = xyes; then
-	echo "  Warning: --enable-zlib-uncompress is incompatible with --disable-zlib."
-    fi
-    enable_zlib_uncompress="no"
-fi
-
-AM_CONDITIONAL(BUILD_ZLIB, test x$enable_zlib = xyes)
-AH_TEMPLATE([ENABLE_ZLIB],
-	    [Build against zlib.])
-AM_CONDITIONAL(BUILD_ZLIB_UNCOMPRESS, test x$enable_zlib_uncompress = xyes)
-AH_TEMPLATE([ENABLE_ZLIB_UNCOMPRESS],
-	    [Use zlib instead of builtin zlib decoder to uncompress flate streams.])
-
-dnl Test for libcurl
-AC_ARG_ENABLE(libcurl,
-	      AC_HELP_STRING([--enable-libcurl],
-	                     [Build with libcurl based HTTP support.]),
-              enable_libcurl=$enableval,
-              enable_libcurl="no")
-
-if test x$enable_libcurl = xyes; then
-  PKG_CHECK_MODULES(LIBCURL, libcurl)
-  AC_DEFINE(ENABLE_LIBCURL, 1, [Build against libcurl.])
-  AC_DEFINE(POPPLER_HAS_CURL_SUPPORT, 1,
-     [Support for curl based doc builder is compiled in.])
-fi
-
-AM_CONDITIONAL(BUILD_LIBCURL, test x$enable_libcurl = xyes)
-
-dnl Test for libjpeg
-AC_ARG_ENABLE(libjpeg,
-	      AC_HELP_STRING([--disable-libjpeg],
-	                     [Don't build against libjpeg.]),
-              enable_libjpeg=$enableval,
-              enable_libjpeg="try")
-AC_ARG_VAR([LIBJPEG_CFLAGS], [C compiler flags for LIBJPEG])
-if test x$enable_libjpeg != xno; then
-
-  dnl
-  dnl POPPLER_FIND_JPEG uses "USER_INCLUDES" and "USER_LIBS"
-  dnl to receive the flags for header and library directories.
-  dnl
-  ac_save_USER_INCLUDES="$USER_INCLUDES"
-  ac_save_USER_LDFLAGS="$USER_LDFLAGS"
-  USER_INCLUDES="$USER_INCLUDES $LIBJPEG_CFLAGS"
-  USER_LDFLAGS="$USER_LDFLAGS $LIBJPEG_CFLAGS"
-  POPPLER_FIND_JPEG
-
-  dnl check INT16, INT32 typedef conflict in jmorecfg.h
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_CFLAGS="$CFLAGS"
-  CPPFLAGS="$CPPFLAGS $LIBJPEG_CFLAGS"
-  CFLAGS="$CFLAGS $LIBJPEG_CFLAGS"
-  AC_MSG_CHECKING([libjpeg.h works correctly])
-  AC_COMPILE_IFELSE([
-    AC_LANG_PROGRAM([
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <jpeglib.h>
-],[{return 0;}])],[
-    AC_MSG_RESULT([ok])
-  ],[
-    AC_MSG_RESULT([no])
-    AC_MSG_CHECKING([libjpeg.h problem can be fixed by XMD_H macro])
-    CPPFLAGS="$CPPFLAGS -DXMD_H"
-    CFLAGS="$CFLAGS -DXMD_H"
-    AC_COMPILE_IFELSE([
-      AC_LANG_PROGRAM([
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <jpeglib.h>
-],[{return 0;}])],[
-      AC_MSG_RESULT([ok, -DXMD_H is added to LIBJPEG_CFLAGS])
-      LIBJPEG_CFLAGS="$LIBJPEG_CFLAGS -DXMD_H"
-    ],[
-      AC_MSG_RESULT([no, disable libjpeg])
-      enable_libjpeg="no"
-    ])
-  ])
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  CFLAGS="$ac_save_CFLAGS"
-
-  dnl POPPLER_FIND_JPEG sets LIBJPEG_LIBS
-  AC_SUBST(LIBJPEG_CFLAGS)
-  USER_INCLUDES="$ac_save_USER_INCLUDES"
-  USER_LDFLAGS="$ac_save_USER_LDFLAGS"
-fi
-
-AM_CONDITIONAL(BUILD_LIBJPEG, test x$enable_libjpeg = xyes)
-AH_TEMPLATE([ENABLE_LIBJPEG],
-            [Use libjpeg instead of builtin jpeg decoder.])
-
-dnl Test for libpng
-AC_ARG_ENABLE(libpng,
-	      AC_HELP_STRING([--disable-libpng],
-	                     [Do not build against libpng.]),
-              enable_libpng=$enableval,
-              enable_libpng="try")
-
-if test x$enable_libpng != xno; then
-  PKG_CHECK_MODULES(LIBPNG, libpng, [enable_libpng="yes"],
-      [enable_libpng="no"])
-fi
-
-if test x$enable_libpng = xyes; then
-  AC_DEFINE(ENABLE_LIBPNG, 1, [Build against libpng.])
-fi
-
-AM_CONDITIONAL(BUILD_LIBPNG, test x$enable_libpng = xyes)
-
-dnl Check for freetype headers
-
-PKG_CHECK_MODULES(FREETYPE, freetype2,
-                  [freetype_pkgconfig=yes], [freetype_pkgconfig=no])
-
-if test "x$freetype_pkgconfig" = "xyes"; then
-
-  AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])
-
-else
-
-  FREETYPE_LIBS=
-  FREETYPE_CFLAGS=
-
-  AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
-  if test "x$FREETYPE_CONFIG" != "xno" ; then
-
-    FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
-    FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
-    AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])
-
-  fi
-
-fi
-
-AC_SUBST(FREETYPE_CFLAGS)
-AC_SUBST(FREETYPE_LIBS)
-
-AC_MSG_CHECKING([which font configuration to use])
-AC_ARG_WITH([font_configuration],
-   [AS_HELP_STRING([--with-font-configuration=fontconfig|win32],
-                   [Select font configuration backend])],
-   [],
-   [if test x$os_win32 = xyes; then
-        # default to win32 on native Windows.
-        with_font_configuration=win32
-    else
-        # default to fontconig everywhere else.
-        with_font_configuration=fontconfig
-    fi
-   ]
-)
-AC_MSG_RESULT([$with_font_configuration])
-
-case $with_font_configuration in
-  win32)
-     AC_DEFINE([WITH_FONTCONFIGURATION_WIN32],
-               [1],[Use win32 font configuration backend])
-     # Set the minimum required Internet Explorer version to 5.0
-     CPPFLAGS="$CPPFLAGS -D_WIN32_IE=0x0500"
-     ;;
-  fontconfig)
-     AC_DEFINE([WITH_FONTCONFIGURATION_FONTCONFIG],
-               [1],[Use fontconfig font configuration backend])
-     PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.0.0)
-     ;;
-  *)
-     AC_MSG_ERROR(
-               [Invalid font configuration setting: $with_font_configuration])
-     ;;
-esac
-
-AM_CONDITIONAL(BUILD_WITH_WIN32_FONTCONFIGURATION,
-               test x$with_font_configuration = xwin32)
-
-AC_ARG_ENABLE(splash-output,
-              AC_HELP_STRING([--disable-splash-output],
-	                     [Don't build the Splash graphics backend.]),,
-              enable_splash_output="yes")
-AM_CONDITIONAL(BUILD_SPLASH_OUTPUT, test x$enable_splash_output = xyes)
-AH_TEMPLATE([HAVE_SPLASH], [Use splash for rendering.])
-if test x$enable_splash_output = xyes; then
-  AC_DEFINE(HAVE_SPLASH)
-fi
-
-CAIRO_VERSION="1.10.0"
-AC_SUBST(CAIRO_VERSION)
-CAIRO_DEPS="cairo >= $CAIRO_VERSION cairo-ft >= $CAIRO_VERSION"
-AC_ARG_ENABLE(cairo-output,
-              AC_HELP_STRING([--disable-cairo-output],
-                             [Don't build the cairo graphics backend.]),
-              enable_cairo_output=$enableval,
-              enable_cairo_output="try")
-use_cairo=""
-if test x$enable_cairo_output = xyes; then
-  PKG_CHECK_MODULES(CAIRO, $CAIRO_DEPS)
-elif test x$enable_cairo_output = xtry; then
-  PKG_CHECK_MODULES(CAIRO, $CAIRO_DEPS,
-                    [enable_cairo_output="yes"],
-                    [enable_cairo_output="no"
-		     use_cairo="no (requires cairo >= $CAIRO_VERSION)"])
-fi
-if test "x$use_cairo" = "x"; then
-   use_cairo=$enable_cairo_output
-fi
-
-AC_SUBST(CAIRO_CFLAGS)
-AC_SUBST(CAIRO_LIBS)
-
-AM_CONDITIONAL(BUILD_CAIRO_OUTPUT, test x$enable_cairo_output = xyes)
-AH_TEMPLATE([HAVE_CAIRO], [Use cairo for rendering.])
-if test x$enable_cairo_output = xyes; then
-  PDFTOCAIRO_DEPS="cairo cairo-ft"
-  dnl Check for optional cairo backends used by pdftocairo
-  PKG_CHECK_EXISTS(cairo-pdf, [PDFTOCAIRO_DEPS="$PDFTOCAIRO_DEPS cairo-pdf"], [])
-  PKG_CHECK_EXISTS(cairo-ps,  [PDFTOCAIRO_DEPS="$PDFTOCAIRO_DEPS cairo-ps"],  [])
-  PKG_CHECK_EXISTS(cairo-svg, [PDFTOCAIRO_DEPS="$PDFTOCAIRO_DEPS cairo-svg"], [])
-
-  PKG_CHECK_MODULES(PDFTOCAIRO, $PDFTOCAIRO_DEPS)
-  AC_SUBST(PDFTOCAIRO_CFLAGS)
-  AC_SUBST(PDFTOCAIRO_LIBS)
-
-  AC_DEFINE(HAVE_CAIRO)
-  CAIRO_FEATURE="#define POPPLER_HAS_CAIRO 1"
-  CAIRO_REQ="cairo"
-  AC_CHECK_HEADERS(fcntl.h sys/mman.h sys/stat.h)
-else
-  CAIRO_FEATURE="#undef POPPLER_HAS_CAIRO"
-  CAIRO_REQ=""
-fi
-AC_SUBST(CAIRO_FEATURE)
-AC_SUBST(CAIRO_REQ)
-
-use_glib=""
-found_introspection=no
-if test x$enable_cairo_output = xyes; then
-  POPPLER_GLIB_DISABLE_DEPRECATED=""
-  POPPLER_GLIB_DISABLE_SINGLE_INCLUDES=""
-
-  GLIB_REQUIRED=2.41
-  AC_SUBST(GLIB_REQUIRED)
-  AC_ARG_ENABLE(poppler-glib,
-	        AC_HELP_STRING([--disable-poppler-glib],
-		               [Don't compile poppler glib wrapper.]),
-              		       enable_poppler_glib=$enableval,
-			       enable_poppler_glib="try")
-  if test x$enable_poppler_glib = xyes; then
-    PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION)
-  elif test x$enable_poppler_glib = xtry; then
-    PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION,
-                      [enable_poppler_glib="yes"],
-                      [enable_poppler_glib="no"
-                      use_glib="no (requires glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION)"])
-  fi
-  if test x$enable_poppler_glib = xyes; then
-    # Check for introspection
-    GOBJECT_INTROSPECTION_CHECK([0.6.7])
-
-    AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
-    POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
-    POPPLER_GLIB_DISABLE_SINGLE_INCLUDES="$POPPLER_GLIB_DISABLE_SINGLE_INCLUDES -DG_DISABLE_SINGLE_INCLUDES"
-  fi
-else
-  if test x$enable_poppler_glib = xyes; then
-    AC_MSG_ERROR("Cairo output is required to build glib frontend")
-  fi
-  use_glib="no (requires cairo output)"
-  enable_poppler_glib="no"
-fi
-if test x"$use_glib" = x; then
-   use_glib="$enable_poppler_glib"
-fi
-AM_CONDITIONAL(BUILD_POPPLER_GLIB, test x$enable_poppler_glib = xyes)
-AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
-AC_SUBST(GLIB_REQ)
-AC_SUBST(POPPLER_GLIB_DISABLE_DEPRECATED)
-AC_SUBST(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES)
-
-GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
-
-dnl 
-dnl Try Qt4
-dnl
-
-AC_ARG_ENABLE(poppler-qt4,
-              AC_HELP_STRING([--disable-poppler-qt4],
-	                     [Don't compile poppler Qt4 wrapper.]),
-              enable_poppler_qt4=$enableval,
-              enable_poppler_qt4="try")
-if test x$enable_poppler_qt4 = xyes; then
-  PKG_CHECK_MODULES(POPPLER_QT4, 
-	            QtCore >= 4.7.0 QtGui >= 4.7.0 QtXml >= 4.7.0)
-  PKG_CHECK_MODULES(POPPLER_QT4_TEST, 
-	            QtTest >= 4.7.0)
-elif test x$enable_poppler_qt4 = xtry; then
-  PKG_CHECK_MODULES(POPPLER_QT4,
-                    QtCore >= 4.7.0 QtGui >= 4.7.0 QtXml >= 4.7.0,
-                    [enable_poppler_qt4="yes"],
-                    [enable_poppler_qt4="no"])
-  if test x$enable_poppler_qt4 = xyes; then
-    PKG_CHECK_MODULES(POPPLER_QT4_TEST,
-                    QtTest >= 4.7.0,
-                    [enable_poppler_qt4="yes"],
-                    [enable_poppler_qt4="no"])
-  fi
-fi
-
-AC_SUBST(POPPLER_QT4_CXXFLAGS)
-AC_SUBST(POPPLER_QT4_LIBS)
-AC_SUBST(POPPLER_QT4_TEST_LIBS)
-
-if test x$enable_poppler_qt4 = xyes; then
-  AC_CHECK_TOOL(MOCQT4, moc)
-  AC_MSG_CHECKING([for Qt4 moc])
-  mocversion=`$MOCQT4 -v 2>&1`
-  mocversiongrep=`echo $mocversion | grep "Qt 4"`
-  if test x"$mocversiongrep" != x"$mocversion"; then
-    AC_MSG_RESULT([no])
-    # moc was not the qt4 one, try with moc-qt4
-    AC_CHECK_TOOL(MOCQT42, moc-qt4)
-    AC_MSG_CHECKING([for Qt4 moc-qt4])
-    mocversion=`$MOCQT42 -v 2>&1`
-    mocversiongrep=`echo $mocversion | grep "Qt 4"`
-    if test x"$mocversiongrep" != x"$mocversion"; then
-      # no valid moc found
-      enable_poppler_qt4=no;
-      MOCQT4="not found"
-    else
-      MOCQT4=$MOCQT42
-    fi
-  fi
-  AC_SUBST(MOCQT4)
-  AC_MSG_RESULT([$MOCQT4])
-fi
-
-AM_CONDITIONAL(BUILD_POPPLER_QT4, test "x$enable_poppler_qt4" = "xyes")
-
-dnl 
-dnl Try Qt5
-dnl
-
-AC_ARG_ENABLE(poppler-qt5,
-              AC_HELP_STRING([--disable-poppler-qt5],
-	                     [Don't compile poppler Qt5 wrapper.]),
-              enable_poppler_qt5=$enableval,
-              enable_poppler_qt5="try")
-if test x$enable_poppler_qt5 = xyes; then
-  PKG_CHECK_MODULES(POPPLER_QT5, 
-	            Qt5Core >= 5.0.0 Qt5Gui >= 5.0.0 Qt5Xml >= 5.0.0 Qt5Widgets >= 5.0.0)
-  PKG_CHECK_MODULES(POPPLER_QT5_TEST, 
-	            Qt5Test >= 5.0.0 ) 
-elif test x$enable_poppler_qt5 = xtry; then
-  PKG_CHECK_MODULES(POPPLER_QT5,
-                    Qt5Core >= 5.0.0 Qt5Gui >= 5.0.0 Qt5Xml >= 5.0.0 Qt5Widgets >= 5.0.0,
-                    [enable_poppler_qt5="yes"],
-                    [enable_poppler_qt5="no"])
-  if test x$enable_poppler_qt5 = xyes; then
-    PKG_CHECK_MODULES(POPPLER_QT5_TEST,
-                    Qt5Test >= 5.0.0,
-                    [enable_poppler_qt5="yes"],
-                    [enable_poppler_qt5="no"])
-  fi
-fi
-
-AC_SUBST(POPPLER_QT5_CXXFLAGS)
-AC_SUBST(POPPLER_QT5_LIBS)
-AC_SUBST(POPPLER_QT5_TEST_LIBS)
-
-if test x$enable_poppler_qt5 = xyes; then
-  AC_CHECK_TOOL(MOCQT5, moc)
-  AC_MSG_CHECKING([for Qt5 moc])
-  mocversion=`$MOCQT5 -v 2>&1`
-  mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"`
-  if test x"$mocversiongrep" != x"$mocversion"; then
-    AC_MSG_RESULT([no])
-    # moc was not the qt5 one, try with moc-qt5
-    AC_CHECK_TOOL(MOCQT52, moc-qt5)
-    AC_MSG_CHECKING([for Qt5 moc-qt5])
-    mocversion=`$MOCQT52 -v 2>&1`
-    mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc-qt5 5|moc 5"`
-    if test x"$mocversiongrep" != x"$mocversion"; then
-      AC_CHECK_TOOL(QTCHOOSER, qtchooser)
-      AC_MSG_CHECKING([for qtchooser])
-      qt5tooldir=`QT_SELECT=qt5 qtchooser -print-env | grep QTTOOLDIR | cut -d '=' -f 2 | cut -d \" -f 2`
-      mocversion=`$qt5tooldir/moc -v 2>&1`
-      mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"`
-      if test x"$mocversiongrep" != x"$mocversion"; then
-        # no valid moc found
-        enable_poppler_qt5=no;
-        MOCQT5="not found"
-      else
-        MOCQT5=$qt5tooldir/moc
-      fi
-    else
-      MOCQT5=$MOCQT52
-    fi
-  fi
-  AC_SUBST(MOCQT5)
-  AC_MSG_RESULT([$MOCQT5])
-fi
-
-AM_CONDITIONAL(BUILD_POPPLER_QT5, test "x$enable_poppler_qt5" = "xyes")
-
-dnl
-dnl CPP frontend
-dnl
-
-AC_ARG_ENABLE(poppler-cpp,
-              AC_HELP_STRING([--disable-poppler-cpp],
-                             [Don't compile poppler cpp wrapper.]),
-              enable_poppler_cpp=$enableval,
-              enable_poppler_cpp="yes")
-if test x$enable_poppler_cpp = xyes; then
-  AM_ICONV()
-  if test x$am_func_iconv != xyes; then
-    enable_poppler_cpp=no
-  fi
-fi
-
-AM_CONDITIONAL(BUILD_POPPLER_CPP, test "x$enable_poppler_cpp" = "xyes")
-
-
-GTK_TEST_DEPS='gtk+-3.0 >= 3.8 gdk-pixbuf-2.0'
-if test x$enable_cairo_output = xyes; then
-  GTK_TEST_DEPS="$GTK_TEST_DEPS $CAIRO_DEPS"
-fi
-AC_ARG_ENABLE(gtk-test,
-              AC_HELP_STRING([--disable-gtk-test],
-	                     [Don't compile GTK+ test program.]),
-              enable_gtk_test=$enableval,
-              enable_gtk_test="try")
-if test x$enable_gtk_test = xyes; then
-  PKG_CHECK_MODULES(GTK_TEST, $GTK_TEST_DEPS)
-elif test x$enable_gtk_test = xtry; then
-  PKG_CHECK_MODULES(GTK_TEST, $GTK_TEST_DEPS,
-                    [enable_gtk_test="yes"],
-                    [enable_gtk_test="no"])
-fi
-AM_CONDITIONAL(BUILD_GTK_TEST, test x$enable_gtk_test = xyes -a x$enable_poppler_glib = xyes)
-
-AC_ARG_ENABLE(utils,
-              AC_HELP_STRING([--disable-utils],
-	                     [Don't compile poppler command line utils.]),
-              enable_utils=$enableval,
-              enable_utils="yes")
-AM_CONDITIONAL(BUILD_UTILS, test x$enable_utils = xyes)
-
-AC_ARG_ENABLE(compile-warnings,
-              AC_HELP_STRING([--enable-compile-warnings=@<:@no/yes/kde@:>@],
-                             [Turn on compiler warnings.]),,
-              [enable_compile_warnings="yes"])
-
-dnl
-dnl   Color Management
-dnl
-
-AC_ARG_ENABLE(cms,
-              AC_HELP_STRING([--enable-cms=@<:@auto/lcms1/lcms2/none@:>@],
-                             [Use color management system. 'auto' prefers lcms2 over lcms1 if both are available [[default=auto]]]),
-              [enable_cms=$enableval],
-              [enable_cms="auto"])
-if test x$enable_cms = xauto; then
-  PKG_CHECK_MODULES(LCMS, lcms2, [lcms2=yes], [lcms2=no])
-  if test x$lcms2 = xno; then
-      PKG_CHECK_MODULES(LCMS, lcms, [lcms1=yes], [lcms1=no])
-  fi
-elif test x$enable_cms = xlcms1; then
-  PKG_CHECK_MODULES(LCMS, lcms, [lcms1=yes], [lcms1=no])
-elif test x$enable_cms = xlcms2; then
-  PKG_CHECK_MODULES(LCMS, lcms2, [lcms2=yes], [lcms2=no])
-fi
-
-if test x$lcms1 = xyes || test x$lcms2 = xyes; then
-  enable_cms=yes
-  AC_DEFINE(USE_CMS, 1, [Defines if use cms])
-  if test x$lcms1 = xyes; then
-    lcms1=yes;
-    AC_DEFINE(USE_LCMS1, 1, [Defines if use lcms1])
-  fi
-else
-  enable_cms=no
-fi
-
-AM_CONDITIONAL(USE_CMS, test x$enable_cms = xyes)
-AM_CONDITIONAL(USE_LCMS1, test x$lcms1 = xyes)
-
-AC_ARG_WITH([testdatadir],
-   [AS_HELP_STRING([--with-testdatadir=/path/to/testdatadir],
-                   [Specify test data dir])],
-   [case $withval in
-       [[\\/]]* | ?:[[\\/]]* )  # Absolute name.
-          TESTDATADIR=$withval ;;
-       *) # Relative name.
-          TESTDATADIR=$ac_pwd/$withval ;;
-    esac
-   ],
-   [case $srcdir in
-       [[\\/]]* | ?:[[\\/]]* )  # Absolute name.
-          TESTDATADIR=$srcdir/../test ;;
-       *) # Relative name.
-          TESTDATADIR=$ac_pwd/$srcdir/../test ;;
-    esac
-   ]
-)
-AC_MSG_CHECKING([for test data in $TESTDATADIR])
-if test -d $TESTDATADIR && test -f $TESTDATADIR/test-poppler.c; then
-  AC_MSG_RESULT([yes])
-else
-  AC_MSG_RESULT([no])
-  AC_MSG_WARN([
- No test data found in $TESTDATADIR.
- You will not be able to run 'make check' successfully.
-
- The test data is not included in the source packages
- and is also not part of the main git repository. Instead,
- you can checkout the test data from its own git
- repository with:
-
-   git clone git://git.freedesktop.org/git/poppler/test
-
- You should checkout the test data as a sibling of your
- poppler source folder or specify the location of your
- checkout with --with-testdatadir=/path/to/checkoutdir/test.
-])
-fi
-AC_SUBST(TESTDATADIR)
-
-# some compilers do not support this flag (see bug #76963)
-fno_check_new=
-AC_MSG_CHECKING([for -fno-check-new compiler flag])
-AC_LANG_PUSH([C++])
-saved_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="-fno-check-new $CXXFLAGS"
-AC_TRY_COMPILE([], [],
-  [AC_MSG_RESULT([yes])
-  fno_check_new="-fno-check-new"],
-  AC_MSG_RESULT([no])
-)
-CXXFLAGS=$saved_CXXFLAGS
-AC_LANG_POP
-
-if test "x$GCC" != xyes; then
-  enable_compile_warnings=no
-fi
-case "$enable_compile_warnings" in
-  no)	;;
-  yes)	CXXFLAGS="-Wall -Woverloaded-virtual -Wnon-virtual-dtor -Wcast-align -fno-exceptions $fno_check_new -fno-common $CXXFLAGS";
-        CFLAGS="-Wall $CFLAGS" ;;
-  kde)	CXXFLAGS="-Wnon-virtual-dtor -Wno-long-long -Wundef \
-		-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align \
-		-Wconversion -Wall -W -Wpointer-arith \
-		-Wwrite-strings -O2 -Wformat-security \
-		-Wmissing-format-attribute -fno-exceptions $fno_check_new \
-		-fno-common $CXXFLAGS" ;;
-esac
-
-case "$host_os" in
-  mingw*|cygwin*)
-    # mingw and cygwin print "warning: -fPIC ignored for target (all code is position independent)"
-    # for every file
-    ;;
-  *)
-    CXXFLAGS="-fPIC $CXXFLAGS";
-    ;;
-esac
-
-
-case `$PKG_CONFIG --version` in
-  0.?|0.1[0-7])
-    PC_REQUIRES_PRIVATE="";
-    PC_REQUIRES="poppler = $VERSION";;
-  *)
-    PC_REQUIRES_PRIVATE="Requires.private: poppler = $VERSION";
-    PC_REQUIRES="";;
-esac
-
-AC_SUBST(PC_REQUIRES)
-AC_SUBST(PC_REQUIRES_PRIVATE)
-
-AC_SUBST([POPPLER_MAJOR_VERSION],[poppler_version_major])
-AC_SUBST([POPPLER_MINOR_VERSION],[poppler_version_minor])
-AC_SUBST([POPPLER_MICRO_VERSION],[poppler_version_micro])
-AC_SUBST([POPPLER_VERSION],[poppler_version])
-
-AC_OUTPUT([
-Makefile
-goo/Makefile
-fofi/Makefile
-splash/Makefile
-poppler/Makefile
-utils/Makefile
-glib/Makefile
-glib/poppler-features.h
-glib/reference/Makefile
-glib/reference/version.xml
-glib/demo/Makefile
-test/Makefile
-qt4/Makefile
-qt4/src/Makefile
-qt4/tests/Makefile
-qt4/demos/Makefile
-qt5/Makefile
-qt5/src/Makefile
-qt5/tests/Makefile
-qt5/demos/Makefile
-cpp/Makefile
-cpp/poppler-version.h
-cpp/tests/Makefile
-poppler.pc
-poppler-uninstalled.pc
-poppler-cairo.pc
-poppler-cairo-uninstalled.pc
-poppler-splash.pc
-poppler-splash-uninstalled.pc
-poppler-glib.pc
-poppler-glib-uninstalled.pc
-poppler-qt4.pc
-poppler-qt4-uninstalled.pc
-poppler-qt5.pc
-poppler-qt5-uninstalled.pc
-poppler-cpp.pc
-poppler-cpp-uninstalled.pc])
-
-
-echo ""
-echo "Building poppler with support for:"
-echo "  font configuration:  $with_font_configuration"
-echo "  splash output:       $enable_splash_output"
-if test x$enable_cmyk = xyes;then
-        echo "      with CMYK support"
-fi
-echo "  cairo output:        $use_cairo"
-echo "  qt4 wrapper:         $enable_poppler_qt4"
-echo "  qt5 wrapper:         $enable_poppler_qt5"
-echo "  glib wrapper:        $use_glib"
-echo "    introspection:     $found_introspection"
-echo "  cpp wrapper:         $enable_poppler_cpp"
-echo "  use gtk-doc:         $enable_gtk_doc"
-echo "  use libjpeg:         $enable_libjpeg"
-echo "  use libpng:          $enable_libpng"
-echo "  use libtiff:         $enable_libtiff"
-echo "  use zlib compress:   $enable_zlib"
-echo "  use zlib uncompress: $enable_zlib_uncompress"
-echo "  use nss:             $enable_nss"
-echo "  use libcurl:         $enable_libcurl"
-echo "  use libopenjpeg:     $enable_libopenjpeg"
-if test x$enable_libopenjpeg = xyes;then
-    if test x$openjpeg1 = xyes;then
-        echo "      with openjpeg1"
-    else
-        echo "      with openjpeg2"
-    fi
-fi
-echo "  use cms:             $enable_cms"
-if test x$enable_cms = xyes;then
-    if test x$lcms1 = xyes;then
-        echo "      with lcms1"
-    else
-        echo "      with lcms2"
-    fi
-fi
-if test x$enable_build_type != xno;then
-        echo "  build type:          $enable_build_type"
-fi
-echo "  command line utils:  $enable_utils"
-echo "  test data dir:       $TESTDATADIR"
-echo ""
-
-if test x$enable_splash_output = xno -a x$enable_cairo_output = xno; then
-	echo "  Warning: There is no rendering backend enabled"
-fi
-
-if test x$enable_single_precision = xyes -a x$enable_fixedpoint = xyes; then
-	echo "  Warning: Single precision and fixed point options should not be enabled at the same time"
-fi
-
-if test x$enable_libjpeg != xyes; then
-	echo "  Warning: Using libjpeg is recommended. The internal DCT decoder is unmaintained."
-fi
-
-if test x$enable_zlib_uncompress != xno; then
-	echo "  Warning: Using zlib for decompression is not totally safe"
-fi
-
-if test x$enable_libopenjpeg != xyes; then
-	echo "  Warning: Using libopenjpeg2 is recommended. The internal JPX decoder is unmaintained."
-fi

Modified: branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiIdentifier.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiIdentifier.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiIdentifier.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -69,13 +69,13 @@
 public:
 
   static MemReader *make(char *bufA, int lenA);
-  virtual ~MemReader();
-  virtual int getByte(int pos);
-  virtual GBool getU16BE(int pos, int *val);
-  virtual GBool getU32BE(int pos, Guint *val);
-  virtual GBool getU32LE(int pos, Guint *val);
-  virtual GBool getUVarBE(int pos, int size, Guint *val);
-  virtual GBool cmp(int pos, const char *s);
+  ~MemReader();
+  int getByte(int pos) override;
+  GBool getU16BE(int pos, int *val) override;
+  GBool getU32BE(int pos, Guint *val) override;
+  GBool getU32LE(int pos, Guint *val) override;
+  GBool getUVarBE(int pos, int size, Guint *val) override;
+  GBool cmp(int pos, const char *s) override;
 
 private:
 
@@ -164,13 +164,13 @@
 public:
 
   static FileReader *make(char *fileName);
-  virtual ~FileReader();
-  virtual int getByte(int pos);
-  virtual GBool getU16BE(int pos, int *val);
-  virtual GBool getU32BE(int pos, Guint *val);
-  virtual GBool getU32LE(int pos, Guint *val);
-  virtual GBool getUVarBE(int pos, int size, Guint *val);
-  virtual GBool cmp(int pos, const char *s);
+  ~FileReader();
+  int getByte(int pos) override;
+  GBool getU16BE(int pos, int *val) override;
+  GBool getU32BE(int pos, Guint *val) override;
+  GBool getU32LE(int pos, Guint *val) override;
+  GBool getUVarBE(int pos, int size, Guint *val) override;
+  GBool cmp(int pos, const char *s) override;
 
 private:
 
@@ -287,13 +287,13 @@
 public:
 
   static StreamReader *make(int (*getCharA)(void *data), void *dataA);
-  virtual ~StreamReader();
-  virtual int getByte(int pos);
-  virtual GBool getU16BE(int pos, int *val);
-  virtual GBool getU32BE(int pos, Guint *val);
-  virtual GBool getU32LE(int pos, Guint *val);
-  virtual GBool getUVarBE(int pos, int size, Guint *val);
-  virtual GBool cmp(int pos, const char *s);
+  ~StreamReader();
+  int getByte(int pos) override;
+  GBool getU16BE(int pos, int *val) override;
+  GBool getU32BE(int pos, Guint *val) override;
+  GBool getU32LE(int pos, Guint *val) override;
+  GBool getUVarBE(int pos, int size, Guint *val) override;
+  GBool cmp(int pos, const char *s) override;
 
 private:
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiTrueType.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiTrueType.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiTrueType.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -16,10 +16,10 @@
 // Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
 // Copyright (C) 2007 Koji Otani <sho at bbr.jp>
 // Copyright (C) 2007 Carlos Garcia Campos <carlosgc at gnome.org>
-// Copyright (C) 2008, 2009, 2012, 2014-2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2009, 2012, 2014-2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Tomas Are Haavet <tomasare at gmail.com>
 // Copyright (C) 2012 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
-// Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2014 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2015 Aleksei Volkov <Aleksei Volkov>
 // Copyright (C) 2015, 2016 William Bader <williambader at hotmail.com>
@@ -37,6 +37,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <limits.h>
 #include <algorithm>
 #include "goo/gtypes.h"
 #include "goo/gmem.h"
@@ -451,7 +452,7 @@
 GBool FoFiTrueType::getCFFBlock(char **start, int *length) {
   int i;
 
-  if (!openTypeCFF) {
+  if (!openTypeCFF || !tables) {
     return gFalse;
   }
   i = seekTable("CFF ");
@@ -1307,8 +1308,10 @@
     switch (length & 3) {
     case 3:
       word |= (data[i+2] & 0xff) <<  8;
+      // fallthrough
     case 2:
       word |= (data[i+1] & 0xff) << 16;
+      // fallthrough
     case 1:
       word |= (data[i  ] & 0xff) << 24;
       break;

Modified: branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiTrueType.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiTrueType.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiTrueType.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -53,7 +53,7 @@
   // Create a FoFiTrueType object from a file on disk.
   static FoFiTrueType *load(char *fileName, int faceIndexA=0);
 
-  virtual ~FoFiTrueType();
+  ~FoFiTrueType();
 
   // Returns true if this an OpenType font containing CFF data, false
   // if it's a TrueType font (or OpenType font with TrueType data).

Modified: branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -17,6 +17,8 @@
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2010 Jakub Wilk <jwilk at jwilk.net>
 // Copyright (C) 2014 Carlos Garcia Campos <carlosgc at gnome.org>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2017 Jean Ghali <jghali at libertysurf.fr>
 //
 // 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
@@ -31,6 +33,8 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <limits.h>
+#include "goo/glibc.h"
 #include "goo/gmem.h"
 #include "goo/GooLikely.h"
 #include "FoFiEncodings.h"
@@ -209,12 +213,12 @@
 }
 
 void FoFiType1::parse() {
-  char *line, *line1, *p, *p2;
+  char *line, *line1, *firstLine, *p, *p2;
   char buf[256];
   char c;
   int n, code, base, i, j;
   char *tokptr;
-  GBool gotMatrix;
+  GBool gotMatrix, continueLine;
 
   gotMatrix = gFalse;
   for (i = 1, line = (char *)file;
@@ -241,6 +245,7 @@
       for (j = 0; j < 256; ++j) {
 	encoding[j] = NULL;
       }
+      continueLine = gFalse;
       for (j = 0, line = getNextLine(line);
 	   j < 300 && line && (line1 = getNextLine(line));
 	   ++j, line = line1) {
@@ -248,8 +253,26 @@
 	  error(errSyntaxWarning, -1, "FoFiType1::parse a line has more than 255 characters, we don't support this");
 	  n = 255;
 	}
-	strncpy(buf, line, n);
-	buf[n] = '\0';
+	if (continueLine) {
+	  continueLine = gFalse;
+	  if ((line1 - firstLine) + 1 > (int)sizeof(buf))
+	    break;
+	  p = firstLine;
+	  p2 = buf;
+	  while (p < line1) {
+	    if (*p == '\n' || *p == '\r') {
+	      *p2++ = ' ';
+	      p++;
+	    } else {
+	      *p2++ = *p++;
+	    }
+	  }
+	  *p2 = '\0';
+	} else {
+	  firstLine = line;
+	  strncpy(buf, line, n);
+	  buf[n] = '\0';
+	}
 	for (p = buf; *p == ' ' || *p == '\t'; ++p) ;
 	if (!strncmp(p, "dup", 3)) {
 	  while (1) {
@@ -261,6 +284,9 @@
 	      p += 2;
 	    } else if (*p >= '0' && *p <= '9') {
 	      base = 10;
+	    } else if (*p == '\n' || *p == '\r') {
+	      continueLine = gTrue;
+	      break;
 	    } else {
 	      break;
 	    }
@@ -268,8 +294,11 @@
 	      code = code * base + (*p - '0');
 	    }
 	    for (; *p == ' ' || *p == '\t'; ++p) ;
-	    if (*p != '/') {
+	    if (*p == '\n' || *p == '\r') {
+	      continueLine = gTrue;
 	      break;
+	    } else if (*p != '/') {
+	      break;
 	    }
 	    ++p;
 	    for (p2 = p; *p2 && *p2 != ' ' && *p2 != '\t'; ++p2) ;
@@ -276,10 +305,15 @@
 	    if (code >= 0 && code < 256) {
 	      c = *p2;
 	      *p2 = '\0';
+	      gfree(encoding[code]);
 	      encoding[code] = copyString(p);
 	      *p2 = c;
 	    }
 	    for (p = p2; *p == ' ' || *p == '\t'; ++p) ;
+	    if (*p == '\n' || *p == '\r') {
+	      continueLine = gTrue;
+	      break;
+	    }
 	    if (strncmp(p, "put", 3)) {
 	      break;
 	    }

Modified: branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -29,7 +29,7 @@
   // Create a FoFiType1 object from a file on disk.
   static FoFiType1 *load(char *fileName);
 
-  virtual ~FoFiType1();
+  ~FoFiType1();
 
   // Return the font name.
   char *getName();

Modified: branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1C.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1C.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/fofi/FoFiType1C.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2009, 2010 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009, 2010, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
 //
 // To see a description of the changes please see the Changelog file that
@@ -33,6 +33,7 @@
 #include "goo/gmem.h"
 #include "goo/gstrtod.h"
 #include "goo/GooString.h"
+#include "poppler/Error.h"
 #include "FoFiEncodings.h"
 #include "FoFiType1C.h"
 
@@ -879,253 +880,260 @@
     }
   }
 
+  if (privateDicts) {
   // write the descendant Type 1 fonts
-  for (i = 0; i < nCIDs; i += 256) {
+    for (i = 0; i < nCIDs; i += 256) {
 
-    //~ this assumes that all CIDs in this block have the same FD --
-    //~ to handle multiple FDs correctly, need to somehow divide the
-    //~ font up by FD; as a kludge we ignore CID 0, which is .notdef
-    fd = 0;
-    // if fdSelect is NULL, we have an 8-bit font, so just leave fd=0
-    if (fdSelect) {
-      for (j = i==0 ? 1 : 0; j < 256 && i+j < nCIDs; ++j) {
-        if (cidMap[i+j] >= 0) {
-          fd = fdSelect[cidMap[i+j]];
-          break;
-        }
+      //~ this assumes that all CIDs in this block have the same FD --
+      //~ to handle multiple FDs correctly, need to somehow divide the
+      //~ font up by FD; as a kludge we ignore CID 0, which is .notdef
+      fd = 0;
+      // if fdSelect is NULL, we have an 8-bit font, so just leave fd=0
+      if (fdSelect) {
+	for (j = i==0 ? 1 : 0; j < 256 && i+j < nCIDs; ++j) {
+	  if (cidMap[i+j] >= 0) {
+	    fd = fdSelect[cidMap[i+j]];
+	    break;
+	  }
+	}
       }
-    }
 
-    // font dictionary (unencrypted section)
-    (*outputFunc)(outputStream, "16 dict begin\n", 14);
-    (*outputFunc)(outputStream, "/FontName /", 11);
-    (*outputFunc)(outputStream, psName, strlen(psName));
-    buf = GooString::format("_{0:02x} def\n", i >> 8);
-    (*outputFunc)(outputStream, buf->getCString(), buf->getLength());
-    delete buf;
-    (*outputFunc)(outputStream, "/FontType 1 def\n", 16);
-    if (privateDicts[fd].hasFontMatrix) {
-      buf = GooString::format("/FontMatrix [{0:.8g} {1:.8g} {2:.8g} {3:.8g} {4:.8g} {5:.8g}] def\n",
-			    privateDicts[fd].fontMatrix[0],
-			    privateDicts[fd].fontMatrix[1],
-			    privateDicts[fd].fontMatrix[2],
-			    privateDicts[fd].fontMatrix[3],
-			    privateDicts[fd].fontMatrix[4],
-			    privateDicts[fd].fontMatrix[5]);
+      if (fd >= nFDs)
+	continue;
+
+      // font dictionary (unencrypted section)
+      (*outputFunc)(outputStream, "16 dict begin\n", 14);
+      (*outputFunc)(outputStream, "/FontName /", 11);
+      (*outputFunc)(outputStream, psName, strlen(psName));
+      buf = GooString::format("_{0:02x} def\n", i >> 8);
       (*outputFunc)(outputStream, buf->getCString(), buf->getLength());
       delete buf;
-    } else if (topDict.hasFontMatrix) {
-      (*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30);
-    } else {
-      (*outputFunc)(outputStream,
-		    "/FontMatrix [0.001 0 0 0.001 0 0] def\n", 38);
-    }
-    buf = GooString::format("/FontBBox [{0:.4g} {1:.4g} {2:.4g} {3:.4g}] def\n",
-			  topDict.fontBBox[0], topDict.fontBBox[1],
-			  topDict.fontBBox[2], topDict.fontBBox[3]);
-    (*outputFunc)(outputStream, buf->getCString(), buf->getLength());
-    delete buf;
-    buf = GooString::format("/PaintType {0:d} def\n", topDict.paintType);
-    (*outputFunc)(outputStream, buf->getCString(), buf->getLength());
-    delete buf;
-    if (topDict.paintType != 0) {
-      buf = GooString::format("/StrokeWidth {0:.4g} def\n", topDict.strokeWidth);
+      (*outputFunc)(outputStream, "/FontType 1 def\n", 16);
+      if (privateDicts[fd].hasFontMatrix) {
+	buf = GooString::format("/FontMatrix [{0:.8g} {1:.8g} {2:.8g} {3:.8g} {4:.8g} {5:.8g}] def\n",
+			      privateDicts[fd].fontMatrix[0],
+			      privateDicts[fd].fontMatrix[1],
+			      privateDicts[fd].fontMatrix[2],
+			      privateDicts[fd].fontMatrix[3],
+			      privateDicts[fd].fontMatrix[4],
+			      privateDicts[fd].fontMatrix[5]);
+	(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
+	delete buf;
+      } else if (topDict.hasFontMatrix) {
+	(*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30);
+      } else {
+	(*outputFunc)(outputStream,
+		      "/FontMatrix [0.001 0 0 0.001 0 0] def\n", 38);
+      }
+      buf = GooString::format("/FontBBox [{0:.4g} {1:.4g} {2:.4g} {3:.4g}] def\n",
+			    topDict.fontBBox[0], topDict.fontBBox[1],
+			    topDict.fontBBox[2], topDict.fontBBox[3]);
       (*outputFunc)(outputStream, buf->getCString(), buf->getLength());
       delete buf;
-    }
-    (*outputFunc)(outputStream, "/Encoding 256 array\n", 20);
-    for (j = 0; j < 256 && i+j < nCIDs; ++j) {
-      buf = GooString::format("dup {0:d} /c{1:02x} put\n", j, j);
+      buf = GooString::format("/PaintType {0:d} def\n", topDict.paintType);
       (*outputFunc)(outputStream, buf->getCString(), buf->getLength());
       delete buf;
-    }
-    if (j < 256) {
-      buf = GooString::format("{0:d} 1 255 {{ 1 index exch /.notdef put }} for\n",
-			    j);
-      (*outputFunc)(outputStream, buf->getCString(), buf->getLength());
-      delete buf;
-    }
-    (*outputFunc)(outputStream, "readonly def\n", 13);
-    (*outputFunc)(outputStream, "currentdict end\n", 16);
+      if (topDict.paintType != 0) {
+	buf = GooString::format("/StrokeWidth {0:.4g} def\n", topDict.strokeWidth);
+	(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
+	delete buf;
+      }
+      (*outputFunc)(outputStream, "/Encoding 256 array\n", 20);
+      for (j = 0; j < 256 && i+j < nCIDs; ++j) {
+	buf = GooString::format("dup {0:d} /c{1:02x} put\n", j, j);
+	(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
+	delete buf;
+      }
+      if (j < 256) {
+	buf = GooString::format("{0:d} 1 255 {{ 1 index exch /.notdef put }} for\n",
+			      j);
+	(*outputFunc)(outputStream, buf->getCString(), buf->getLength());
+	delete buf;
+      }
+      (*outputFunc)(outputStream, "readonly def\n", 13);
+      (*outputFunc)(outputStream, "currentdict end\n", 16);
 
-    // start the binary section
-    (*outputFunc)(outputStream, "currentfile eexec\n", 18);
-    eb.outputFunc = outputFunc;
-    eb.outputStream = outputStream;
-    eb.ascii = gTrue;
-    eb.r1 = 55665;
-    eb.line = 0;
+      // start the binary section
+      (*outputFunc)(outputStream, "currentfile eexec\n", 18);
+      eb.outputFunc = outputFunc;
+      eb.outputStream = outputStream;
+      eb.ascii = gTrue;
+      eb.r1 = 55665;
+      eb.line = 0;
 
-    // start the private dictionary
-    eexecWrite(&eb, "\x83\xca\x73\xd5");
-    eexecWrite(&eb, "dup /Private 32 dict dup begin\n");
-    eexecWrite(&eb, "/RD {string currentfile exch readstring pop}"
-	       " executeonly def\n");
-    eexecWrite(&eb, "/ND {noaccess def} executeonly def\n");
-    eexecWrite(&eb, "/NP {noaccess put} executeonly def\n");
-    eexecWrite(&eb, "/MinFeature {16 16} def\n");
-    eexecWrite(&eb, "/password 5839 def\n");
-    if (privateDicts[fd].nBlueValues) {
-      eexecWrite(&eb, "/BlueValues [");
-      for (k = 0; k < privateDicts[fd].nBlueValues; ++k) {
-	buf = GooString::format("{0:s}{1:d}",
-			      k > 0 ? " " : "",
-			      privateDicts[fd].blueValues[k]);
+      // start the private dictionary
+      eexecWrite(&eb, "\x83\xca\x73\xd5");
+      eexecWrite(&eb, "dup /Private 32 dict dup begin\n");
+      eexecWrite(&eb, "/RD {string currentfile exch readstring pop}"
+		" executeonly def\n");
+      eexecWrite(&eb, "/ND {noaccess def} executeonly def\n");
+      eexecWrite(&eb, "/NP {noaccess put} executeonly def\n");
+      eexecWrite(&eb, "/MinFeature {16 16} def\n");
+      eexecWrite(&eb, "/password 5839 def\n");
+      if (privateDicts[fd].nBlueValues) {
+	eexecWrite(&eb, "/BlueValues [");
+	for (k = 0; k < privateDicts[fd].nBlueValues; ++k) {
+	  buf = GooString::format("{0:s}{1:d}",
+				k > 0 ? " " : "",
+				privateDicts[fd].blueValues[k]);
+	  eexecWrite(&eb, buf->getCString());
+	  delete buf;
+	}
+	eexecWrite(&eb, "] def\n");
+      }
+      if (privateDicts[fd].nOtherBlues) {
+	eexecWrite(&eb, "/OtherBlues [");
+	for (k = 0; k < privateDicts[fd].nOtherBlues; ++k) {
+	  buf = GooString::format("{0:s}{1:d}",
+				k > 0 ? " " : "",
+				privateDicts[fd].otherBlues[k]);
+	  eexecWrite(&eb, buf->getCString());
+	  delete buf;
+	}
+	eexecWrite(&eb, "] def\n");
+      }
+      if (privateDicts[fd].nFamilyBlues) {
+	eexecWrite(&eb, "/FamilyBlues [");
+	for (k = 0; k < privateDicts[fd].nFamilyBlues; ++k) {
+	  buf = GooString::format("{0:s}{1:d}", k > 0 ? " " : "",
+				privateDicts[fd].familyBlues[k]);
+	  eexecWrite(&eb, buf->getCString());
+	  delete buf;
+	}
+	eexecWrite(&eb, "] def\n");
+      }
+      if (privateDicts[fd].nFamilyOtherBlues) {
+	eexecWrite(&eb, "/FamilyOtherBlues [");
+	for (k = 0; k < privateDicts[fd].nFamilyOtherBlues; ++k) {
+	  buf = GooString::format("{0:s}{1:d}", k > 0 ? " " : "",
+				privateDicts[fd].familyOtherBlues[k]);
+	  eexecWrite(&eb, buf->getCString());
+	  delete buf;
+	}
+	eexecWrite(&eb, "] def\n");
+      }
+      if (privateDicts[fd].blueScale != 0.039625) {
+	buf = GooString::format("/BlueScale {0:.4g} def\n",
+			      privateDicts[fd].blueScale);
 	eexecWrite(&eb, buf->getCString());
 	delete buf;
       }
-      eexecWrite(&eb, "] def\n");
-    }
-    if (privateDicts[fd].nOtherBlues) {
-      eexecWrite(&eb, "/OtherBlues [");
-      for (k = 0; k < privateDicts[fd].nOtherBlues; ++k) {
-	buf = GooString::format("{0:s}{1:d}",
-			      k > 0 ? " " : "",
-			      privateDicts[fd].otherBlues[k]);
+      if (privateDicts[fd].blueShift != 7) {
+	buf = GooString::format("/BlueShift {0:d} def\n",
+			      privateDicts[fd].blueShift);
 	eexecWrite(&eb, buf->getCString());
 	delete buf;
       }
-      eexecWrite(&eb, "] def\n");
-    }
-    if (privateDicts[fd].nFamilyBlues) {
-      eexecWrite(&eb, "/FamilyBlues [");
-      for (k = 0; k < privateDicts[fd].nFamilyBlues; ++k) {
-	buf = GooString::format("{0:s}{1:d}", k > 0 ? " " : "",
-			      privateDicts[fd].familyBlues[k]);
+      if (privateDicts[fd].blueFuzz != 1) {
+	buf = GooString::format("/BlueFuzz {0:d} def\n",
+			      privateDicts[fd].blueFuzz);
 	eexecWrite(&eb, buf->getCString());
 	delete buf;
       }
-      eexecWrite(&eb, "] def\n");
-    }
-    if (privateDicts[fd].nFamilyOtherBlues) {
-      eexecWrite(&eb, "/FamilyOtherBlues [");
-      for (k = 0; k < privateDicts[fd].nFamilyOtherBlues; ++k) {
-	buf = GooString::format("{0:s}{1:d}", k > 0 ? " " : "",
-			      privateDicts[fd].familyOtherBlues[k]);
+      if (privateDicts[fd].hasStdHW) {
+	buf = GooString::format("/StdHW [{0:.4g}] def\n", privateDicts[fd].stdHW);
 	eexecWrite(&eb, buf->getCString());
 	delete buf;
       }
-      eexecWrite(&eb, "] def\n");
-    }
-    if (privateDicts[fd].blueScale != 0.039625) {
-      buf = GooString::format("/BlueScale {0:.4g} def\n",
-			    privateDicts[fd].blueScale);
-      eexecWrite(&eb, buf->getCString());
-      delete buf;
-    }
-    if (privateDicts[fd].blueShift != 7) {
-      buf = GooString::format("/BlueShift {0:d} def\n",
-			    privateDicts[fd].blueShift);
-      eexecWrite(&eb, buf->getCString());
-      delete buf;
-    }
-    if (privateDicts[fd].blueFuzz != 1) {
-      buf = GooString::format("/BlueFuzz {0:d} def\n",
-			    privateDicts[fd].blueFuzz);
-      eexecWrite(&eb, buf->getCString());
-      delete buf;
-    }
-    if (privateDicts[fd].hasStdHW) {
-      buf = GooString::format("/StdHW [{0:.4g}] def\n", privateDicts[fd].stdHW);
-      eexecWrite(&eb, buf->getCString());
-      delete buf;
-    }
-    if (privateDicts[fd].hasStdVW) {
-      buf = GooString::format("/StdVW [{0:.4g}] def\n", privateDicts[fd].stdVW);
-      eexecWrite(&eb, buf->getCString());
-      delete buf;
-    }
-    if (privateDicts[fd].nStemSnapH) {
-      eexecWrite(&eb, "/StemSnapH [");
-      for (k = 0; k < privateDicts[fd].nStemSnapH; ++k) {
-	buf = GooString::format("{0:s}{1:.4g}",
-			      k > 0 ? " " : "", privateDicts[fd].stemSnapH[k]);
+      if (privateDicts[fd].hasStdVW) {
+	buf = GooString::format("/StdVW [{0:.4g}] def\n", privateDicts[fd].stdVW);
 	eexecWrite(&eb, buf->getCString());
 	delete buf;
       }
-      eexecWrite(&eb, "] def\n");
-    }
-    if (privateDicts[fd].nStemSnapV) {
-      eexecWrite(&eb, "/StemSnapV [");
-      for (k = 0; k < privateDicts[fd].nStemSnapV; ++k) {
-	buf = GooString::format("{0:s}{1:.4g}",
-			      k > 0 ? " " : "", privateDicts[fd].stemSnapV[k]);
+      if (privateDicts[fd].nStemSnapH) {
+	eexecWrite(&eb, "/StemSnapH [");
+	for (k = 0; k < privateDicts[fd].nStemSnapH; ++k) {
+	  buf = GooString::format("{0:s}{1:.4g}",
+				k > 0 ? " " : "", privateDicts[fd].stemSnapH[k]);
+	  eexecWrite(&eb, buf->getCString());
+	  delete buf;
+	}
+	eexecWrite(&eb, "] def\n");
+      }
+      if (privateDicts[fd].nStemSnapV) {
+	eexecWrite(&eb, "/StemSnapV [");
+	for (k = 0; k < privateDicts[fd].nStemSnapV; ++k) {
+	  buf = GooString::format("{0:s}{1:.4g}",
+				k > 0 ? " " : "", privateDicts[fd].stemSnapV[k]);
+	  eexecWrite(&eb, buf->getCString());
+	  delete buf;
+	}
+	eexecWrite(&eb, "] def\n");
+      }
+      if (privateDicts[fd].hasForceBold) {
+	buf = GooString::format("/ForceBold {0:s} def\n",
+			      privateDicts[fd].forceBold ? "true" : "false");
 	eexecWrite(&eb, buf->getCString());
 	delete buf;
       }
-      eexecWrite(&eb, "] def\n");
-    }
-    if (privateDicts[fd].hasForceBold) {
-      buf = GooString::format("/ForceBold {0:s} def\n",
-			    privateDicts[fd].forceBold ? "true" : "false");
-      eexecWrite(&eb, buf->getCString());
-      delete buf;
-    }
-    if (privateDicts[fd].forceBoldThreshold != 0) {
-      buf = GooString::format("/ForceBoldThreshold {0:.4g} def\n",
-			    privateDicts[fd].forceBoldThreshold);
-      eexecWrite(&eb, buf->getCString());
-      delete buf;
-    }
-    if (privateDicts[fd].languageGroup != 0) {
-      buf = GooString::format("/LanguageGroup {0:d} def\n",
-			    privateDicts[fd].languageGroup);
-      eexecWrite(&eb, buf->getCString());
-      delete buf;
-    }
-    if (privateDicts[fd].expansionFactor != 0.06) {
-      buf = GooString::format("/ExpansionFactor {0:.4g} def\n",
-			    privateDicts[fd].expansionFactor);
-      eexecWrite(&eb, buf->getCString());
-      delete buf;
-    }
+      if (privateDicts[fd].forceBoldThreshold != 0) {
+	buf = GooString::format("/ForceBoldThreshold {0:.4g} def\n",
+			      privateDicts[fd].forceBoldThreshold);
+	eexecWrite(&eb, buf->getCString());
+	delete buf;
+      }
+      if (privateDicts[fd].languageGroup != 0) {
+	buf = GooString::format("/LanguageGroup {0:d} def\n",
+			      privateDicts[fd].languageGroup);
+	eexecWrite(&eb, buf->getCString());
+	delete buf;
+      }
+      if (privateDicts[fd].expansionFactor != 0.06) {
+	buf = GooString::format("/ExpansionFactor {0:.4g} def\n",
+			      privateDicts[fd].expansionFactor);
+	eexecWrite(&eb, buf->getCString());
+	delete buf;
+      }
 
-    // set up the subroutines
-    ok = gTrue;
-    getIndex(privateDicts[fd].subrsOffset, &subrIdx, &ok);
-    if (!ok) {
-      subrIdx.pos = -1;
-    }
+      // set up the subroutines
+      ok = gTrue;
+      getIndex(privateDicts[fd].subrsOffset, &subrIdx, &ok);
+      if (!ok) {
+	subrIdx.pos = -1;
+      }
 
-    // start the CharStrings
-    eexecWrite(&eb, "2 index /CharStrings 256 dict dup begin\n");
+      // start the CharStrings
+      eexecWrite(&eb, "2 index /CharStrings 256 dict dup begin\n");
 
-    // write the .notdef CharString
-    ok = gTrue;
-    getIndexVal(&charStringsIdx, 0, &val, &ok);
-    if (ok) {
-      eexecCvtGlyph(&eb, ".notdef", val.pos, val.len,
-		    &subrIdx, &privateDicts[fd]);
-    }
+      // write the .notdef CharString
+      ok = gTrue;
+      getIndexVal(&charStringsIdx, 0, &val, &ok);
+      if (ok) {
+	eexecCvtGlyph(&eb, ".notdef", val.pos, val.len,
+		      &subrIdx, &privateDicts[fd]);
+      }
 
-    // write the CharStrings
-    for (j = 0; j < 256 && i+j < nCIDs; ++j) {
-      if (cidMap[i+j] >= 0) {
-	ok = gTrue;
-	getIndexVal(&charStringsIdx, cidMap[i+j], &val, &ok);
-	if (ok) {
-	  buf = GooString::format("c{0:02x}", j);
-	  eexecCvtGlyph(&eb, buf->getCString(), val.pos, val.len,
-			&subrIdx, &privateDicts[fd]);
-	  delete buf;
+      // write the CharStrings
+      for (j = 0; j < 256 && i+j < nCIDs; ++j) {
+	if (cidMap[i+j] >= 0) {
+	  ok = gTrue;
+	  getIndexVal(&charStringsIdx, cidMap[i+j], &val, &ok);
+	  if (ok) {
+	    buf = GooString::format("c{0:02x}", j);
+	    eexecCvtGlyph(&eb, buf->getCString(), val.pos, val.len,
+			  &subrIdx, &privateDicts[fd]);
+	    delete buf;
+	  }
 	}
       }
-    }
-    eexecWrite(&eb, "end\n");
-    eexecWrite(&eb, "end\n");
-    eexecWrite(&eb, "readonly put\n");
-    eexecWrite(&eb, "noaccess put\n");
-    eexecWrite(&eb, "dup /FontName get exch definefont pop\n");
-    eexecWrite(&eb, "mark currentfile closefile\n");
+      eexecWrite(&eb, "end\n");
+      eexecWrite(&eb, "end\n");
+      eexecWrite(&eb, "readonly put\n");
+      eexecWrite(&eb, "noaccess put\n");
+      eexecWrite(&eb, "dup /FontName get exch definefont pop\n");
+      eexecWrite(&eb, "mark currentfile closefile\n");
 
-    // trailer
-    if (eb.line > 0) {
-      (*outputFunc)(outputStream, "\n", 1);
+      // trailer
+      if (eb.line > 0) {
+	(*outputFunc)(outputStream, "\n", 1);
+      }
+      for (j = 0; j < 8; ++j) {
+	(*outputFunc)(outputStream, "0000000000000000000000000000000000000000000000000000000000000000\n", 65);
+      }
+      (*outputFunc)(outputStream, "cleartomark\n", 12);
     }
-    for (j = 0; j < 8; ++j) {
-      (*outputFunc)(outputStream, "0000000000000000000000000000000000000000000000000000000000000000\n", 65);
-    }
-    (*outputFunc)(outputStream, "cleartomark\n", 12);
+  } else {
+    error(errSyntaxError, -1, "FoFiType1C::convertToType0 without privateDicts");
   }
 
   // write the Type 0 parent font

Deleted: branches/stable/source/src/libs/poppler/poppler-src/fofi/Makefile.am
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/fofi/Makefile.am	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/fofi/Makefile.am	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,28 +0,0 @@
-noinst_LTLIBRARIES = libfofi.la
-
-if ENABLE_XPDF_HEADERS
-poppler_fofi_includedir = $(includedir)/poppler/fofi
-poppler_fofi_include_HEADERS =	\
-	FoFiBase.h		\
-	FoFiEncodings.h		\
-	FoFiTrueType.h		\
-	FoFiType1.h		\
-	FoFiIdentifier.h	\
-	FoFiType1C.h
-endif
-
-libfofi_la_SOURCES =		\
-	FoFiBase.cc		\
-	FoFiBase.h		\
-	FoFiEncodings.cc	\
-	FoFiEncodings.h		\
-	FoFiTrueType.cc		\
-	FoFiTrueType.h		\
-	FoFiType1.cc		\
-	FoFiType1.h		\
-	FoFiType1C.cc		\
-	FoFiIdentifier.cc	\
-	FoFiType1C.h
-
-libfofi_la_CPPFLAGS =		\
-	-I$(top_srcdir)

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/FixedPoint.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/FixedPoint.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/FixedPoint.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -8,9 +8,23 @@
 //
 //========================================================================
 
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
+//
+//========================================================================
+
 #include <config.h>
 
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
 
 #ifdef USE_GCC_PRAGMAS
 #pragma implementation

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/FixedPoint.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/FixedPoint.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/FixedPoint.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -8,12 +8,27 @@
 //
 //========================================================================
 
+
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
+//
+//========================================================================
+
 #ifndef FIXEDPOINT_H
 #define FIXEDPOINT_H
 
 #include "poppler-config.h"
 
-#if USE_FIXEDPOINT
+#ifdef USE_FIXEDPOINT
 
 #ifdef USE_GCC_PRAGMAS
 #pragma interface

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/GooHash.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/GooHash.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/GooHash.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -6,6 +6,20 @@
 //
 //========================================================================
 
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2017 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>
 
 #ifdef USE_GCC_PRAGMAS
@@ -15,6 +29,7 @@
 #include "gmem.h"
 #include "GooString.h"
 #include "GooHash.h"
+#include "GooLikely.h"
 
 //------------------------------------------------------------------------
 
@@ -339,6 +354,9 @@
 GooHashBucket *GooHash::find(GooString *key, int *h) {
   GooHashBucket *p;
 
+  if (unlikely(!key))
+    return nullptr;
+
   *h = hash(key);
   for (p = tab[*h]; p; p = p->next) {
     if (!p->key->cmp(key)) {

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/GooMutex.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/GooMutex.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/GooMutex.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -21,6 +21,7 @@
 // Copyright (C) 2013 Adam Reichold <adamreichold at myopera.com>
 // Copyright (C) 2014 Bogdan Cristea <cristeab at gmail.com>
 // Copyright (C) 2014 Peter Breitenlohner <peb at mppmu.mpg.de>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -30,6 +31,8 @@
 #ifndef GMUTEX_H
 #define GMUTEX_H
 
+#ifdef MULTITHREADED
+
 // Usage:
 //
 // GooMutex m;
@@ -82,4 +85,6 @@
   GooMutex *mutex;
 };
 
-#endif
+#endif // MULTITHREADED
+
+#endif // GMUTEX_H

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/GooString.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/GooString.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/GooString.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -18,10 +18,10 @@
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 // Copyright (C) 2007 Jeff Muizelaar <jeff at infidigm.net>
-// Copyright (C) 2008-2011, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008-2011, 2016, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2011 Kenji Uno <ku at digitaldolphins.jp>
 // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso at hotmail.it>
-// Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2012 Pino Toscano <pino at kde.org>
 // Copyright (C) 2013 Jason Crain <jason at aquaticape.us>
 // Copyright (C) 2015 William Bader <williambader at hotmail.com>
@@ -56,12 +56,8 @@
   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 @@
   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 @@
 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 @@
 	  case fmtULongBinary:
 	    args[argsLen].ul = va_arg(argList, Gulong);
 	    break;
-#ifdef LLONG_MAX
 	  case fmtLongLongDecimal:
 	  case fmtLongLongHex:
 	  case fmtLongLongHexUpper:
@@ -432,8 +419,6 @@
 	  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 @@
 	  case fmtULongLongBinary:
 	    args[argsLen].ull = va_arg(argList, unsigned long long);
 	    break;
-#endif
 	  case fmtDouble:
 	  case fmtDoubleTrim:
 	  case fmtDoubleTrimSmallAware:
@@ -531,7 +515,6 @@
 	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 @@
 	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 @@
 	  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 @@
 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 @@
   *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;
 
@@ -917,8 +881,14 @@
   return length > 1 && (s[0] & 0xff) == 0xfe && (s[1] & 0xff) == 0xff;
 }
 
-GooString *GooString::sanitizedName(GBool psmode)
+void GooString::prependUnicodeMarker()
 {
+    insert(0, (char)0xff);
+    insert(0, (char)0xfe);
+}
+
+GooString *GooString::sanitizedName(GBool psmode) const
+{
   GooString *name;
   char buf[8];
   int i;

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/GooString.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/GooString.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/GooString.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -17,11 +17,12 @@
 //
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
-// Copyright (C) 2008-2010, 2012, 2014 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008-2010, 2012, 2014, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2012-2014 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Jason Crain <jason at aquaticape.us>
 // Copyright (C) 2015 Adam Reichold <adam.reichold at t-online.de>
 // Copyright (C) 2016 Jakub Alba <jakubalba at gmail.com>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -35,22 +36,6 @@
 #pragma interface
 #endif
 
-#include <limits.h> // for LLONG_MAX and ULLONG_MAX
-
-/* <limits.h> and/or the compiler may or may not define these.  */
-/* Minimum and maximum values a `signed long long int' can hold.  */
-#ifndef LLONG_MAX
-# define LLONG_MAX	9223372036854775807LL
-#endif
-#ifndef LLONG_MIN
-# define LLONG_MIN	(-LLONG_MAX - 1LL)
-#endif
-
-/* Maximum value an `unsigned long long int' can hold.  (Minimum is 0.)  */
-#ifndef ULLONG_MAX
-# define ULLONG_MAX	18446744073709551615ULL
-#endif
-
 #include <stdarg.h>
 #include <stdlib.h> // for NULL
 #include "gtypes.h"
@@ -176,6 +161,7 @@
   GBool endsWith(const char *suffix) const;
 
   GBool hasUnicodeMarker(void) const;
+  void prependUnicodeMarker();
   GBool hasJustUnicodeMarker(void) const { return length == 2 && hasUnicodeMarker(); }
 
   // Sanitizes the string so that it does
@@ -182,7 +168,7 @@
   // not contain any ( ) < > [ ] { } / %
   // The postscript mode also has some more strict checks
   // The caller owns the return value
-  GooString *sanitizedName(GBool psmode);
+  GooString *sanitizedName(GBool psmode) const;
 
 private:
   GooString(const GooString &other);
@@ -201,24 +187,12 @@
   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,

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/JpegWriter.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/JpegWriter.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/JpegWriter.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -5,10 +5,11 @@
 // This file is licensed under the GPLv2 or later
 //
 // Copyright (C) 2009 Stefan Thomas <thomas at eload24.com>
-// Copyright (C) 2010, 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2010, 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2010 Harry Roberts <harry.roberts at midnight-labs.org>
 // Copyright (C) 2011 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2013 Peter Breitenlohner <peb at mppmu.mpg.de>
+// Copyright (C) 2017 Albert Astals Cid <aacid at kde.org>
 //
 //========================================================================
 
@@ -30,7 +31,7 @@
   struct jpeg_error_mgr jerr;
 };
 
-void outputMessage(j_common_ptr cinfo)
+static void outputMessage(j_common_ptr cinfo)
 {
   char buffer[JMSG_LENGTH_MAX];
 
@@ -64,6 +65,16 @@
   delete priv;
 }
 
+void JpegWriter::setQuality(int quality)
+{
+  priv->quality = quality;
+}
+
+void JpegWriter::setProgressive(bool progressive)
+{
+  priv->progressive = progressive;
+}
+
 bool JpegWriter::init(FILE *f, int width, int height, int hDPI, int vDPI)
 {
   // Setup error handler

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/JpegWriter.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/JpegWriter.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/JpegWriter.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -5,7 +5,7 @@
 // This file is licensed under the GPLv2 or later
 //
 // Copyright (C) 2009 Stefan Thomas <thomas at eload24.com>
-// Copyright (C) 2010, 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2010, 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2010 Jürg Billeter <j at bitron.ch>
 // Copyright (C) 2010 Harry Roberts <harry.roberts at midnight-labs.org>
 // Copyright (C) 2010 Brian Cameron <brian.cameron at oracle.com>
@@ -39,13 +39,15 @@
   JpegWriter(Format format = RGB);
   ~JpegWriter();
 
-  bool init(FILE *f, int width, int height, int hDPI, int vDPI);
+  void setQuality(int quality);
+  void setProgressive(bool progressive);
+  bool init(FILE *f, int width, int height, int hDPI, int vDPI) override;
 
-  bool writePointers(unsigned char **rowPointers, int rowCount);
-  bool writeRow(unsigned char **row);
+  bool writePointers(unsigned char **rowPointers, int rowCount) override;
+  bool writeRow(unsigned char **row) override;
 
-  bool close();
-  bool supportCMYK();
+  bool close() override;
+  bool supportCMYK() override;
 
 private:
   JpegWriter(const JpegWriter &other);

Deleted: branches/stable/source/src/libs/poppler/poppler-src/goo/Makefile.am
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/Makefile.am	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/Makefile.am	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,69 +0,0 @@
-noinst_LTLIBRARIES = libgoo.la
-
-if ENABLE_XPDF_HEADERS
-
-poppler_goo_includedir = $(includedir)/poppler/goo
-poppler_goo_include_HEADERS =			\
-	GooHash.h				\
-	GooList.h				\
-	GooTimer.h				\
-	GooMutex.h				\
-	GooString.h				\
-	gtypes.h				\
-	gmem.h					\
-	gfile.h					\
-	FixedPoint.h				\
-	NetPBMWriter.h				\
-	PNGWriter.h				\
-	JpegWriter.h				\
-	TiffWriter.h				\
-	ImgWriter.h				\
-	GooLikely.h				\
-	gstrtod.h				\
-	grandom.h
-
-endif
-
-libgoo_la_SOURCES =				\
-	gfile.cc				\
-	gmempp.cc				\
-	GooHash.cc				\
-	GooList.cc				\
-	GooTimer.cc				\
-	GooString.cc				\
-	gmem.cc					\
-	FixedPoint.cc				\
-	NetPBMWriter.cc				\
-	PNGWriter.cc				\
-	JpegWriter.cc				\
-	TiffWriter.cc				\
-	ImgWriter.cc				\
-	gtypes_p.h				\
-	gstrtod.cc				\
-	grandom.cc                              \
-	glibc.cc
-
-if BUILD_LIBJPEG
-libjpeg_includes = $(LIBJPEG_CFLAGS)
-endif
-
-if BUILD_LIBTIFF
-libtiff_includes = $(LIBTIFF_CFLAGS)
-endif
-
-if BUILD_LIBOPENJPEG
-libjpeg2000_includes = $(LIBOPENJPEG_CFLAGS)
-endif
-
-if BUILD_LIBPNG
-libpng_includes = $(LIBPNG_CFLAGS)
-endif
-
-libgoo_la_CPPFLAGS =				\
-	-I$(top_srcdir)				\
-	$(libjpeg_includes)                     \
-	$(libtiff_includes)                     \
-	$(libjpeg2000_includes)                 \
-	$(libpng_includes)
-
-EXTRA_DIST = glibc.h
\ No newline at end of file

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/NetPBMWriter.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/NetPBMWriter.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/NetPBMWriter.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -36,12 +36,12 @@
   NetPBMWriter(Format formatA = RGB);
   ~NetPBMWriter() {};
 
-  bool init(FILE *f, int width, int height, int hDPI, int vDPI);
+  bool init(FILE *f, int width, int height, int hDPI, int vDPI) override;
 
-  bool writePointers(unsigned char **rowPointers, int rowCount);
-  bool writeRow(unsigned char **row);
+  bool writePointers(unsigned char **rowPointers, int rowCount) override;
+  bool writeRow(unsigned char **row) override;
 
-  bool close();
+  bool close() override;
 
 private:
   FILE *file;

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/PNGWriter.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/PNGWriter.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/PNGWriter.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -8,7 +8,7 @@
 // Copyright (C) 2009 Shen Liang <shenzhuxi at gmail.com>
 // Copyright (C) 2009, 2011 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Stefan Thomas <thomas at eload24.com>
-// Copyright (C) 2010, 2011, 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2010, 2011, 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2011 Thomas Klausner <wiz at danbala.tuwien.ac.at>
 // Copyright (C) 2012 Pino Toscano <pino at kde.org>
 //
@@ -117,6 +117,10 @@
       bit_depth = 8;
       color_type = PNG_COLOR_TYPE_RGB;
       break;
+    case RGB48:
+      bit_depth = 16;
+      color_type = PNG_COLOR_TYPE_RGB;
+      break;
     case RGBA:
       bit_depth = 8;
       color_type = PNG_COLOR_TYPE_RGB_ALPHA;

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/PNGWriter.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/PNGWriter.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/PNGWriter.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -8,7 +8,7 @@
 // Copyright (C) 2009 Shen Liang <shenzhuxi at gmail.com>
 // Copyright (C) 2009, 2011-2013 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Stefan Thomas <thomas at eload24.com>
-// Copyright (C) 2010, 2011, 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2010, 2011, 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2012 Pino Toscano <pino at kde.org>
 //
 //========================================================================
@@ -32,8 +32,9 @@
    * RGBA       - 4 bytes/pixel
    * GRAY       - 1 byte/pixel
    * MONOCHROME - 8 pixels/byte
+   * RGB48      - 6 bytes/pixel
    */
-  enum Format { RGB, RGBA, GRAY, MONOCHROME };
+  enum Format { RGB, RGBA, GRAY, MONOCHROME, RGB48 };
 
   PNGWriter(Format format = RGB);
   ~PNGWriter();
@@ -42,12 +43,12 @@
   void setSRGBProfile();
 
 
-  bool init(FILE *f, int width, int height, int hDPI, int vDPI);
+  bool init(FILE *f, int width, int height, int hDPI, int vDPI) override;
 
-  bool writePointers(unsigned char **rowPointers, int rowCount);
-  bool writeRow(unsigned char **row);
+  bool writePointers(unsigned char **rowPointers, int rowCount) override;
+  bool writeRow(unsigned char **row) override;
 
-  bool close();
+  bool close() override;
 
 private:
   PNGWriter(const PNGWriter &other);

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/TiffWriter.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/TiffWriter.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/TiffWriter.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -6,7 +6,7 @@
 //
 // Copyright (C) 2010, 2012 William Bader <williambader at hotmail.com>
 // Copyright (C) 2012 Albert Astals Cid <aacid at kde.org>
-// Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2012 Pino Toscano <pino at kde.org>
 // Copyright (C) 2014 Steven Lee <roc.sky at gmail.com>
 //
@@ -14,7 +14,7 @@
 
 #include "TiffWriter.h"
 
-#if ENABLE_LIBTIFF
+#ifdef ENABLE_LIBTIFF
 
 #include <string.h>
 
@@ -147,6 +147,12 @@
       samplesperpixel = 4;
       photometric = PHOTOMETRIC_SEPARATED;
       break;
+
+    case RGB48:
+      samplesperpixel = 3;
+      bitspersample = 16;
+      photometric = PHOTOMETRIC_RGB;
+      break;
   }
 
   // Open the file

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/TiffWriter.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/TiffWriter.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/TiffWriter.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -6,7 +6,7 @@
 //
 // Copyright (C) 2010, 2012 William Bader <williambader at hotmail.com>
 // Copyright (C) 2011, 2012 Albert Astals Cid <aacid at kde.org>
-// Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2012 Pino Toscano <pino at kde.org>
 //
 //========================================================================
@@ -31,8 +31,9 @@
    * GRAY                - 1 byte/pixel
    * MONOCHROME          - 8 pixels/byte
    * CMYK                - 4 bytes/pixel
+   * RGB48               - 6 bytes/pixel
    */
-  enum Format { RGB, RGBA_PREMULTIPLIED, GRAY, MONOCHROME, CMYK };
+  enum Format { RGB, RGBA_PREMULTIPLIED, GRAY, MONOCHROME, CMYK, RGB48 };
 
   TiffWriter(Format format = RGB);
   ~TiffWriter();
@@ -39,14 +40,14 @@
 
   void setCompressionString(const char *compressionStringArg);
 
-  bool init(FILE *openedFile, int width, int height, int hDPI, int vDPI);
+  bool init(FILE *openedFile, int width, int height, int hDPI, int vDPI) override;
 
-  bool writePointers(unsigned char **rowPointers, int rowCount);
-  bool writeRow(unsigned char **rowData);
+  bool writePointers(unsigned char **rowPointers, int rowCount) override;
+  bool writeRow(unsigned char **rowData) override;
 
-  bool supportCMYK() { return true; }
+  bool supportCMYK() override { return true; }
 
-  bool close();
+  bool close() override;
 
 private:
   TiffWriter(const TiffWriter &other);

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/gfile.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/gfile.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/gfile.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -22,9 +22,10 @@
 // Copyright (C) 2009, 2012, 2014 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
 // Copyright (C) 2013 Adam Reichold <adamreichold at myopera.com>
-// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 Peter Breitenlohner <peb at mppmu.mpg.de>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2017 Christoph Cullmann <cullmann 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
@@ -72,7 +73,7 @@
 #if defined(__EMX__)
   if (_getcwd2(buf, sizeof(buf)))
 #elif defined(_WIN32)
-  if (GetCurrentDirectory(sizeof(buf), buf))
+  if (GetCurrentDirectoryA(sizeof(buf), buf))
 #elif defined(ACORN)
   if (strcpy(buf, "@"))
 #elif defined(MACOS)
@@ -134,7 +135,7 @@
   tmp = new GooString(path);
   tmp->append('/');
   tmp->append(fileName);
-  GetFullPathName(tmp->getCString(), sizeof(buf), buf, &fp);
+  GetFullPathNameA(tmp->getCString(), sizeof(buf), buf, &fp);
   delete tmp;
   path->clear();
   path->append(buf);
@@ -398,7 +399,7 @@
   char *s;
   int fd;
 
-#if HAVE_MKSTEMP
+#ifdef HAVE_MKSTEMP
   if ((s = getenv("TMPDIR"))) {
     *name = new GooString(s);
   } else {
@@ -422,7 +423,7 @@
 #endif
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 GooString *fileNameToUTF8(char *path) {
   GooString *s;
   char *p;
@@ -461,7 +462,7 @@
 #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];
@@ -553,13 +554,13 @@
 }
 
 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);
@@ -567,13 +568,13 @@
 }
 
 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);
@@ -581,11 +582,11 @@
 }
 
 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)();
@@ -620,7 +621,7 @@
 }
 
 GooFile* GooFile::open(const GooString *fileName) {
-  HANDLE handle = CreateFile(fileName->getCString(),
+  HANDLE handle = CreateFileA(fileName->getCString(),
                               GENERIC_READ,
                               FILE_SHARE_READ | FILE_SHARE_WRITE,
                               NULL,
@@ -697,7 +698,7 @@
 #elif defined(ACORN)
 #else
 #ifdef _WIN32
-    fa = GetFileAttributes(fullPath->getCString());
+    fa = GetFileAttributesA(fullPath->getCString());
     dir = (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY));
 #else
     if (stat(fullPath->getCString(), &st) == 0)
@@ -720,7 +721,7 @@
 
   tmp = path->copy();
   tmp->append("/*.*");
-  hnd = FindFirstFile(tmp->getCString(), &ffd);
+  hnd = FindFirstFileA(tmp->getCString(), &ffd);
   delete tmp;
 #elif defined(ACORN)
 #elif defined(MACOS)
@@ -753,7 +754,7 @@
 #if defined(_WIN32)
   if (hnd != INVALID_HANDLE_VALUE) {
     e = new GDirEntry(path->getCString(), ffd.cFileName, doStat);
-    if (!FindNextFile(hnd, &ffd)) {
+    if (!FindNextFileA(hnd, &ffd)) {
       FindClose(hnd);
       hnd = INVALID_HANDLE_VALUE;
     }
@@ -797,7 +798,7 @@
     FindClose(hnd);
   tmp = path->copy();
   tmp->append("/*.*");
-  hnd = FindFirstFile(tmp->getCString(), &ffd);
+  hnd = FindFirstFileA(tmp->getCString(), &ffd);
   delete tmp;
 #elif defined(ACORN)
 #elif defined(MACOS)

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/gfile.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/gfile.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/gfile.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -19,9 +19,10 @@
 // Copyright (C) 2009, 2011, 2012 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
 // Copyright (C) 2013 Adam Reichold <adamreichold at myopera.com>
-// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2014 Bogdan Cristea <cristeab at gmail.com>
 // Copyright (C) 2014 Peter Breitenlohner <peb at mppmu.mpg.de>
+// Copyright (C) 2017 Christoph Cullmann <cullmann 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
@@ -52,21 +53,21 @@
 #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
@@ -104,7 +105,7 @@
 // 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);
 
@@ -194,7 +195,7 @@
   GooString *path;		// directory path
   GBool doStat;			// call stat() for each entry?
 #if defined(_WIN32)
-  WIN32_FIND_DATA ffd;
+  WIN32_FIND_DATAA ffd;
   HANDLE hnd;
 #elif defined(ACORN)
 #elif defined(MACOS)

Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/glibc.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/glibc.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/glibc.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -6,7 +6,7 @@
 //
 // This file is licensed under the GPLv2 or later
 //
-// Copyright (C) 2016 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2016, 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 //========================================================================
 
@@ -31,7 +31,11 @@
 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
 

Added: branches/stable/source/src/libs/poppler/poppler-src/goo/glibc_strtok_r.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/glibc_strtok_r.cc	                        (rev 0)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/glibc_strtok_r.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -0,0 +1,95 @@
+/* Reentrant string tokenizer.  Generic version.
+   Copyright (C) 1991,1996-1999,2001,2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Copyright (C) 1991,93,96,97,99,2000,2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Based on strlen implementation by Torbjorn Granlund (tege at sics.se),
+   with help from Dan Sahlin (dan at sics.se) and
+   commentary by Jim Blandy (jimb at ai.mit.edu);
+   adaptation to memchr suggested by Dick Karpinski (dick at cca.ucsf.edu),
+   and implemented by Roland McGrath (roland at ai.mit.edu).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2012 Alexey Pavlov <alexpux at gmail.com>
+// Copyright (C) 2012 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
+//
+//========================================================================
+
+#ifndef HAVE_STRTOK_R
+
+#include <string.h>
+
+#define __rawmemchr strchr
+
+char * strtok_r (char *s, const char *delim, char **save_ptr)
+{
+  char *token;
+
+  if (s == NULL)
+    s = *save_ptr;
+
+  /* Scan leading delimiters.  */
+  s += strspn (s, delim);
+  if (*s == '\0')
+    {
+      *save_ptr = s;
+      return NULL;
+    }
+
+  /* Find the end of the token.  */
+  token = s;
+  s = strpbrk (token, delim);
+  if (s == NULL)
+    /* This token finishes the string.  */
+    *save_ptr = __rawmemchr (token, '\0');
+  else
+    {
+      /* Terminate the token and make *SAVE_PTR point past it.  */
+      *s = '\0';
+      *save_ptr = s + 1;
+    }
+  return token;
+}
+
+#endif


Property changes on: branches/stable/source/src/libs/poppler/poppler-src/goo/glibc_strtok_r.cc
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: branches/stable/source/src/libs/poppler/poppler-src/goo/gmem.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/gmem.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/gmem.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Takashi Iwai <tiwai at suse.de>
-// Copyright (C) 2007-2010 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007-2010, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Jonathan Kew <jonathan_kew at sil.org>
 //
 // To see a description of the changes please see the Changelog file that
@@ -44,7 +44,7 @@
  * returns NULL.  If <p> is NULL, calls malloc instead of realloc().
  */
 extern void *grealloc(void *p, size_t size);
-extern void *grealloc_checkoverflow(size_t size);
+extern void *grealloc_checkoverflow(void *p, size_t size);
 
 /*
  * These are similar to gmalloc and grealloc, but take an object count

Deleted: branches/stable/source/src/libs/poppler/poppler-src/goo/gtypes_p.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/goo/gtypes_p.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/goo/gtypes_p.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -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

Deleted: branches/stable/source/src/libs/poppler/poppler-src/gtk-doc.make
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/gtk-doc.make	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/gtk-doc.make	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,304 +0,0 @@
-# -*- mode: makefile -*-
-
-####################################
-# Everything below here is generic #
-####################################
-
-if GTK_DOC_USE_LIBTOOL
-GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
-GTKDOC_RUN = $(LIBTOOL) --mode=execute
-else
-GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
-GTKDOC_RUN =
-endif
-
-# We set GPATH here; this gives us semantics for GNU make
-# which are more like other make's VPATH, when it comes to
-# whether a source that is a target of one rule is then
-# searched for in VPATH/GPATH.
-#
-GPATH = $(srcdir)
-
-TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
-
-SETUP_FILES = \
-	$(content_files)		\
-	$(expand_content_files)		\
-	$(DOC_MAIN_SGML_FILE)		\
-	$(DOC_MODULE)-sections.txt	\
-	$(DOC_MODULE)-overrides.txt
-
-EXTRA_DIST = 				\
-	$(HTML_IMAGES)			\
-	$(SETUP_FILES)
-
-DOC_STAMPS=setup-build.stamp scan-build.stamp sgml-build.stamp \
-	html-build.stamp pdf-build.stamp \
-	sgml.stamp html.stamp pdf.stamp
-
-SCANOBJ_FILES = 		 \
-	$(DOC_MODULE).args 	 \
-	$(DOC_MODULE).hierarchy  \
-	$(DOC_MODULE).interfaces \
-	$(DOC_MODULE).prerequisites \
-	$(DOC_MODULE).signals
-
-REPORT_FILES = \
-	$(DOC_MODULE)-undocumented.txt \
-	$(DOC_MODULE)-undeclared.txt \
-	$(DOC_MODULE)-unused.txt
-
-gtkdoc-check.test: Makefile
-	$(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
-		echo "$(GTKDOC_CHECK_PATH) || exit 1" >> $@; \
-		chmod +x $@
-
-CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) gtkdoc-check.test
-
-if GTK_DOC_BUILD_HTML
-HTML_BUILD_STAMP=html-build.stamp
-else
-HTML_BUILD_STAMP=
-endif
-if GTK_DOC_BUILD_PDF
-PDF_BUILD_STAMP=pdf-build.stamp
-else
-PDF_BUILD_STAMP=
-endif
-
-all-gtk-doc: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
-.PHONY: all-gtk-doc
-
-if ENABLE_GTK_DOC
-all-local: all-gtk-doc
-endif
-
-docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP)
-
-$(REPORT_FILES): sgml-build.stamp
-
-#### setup ####
-
-GTK_DOC_V_SETUP=$(GTK_DOC_V_SETUP_$(V))
-GTK_DOC_V_SETUP_=$(GTK_DOC_V_SETUP_$(AM_DEFAULT_VERBOSITY))
-GTK_DOC_V_SETUP_0=@echo "  DOC   Preparing build";
-
-setup-build.stamp:
-	-$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
-	    files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
-	    if test "x$$files" != "x" ; then \
-	        for file in $$files ; do \
-	            destdir=`dirname $(abs_builddir)/$$file`; \
-	            test -d "$$destdir" || mkdir -p "$$destdir"; \
-	            test -f $(abs_srcdir)/$$file && \
-	                cp -pf $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \
-	        done; \
-	    fi; \
-	fi
-	$(AM_V_at)touch setup-build.stamp
-
-
-#### scan ####
-
-GTK_DOC_V_SCAN=$(GTK_DOC_V_SCAN_$(V))
-GTK_DOC_V_SCAN_=$(GTK_DOC_V_SCAN_$(AM_DEFAULT_VERBOSITY))
-GTK_DOC_V_SCAN_0=@echo "  DOC   Scanning header files";
-
-GTK_DOC_V_INTROSPECT=$(GTK_DOC_V_INTROSPECT_$(V))
-GTK_DOC_V_INTROSPECT_=$(GTK_DOC_V_INTROSPECT_$(AM_DEFAULT_VERBOSITY))
-GTK_DOC_V_INTROSPECT_0=@echo "  DOC   Introspecting gobjects";
-
-scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
-	$(GTK_DOC_V_SCAN)_source_dir='' ; \
-	for i in $(DOC_SOURCE_DIR) ; do \
-	    _source_dir="$${_source_dir} --source-dir=$$i" ; \
-	done ; \
-	gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
-	$(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
-	    scanobj_options=""; \
-	    gtkdoc-scangobj 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
-	    if test "$$?" = "0"; then \
-	        if test "x$(V)" = "x1"; then \
-	            scanobj_options="--verbose"; \
-	        fi; \
-	    fi; \
-	    CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \
-	    gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \
-	else \
-	    for i in $(SCANOBJ_FILES) ; do \
-	        test -f $$i || touch $$i ; \
-	    done \
-	fi
-	$(AM_V_at)touch scan-build.stamp
-
-$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
-	@true
-
-#### xml ####
-
-GTK_DOC_V_XML=$(GTK_DOC_V_XML_$(V))
-GTK_DOC_V_XML_=$(GTK_DOC_V_XML_$(AM_DEFAULT_VERBOSITY))
-GTK_DOC_V_XML_0=@echo "  DOC   Building XML";
-
-sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) xml/gtkdocentities.ent
-	$(GTK_DOC_V_XML)_source_dir='' ; \
-	for i in $(DOC_SOURCE_DIR) ; do \
-	    _source_dir="$${_source_dir} --source-dir=$$i" ; \
-	done ; \
-	gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS)
-	$(AM_V_at)touch sgml-build.stamp
-
-sgml.stamp: sgml-build.stamp
-	@true
-
-xml/gtkdocentities.ent: Makefile
-	$(GTK_DOC_V_XML)$(MKDIR_P) $(@D) && ( \
-		echo "<!ENTITY package \"$(PACKAGE)\">"; \
-		echo "<!ENTITY package_bugreport \"$(PACKAGE_BUGREPORT)\">"; \
-		echo "<!ENTITY package_name \"$(PACKAGE_NAME)\">"; \
-		echo "<!ENTITY package_string \"$(PACKAGE_STRING)\">"; \
-		echo "<!ENTITY package_tarname \"$(PACKAGE_TARNAME)\">"; \
-		echo "<!ENTITY package_url \"$(PACKAGE_URL)\">"; \
-		echo "<!ENTITY package_version \"$(PACKAGE_VERSION)\">"; \
-	) > $@
-
-#### html ####
-
-GTK_DOC_V_HTML=$(GTK_DOC_V_HTML_$(V))
-GTK_DOC_V_HTML_=$(GTK_DOC_V_HTML_$(AM_DEFAULT_VERBOSITY))
-GTK_DOC_V_HTML_0=@echo "  DOC   Building HTML";
-
-GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_$(V))
-GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY))
-GTK_DOC_V_XREF_0=@echo "  DOC   Fixing cross-references";
-
-html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
-	$(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
-	mkhtml_options=""; \
-	gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
-	if test "$$?" = "0"; then \
-	  if test "x$(V)" = "x1"; then \
-	    mkhtml_options="$$mkhtml_options --verbose"; \
-	  fi; \
-	fi; \
-	gtkdoc-mkhtml 2>&1 --help | grep  >/dev/null "\-\-path"; \
-	if test "$$?" = "0"; then \
-	  mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
-	fi; \
-	cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
-	- at test "x$(HTML_IMAGES)" = "x" || \
-	for file in $(HTML_IMAGES) ; do \
-	  if test -f $(abs_srcdir)/$$file ; then \
-	    cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
-	  fi; \
-	  if test -f $(abs_builddir)/$$file ; then \
-	    cp $(abs_builddir)/$$file $(abs_builddir)/html; \
-	  fi; \
-	done;
-	$(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
-	$(AM_V_at)touch html-build.stamp
-
-#### pdf ####
-
-GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_$(V))
-GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY))
-GTK_DOC_V_PDF_0=@echo "  DOC   Building PDF";
-
-pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
-	$(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
-	mkpdf_options=""; \
-	gtkdoc-mkpdf 2>&1 --help | grep  >/dev/null "\-\-verbose"; \
-	if test "$$?" = "0"; then \
-	  if test "x$(V)" = "x1"; then \
-	    mkpdf_options="$$mkpdf_options --verbose"; \
-	  fi; \
-	fi; \
-	if test "x$(HTML_IMAGES)" != "x"; then \
-	  for img in $(HTML_IMAGES); do \
-	    part=`dirname $$img`; \
-	    echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \
-	    if test $$? != 0; then \
-	      mkpdf_options="$$mkpdf_options --imgdir=$$part"; \
-	    fi; \
-	  done; \
-	fi; \
-	gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
-	$(AM_V_at)touch pdf-build.stamp
-
-##############
-
-clean-local:
-	@rm -f *~ *.bak
-	@rm -rf .libs
-	@if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
-	  rm -f $(DOC_MODULE).types; \
-	fi
-	@if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \
-	  rm -f $(DOC_MODULE)-sections.txt; \
-	fi
-
-distclean-local:
-	@rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
-	    $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
-	@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
-	    rm -f $(SETUP_FILES) $(DOC_MODULE).types; \
-	fi
-
-maintainer-clean-local:
-	@rm -rf xml html
-
-install-data-local:
-	@installfiles=`echo $(builddir)/html/*`; \
-	if test "$$installfiles" = '$(builddir)/html/*'; \
-	then echo 1>&2 'Nothing to install' ; \
-	else \
-	  if test -n "$(DOC_MODULE_VERSION)"; then \
-	    installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
-	  else \
-	    installdir="$(DESTDIR)$(TARGET_DIR)"; \
-	  fi; \
-	  $(mkinstalldirs) $${installdir} ; \
-	  for i in $$installfiles; do \
-	    echo ' $(INSTALL_DATA) '$$i ; \
-	    $(INSTALL_DATA) $$i $${installdir}; \
-	  done; \
-	  if test -n "$(DOC_MODULE_VERSION)"; then \
-	    mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
-	      $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
-	  fi; \
-	  $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \
-	fi
-
-uninstall-local:
-	@if test -n "$(DOC_MODULE_VERSION)"; then \
-	  installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
-	else \
-	  installdir="$(DESTDIR)$(TARGET_DIR)"; \
-	fi; \
-	rm -rf $${installdir}
-
-#
-# Require gtk-doc when making dist
-#
-if HAVE_GTK_DOC
-dist-check-gtkdoc: docs
-else
-dist-check-gtkdoc:
-	@echo "*** gtk-doc is needed to run 'make dist'.         ***"
-	@echo "*** gtk-doc was not found when 'configure' ran.   ***"
-	@echo "*** please install gtk-doc and rerun 'configure'. ***"
-	@false
-endif
-
-dist-hook: dist-check-gtkdoc all-gtk-doc dist-hook-local
-	@mkdir $(distdir)/html
-	@cp ./html/* $(distdir)/html
-	@-cp ./$(DOC_MODULE).pdf $(distdir)/
-	@-cp ./$(DOC_MODULE).types $(distdir)/
-	@-cp ./$(DOC_MODULE)-sections.txt $(distdir)/
-	@cd $(distdir) && rm -f $(DISTCLEANFILES)
-	@$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
-
-.PHONY : dist-hook-local docs

Added: branches/stable/source/src/libs/poppler/poppler-src/gtkdoc.py
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/gtkdoc.py	                        (rev 0)
+++ branches/stable/source/src/libs/poppler/poppler-src/gtkdoc.py	2018-02-27 23:34:23 UTC (rev 795)
@@ -0,0 +1,440 @@
+# Copyright (C) 2011 Igalia S.L.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+import errno
+import logging
+import os
+import os.path
+import subprocess
+import sys
+
+
+class GTKDoc(object):
+
+    """Class that controls a gtkdoc run.
+
+    Each instance of this class represents one gtkdoc configuration
+    and set of documentation. The gtkdoc package is a series of tools
+    run consecutively which converts inline C/C++ documentation into
+    docbook files and then into HTML. This class is suitable for
+    generating documentation or simply verifying correctness.
+
+    Keyword arguments:
+    output_dir         -- The path where gtkdoc output should be placed. Generation
+                          may overwrite file in this directory. Required.
+    module_name        -- The name of the documentation module. For libraries this
+                          is typically the library name. Required if not library path
+                          is given.
+    source_dirs        -- A list of paths to directories of source code to be scanned.
+                          Required if headers is not specified.
+    ignored_files      -- A list of filenames to ignore in the source directory. It is
+                          only necessary to provide the basenames of these files.
+                          Typically it is important to provide an updated list of
+                          ignored files to prevent warnings about undocumented symbols.
+    headers            -- A list of paths to headers to be scanned. Required if source_dirs
+                          is not specified.
+    namespace          -- The library namespace.
+    decorator          -- If a decorator is used to unhide certain symbols in header
+                          files this parameter is required for successful scanning.
+                          (default '')
+    deprecation_guard  -- gtkdoc tries to ensure that symbols marked as deprecated
+                          are encased in this C preprocessor define. This is required
+                          to avoid gtkdoc warnings. (default '')
+    cflags             -- This parameter specifies any preprocessor flags necessary for
+                          building the scanner binary during gtkdoc-scanobj. Typically
+                          this includes all absolute include paths necessary to resolve
+                          all header dependencies. (default '')
+    ldflags            -- This parameter specifies any linker flags necessary for
+                          building the scanner binary during gtkdoc-scanobj. Typically
+                          this includes "-lyourlibraryname". (default '')
+    library_path       -- This parameter specifies the path to the directory where you
+                          library resides used for building the scanner binary during
+                          gtkdoc-scanobj. (default '')
+
+    doc_dir            -- The path to other documentation files necessary to build
+                          the documentation. This files in this directory as well as
+                          the files in the 'html' subdirectory will be copied
+                          recursively into the output directory. (default '')
+    main_sgml_file     -- The path or name (if a doc_dir is given) of the SGML file
+                          that is the considered the main page of your documentation.
+                          (default: <module_name>-docs.sgml)
+    version            -- The version number of the module. If this is provided,
+                          a version.xml file containing the version will be created
+                          in the output directory during documentation generation.
+
+    interactive        -- Whether or not errors or warnings should prompt the user
+                          to continue or not. When this value is false, generation
+                          will continue despite warnings. (default False)
+
+    virtual_root       -- A temporary installation directory which is used as the root
+                          where the actual installation prefix lives; this is mostly
+                          useful for packagers, and should be set to what is given to
+                          make install as DESTDIR.
+    """
+
+    def __init__(self, args):
+
+        # Parameters specific to scanning.
+        self.module_name = ''
+        self.source_dirs = []
+        self.headers = []
+        self.ignored_files = []
+        self.namespace = ''
+        self.decorator = ''
+        self.deprecation_guard = ''
+
+        # Parameters specific to gtkdoc-scanobj.
+        self.cflags = ''
+        self.ldflags = ''
+        self.library_path = ''
+
+        # Parameters specific to generation.
+        self.output_dir = ''
+        self.doc_dir = ''
+        self.main_sgml_file = ''
+
+        # Parameters specific to gtkdoc-fixxref.
+        self.cross_reference_deps = []
+
+        self.interactive = False
+
+        self.logger = logging.getLogger('gtkdoc')
+
+        for key, value in iter(args.items()):
+            setattr(self, key, value)
+
+        if not getattr(self, 'output_dir'):
+            raise Exception('output_dir not specified.')
+        if not getattr(self, 'module_name'):
+            raise Exception('module_name not specified.')
+        if not getattr(self, 'source_dirs') and not getattr(self, 'headers'):
+            raise Exception('Neither source_dirs nor headers specified.' % key)
+
+        # Make all paths absolute in case we were passed relative paths, since
+        # we change the current working directory when executing subcommands.
+        self.output_dir = os.path.abspath(self.output_dir)
+        self.source_dirs = [os.path.abspath(x) for x in self.source_dirs]
+        self.headers = [os.path.abspath(x) for x in self.headers]
+        if self.library_path:
+            self.library_path = os.path.abspath(self.library_path)
+
+        if not self.main_sgml_file:
+            self.main_sgml_file = self.module_name + "-docs.sgml"
+
+    def generate(self, html=True):
+        self.saw_warnings = False
+
+        self._copy_doc_files_to_output_dir(html)
+        self._write_version_xml()
+        self._run_gtkdoc_scan()
+        self._run_gtkdoc_scangobj()
+        self._run_gtkdoc_mkdb()
+
+        if not html:
+            return
+
+        self._run_gtkdoc_mkhtml()
+        self._run_gtkdoc_fixxref()
+
+    def _delete_file_if_exists(self, path):
+        if not os.access(path, os.F_OK | os.R_OK):
+            return
+        self.logger.debug('deleting %s', path)
+        os.unlink(path)
+
+    def _create_directory_if_nonexistent(self, path):
+        try:
+            os.makedirs(path)
+        except OSError as error:
+            if error.errno != errno.EEXIST:
+                raise
+
+    def _raise_exception_if_file_inaccessible(self, path):
+        if not os.path.exists(path) or not os.access(path, os.R_OK):
+            raise Exception("Could not access file at: %s" % path)
+
+    def _output_has_warnings(self, outputs):
+        for output in outputs:
+            if output and output.find('warning'):
+                return True
+        return False
+
+    def _ask_yes_or_no_question(self, question):
+        if not self.interactive:
+            return True
+
+        question += ' [y/N] '
+        answer = None
+        while answer != 'y' and answer != 'n' and answer != '':
+            answer = raw_input(question).lower()
+        return answer == 'y'
+
+    def _run_command(self, args, env=None, cwd=None, print_output=True, ignore_warnings=False):
+        if print_output:
+            self.logger.debug("Running %s", args[0])
+        self.logger.debug("Full command args: %s", str(args))
+
+        process = subprocess.Popen(args, env=env, cwd=cwd,
+                                   stdout=subprocess.PIPE,
+                                   stderr=subprocess.PIPE)
+        stdout, stderr = [b.decode("utf-8") for b in process.communicate()]
+
+        if print_output:
+            if stdout:
+                try:
+                    sys.stdout.write(stdout.encode("utf-8"))
+                except UnicodeDecodeError:
+                    sys.stdout.write(stdout)
+            if stderr:
+                try:
+                    sys.stderr.write(stderr.encode("utf-8"))
+                except UnicodeDecodeError:
+                    sys.stderr.write(stderr)
+
+        if process.returncode != 0:
+            raise Exception('%s produced a non-zero return code %i'
+                             % (args[0], process.returncode))
+
+        if not ignore_warnings and ('warning' in stderr or 'warning' in stdout):
+            self.saw_warnings = True
+            if not self._ask_yes_or_no_question('%s produced warnings, '
+                                                'try to continue?' % args[0]):
+                raise Exception('%s step failed' % args[0])
+
+        return stdout.strip()
+
+    def _copy_doc_files_to_output_dir(self, html=True):
+        if not self.doc_dir:
+            self.logger.info('Not copying any files from doc directory,'
+                             ' because no doc directory given.')
+            return
+
+        def copy_file_replacing_existing(src, dest):
+            if os.path.isdir(src):
+                self.logger.debug('skipped directory %s',  src)
+                return
+            if not os.access(src, os.F_OK | os.R_OK):
+                self.logger.debug('skipped unreadable %s', src)
+                return
+
+            self._delete_file_if_exists(dest)
+
+            self.logger.debug('created %s', dest)
+            try:
+                os.link(src, dest)
+            except OSError:
+                os.symlink(src, dest)
+
+        def copy_all_files_in_directory(src, dest):
+            for path in os.listdir(src):
+                copy_file_replacing_existing(os.path.join(src, path),
+                                             os.path.join(dest, path))
+
+        self.logger.debug('Copying template files to output directory...')
+        self._create_directory_if_nonexistent(self.output_dir)
+        copy_all_files_in_directory(self.doc_dir, self.output_dir)
+
+        if not html:
+            return
+
+        self.logger.debug('Copying HTML files to output directory...')
+        html_src_dir = os.path.join(self.doc_dir, 'html')
+        html_dest_dir = os.path.join(self.output_dir, 'html')
+        self._create_directory_if_nonexistent(html_dest_dir)
+
+        if os.path.exists(html_src_dir):
+            copy_all_files_in_directory(html_src_dir, html_dest_dir)
+
+    def _write_version_xml(self):
+        if not self.version:
+            self.logger.info('No version specified, so not writing version.xml')
+            return
+
+        version_xml_path = os.path.join(self.output_dir, 'version.xml')
+        src_version_xml_path = os.path.join(self.doc_dir, 'version.xml')
+
+        # Don't overwrite version.xml if it was in the doc directory.
+        if os.path.exists(version_xml_path) and \
+           os.path.exists(src_version_xml_path):
+            return
+
+        output_file = open(version_xml_path, 'w')
+        output_file.write(self.version)
+        output_file.close()
+
+    def _ignored_files_basenames(self):
+        return ' '.join([os.path.basename(x) for x in self.ignored_files])
+
+    def _run_gtkdoc_scan(self):
+        args = ['gtkdoc-scan',
+                '--module=%s' % self.module_name,
+                '--rebuild-types']
+
+        if not self.headers:
+            # Each source directory should be have its own "--source-dir=" prefix.
+            args.extend(['--source-dir=%s' % path for path in self.source_dirs])
+
+        if self.decorator:
+            args.append('--ignore-decorators=%s' % self.decorator)
+        if self.deprecation_guard:
+            args.append('--deprecated-guards=%s' % self.deprecation_guard)
+        if self.output_dir:
+            args.append('--output-dir=%s' % self.output_dir)
+
+        # We only need to pass the list of ignored files if the we are not using an explicit list of headers.
+        if not self.headers:
+            # gtkdoc-scan wants the basenames of ignored headers, so strip the
+            # dirname. Different from "--source-dir", the headers should be
+            # specified as one long string.
+            ignored_files_basenames = self._ignored_files_basenames()
+            if ignored_files_basenames:
+                args.append('--ignore-headers=%s' % ignored_files_basenames)
+
+        if self.headers:
+            args.extend(self.headers)
+
+        self._run_command(args)
+
+    def _run_gtkdoc_scangobj(self):
+        env = os.environ
+        ldflags = self.ldflags
+        if self.library_path:
+            additional_ldflags = ''
+            for arg in env.get('LDFLAGS', '').split(' '):
+                if arg.startswith('-L'):
+                    additional_ldflags = '%s %s' % (additional_ldflags, arg)
+            ldflags = ' "-L%s" %s ' % (self.library_path, additional_ldflags) + ldflags
+            current_ld_library_path = env.get('LD_LIBRARY_PATH')
+            if current_ld_library_path:
+                env['RUN'] = 'LD_LIBRARY_PATH="%s:%s" ' % (self.library_path, current_ld_library_path)
+            else:
+                env['RUN'] = 'LD_LIBRARY_PATH="%s" ' % self.library_path
+
+        if ldflags:
+            env['LDFLAGS'] = '%s %s' % (ldflags, env.get('LDFLAGS', ''))
+        if self.cflags:
+            env['CFLAGS'] = '%s %s' % (self.cflags, env.get('CFLAGS', ''))
+
+        if 'CFLAGS' in env:
+            self.logger.debug('CFLAGS=%s', env['CFLAGS'])
+        if 'LDFLAGS' in env:
+            self.logger.debug('LDFLAGS %s', env['LDFLAGS'])
+        if 'RUN' in env:
+            self.logger.debug('RUN=%s', env['RUN'])
+        self._run_command(['gtkdoc-scangobj', '--module=%s' % self.module_name],
+                          env=env, cwd=self.output_dir)
+
+    def _run_gtkdoc_mkdb(self):
+        sgml_file = os.path.join(self.output_dir, self.main_sgml_file)
+        self._raise_exception_if_file_inaccessible(sgml_file)
+
+        args = ['gtkdoc-mkdb',
+                '--module=%s' % self.module_name,
+                '--main-sgml-file=%s' % sgml_file,
+                '--source-suffixes=h,c,cpp,cc',
+                '--output-format=xml',
+                '--sgml-mode']
+
+        if self.namespace:
+            args.append('--name-space=%s' % self.namespace)
+
+        ignored_files_basenames = self._ignored_files_basenames()
+        if ignored_files_basenames:
+            args.append('--ignore-files=%s' % ignored_files_basenames)
+
+        # Each directory should be have its own "--source-dir=" prefix.
+        args.extend(['--source-dir=%s' % path for path in self.source_dirs])
+        self._run_command(args, cwd=self.output_dir)
+
+    def _run_gtkdoc_mkhtml(self):
+        html_dest_dir = os.path.join(self.output_dir, 'html')
+        if not os.path.isdir(html_dest_dir):
+            raise Exception("%s is not a directory, could not generate HTML"
+                            % html_dest_dir)
+        elif not os.access(html_dest_dir, os.X_OK | os.R_OK | os.W_OK):
+            raise Exception("Could not access %s to generate HTML"
+                            % html_dest_dir)
+
+        # gtkdoc-mkhtml expects the SGML path to be absolute.
+        sgml_file = os.path.join(os.path.abspath(self.output_dir),
+                                 self.main_sgml_file)
+        self._raise_exception_if_file_inaccessible(sgml_file)
+
+        self._run_command(['gtkdoc-mkhtml', self.module_name, sgml_file],
+                          cwd=html_dest_dir)
+
+    def _run_gtkdoc_fixxref(self):
+        args = ['gtkdoc-fixxref',
+                '--module=%s' % self.module_name,
+                '--module-dir=html',
+                '--html-dir=html']
+        args.extend(['--extra-dir=%s' % extra_dir for extra_dir in self.cross_reference_deps])
+        self._run_command(args, cwd=self.output_dir, ignore_warnings=True)
+
+    def rebase_installed_docs(self):
+        if not os.path.isdir(self.output_dir):
+            raise Exception("Tried to rebase documentation before generating it.")
+        html_dir = os.path.join(self.virtual_root + self.prefix, 'share', 'gtk-doc', 'html', self.module_name)
+        if not os.path.isdir(html_dir):
+            return
+        args = ['gtkdoc-rebase',
+                '--relative',
+                '--html-dir=%s' % html_dir]
+        args.extend(['--other-dir=%s' % extra_dir for extra_dir in self.cross_reference_deps])
+        if self.virtual_root:
+            args.extend(['--dest-dir=%s' % self.virtual_root])
+        self._run_command(args, cwd=self.output_dir)
+
+    def api_missing_documentation(self):
+        unused_doc_file = os.path.join(self.output_dir, self.module_name + "-unused.txt")
+        if not os.path.exists(unused_doc_file) or not os.access(unused_doc_file, os.R_OK):
+            return []
+        return open(unused_doc_file).read().splitlines()
+
+class PkgConfigGTKDoc(GTKDoc):
+
+    """Class reads a library's pkgconfig file to guess gtkdoc parameters.
+
+    Some gtkdoc parameters can be guessed by reading a library's pkgconfig
+    file, including the cflags, ldflags and version parameters. If you
+    provide these parameters as well, they will be appended to the ones
+    guessed via the pkgconfig file.
+
+    Keyword arguments:
+      pkg_config_path -- Path to the pkgconfig file for the library. Required.
+    """
+
+    def __init__(self, pkg_config_path, args):
+        super(PkgConfigGTKDoc, self).__init__(args)
+
+        pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
+
+        if not os.path.exists(pkg_config_path):
+            raise Exception('Could not find pkg-config file at: %s'
+                            % pkg_config_path)
+
+        self.cflags += " " + self._run_command([pkg_config,
+                                                pkg_config_path,
+                                                '--cflags'], print_output=False)
+        self.ldflags += " " + self._run_command([pkg_config,
+                                                pkg_config_path,
+                                                '--libs'], print_output=False)
+        self.version = self._run_command([pkg_config,
+                                          pkg_config_path,
+                                          '--modversion'], print_output=False)
+        self.prefix = self._run_command([pkg_config,
+                                         pkg_config_path,
+                                         '--variable=prefix'], print_output=False)


Property changes on: branches/stable/source/src/libs/poppler/poppler-src/gtkdoc.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: branches/stable/source/src/libs/poppler/poppler-src/make-glib-api-docs
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/make-glib-api-docs	                        (rev 0)
+++ branches/stable/source/src/libs/poppler/poppler-src/make-glib-api-docs	2018-02-27 23:34:23 UTC (rev 795)
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2017 Carlos Garcia Campos <carlosgc at gnome.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+import argparse
+import logging
+import os
+from gtkdoc import PkgConfigGTKDoc
+
+def configure_logging(verbose):
+    level = logging.DEBUG if verbose else logging.INFO
+    logger = logging.getLogger('gtkdoc')
+    logger.setLevel(level)
+    handler = logging.StreamHandler()
+    handler.setLevel(level)
+    logger.addHandler(handler)
+    if level == logging.DEBUG:
+        handler.setFormatter(logging.Formatter('[%(asctime)s]  %(message)s'))
+    else:
+        handler.setFormatter(logging.Formatter('%(message)s'))
+
+
+parser = argparse.ArgumentParser(description='Make poppler GLib API documentation.')
+parser.add_argument('-v', '--verbose', action='store_true', default = False,
+                    help='Whether or not to run in verbose mode.')
+parser.add_argument('--skip-html', action='store_true',
+                    help='Whether or not to skip HTML generation, which can be slow.')
+parser.add_argument('-s', '--src-dir', action='store', default='.', dest='src_dir',
+                    help='The source directory')
+parser.add_argument('-b', '--build-dir', action='store', default='build', dest='build_dir',
+                    help='The build directory')
+args = parser.parse_args()
+configure_logging(args.verbose)
+
+pkgconfig_file = os.path.join(args.build_dir, 'poppler-glib.pc')
+pkgconfig_path = os.environ.get("PKG_CONFIG_PATH")
+os.environ['PKG_CONFIG_PATH'] = args.build_dir
+if pkgconfig_path:
+    os.environ['PKG_CONFIG_PATH'] += ':' + pkgconfig_path
+
+gtkdoc = PkgConfigGTKDoc(pkgconfig_file, {
+    'library_path': os.path.join(args.build_dir, 'glib'),
+    'module_name': 'poppler',
+    'doc_dir': os.path.join(args.src_dir, 'glib', 'reference'),
+    'output_dir': os.path.join(args.build_dir, 'glib', 'reference'),
+    'main_sgml_file': 'poppler-docs.sgml',
+    'source_dirs': [os.path.join(args.src_dir, 'glib')],
+    'cflags': '-I%s' % os.path.join(args.src_dir, 'glib'),
+    'ignored_files': ['poppler-private.h', 'poppler-input-stream.h', 'poppler-cached-file-loader.h', 'demo']
+})
+
+gtkdoc.generate(not args.skip_html)


Property changes on: branches/stable/source/src/libs/poppler/poppler-src/make-glib-api-docs
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Annot.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Annot.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Annot.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -28,7 +28,7 @@
 // Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2012, 2015 Tobias Koenig <tokoe at kdab.com>
 // Copyright (C) 2013 Peter Breitenlohner <peb at mppmu.mpg.de>
-// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2014, 2015 Marek Kasik <mkasik at redhat.com>
 // Copyright (C) 2014 Jiri Slaby <jirislaby at gmail.com>
 // Copyright (C) 2014 Anuj Khare <khareanuj18 at gmail.com>
@@ -35,6 +35,7 @@
 // Copyright (C) 2015 Petr Gajdos <pgajdos at suse.cz>
 // Copyright (C) 2015 Philipp Reinkemeier <philipp.reinkemeier at offis.de>
 // Copyright (C) 2015 Tamas Szekeres <szekerest at gmail.com>
+// Copyright (C) 2017 Hans-Ulrich Jüttner <huj at froreich-bioscientia.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
@@ -76,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
@@ -112,7 +113,7 @@
 // = (4 * (sqrt(2) - 1) / 3) * r
 #define bezierCircle 0.55228475
 
-AnnotLineEndingStyle parseAnnotLineEndingStyle(GooString *string) {
+static AnnotLineEndingStyle parseAnnotLineEndingStyle(GooString *string) {
   if (string != NULL) {
     if (!string->cmp("Square")) {
       return annotLineEndingSquare;
@@ -140,7 +141,7 @@
   }  
 }
 
-const char* convertAnnotLineEndingStyle(AnnotLineEndingStyle style) {
+static const char* convertAnnotLineEndingStyle(AnnotLineEndingStyle style) {
   switch (style) {
     case annotLineEndingSquare:
       return "Square";
@@ -166,10 +167,10 @@
 }
 
 static AnnotExternalDataType parseAnnotExternalData(Dict* dict) {
-  Object obj1;
   AnnotExternalDataType type;
 
-  if (dict->lookup("Subtype", &obj1)->isName()) {
+  Object obj1 = dict->lookup("Subtype");
+  if (obj1.isName()) {
     const char *typeName = obj1.getName();
 
     if (!strcmp(typeName, "Markup3D")) {
@@ -180,24 +181,19 @@
   } else {
     type = annotExternalDataMarkupUnknown;
   }
-  obj1.free();
 
   return type;
 }
 
-PDFRectangle *parseDiffRectangle(Array *array, PDFRectangle *rect) {
+static PDFRectangle *parseDiffRectangle(Array *array, PDFRectangle *rect) {
   PDFRectangle *newRect = NULL;
   if (array->getLength() == 4) {
     // deltas
     Object obj1;
-    double dx1 = (array->get(0, &obj1)->isNum() ? obj1.getNum() : 0);
-    obj1.free();
-    double dy1 = (array->get(1, &obj1)->isNum() ? obj1.getNum() : 0);
-    obj1.free();
-    double dx2 = (array->get(2, &obj1)->isNum() ? obj1.getNum() : 0);
-    obj1.free();
-    double dy2 = (array->get(3, &obj1)->isNum() ? obj1.getNum() : 0);
-    obj1.free();
+    double dx1 = (obj1 = array->get(0), obj1.isNum() ? obj1.getNum() : 0);
+    double dy1 = (obj1 = array->get(1), obj1.isNum() ? obj1.getNum() : 0);
+    double dx2 = (obj1 = array->get(2), obj1.isNum() ? obj1.getNum() : 0);
+    double dy2 = (obj1 = array->get(3), obj1.isNum() ? obj1.getNum() : 0);
 
     // checking that the numbers are valid (i.e. >= 0),
     // and that applying the differences still give us a valid rect
@@ -215,10 +211,10 @@
 }
 
 static LinkAction* getAdditionalAction(Annot::AdditionalActionsType type, Object *additionalActions, PDFDoc *doc) {
-  Object additionalActionsObject;
-  LinkAction *linkAction = NULL;
+  LinkAction *linkAction = nullptr;
+  Object additionalActionsObject = additionalActions->fetch(doc->getXRef());
 
-  if (additionalActions->fetch(doc->getXRef(), &additionalActionsObject)->isDict()) {
+  if (additionalActionsObject.isDict()) {
     const char *key = (type == Annot::actionCursorEntering ? "E" :
                        type == Annot::actionCursorLeaving ?  "X" :
                        type == Annot::actionMousePressed ?   "D" :
@@ -230,37 +226,29 @@
                        type == Annot::actionPageVisible ?   "PV" :
                        type == Annot::actionPageInvisible ? "PI" : NULL);
 
-    Object actionObject;
-
-    if (additionalActionsObject.dictLookup(key, &actionObject)->isDict())
+    Object actionObject = additionalActionsObject.dictLookup(key);
+    if (actionObject.isDict())
       linkAction = LinkAction::parseAction(&actionObject, doc->getCatalog()->getBaseURI());
-    actionObject.free();
   }
 
-  additionalActionsObject.free();
-
   return linkAction;
 }
 
 static LinkAction* getFormAdditionalAction(Annot::FormAdditionalActionsType type, Object *additionalActions, PDFDoc *doc) {
-  Object additionalActionsObject;
-  LinkAction *linkAction = NULL;
+  LinkAction *linkAction = nullptr;
+  Object additionalActionsObject = additionalActions->fetch(doc->getXRef());
 
-  if (additionalActions->fetch(doc->getXRef(), &additionalActionsObject)->isDict()) {
+  if (additionalActionsObject.isDict()) {
     const char *key = (type == Annot::actionFieldModified ?  "K" :
                        type == Annot::actionFormatField ?    "F" :
                        type == Annot::actionValidateField ?  "V" :
                        type == Annot::actionCalculateField ? "C" : NULL);
 
-    Object actionObject;
-
-    if (additionalActionsObject.dictLookup(key, &actionObject)->isDict())
+    Object actionObject = additionalActionsObject.dictLookup(key);
+    if (actionObject.isDict())
       linkAction = LinkAction::parseAction(&actionObject, doc->getCatalog()->getBaseURI());
-    actionObject.free();
   }
 
-  additionalActionsObject.free();
-
   return linkAction;
 }
 
@@ -271,7 +259,8 @@
 AnnotBorderEffect::AnnotBorderEffect(Dict *dict) {
   Object obj1;
 
-  if (dict->lookup("S", &obj1)->isName()) {
+  obj1 = dict->lookup("S");
+  if (obj1.isName()) {
     const char *effectName = obj1.getName();
 
     if (!strcmp(effectName, "C"))
@@ -281,14 +270,13 @@
   } else {
     effectType = borderEffectNoEffect;
   }
-  obj1.free();
 
-  if ((dict->lookup("I", &obj1)->isNum()) && effectType == borderEffectCloudy) {
+  obj1 = dict->lookup("I");
+  if (obj1.isNum() && effectType == borderEffectCloudy) {
     intensity = obj1.getNum();
   } else {
     intensity = 0;
   }
-  obj1.free();
 }
 
 //------------------------------------------------------------------------
@@ -351,22 +339,21 @@
   tempCoords = (AnnotCoord **) gmallocn (tempLength, sizeof(AnnotCoord *));
   memset(tempCoords, 0, tempLength * sizeof(AnnotCoord *));
   for (int i = 0; i < tempLength && correct; i++) {
-    Object obj1;
     double x = 0, y = 0;
 
-    if (array->get(i * 2, &obj1)->isNum()) {
+    Object obj1 = array->get(i * 2);
+    if (obj1.isNum()) {
       x = obj1.getNum();
     } else {
       correct = gFalse;
     }
-    obj1.free();
 
-    if (array->get((i * 2) + 1, &obj1)->isNum()) {
+    obj1 = array->get((i * 2) + 1);
+    if (obj1.isNum()) {
       y = obj1.getNum();
     } else {
       correct = gFalse;
     }
-    obj1.free();
 
     if (!correct) {
       for (int j = i - 1; j >= 0; j--)
@@ -424,16 +411,14 @@
 
     for (i = 0; i < quadsLength; i++) {
       for (int j = 0; j < 8; j++) {
-        Object obj;
-        if (array->get(i * 8 + j, &obj)->isNum()) {
+        Object obj = array->get(i * 8 + j);
+        if (obj.isNum()) {
           quadArray[j] = obj.getNum();
         } else {
             correct = gFalse;
-	    obj.free();
 	    error (errSyntaxError, -1, "Invalid QuadPoint in annot");
 	    break;
         }
-        obj.free();
       }
 
       if (!correct)
@@ -540,13 +525,11 @@
 
   // TODO: check not all zero (Line Dash Pattern Page 217 PDF 8.1)
   for (int i = 0; i < tempLength && i < DASH_LIMIT && correct; i++) {
-    Object obj1;
-
-    if (dashObj->arrayGet(i, &obj1)->isNum()) {
+    Object obj1 = dashObj->arrayGet(i);
+    if (obj1.isNum()) {
       tempDash[i] = obj1.getNum();
 
       correct = tempDash[i] >= 0;
-      obj1.free();
     }
   }
 
@@ -583,30 +566,30 @@
   if (arrayLength == 3 || arrayLength == 4) {
     // implementation note 81 in Appendix H.
 
-    if (array->get(0, &obj1)->isNum())
+    obj1 = array->get(0);
+    if (obj1.isNum())
       horizontalCorner = obj1.getNum();
     else
       correct = gFalse;
-    obj1.free();
 
-    if (array->get(1, &obj1)->isNum())
+    obj1 = array->get(1);
+    if (obj1.isNum())
       verticalCorner = obj1.getNum();
     else
       correct = gFalse;
-    obj1.free();
 
-    if (array->get(2, &obj1)->isNum())
+    obj1 = array->get(2);
+    if (obj1.isNum())
       width = obj1.getNum();
     else
       correct = gFalse;
-    obj1.free();
 
     if (arrayLength == 4) {
-      if (array->get(3, &obj1)->isArray())
+      obj1 = array->get(3);
+      if (obj1.isArray())
         correct = parseDashArray(&obj1);
       else
         correct = gFalse;
-      obj1.free();
     }
   } else {
     correct = gFalse;
@@ -617,21 +600,22 @@
   }
 }
 
-void AnnotBorderArray::writeToObject(XRef *xref, Object *obj1) const {
-  Object obj2;
+Object AnnotBorderArray::writeToObject(XRef *xref) const {
+  Array *borderArray = new Array(xref);
+  borderArray->add(Object(horizontalCorner));
+  borderArray->add(Object(verticalCorner));
+  borderArray->add(Object(width));
 
-  obj1->initArray(xref);
-  obj1->arrayAdd(obj2.initReal(horizontalCorner));
-  obj1->arrayAdd(obj2.initReal(verticalCorner));
-  obj1->arrayAdd(obj2.initReal(width));
-
   if (dashLength > 0) {
-    Object obj3;
+    Array *a = new Array(xref);
 
-    obj1->arrayAdd(obj3.initArray(xref));
     for (int i = 0; i < dashLength; i++)
-      obj3.arrayAdd(obj2.initReal(dash[i]));
+      a->add(Object(dash[i]));
+
+    borderArray->add(Object(a));
   }
+
+  return Object(borderArray);
 }
 
 //------------------------------------------------------------------------
@@ -650,8 +634,8 @@
   // that behaviour by veryifying both entries exist
   // otherwise we set the borderWidth to 0
   // --jrmuizel
-  dict->lookup("W", &obj1);
-  dict->lookup("S", &obj2);
+  obj1 = dict->lookup("W");
+  obj2 = dict->lookup("S");
   if (obj1.isNum() && obj2.isName()) {
     const char *styleName = obj2.getName();
 
@@ -673,13 +657,11 @@
   } else {
     width = 0;
   }
-  obj2.free();
-  obj1.free();
 
   if (style == borderDashed) {
-    if (dict->lookup("D", &obj1)->isArray())
+    obj1 = dict->lookup("D");
+  if (obj1.isArray())
       parseDashArray(&obj1);
-    obj1.free();
 
     if (!dash) {
       dashLength = 1;
@@ -706,19 +688,18 @@
   return "S";
 }
 
-void AnnotBorderBS::writeToObject(XRef *xref, Object *obj1) const {
-  Object obj2;
-
-  obj1->initDict(xref);
-  obj1->dictSet("W", obj2.initReal(width));
-  obj1->dictSet("S", obj2.initName(getStyleName()));
+Object AnnotBorderBS::writeToObject(XRef *xref) const {
+  Dict *dict = new Dict(xref);
+  dict->set("W", Object(width));
+  dict->set("S", Object(objName, getStyleName()));
   if (style == borderDashed && dashLength > 0) {
-    Object obj3;
+    Array *a = new Array(xref);
 
-    obj1->dictSet("D", obj3.initArray(xref));
     for (int i = 0; i < dashLength; i++)
-      obj3.arrayAdd(obj2.initReal(dash[i]));
+      a->add(Object(dash[i]));
+    dict->set("D", Object(a));
   }
+  return Object(dict);
 }
 
 //------------------------------------------------------------------------
@@ -763,9 +744,8 @@
     length = 4;
 
   for (i = 0; i < length; i++) {
-    Object obj1;
-
-    if (array->get(i, &obj1)->isNum()) {
+    Object obj1 = array->get(i);
+    if (obj1.isNum()) {
       values[i] = obj1.getNum();
 
       if (values[i] < 0 || values[i] > 1)
@@ -773,7 +753,6 @@
     } else {
       values[i] = 0;
     }
-    obj1.free();
   }
 
   if (adjust != 0)
@@ -797,16 +776,14 @@
   }
 }
 
-void AnnotColor::writeToObject(XRef *xref, Object *obj1) const {
-  Object obj2;
-  int i;
-
+Object AnnotColor::writeToObject(XRef *xref) const {
   if (length == 0) {
-    obj1->initNull(); // Transparent (no color)
+    return Object(objNull); // Transparent (no color)
   } else {
-    obj1->initArray(xref);
-    for (i = 0; i < length; ++i)
-      obj1->arrayAdd( obj2.initReal( values[i] ) );
+    Array *a = new Array(xref);
+    for (int i = 0; i < length; ++i)
+      a->add( Object( values[i] ) );
+    return Object(a);
   }
 }
 
@@ -817,7 +794,8 @@
 AnnotIconFit::AnnotIconFit(Dict* dict) {
   Object obj1;
 
-  if (dict->lookup("SW", &obj1)->isName()) {
+  obj1 = dict->lookup("SW");
+  if (obj1.isName()) {
     const char *scaleName = obj1.getName();
 
     if(!strcmp(scaleName, "B")) {
@@ -832,9 +810,9 @@
   } else {
     scaleWhen = scaleAlways;
   }
-  obj1.free();
 
-  if (dict->lookup("S", &obj1)->isName()) {
+  obj1 = dict->lookup("S");
+  if (obj1.isName()) {
     const char *scaleName = obj1.getName();
 
     if(!strcmp(scaleName, "A")) {
@@ -845,14 +823,12 @@
   } else {
     scale = scaleProportional;
   }
-  obj1.free();
 
-  if (dict->lookup("A", &obj1)->isArray() && obj1.arrayGetLength() == 2) {
+  obj1 = dict->lookup("A");
+  if (obj1.isArray() && obj1.arrayGetLength() == 2) {
     Object obj2;
-    (obj1.arrayGet(0, &obj2)->isNum() ? left = obj2.getNum() : left = 0);
-    obj2.free();
-    (obj1.arrayGet(1, &obj2)->isNum() ? bottom = obj2.getNum() : bottom = 0);
-    obj2.free();
+    (obj2 = obj1.arrayGet(0), obj2.isNum() ? left = obj2.getNum() : left = 0);
+    (obj2 = obj1.arrayGet(1), obj2.isNum() ? bottom = obj2.getNum() : bottom = 0);
 
     if (left < 0 || left > 1)
       left = 0.5;
@@ -863,14 +839,13 @@
   } else {
     left = bottom = 0.5;
   }
-  obj1.free();
 
-  if (dict->lookup("FB", &obj1)->isBool()) {
+  obj1 = dict->lookup("FB");
+  if (obj1.isBool()) {
     fullyBounds = obj1.getBool();
   } else {
     fullyBounds = gFalse;
   }
-  obj1.free();
 }
 
 //------------------------------------------------------------------------
@@ -881,55 +856,54 @@
   assert(dict->isDict());
   doc = docA;
   xref = docA->getXRef();
-  dict->copy(&appearDict);
+  appearDict = dict->copy();
 }
 
 AnnotAppearance::~AnnotAppearance() {
-  appearDict.free();
 }
 
-void AnnotAppearance::getAppearanceStream(AnnotAppearanceType type, const char *state, Object *dest) {
-  Object apData, stream;
-  apData.initNull();
+Object AnnotAppearance::getAppearanceStream(AnnotAppearanceType type, const char *state) {
+  Object apData;
 
   // Obtain dictionary or stream associated to appearance type
   switch (type) {
   case appearRollover:
-    if (appearDict.dictLookupNF("R", &apData)->isNull())
-      appearDict.dictLookupNF("N", &apData);
+    apData = appearDict.dictLookupNF("R");
+    if (apData.isNull())
+      apData = appearDict.dictLookupNF("N");
     break;
   case appearDown:
-    if (appearDict.dictLookupNF("D", &apData)->isNull())
-      appearDict.dictLookupNF("N", &apData);
+    apData = appearDict.dictLookupNF("D");
+    if (apData.isNull())
+      apData = appearDict.dictLookupNF("N");
     break;
   case appearNormal:
-    appearDict.dictLookupNF("N", &apData);
+    apData = appearDict.dictLookupNF("N");
     break;
   }
 
-  dest->initNull();
+  Object res;
   if (apData.isDict() && state)
-    apData.dictLookupNF(state, dest);
+    res = apData.dictLookupNF(state);
   else if (apData.isRef())
-    apData.copy(dest);
-  apData.free();
+    res = apData.copy();
+
+  return res;
 }
 
 GooString * AnnotAppearance::getStateKey(int i) {
-  Object obj1;
   GooString * res = NULL;
-  if (appearDict.dictLookupNF("N", &obj1)->isDict())
+  Object obj1 = appearDict.dictLookupNF("N");
+  if (obj1.isDict())
     res = new GooString(obj1.dictGetKey(i));
-  obj1.free();
   return res;
 }
 
 int AnnotAppearance::getNumStates() {
-  Object obj1;
   int res = 0;
-  if (appearDict.dictLookupNF("N", &obj1)->isDict())
+  Object obj1 = appearDict.dictLookupNF("N");
+  if (obj1.isDict())
     res = obj1.dictGetLength();
-  obj1.free();
   return res;
 }
 
@@ -943,8 +917,7 @@
   } else if (stateObj->isDict()) { // Test each value
     const int size = stateObj->dictGetLength();
     for (int i = 0; i < size; ++i) {
-      Object obj1;
-      stateObj->dictGetValNF(i, &obj1);
+      Object obj1 = stateObj->dictGetValNF(i);
       if (obj1.isRef()) {
         Ref r = obj1.getRef();
         if (r.num == refToStream.num && r.gen == refToStream.gen) {
@@ -951,7 +924,6 @@
           return gTrue;
         }
       }
-      obj1.free();
     }
   }
   return gFalse; // Not found
@@ -963,21 +935,18 @@
   GBool found;
 
   // Scan each state's ref/subdictionary
-  appearDict.dictLookupNF("N", &obj1);
+  obj1 = appearDict.dictLookupNF("N");
   found = referencesStream(&obj1, refToStream);
-  obj1.free();
   if (found)
     return gTrue;
 
-  appearDict.dictLookupNF("R", &obj1);
+  obj1 = appearDict.dictLookupNF("R");
   found = referencesStream(&obj1, refToStream);
-  obj1.free();
   if (found)
     return gTrue;
 
-  appearDict.dictLookupNF("D", &obj1);
+  obj1 = appearDict.dictLookupNF("D");
   found = referencesStream(&obj1, refToStream);
-  obj1.free();
   return found;
 }
 
@@ -1011,12 +980,10 @@
   } else if (obj1->isDict()) {
     const int size = obj1->dictGetLength();
     for (int i = 0; i < size; ++i) {
-      Object obj2;
-      obj1->dictGetValNF(i, &obj2);
+      Object obj2 = obj1->dictGetValNF(i);
       if (obj2.isRef()) {
         removeStream(obj2.getRef());
       }
-      obj2.free();
     }
   }
 }
@@ -1023,15 +990,12 @@
 
 void AnnotAppearance::removeAllStreams() {
   Object obj1;
-  appearDict.dictLookupNF("N", &obj1);
+  obj1 = appearDict.dictLookupNF("N");
   removeStateStreams(&obj1);
-  obj1.free();
-  appearDict.dictLookupNF("R", &obj1);
+  obj1 = appearDict.dictLookupNF("R");
   removeStateStreams(&obj1);
-  obj1.free();
-  appearDict.dictLookupNF("D", &obj1);
+  obj1 = appearDict.dictLookupNF("D");
   removeStateStreams(&obj1);
-  obj1.free();
 }
 
 //------------------------------------------------------------------------
@@ -1041,14 +1005,15 @@
 AnnotAppearanceCharacs::AnnotAppearanceCharacs(Dict *dict) {
   Object obj1;
 
-  if (dict->lookup("R", &obj1)->isInt()) {
+  obj1 = dict->lookup("R");
+  if (obj1.isInt()) {
     rotation = obj1.getInt();
   } else {
     rotation = 0;
   }
-  obj1.free();
 
-  if (dict->lookup("BC", &obj1)->isArray()) {
+  obj1 = dict->lookup("BC");
+  if (obj1.isArray()) {
     Array *colorComponents = obj1.getArray();
     if (colorComponents->getLength() > 0) {
       borderColor = new AnnotColor(colorComponents);
@@ -1058,9 +1023,9 @@
   } else {
     borderColor = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("BG", &obj1)->isArray()) {
+  obj1 = dict->lookup("BG");
+  if (obj1.isArray()) {
     Array *colorComponents = obj1.getArray();
     if (colorComponents->getLength() > 0) {
       backColor = new AnnotColor(colorComponents);
@@ -1070,42 +1035,41 @@
   } else {
     backColor = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("CA", &obj1)->isString()) {
+  obj1 = dict->lookup("CA");
+  if (obj1.isString()) {
     normalCaption = new GooString(obj1.getString());
   } else {
     normalCaption = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("RC", &obj1)->isString()) {
+  obj1 = dict->lookup("RC");
+  if (obj1.isString()) {
     rolloverCaption = new GooString(obj1.getString());
   } else {
     rolloverCaption = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("AC", &obj1)->isString()) {
+  obj1 = dict->lookup("AC");
+  if (obj1.isString()) {
     alternateCaption = new GooString(obj1.getString());
   } else {
     alternateCaption = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("IF", &obj1)->isDict()) {
+  obj1 = dict->lookup("IF");
+  if (obj1.isDict()) {
     iconFit = new AnnotIconFit(obj1.getDict());
   } else {
     iconFit = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("TP", &obj1)->isInt()) {
+  obj1 = dict->lookup("TP");
+  if (obj1.isInt()) {
     position = (AnnotAppearanceCharacsTextPos) obj1.getInt();
   } else {
     position = captionNoIcon;
   }
-  obj1.free();
 }
 
 AnnotAppearanceCharacs::~AnnotAppearanceCharacs() {
@@ -1185,24 +1149,20 @@
 //------------------------------------------------------------------------
 
 Annot::Annot(PDFDoc *docA, PDFRectangle *rectA) {
-  Object obj1;
 
   refCnt = 1;
   flags = flagUnknown;
   type = typeUnknown;
 
-  obj1.initArray (docA->getXRef());
-  Object obj2;
-  obj1.arrayAdd (obj2.initReal (rectA->x1));
-  obj1.arrayAdd (obj2.initReal (rectA->y1));
-  obj1.arrayAdd (obj2.initReal (rectA->x2));
-  obj1.arrayAdd (obj2.initReal (rectA->y2));
-  obj2.free ();
+  Array *a = new Array(docA->getXRef());
+  a->add(Object(rectA->x1));
+  a->add(Object(rectA->y1));
+  a->add(Object(rectA->x2));
+  a->add(Object(rectA->y2));
 
-  annotObj.initDict (docA->getXRef());
-  annotObj.dictSet ("Type", obj2.initName ("Annot"));
-  annotObj.dictSet ("Rect", &obj1);
-  // obj1 is owned by the dict
+  annotObj = Object(new Dict(docA->getXRef()));
+  annotObj.dictSet ("Type", Object(objName, "Annot"));
+  annotObj.dictSet ("Rect", Object(a));
 
   ref = docA->getXRef()->addIndirectObject (&annotObj);
 
@@ -1209,16 +1169,16 @@
   initialize (docA, annotObj.getDict());
 }
 
-Annot::Annot(PDFDoc *docA, Dict *dict) {
+Annot::Annot(PDFDoc *docA, Object *dictObject) {
   refCnt = 1;
   hasRef = false;
   flags = flagUnknown;
   type = typeUnknown;
-  annotObj.initDict (dict);
-  initialize (docA, dict);
+  annotObj = dictObject->copy();
+  initialize (docA, dictObject->getDict());
 }
 
-Annot::Annot(PDFDoc *docA, Dict *dict, Object *obj) {
+Annot::Annot(PDFDoc *docA, Object *dictObject, Object *obj) {
   refCnt = 1;
   if (obj->isRef()) {
     hasRef = gTrue;
@@ -1228,12 +1188,12 @@
   }
   flags = flagUnknown;
   type = typeUnknown;
-  annotObj.initDict (dict);
-  initialize (docA, dict);
+  annotObj = dictObject->copy();
+  initialize (docA, dictObject->getDict());
 }
 
 void Annot::initialize(PDFDoc *docA, Dict *dict) {
-  Object apObj, asObj, obj1, obj2;
+  Object apObj, asObj, obj1;
 
   ok = gTrue;
   doc = docA;
@@ -1244,20 +1204,17 @@
   appearBuf = NULL;
   fontSize = 0;
 
-  appearance.initNull();
+  appearance.setToNull();
 
   //----- parse the rectangle
   rect = new PDFRectangle();
-  if (dict->lookup("Rect", &obj1)->isArray() && obj1.arrayGetLength() == 4) {
+  obj1 = dict->lookup("Rect");
+  if (obj1.isArray() && obj1.arrayGetLength() == 4) {
     Object obj2;
-    (obj1.arrayGet(0, &obj2)->isNum() ? rect->x1 = obj2.getNum() : rect->x1 = 0);
-    obj2.free();
-    (obj1.arrayGet(1, &obj2)->isNum() ? rect->y1 = obj2.getNum() : rect->y1 = 0);
-    obj2.free();
-    (obj1.arrayGet(2, &obj2)->isNum() ? rect->x2 = obj2.getNum() : rect->x2 = 1);
-    obj2.free();
-    (obj1.arrayGet(3, &obj2)->isNum() ? rect->y2 = obj2.getNum() : rect->y2 = 1);
-    obj2.free();
+    (obj2 = obj1.arrayGet(0), obj2.isNum() ? rect->x1 = obj2.getNum() : rect->x1 = 0);
+    (obj2 = obj1.arrayGet(1), obj2.isNum() ? rect->y1 = obj2.getNum() : rect->y1 = 0);
+    (obj2 = obj1.arrayGet(2), obj2.isNum() ? rect->x2 = obj2.getNum() : rect->x2 = 1);
+    (obj2 = obj1.arrayGet(3), obj2.isNum() ? rect->y2 = obj2.getNum() : rect->y2 = 1);
 
     if (rect->x1 > rect->x2) {
       double t = rect->x1;
@@ -1276,17 +1233,17 @@
     error(errSyntaxError, -1, "Bad bounding box for annotation");
     ok = gFalse;
   }
-  obj1.free();
 
-  if (dict->lookup("Contents", &obj1)->isString()) {
+  obj1 = dict->lookup("Contents");
+  if (obj1.isString()) {
     contents = obj1.getString()->copy();
   } else {
     contents = new GooString();
   }
-  obj1.free();
 
   // Note: This value is overwritten by Annots ctor
-  if (dict->lookupNF("P", &obj1)->isRef()) {
+  obj1 = dict->lookupNF("P");
+  if (obj1.isRef()) {
     Ref ref = obj1.getRef();
 
     page = doc->getCatalog()->findPage (ref.num, ref.gen);
@@ -1293,39 +1250,37 @@
   } else {
     page = 0;
   }
-  obj1.free();
 
-  if (dict->lookup("NM", &obj1)->isString()) {
+  obj1 = dict->lookup("NM");
+  if (obj1.isString()) {
     name = obj1.getString()->copy();
   } else {
     name = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("M", &obj1)->isString()) {
+  obj1 = dict->lookup("M");
+  if (obj1.isString()) {
     modified = obj1.getString()->copy();
   } else {
     modified = NULL;
   }
-  obj1.free();
 
   //----- get the flags
-  if (dict->lookup("F", &obj1)->isInt()) {
+  obj1 = dict->lookup("F");
+  if (obj1.isInt()) {
     flags |= obj1.getInt();
   } else {
     flags = flagUnknown;
   }
-  obj1.free();
 
   //----- get the annotation appearance dictionary
-  dict->lookup("AP", &apObj);
+  apObj = dict->lookup("AP");
   if (apObj.isDict()) {
     appearStreams = new AnnotAppearance(doc, &apObj);
   }
-  apObj.free();
 
   //----- get the appearance state
-  dict->lookup("AS", &asObj);
+  asObj = dict->lookup("AS");
   if (asObj.isName()) {
     appearState = new GooString(asObj.getName());
   } else if (appearStreams && appearStreams->getNumStates() != 0) {
@@ -1340,11 +1295,10 @@
   if (!appearState) {
     appearState = new GooString("Off");
   }
-  asObj.free();
 
   //----- get the annotation appearance
   if (appearStreams) {
-    appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->getCString(), &appearance);
+    appearance = appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->getCString());
   }
 
   //----- parse the border style
@@ -1352,29 +1306,29 @@
   // the border shall be drawn as a solid line with a width of 1 point. But acroread
   // seems to ignore the Border entry for annots that can't have a BS entry. So, we only
   // follow this rule for annots tha can have a BS entry.
-  if (dict->lookup("Border", &obj1)->isArray())
+  obj1 = dict->lookup("Border");
+  if (obj1.isArray())
     border = new AnnotBorderArray(obj1.getArray());
   else
     border = NULL;
-  obj1.free();
 
-  if (dict->lookup("C", &obj1)->isArray()) {
+  obj1 = dict->lookup("C");
+  if (obj1.isArray()) {
     color = new AnnotColor(obj1.getArray());
   } else {
     color = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("StructParent", &obj1)->isInt()) {
+  obj1 = dict->lookup("StructParent");
+  if (obj1.isInt()) {
     treeKey = obj1.getInt();
   } else {
     treeKey = 0;
   }
-  obj1.free();
 
-  dict->lookupNF("OC", &oc);
+  oc = dict->lookupNF("OC");
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -1391,8 +1345,6 @@
 }
 
 void Annot::setRect(double x1, double y1, double x2, double y2) {
-  Object obj1, obj2;
-
   if (x1 < x2) {
     rect->x1 = x1;
     rect->x2 = x2;
@@ -1409,13 +1361,13 @@
     rect->y2 = y1;
   }
 
-  obj1.initArray (xref);
-  obj1.arrayAdd (obj2.initReal (rect->x1));
-  obj1.arrayAdd (obj2.initReal (rect->y1));
-  obj1.arrayAdd (obj2.initReal (rect->x2));
-  obj1.arrayAdd (obj2.initReal (rect->y2));
+  Array *a = new Array(xref);
+  a->add(Object(rect->x1));
+  a->add(Object(rect->y1));
+  a->add(Object(rect->x2));
+  a->add(Object(rect->y2));
 
-  update("Rect", &obj1);
+  update("Rect", Object(a));
   invalidateAppearance();
 }
 
@@ -1423,7 +1375,7 @@
   return rect->contains(x, y);
 }
 
-void Annot::update(const char *key, Object *value) {
+void Annot::update(const char *key, Object &&value) {
   annotLocker();
   /* Set M to current time, unless we are updating M itself */
   if (strcmp(key, "M") != 0) {
@@ -1430,12 +1382,10 @@
     delete modified;
     modified = timeToDateString(NULL);
 
-    Object obj1;
-    obj1.initString (modified->copy());
-    annotObj.dictSet("M", &obj1);
+    annotObj.dictSet("M", Object(modified->copy()));
   }
 
-  annotObj.dictSet(const_cast<char*>(key), value);
+  annotObj.dictSet(const_cast<char*>(key), std::move(value));
   
   xref->setModifiedObject(&annotObj, ref);
 }
@@ -1448,16 +1398,13 @@
     contents = new GooString(new_content);
     //append the unicode marker <FE FF> if needed	
     if (!contents->hasUnicodeMarker()) {
-      contents->insert(0, 0xff);
-      contents->insert(0, 0xfe);
+      contents->prependUnicodeMarker();
     }
   } else {
     contents = new GooString();
   }
   
-  Object obj1;
-  obj1.initString(contents->copy());
-  update ("Contents", &obj1);
+  update ("Contents", Object(contents->copy()));
 }
 
 void Annot::setName(GooString *new_name) {
@@ -1470,9 +1417,7 @@
     name = new GooString();
   }
 
-  Object obj1;
-  obj1.initString(name->copy());
-  update ("NM", &obj1);
+  update ("NM", Object(name->copy()));
 }
 
 void Annot::setModified(GooString *new_modified) {
@@ -1484,17 +1429,13 @@
   else
     modified = new GooString();
 
-  Object obj1;
-  obj1.initString(modified->copy());
-  update ("M", &obj1);
+  update ("M", Object(modified->copy()));
 }
 
 void Annot::setFlags(Guint new_flags) {
   annotLocker();
-  Object obj1;
   flags = new_flags;
-  obj1.initInt(flags);
-  update ("F", &obj1);
+  update ("F", Object(int(flags)));
 }
 
 void Annot::setBorder(AnnotBorder *new_border) {
@@ -1502,9 +1443,8 @@
   delete border;
 
   if (new_border) {
-    Object obj1;
-    new_border->writeToObject(xref, &obj1);
-    update(new_border->getType() == AnnotBorder::typeArray ? "Border" : "BS", &obj1);
+    Object obj1 = new_border->writeToObject(xref);
+    update(new_border->getType() == AnnotBorder::typeArray ? "Border" : "BS", std::move(obj1));
     border = new_border;
   } else {
     border = NULL;
@@ -1517,9 +1457,8 @@
   delete color;
 
   if (new_color) {
-    Object obj1;
-    new_color->writeToObject(xref, &obj1);
-    update ("C", &obj1);
+    Object obj1 = new_color->writeToObject(xref);
+    update ("C", std::move(obj1));
     color = new_color;
   } else {
     color = NULL;
@@ -1530,19 +1469,18 @@
 void Annot::setPage(int pageIndex, GBool updateP) {
   annotLocker();
   Page *pageobj = doc->getPage(pageIndex);
-  Object obj1;
+  Object obj1(objNull);
 
   if (pageobj) {
     Ref pageRef = pageobj->getRef();
-    obj1.initRef(pageRef.num, pageRef.gen);
+    obj1 = Object(pageRef.num, pageRef.gen);
     page = pageIndex;
   } else {
-    obj1.initNull();
     page = 0;
   }
 
   if (updateP) {
-    update("P", &obj1);
+    update("P", std::move(obj1));
   }
 }
 
@@ -1557,16 +1495,13 @@
   delete appearBBox;
   appearBBox = NULL;
 
-  Object obj1;
-  obj1.initName(state);
-  update ("AS", &obj1);
+  update ("AS", Object(objName, state));
 
   // The appearance state determines the current appearance stream
-  appearance.free();
   if (appearStreams) {
-    appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->getCString(), &appearance);
+    appearance = appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->getCString());
   } else {
-    appearance.initNull();
+    appearance.setToNull();
   }
 }
 
@@ -1584,18 +1519,15 @@
   delete appearBBox;
   appearBBox = NULL;
 
-  appearance.free();
-  appearance.initNull();
+  appearance.setToNull();
 
-  Object obj1, obj2;
-  obj1.initNull();
-  if (!annotObj.dictLookup("AP", &obj2)->isNull())
-    update ("AP", &obj1); // Remove AP
-  obj2.free();
+  Object obj2 = annotObj.dictLookup("AP");
+  if (!obj2.isNull())
+    update ("AP", Object(objNull)); // Remove AP
 
-  if (!annotObj.dictLookup("AS", &obj2)->isNull())
-    update ("AS", &obj1); // Remove AS
-  obj2.free();
+  obj2 = annotObj.dictLookup("AS");
+  if (!obj2.isNull())
+    update ("AS", Object(objNull)); // Remove AS
 }
 
 double Annot::getXMin() {
@@ -1615,9 +1547,7 @@
 }
 
 void Annot::readArrayNum(Object *pdfArray, int key, double *value) {
-  Object valueObject;
-
-  pdfArray->arrayGet(key, &valueObject);
+  Object valueObject = pdfArray->arrayGet(key);
   if (valueObject.isNum()) {
     *value = valueObject.getNum();
   } else {
@@ -1624,7 +1554,6 @@
     *value = 0;
     ok = gFalse;
   }
-  valueObject.free();
 }
 
 void Annot::removeReferencedObjects() {
@@ -1638,24 +1567,22 @@
 }
 
 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
 }
 
 Annot::~Annot() {
-  annotObj.free();
-  
   delete rect;
   delete contents;
 
@@ -1667,7 +1594,6 @@
 
   delete appearStreams;
   delete appearBBox;
-  appearance.free();
 
   if (appearState)
     delete appearState;
@@ -1678,9 +1604,7 @@
   if (color)
     delete color;
 
-  oc.free();
-
-#if MULTITHREADED
+#ifdef MULTITHREADED
     gDestroyMutex(&mutex);
 #endif
 }
@@ -1804,74 +1728,66 @@
   appearBuf->append("S\n");
 }
 
-void Annot::createForm(double *bbox, GBool transparencyGroup, Object *resDict, Object *aStream) {
-  Object obj1, obj2;
-  Object appearDict;
+Object Annot::createForm(double *bbox, GBool transparencyGroup, Dict *resDict) {
+  Dict *appearDict = new Dict(xref);
+  appearDict->set("Length", Object(appearBuf->getLength()));
+  appearDict->set("Subtype", Object(objName, "Form"));
 
-  appearDict.initDict(xref);
-  appearDict.dictSet("Length", obj1.initInt(appearBuf->getLength()));
-  appearDict.dictSet("Subtype", obj1.initName("Form"));
-  obj1.initArray(xref);
-  obj1.arrayAdd(obj2.initReal(bbox[0]));
-  obj1.arrayAdd(obj2.initReal(bbox[1]));
-  obj1.arrayAdd(obj2.initReal(bbox[2]));
-  obj1.arrayAdd(obj2.initReal(bbox[3]));
-  appearDict.dictSet("BBox", &obj1);
+  Array *a = new Array(xref);
+  a->add(Object(bbox[0]));
+  a->add(Object(bbox[1]));
+  a->add(Object(bbox[2]));
+  a->add(Object(bbox[3]));
+  appearDict->set("BBox", Object(a));
   if (transparencyGroup) {
-    Object transDict;
-    transDict.initDict(xref);
-    transDict.dictSet("S", obj1.initName("Transparency"));
-    appearDict.dictSet("Group", &transDict);
+    Dict *d = new Dict(xref);
+    d->set("S", Object(objName, "Transparency"));
+    appearDict->set("Group", Object(d));
   }
   if (resDict)
-    appearDict.dictSet("Resources", resDict);
+    appearDict->set("Resources", Object(resDict));
 
   MemStream *mStream = new MemStream(copyString(appearBuf->getCString()), 0,
-				     appearBuf->getLength(), &appearDict);
+				     appearBuf->getLength(), Object(appearDict));
   mStream->setNeedFree(gTrue);
-  aStream->initStream(mStream);
+  return Object(static_cast<Stream*>(mStream));
 }
 
-void Annot::createResourcesDict(const char *formName, Object *formStream,
+Dict *Annot::createResourcesDict(const char *formName, Object &&formStream,
 				const char *stateName,
-				double opacity, const char *blendMode,
-				Object *resDict) {
-  Object gsDict, stateDict, formDict, obj1;
-
-  gsDict.initDict(xref);
+				double opacity, const char *blendMode) {
+  Dict *gsDict = new Dict(xref);
   if (opacity != 1) {
-    gsDict.dictSet("CA", obj1.initReal(opacity));
-    gsDict.dictSet("ca", obj1.initReal(opacity));
+    gsDict->set("CA", Object(opacity));
+    gsDict->set("ca", Object(opacity));
   }
   if (blendMode)
-    gsDict.dictSet("BM", obj1.initName(blendMode));
-  stateDict.initDict(xref);
-  stateDict.dictSet(stateName, &gsDict);
-  formDict.initDict(xref);
-  formDict.dictSet(formName, formStream);
+    gsDict->set("BM", Object(objName, blendMode));
+  Dict *stateDict = new Dict(xref);
+  stateDict->set(stateName, Object(gsDict));
+  Dict *formDict = new Dict(xref);
+  formDict->set(formName, std::move(formStream));
 
-  resDict->initDict(xref);
-  resDict->dictSet("ExtGState", &stateDict);
-  resDict->dictSet("XObject", &formDict);
+  Dict *resDict = new Dict(xref);
+  resDict->set("ExtGState", Object(stateDict));
+  resDict->set("XObject", Object(formDict));
+
+  return resDict;
 }
 
-Object *Annot::getAppearanceResDict(Object *dest) {
+Object Annot::getAppearanceResDict() {
   Object obj1, obj2;
 
-  dest->initNull(); // Default value
-
   // Fetch appearance's resource dict (if any)
-  appearance.fetch(xref, &obj1);
+  obj1 = appearance.fetch(xref);
   if (obj1.isStream()) {
-    obj1.streamGetDict()->lookup("Resources", &obj2);
+    obj2 = obj1.streamGetDict()->lookup("Resources");
     if (obj2.isDict()) {
-      obj2.copy(dest);
+      return obj2;
     }
-    obj2.free();
   }
-  obj1.free();
 
-  return dest;
+  return Object(objNull);
 }
 
 GBool Annot::isVisible(GBool printing) {
@@ -1905,17 +1821,14 @@
 }
 
 void Annot::draw(Gfx *gfx, GBool printing) {
-  Object obj;
-
   annotLocker();
   if (!isVisible (printing))
     return;
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
       rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
-  obj.free();
 }
 
 //------------------------------------------------------------------------
@@ -1928,52 +1841,45 @@
 
   type = typePopup;
 
-  annotObj.dictSet ("Subtype", obj1.initName ("Popup"));
+  annotObj.dictSet ("Subtype", Object(objName, "Popup"));
   initialize (docA, annotObj.getDict());
 }
 
-AnnotPopup::AnnotPopup(PDFDoc *docA, Dict *dict, Object *obj) :
-    Annot(docA, dict, obj) {
+AnnotPopup::AnnotPopup(PDFDoc *docA, Object *dictObject, Object *obj) :
+    Annot(docA, dictObject, obj) {
   type = typePopup;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotPopup::~AnnotPopup() {
-  parent.free();
 }
 
 void AnnotPopup::initialize(PDFDoc *docA, Dict *dict) {
-  Object obj1;
-
-  if (!dict->lookupNF("Parent", &parent)->isRef()) {
-    parent.initNull();
+  parent = dict->lookupNF("Parent");
+  if (!parent.isRef()) {
+    parent.setToNull();
   }
 
-  if (dict->lookup("Open", &obj1)->isBool()) {
+  Object obj1 = dict->lookup("Open");
+  if (obj1.isBool()) {
     open = obj1.getBool();
   } else {
     open = gFalse;
   }
-  obj1.free();
 }
 
 void AnnotPopup::setParent(Object *parentA) {
-  parentA->copy(&parent);
-  update ("Parent", &parent);
+  update ("Parent", parentA->copy());
 }
 
 void AnnotPopup::setParent(Annot *parentA) {
-  Ref parentRef = parentA->getRef();
-  parent.initRef(parentRef.num, parentRef.gen);
-  update ("Parent", &parent);
+  const Ref parentRef = parentA->getRef();
+  update ("Parent", Object(parentRef.num, parentRef.gen));
 }
 
 void AnnotPopup::setOpen(GBool openA) {
-  Object obj1;
-
   open = openA;
-  obj1.initBool(open);
-  update ("Open", &obj1);
+  update ("Open", Object(open));
 }
 
 //------------------------------------------------------------------------
@@ -1984,9 +1890,9 @@
   initialize(docA, annotObj.getDict(), &annotObj);
 }
 
-AnnotMarkup::AnnotMarkup(PDFDoc *docA, Dict *dict, Object *obj) :
-    Annot(docA, dict, obj) {
-  initialize(docA, dict, obj);
+AnnotMarkup::AnnotMarkup(PDFDoc *docA, Object *dictObject, Object *obj) :
+    Annot(docA, dictObject, obj) {
+  initialize(docA, dictObject->getDict(), obj);
 }
 
 AnnotMarkup::~AnnotMarkup() {
@@ -2006,50 +1912,52 @@
 void AnnotMarkup::initialize(PDFDoc *docA, Dict *dict, Object *obj) {
   Object obj1, obj2;
 
-  if (dict->lookup("T", &obj1)->isString()) {
+  obj1 = dict->lookup("T");
+  if (obj1.isString()) {
     label = obj1.getString()->copy();
   } else {
     label = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("Popup", &obj1)->isDict() && dict->lookupNF("Popup", &obj2)->isRef()) {
-    popup = new AnnotPopup(docA, obj1.getDict(), &obj2);
+  obj1 = dict->lookup("Popup");
+  obj2 = dict->lookupNF("Popup");
+  if (obj1.isDict() && obj2.isRef()) {
+    popup = new AnnotPopup(docA, &obj1, &obj2);
   } else {
     popup = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("CA", &obj1)->isNum()) {
+  obj1 = dict->lookup("CA");
+  if (obj1.isNum()) {
     opacity = obj1.getNum();
   } else {
     opacity = 1.0;
   }
-  obj1.free();
 
-  if (dict->lookup("CreationDate", &obj1)->isString()) {
+  obj1 = dict->lookup("CreationDate");
+  if (obj1.isString()) {
     date = obj1.getString()->copy();
   } else {
     date = NULL;
   }
-  obj1.free();
 
-  if (dict->lookupNF("IRT", &obj1)->isRef()) {
+  obj1 = dict->lookupNF("IRT");
+  if (obj1.isRef()) {
     inReplyTo = obj1.getRef();
   } else {
     inReplyTo.num = 0;
     inReplyTo.gen = 0;
   }
-  obj1.free();
 
-  if (dict->lookup("Subj", &obj1)->isString()) {
+  obj1 = dict->lookup("Subj");
+  if (obj1.isString()) {
     subject = obj1.getString()->copy();
   } else {
     subject = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("RT", &obj1)->isName()) {
+  obj1 = dict->lookup("RT");
+  if (obj1.isName()) {
     const char *replyName = obj1.getName();
 
     if (!strcmp(replyName, "R")) {
@@ -2062,14 +1970,13 @@
   } else {
     replyTo = replyTypeR;
   }
-  obj1.free();
 
-  if (dict->lookup("ExData", &obj1)->isDict()) {
+  obj1 = dict->lookup("ExData");
+  if (obj1.isDict()) {
     exData = parseAnnotExternalData(obj1.getDict());
   } else {
     exData = annotExternalDataMarkupUnknown;
   }
-  obj1.free();
 }
 
 void AnnotMarkup::setLabel(GooString *new_label) {
@@ -2079,16 +1986,13 @@
     label = new GooString(new_label);
     //append the unicode marker <FE FF> if needed
     if (!label->hasUnicodeMarker()) {
-      label->insert(0, 0xff);
-      label->insert(0, 0xfe);
+      label->prependUnicodeMarker();
     }
   } else {
     label = new GooString();
   }
 
-  Object obj1;
-  obj1.initString(label->copy());
-  update ("T", &obj1);
+  update ("T", Object(label->copy()));
 }
 
 void AnnotMarkup::setPopup(AnnotPopup *new_popup) {
@@ -2105,12 +2009,9 @@
   delete popup;
 
   if (new_popup) {
-    Object obj1;
-    Ref popupRef = new_popup->getRef();
+    const Ref popupRef = new_popup->getRef();
+    update ("Popup", Object(popupRef.num, popupRef.gen));
 
-    obj1.initRef (popupRef.num, popupRef.gen);
-    update ("Popup", &obj1);
-
     new_popup->setParent(this);
     popup = new_popup;
 
@@ -2128,11 +2029,8 @@
 }
 
 void AnnotMarkup::setOpacity(double opacityA) {
-  Object obj1;
-
   opacity = opacityA;
-  obj1.initReal(opacity);
-  update ("CA", &obj1);
+  update ("CA", Object(opacity));
   invalidateAppearance();
 }
 
@@ -2144,9 +2042,7 @@
   else
     date = new GooString();
 
-  Object obj1;
-  obj1.initString(date->copy());
-  update ("CreationDate", &obj1);
+  update ("CreationDate", Object(date->copy()));
 }
 
 void AnnotMarkup::removeReferencedObjects() {
@@ -2167,21 +2063,19 @@
 
 AnnotText::AnnotText(PDFDoc *docA, PDFRectangle *rect) :
     AnnotMarkup(docA, rect) {
-  Object obj1;
-
   type = typeText;
   flags |= flagNoZoom | flagNoRotate;
 
-  annotObj.dictSet ("Subtype", obj1.initName ("Text"));
+  annotObj.dictSet ("Subtype", Object(objName, "Text"));
   initialize (docA, annotObj.getDict());
 }
 
-AnnotText::AnnotText(PDFDoc *docA, Dict *dict, Object *obj) :
-    AnnotMarkup(docA, dict, obj) {
+AnnotText::AnnotText(PDFDoc *docA, Object *dictObject, Object *obj) :
+    AnnotMarkup(docA, dictObject, obj) {
 
   type = typeText;
   flags |= flagNoZoom | flagNoRotate;
-  initialize (docA, dict);
+  initialize (docA, dictObject->getDict());
 }
 
 AnnotText::~AnnotText() {
@@ -2191,24 +2085,25 @@
 void AnnotText::initialize(PDFDoc *docA, Dict *dict) {
   Object obj1;
 
-  if (dict->lookup("Open", &obj1)->isBool())
+  obj1 = dict->lookup("Open");
+  if (obj1.isBool())
     open = obj1.getBool();
   else
     open = gFalse;
-  obj1.free();
 
-  if (dict->lookup("Name", &obj1)->isName()) {
+  obj1 = dict->lookup("Name");
+  if (obj1.isName()) {
     icon = new GooString(obj1.getName());
   } else {
     icon = new GooString("Note");
   }
-  obj1.free();
 
-  if (dict->lookup("StateModel", &obj1)->isString()) {
-    Object obj2;
+  obj1 = dict->lookup("StateModel");
+  if (obj1.isString()) {
     GooString *modelName = obj1.getString();
 
-    if (dict->lookup("State", &obj2)->isString()) {
+    Object obj2 = dict->lookup("State");
+    if (obj2.isString()) {
       GooString *stateName = obj2.getString();
 
       if (!stateName->cmp("Marked")) {
@@ -2231,7 +2126,6 @@
     } else {
       state = stateUnknown;
     }
-    obj2.free();
 
     if (!modelName->cmp("Marked")) {
       switch (state) {
@@ -2266,7 +2160,6 @@
   } else {
     state = stateUnknown;
   }
-  obj1.free();
 }
 
 void AnnotText::setOpen(GBool openA) {
@@ -2273,8 +2166,7 @@
   Object obj1;
 
   open = openA;
-  obj1.initBool(open);
-  update ("Open", &obj1);
+  update ("Open", Object(open));
 }
 
 void AnnotText::setIcon(GooString *new_icon) {
@@ -2289,9 +2181,7 @@
     icon = new GooString("Note");
   }
 
-  Object obj1;
-  obj1.initName (icon->getCString());
-  update("Name", &obj1);
+  update("Name", Object(objName, icon->getCString()));
   invalidateAppearance();
 }
 
@@ -2540,7 +2430,6 @@
   "19.5 12.5 m S\n"
 
 void AnnotText::draw(Gfx *gfx, GBool printing) {
-  Object obj;
   double ca = 1;
 
   if (!isVisible (printing))
@@ -2583,22 +2472,20 @@
     double bbox[4];
     appearBBox->getBBoxRect(bbox);
     if (ca == 1) {
-      createForm(bbox, gFalse, NULL, &appearance);
+      appearance = createForm(bbox, gFalse, nullptr);
     } else {
-      Object aStream, resDict;
-
-      createForm(bbox, gTrue, NULL, &aStream);
+      Object aStream = createForm(bbox, gTrue, nullptr);
       delete appearBuf;
 
       appearBuf = new GooString ("/GS0 gs\n/Fm0 Do");
-      createResourcesDict("Fm0", &aStream, "GS0", ca, NULL, &resDict);
-      createForm(bbox, gFalse, &resDict, &appearance);
+      Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, NULL);
+      appearance = createForm(bbox, gFalse, resDict);
     }
     delete appearBuf;
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   if (appearBBox) {
     gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                    appearBBox->getPageXMin(), appearBBox->getPageYMin(),
@@ -2608,7 +2495,6 @@
     gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                    rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   }
-  obj.free();
 }
 
 //------------------------------------------------------------------------
@@ -2619,15 +2505,15 @@
   Object obj1;
 
   type = typeLink;
-  annotObj.dictSet ("Subtype", obj1.initName ("Link"));
+  annotObj.dictSet ("Subtype", Object(objName, "Link"));
   initialize (docA, annotObj.getDict());
 }
 
-AnnotLink::AnnotLink(PDFDoc *docA, Dict *dict, Object *obj) :
-    Annot(docA, dict, obj) {
+AnnotLink::AnnotLink(PDFDoc *docA, Object *dictObject, Object *obj) :
+    Annot(docA, dictObject, obj) {
 
   type = typeLink;
-  initialize (docA, dict);
+  initialize (docA, dictObject->getDict());
 }
 
 AnnotLink::~AnnotLink() {
@@ -2646,18 +2532,19 @@
   action = NULL;
 
   // look for destination
-  if (!dict->lookup("Dest", &obj1)->isNull()) {
+  obj1 = dict->lookup("Dest");
+  if (!obj1.isNull()) {
     action = LinkAction::parseDest(&obj1);
   // look for action
   } else {
-    obj1.free();
-    if (dict->lookup("A", &obj1)->isDict()) {
+    obj1 = dict->lookup("A");
+    if (obj1.isDict()) {
       action = LinkAction::parseAction(&obj1, doc->getCatalog()->getBaseURI());
     }
   }
-  obj1.free();
 
-  if (dict->lookup("H", &obj1)->isName()) {
+  obj1 = dict->lookup("H");
+  if (obj1.isName()) {
     const char *effect = obj1.getName();
 
     if (!strcmp(effect, "N")) {
@@ -2674,9 +2561,9 @@
   } else {
     linkEffect = effectInvert;
   }
-  obj1.free();
   /*
-  if (dict->lookup("PA", &obj1)->isDict()) {
+  obj1 = dict->lookup("PA");
+  if (obj1.isDict()) {
     uriAction = NULL;
   } else {
     uriAction = NULL;
@@ -2683,34 +2570,31 @@
   }
   obj1.free();
   */
-  if (dict->lookup("QuadPoints", &obj1)->isArray()) {
+  obj1 = dict->lookup("QuadPoints");
+  if (obj1.isArray()) {
     quadrilaterals = new AnnotQuadrilaterals(obj1.getArray(), rect);
   } else {
     quadrilaterals = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("BS", &obj1)->isDict()) {
+  obj1 = dict->lookup("BS");
+  if (obj1.isDict()) {
     delete border;
     border = new AnnotBorderBS(obj1.getDict());
   } else if (!border) {
     border = new AnnotBorderBS();
   }
-  obj1.free();
 }
 
 void AnnotLink::draw(Gfx *gfx, GBool printing) {
-  Object obj;
-
   if (!isVisible (printing))
     return;
 
   annotLocker();
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   gfx->drawAnnot(&obj, border, color,
 		 rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
-  obj.free();
 }
 
 //------------------------------------------------------------------------
@@ -2722,19 +2606,16 @@
 
   type = typeFreeText;
 
-  annotObj.dictSet ("Subtype", obj1.initName ("FreeText"));
+  annotObj.dictSet ("Subtype", Object(objName, "FreeText"));
+  annotObj.dictSet("DA", Object(da->copy()));
 
-  Object obj2;
-  obj2.initString (da->copy());
-  annotObj.dictSet("DA", &obj2);
-
   initialize (docA, annotObj.getDict());
 }
 
-AnnotFreeText::AnnotFreeText(PDFDoc *docA, Dict *dict, Object *obj) :
-    AnnotMarkup(docA, dict, obj) {
+AnnotFreeText::AnnotFreeText(PDFDoc *docA, Object *dictObject, Object *obj) :
+    AnnotMarkup(docA, dictObject, obj) {
   type = typeFreeText;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotFreeText::~AnnotFreeText() {
@@ -2756,7 +2637,8 @@
 void AnnotFreeText::initialize(PDFDoc *docA, Dict *dict) {
   Object obj1;
 
-  if (dict->lookup("DA", &obj1)->isString()) {
+  obj1 = dict->lookup("DA");
+  if (obj1.isString()) {
     appearanceString = obj1.getString()->copy();
   } else {
     appearanceString = new GooString();
@@ -2763,41 +2645,35 @@
     error(errSyntaxError, -1, "Bad appearance for annotation");
     ok = gFalse;
   }
-  obj1.free();
 
-  if (dict->lookup("Q", &obj1)->isInt()) {
+  obj1 = dict->lookup("Q");
+  if (obj1.isInt()) {
     quadding = (AnnotFreeTextQuadding) obj1.getInt();
   } else {
     quadding = quaddingLeftJustified;
   }
-  obj1.free();
 
-  if (dict->lookup("DS", &obj1)->isString()) {
+  obj1 = dict->lookup("DS");
+  if (obj1.isString()) {
     styleString = obj1.getString()->copy();
   } else {
     styleString = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("CL", &obj1)->isArray() && obj1.arrayGetLength() >= 4) {
+  obj1 = dict->lookup("CL");
+  if (obj1.isArray() && obj1.arrayGetLength() >= 4) {
     double x1, y1, x2, y2;
     Object obj2;
 
-    (obj1.arrayGet(0, &obj2)->isNum() ? x1 = obj2.getNum() : x1 = 0);
-    obj2.free();
-    (obj1.arrayGet(1, &obj2)->isNum() ? y1 = obj2.getNum() : y1 = 0);
-    obj2.free();
-    (obj1.arrayGet(2, &obj2)->isNum() ? x2 = obj2.getNum() : x2 = 0);
-    obj2.free();
-    (obj1.arrayGet(3, &obj2)->isNum() ? y2 = obj2.getNum() : y2 = 0);
-    obj2.free();
+    (obj2 = obj1.arrayGet(0), obj2.isNum() ? x1 = obj2.getNum() : x1 = 0);
+    (obj2 = obj1.arrayGet(1), obj2.isNum() ? y1 = obj2.getNum() : y1 = 0);
+    (obj2 = obj1.arrayGet(2), obj2.isNum() ? x2 = obj2.getNum() : x2 = 0);
+    (obj2 = obj1.arrayGet(3), obj2.isNum() ? y2 = obj2.getNum() : y2 = 0);
 
     if (obj1.arrayGetLength() == 6) {
       double x3, y3;
-      (obj1.arrayGet(4, &obj2)->isNum() ? x3 = obj2.getNum() : x3 = 0);
-      obj2.free();
-      (obj1.arrayGet(5, &obj2)->isNum() ? y3 = obj2.getNum() : y3 = 0);
-      obj2.free();
+      (obj2 = obj1.arrayGet(4), obj2.isNum() ? x3 = obj2.getNum() : x3 = 0);
+      (obj2 = obj1.arrayGet(5), obj2.isNum() ? y3 = obj2.getNum() : y3 = 0);
       calloutLine = new AnnotCalloutMultiLine(x1, y1, x2, y2, x3, y3);
     } else {
       calloutLine = new AnnotCalloutLine(x1, y1, x2, y2);
@@ -2805,9 +2681,9 @@
   } else {
     calloutLine = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("IT", &obj1)->isName()) {
+  obj1 = dict->lookup("IT");
+  if (obj1.isName()) {
     const char *intentName = obj1.getName();
 
     if (!strcmp(intentName, "FreeText")) {
@@ -2822,37 +2698,36 @@
   } else {
     intent = intentFreeText;
   }
-  obj1.free();
 
-  if (dict->lookup("BS", &obj1)->isDict()) {
+  obj1 = dict->lookup("BS");
+  if (obj1.isDict()) {
     delete border;
     border = new AnnotBorderBS(obj1.getDict());
   } else if (!border) {
     border = new AnnotBorderBS();
   }
-  obj1.free();
 
-  if (dict->lookup("BE", &obj1)->isDict()) {
+  obj1 = dict->lookup("BE");
+  if (obj1.isDict()) {
     borderEffect = new AnnotBorderEffect(obj1.getDict());
   } else {
     borderEffect = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("RD", &obj1)->isArray()) {
+  obj1 = dict->lookup("RD");
+  if (obj1.isArray()) {
     rectangle = parseDiffRectangle(obj1.getArray(), rect);
   } else {
     rectangle = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("LE", &obj1)->isName()) {
+  obj1 = dict->lookup("LE");
+  if (obj1.isName()) {
     GooString styleName(obj1.getName());
     endStyle = parseAnnotLineEndingStyle(&styleName);
   } else {
     endStyle = annotLineEndingNone;
   }
-  obj1.free();
 }
 
 void AnnotFreeText::setContents(GooString *new_content) {
@@ -2869,9 +2744,7 @@
     appearanceString = new GooString();
   }
 
-  Object obj1;
-  obj1.initString(appearanceString->copy());
-  update ("DA", &obj1);
+  update ("DA", Object(appearanceString->copy()));
   invalidateAppearance();
 }
 
@@ -2878,8 +2751,7 @@
 void AnnotFreeText::setQuadding(AnnotFreeTextQuadding new_quadding) {
   Object obj1;
   quadding = new_quadding;
-  obj1.initInt((int)quadding);
-  update ("Q", &obj1);
+  update ("Q", Object((int)quadding));
   invalidateAppearance();
 }
 
@@ -2890,16 +2762,13 @@
     styleString = new GooString(new_string);
     //append the unicode marker <FE FF> if needed
     if (!styleString->hasUnicodeMarker()) {
-      styleString->insert(0, 0xff);
-      styleString->insert(0, 0xfe);
+      styleString->prependUnicodeMarker();
     }
   } else {
     styleString = new GooString();
   }
 
-  Object obj1;
-  obj1.initString(styleString->copy());
-  update ("DS", &obj1);
+  update ("DS", Object(styleString->copy()));
 }
 
 void AnnotFreeText::setCalloutLine(AnnotCalloutLine *line) {
@@ -2907,23 +2776,22 @@
 
   Object obj1;
   if (line == NULL) {
-    obj1.initNull();
+    obj1.setToNull();
     calloutLine = NULL;
   } else {
     double x1 = line->getX1(), y1 = line->getY1();
     double x2 = line->getX2(), y2 = line->getY2();
-    Object obj2;
-    obj1.initArray(xref);
-    obj1.arrayAdd( obj2.initReal(x1) );
-    obj1.arrayAdd( obj2.initReal(y1) );
-    obj1.arrayAdd( obj2.initReal(x2) );
-    obj1.arrayAdd( obj2.initReal(y2) );
+    obj1 = Object( new Array(xref) );
+    obj1.arrayAdd( Object(x1) );
+    obj1.arrayAdd( Object(y1) );
+    obj1.arrayAdd( Object(x2) );
+    obj1.arrayAdd( Object(y2) );
 
     AnnotCalloutMultiLine *mline = dynamic_cast<AnnotCalloutMultiLine*>(line);
     if (mline) {
       double x3 = mline->getX3(), y3 = mline->getY3();
-      obj1.arrayAdd( obj2.initReal(x3) );
-      obj1.arrayAdd( obj2.initReal(y3) );
+      obj1.arrayAdd( Object(x3) );
+      obj1.arrayAdd( Object(y3) );
       calloutLine = new AnnotCalloutMultiLine(x1, y1, x2, y2, x3, y3);
     } else {
       calloutLine = new AnnotCalloutLine(x1, y1, x2, y2);
@@ -2930,50 +2798,37 @@
     }
   }
 
-  update("CL", &obj1);
+  update("CL", std::move(obj1));
   invalidateAppearance();
 }
 
 void AnnotFreeText::setIntent(AnnotFreeTextIntent new_intent) {
-  Object obj1;
+  const char *intentName;
 
   intent = new_intent;
   if (new_intent == intentFreeText)
-    obj1.initName("FreeText");
+    intentName = "FreeText";
   else if (new_intent == intentFreeTextCallout)
-    obj1.initName("FreeTextCallout");
+    intentName = "FreeTextCallout";
   else // intentFreeTextTypeWriter
-    obj1.initName("FreeTextTypeWriter");
-  update ("IT", &obj1);
+    intentName = "FreeTextTypeWriter";
+  update ("IT", Object(objName, intentName));
 }
 
-static GfxFont * createAnnotDrawFont(XRef * xref, Object *fontResDict)
+static GfxFont * createAnnotDrawFont(XRef * xref, Dict *fontResDict)
 {
-  Ref dummyRef = { -1, -1 };
+  const Ref dummyRef = { -1, -1 };
 
-  Object baseFontObj, subtypeObj, encodingObj;
-  baseFontObj.initName("Helvetica");
-  subtypeObj.initName("Type0");
-  encodingObj.initName("WinAnsiEncoding");
-
-  Object fontDictObj;
   Dict *fontDict = new Dict(xref);
-  fontDict->decRef();
-  fontDict->add(copyString("BaseFont"), &baseFontObj);
-  fontDict->add(copyString("Subtype"), &subtypeObj);
-  fontDict->add(copyString("Encoding"), &encodingObj);
-  fontDictObj.initDict(fontDict);
+  fontDict->add(copyString("BaseFont"), Object(objName, "Helvetica"));
+  fontDict->add(copyString("Subtype"), Object(objName, "Type0"));
+  fontDict->add(copyString("Encoding"), Object(objName, "WinAnsiEncoding"));
 
-  Object fontsDictObj;
   Dict *fontsDict = new Dict(xref);
-  fontsDict->decRef();
-  fontsDict->add(copyString("AnnotDrawFont"), &fontDictObj);
-  fontsDictObj.initDict(fontsDict);
+  fontsDict->add(copyString("AnnotDrawFont"), Object(fontDict));
 
-  Dict *dict = new Dict(xref);
-  dict->add(copyString("Font"), &fontsDictObj);
+  fontResDict->add(copyString("Font"), Object(fontsDict));
 
-  fontResDict->initDict(dict);
   return GfxFont::makeFont(xref, "AnnotDrawFont", dummyRef, fontDict);
 }
 
@@ -2982,29 +2837,14 @@
   fontcolor = NULL;
   if (da) {
     GooList * daToks = new GooList();
-    int j, i = 0;
+    int i = FormFieldText::tokenizeDA(da, daToks, "Tf");
 
-    // Tokenize
-    while (i < da->getLength()) {
-      while (i < da->getLength() && Lexer::isSpace(da->getChar(i))) {
-        ++i;
-      }
-      if (i < da->getLength()) {
-        for (j = i + 1; j < da->getLength() && !Lexer::isSpace(da->getChar(j)); ++j) {
-        }
-        daToks->append(new GooString(da, i, j - i));
-        i = j;
-      }
+    if (i >= 1) {
+      fontsize = gatof(( (GooString *)daToks->get(i-1) )->getCString());
+      // TODO: Font name
     }
-
     // Scan backwards: we are looking for the last set value
     for (i = daToks->getLength()-1; i >= 0; --i) {
-      if (fontsize == -1) {
-        if (!((GooString *)daToks->get(i))->cmp("Tf") && i >= 2) {
-            // TODO: Font name
-            fontsize = gatof(( (GooString *)daToks->get(i-1) )->getCString());
-        }
-      }
       if (fontcolor == NULL) {
         if (!((GooString *)daToks->get(i))->cmp("g") && i >= 1) {
           fontcolor = new AnnotColor(gatof(( (GooString *)daToks->get(i-1) )->getCString()));
@@ -3072,8 +2912,8 @@
   const double textwidth = width - 2*textmargin;
   appearBuf->appendf ("{0:.2f} {0:.2f} {1:.2f} {2:.2f} re W n\n", textmargin, textwidth, height - 2*textmargin);
 
-  Object fontResDict;
-  GfxFont *font = createAnnotDrawFont(xref, &fontResDict);
+  Dict *fontResDict = new Dict(xref);
+  GfxFont *font = createAnnotDrawFont(xref, fontResDict);
 
   // Set font state
   setColor(fontcolor, gTrue);
@@ -3114,23 +2954,19 @@
   bbox[3] = rect->y2 - rect->y1;
 
   if (ca == 1) {
-    createForm(bbox, gFalse, &fontResDict, &appearance);
+    appearance = createForm(bbox, gFalse, fontResDict);
   } else {
-    Object aStream, resDict;
-
-    createForm(bbox, gTrue, &fontResDict, &aStream);
+    Object aStream = createForm(bbox, gTrue, fontResDict);
     delete appearBuf;
 
     appearBuf = new GooString ("/GS0 gs\n/Fm0 Do");
-    createResourcesDict("Fm0", &aStream, "GS0", ca, NULL, &resDict);
-    createForm(bbox, gFalse, &resDict, &appearance);
+    Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, NULL);
+    appearance = createForm(bbox, gFalse, resDict);
   }
   delete appearBuf;
 }
 
 void AnnotFreeText::draw(Gfx *gfx, GBool printing) {
-  Object obj;
-
   if (!isVisible (printing))
     return;
 
@@ -3140,19 +2976,18 @@
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                  rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
-  obj.free();
 }
 
 // Before retrieving the res dict, regenerate the appearance stream if needed,
 // because AnnotFreeText::draw needs to store font info in the res dict
-Object *AnnotFreeText::getAppearanceResDict(Object *dest) {
+Object AnnotFreeText::getAppearanceResDict() {
   if (appearance.isNull()) {
     generateFreeTextAppearance();
   }
-  return Annot::getAppearanceResDict(dest);
+  return Annot::getAppearanceResDict();
 }
 
 //------------------------------------------------------------------------
@@ -3164,15 +2999,15 @@
   Object obj1;
 
   type = typeLine;
-  annotObj.dictSet ("Subtype", obj1.initName ("Line"));
+  annotObj.dictSet ("Subtype", Object(objName, "Line"));
 
   initialize (docA, annotObj.getDict());
 }
 
-AnnotLine::AnnotLine(PDFDoc *docA, Dict *dict, Object *obj) :
-    AnnotMarkup(docA, dict, obj) {
+AnnotLine::AnnotLine(PDFDoc *docA, Object *dictObject, Object *obj) :
+    AnnotMarkup(docA, dictObject, obj) {
   type = typeLine;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotLine::~AnnotLine() {
@@ -3189,18 +3024,15 @@
 void AnnotLine::initialize(PDFDoc *docA, Dict *dict) {
   Object obj1;
 
-  if (dict->lookup("L", &obj1)->isArray() && obj1.arrayGetLength() == 4) {
+  obj1 = dict->lookup("L");
+  if (obj1.isArray() && obj1.arrayGetLength() == 4) {
     Object obj2;
     double x1, y1, x2, y2;
 
-    (obj1.arrayGet(0, &obj2)->isNum() ? x1 = obj2.getNum() : x1 = 0);
-    obj2.free();
-    (obj1.arrayGet(1, &obj2)->isNum() ? y1 = obj2.getNum() : y1 = 0);
-    obj2.free();
-    (obj1.arrayGet(2, &obj2)->isNum() ? x2 = obj2.getNum() : x2 = 0);
-    obj2.free();
-    (obj1.arrayGet(3, &obj2)->isNum() ? y2 = obj2.getNum() : y2 = 0);
-    obj2.free();
+    (obj2 = obj1.arrayGet(0), obj2.isNum() ? x1 = obj2.getNum() : x1 = 0);
+    (obj2 = obj1.arrayGet(1), obj2.isNum() ? y1 = obj2.getNum() : y1 = 0);
+    (obj2 = obj1.arrayGet(2), obj2.isNum() ? x2 = obj2.getNum() : x2 = 0);
+    (obj2 = obj1.arrayGet(3), obj2.isNum() ? y2 = obj2.getNum() : y2 = 0);
 
     coord1 = new AnnotCoord(x1, y1);
     coord2 = new AnnotCoord(x2, y2);
@@ -3208,43 +3040,43 @@
     coord1 = new AnnotCoord();
     coord2 = new AnnotCoord();
   }
-  obj1.free();
 
-  if (dict->lookup("LE", &obj1)->isArray() && obj1.arrayGetLength() == 2) {
+  obj1 = dict->lookup("LE");
+  if (obj1.isArray() && obj1.arrayGetLength() == 2) {
     Object obj2;
 
-    if(obj1.arrayGet(0, &obj2)->isString())
+    obj2 = obj1.arrayGet(0);
+    if (obj2.isString())
       startStyle = parseAnnotLineEndingStyle(obj2.getString());
     else
       startStyle = annotLineEndingNone;
-    obj2.free();
 
-    if(obj1.arrayGet(1, &obj2)->isString())
+    obj2 = obj1.arrayGet(1);
+    if (obj2.isString())
       endStyle = parseAnnotLineEndingStyle(obj2.getString());
     else
       endStyle = annotLineEndingNone;
-    obj2.free();
 
   } else {
     startStyle = endStyle = annotLineEndingNone;
   }
-  obj1.free();
 
-  if (dict->lookup("IC", &obj1)->isArray()) {
+  obj1 = dict->lookup("IC");
+  if (obj1.isArray()) {
     interiorColor = new AnnotColor(obj1.getArray());
   } else {
     interiorColor = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("LL", &obj1)->isNum()) {
+  obj1 = dict->lookup("LL");
+  if (obj1.isNum()) {
     leaderLineLength = obj1.getNum();
   } else {
     leaderLineLength = 0;
   }
-  obj1.free();
 
-  if (dict->lookup("LLE", &obj1)->isNum()) {
+  obj1 = dict->lookup("LLE");
+  if (obj1.isNum()) {
     leaderLineExtension = obj1.getNum();
 
     if (leaderLineExtension < 0)
@@ -3252,16 +3084,16 @@
   } else {
     leaderLineExtension = 0;
   }
-  obj1.free();
 
-  if (dict->lookup("Cap", &obj1)->isBool()) {
+  obj1 = dict->lookup("Cap");
+  if (obj1.isBool()) {
     caption = obj1.getBool();
   } else {
     caption = gFalse;
   }
-  obj1.free();
 
-  if (dict->lookup("IT", &obj1)->isName()) {
+  obj1 = dict->lookup("IT");
+  if (obj1.isName()) {
     const char *intentName = obj1.getName();
 
     if(!strcmp(intentName, "LineArrow")) {
@@ -3274,9 +3106,9 @@
   } else {
     intent = intentLineArrow;
   }
-  obj1.free();
 
-  if (dict->lookup("LLO", &obj1)->isNum()) {
+  obj1 = dict->lookup("LLO");
+  if (obj1.isNum()) {
     leaderLineOffset = obj1.getNum();
 
     if (leaderLineOffset < 0)
@@ -3284,9 +3116,9 @@
   } else {
     leaderLineOffset = 0;
   }
-  obj1.free();
 
-  if (dict->lookup("CP", &obj1)->isName()) {
+  obj1 = dict->lookup("CP");
+  if (obj1.isName()) {
     const char *captionName = obj1.getName();
 
     if(!strcmp(captionName, "Inline")) {
@@ -3299,36 +3131,33 @@
   } else {
     captionPos = captionPosInline;
   }
-  obj1.free();
 
-  if (dict->lookup("Measure", &obj1)->isDict()) {
+  obj1 = dict->lookup("Measure");
+  if (obj1.isDict()) {
     measure = NULL;
   } else {
     measure = NULL;
   }
-  obj1.free();
 
-  if ((dict->lookup("CO", &obj1)->isArray()) && (obj1.arrayGetLength() == 2)) {
+  obj1 = dict->lookup("CO");
+  if (obj1.isArray() && (obj1.arrayGetLength() == 2)) {
     Object obj2;
 
-    (obj1.arrayGet(0, &obj2)->isNum() ? captionTextHorizontal = obj2.getNum() :
-      captionTextHorizontal = 0);
-    obj2.free();
-    (obj1.arrayGet(1, &obj2)->isNum() ? captionTextVertical = obj2.getNum() :
-      captionTextVertical = 0);
-    obj2.free();
+    obj2 = obj1.arrayGet(0);
+    captionTextHorizontal = obj2.isNum() ? obj2.getNum() : 0;
+    obj2 = obj1.arrayGet(1);
+    captionTextVertical = obj2.isNum() ? obj2.getNum() : 0;
   } else {
     captionTextHorizontal = captionTextVertical = 0;
   }
-  obj1.free();
 
-  if (dict->lookup("BS", &obj1)->isDict()) {
+  obj1 = dict->lookup("BS");
+  if (obj1.isDict()) {
     delete border;
     border = new AnnotBorderBS(obj1.getDict());
   } else if (!border) {
     border = new AnnotBorderBS();
   }
-  obj1.free();
 }
 
 void AnnotLine::setContents(GooString *new_content) {
@@ -3338,34 +3167,30 @@
 }
 
 void AnnotLine::setVertices(double x1, double y1, double x2, double y2) {
-  Object obj1, obj2;
-
   delete coord1;
   coord1 = new AnnotCoord(x1, y1);
   delete coord2;
   coord2 = new AnnotCoord(x2, y2);
 
-  obj1.initArray(xref);
-  obj1.arrayAdd( obj2.initReal(x1) );
-  obj1.arrayAdd( obj2.initReal(y1) );
-  obj1.arrayAdd( obj2.initReal(x2) );
-  obj1.arrayAdd( obj2.initReal(y2) );
+  Array *lArray = new Array(xref);
+  lArray->add( Object(x1) );
+  lArray->add( Object(y1) );
+  lArray->add( Object(x2) );
+  lArray->add( Object(y2) );
 
-  update("L", &obj1);
+  update("L", Object(lArray));
   invalidateAppearance();
 }
 
 void AnnotLine::setStartEndStyle(AnnotLineEndingStyle start, AnnotLineEndingStyle end) {
-  Object obj1, obj2;
-
   startStyle = start;
   endStyle = end;
 
-  obj1.initArray(xref);
-  obj1.arrayAdd( obj2.initName(convertAnnotLineEndingStyle( startStyle )) );
-  obj1.arrayAdd( obj2.initName(convertAnnotLineEndingStyle( endStyle )) );
+  Array *leArray = new Array(xref);
+  leArray->add( Object(objName, convertAnnotLineEndingStyle( startStyle )) );
+  leArray->add( Object(objName, convertAnnotLineEndingStyle( endStyle )) );
 
-  update("LE", &obj1);
+  update("LE", Object(leArray));
   invalidateAppearance();
 }
 
@@ -3373,9 +3198,8 @@
   delete interiorColor;
 
   if (new_color) {
-    Object obj1;
-    new_color->writeToObject(xref, &obj1);
-    update ("IC", &obj1);
+    Object obj1 = new_color->writeToObject(xref);
+    update ("IC", std::move(obj1));
     interiorColor = new_color;
   } else {
     interiorColor = NULL;
@@ -3384,45 +3208,35 @@
 }
 
 void AnnotLine::setLeaderLineLength(double len) {
-  Object obj1;
-
   leaderLineLength = len;
-  obj1.initReal(len);
-  update ("LL", &obj1);
+  update ("LL", Object(len));
   invalidateAppearance();
 }
 
 void AnnotLine::setLeaderLineExtension(double len) {
-  Object obj1;
-
   leaderLineExtension = len;
-  obj1.initReal(len);
-  update ("LLE", &obj1);
+  update ("LLE", Object(len));
 
   // LL is required if LLE is present
-  obj1.initReal(leaderLineLength);
-  update ("LL", &obj1);
+  update ("LL", Object(leaderLineLength));
   invalidateAppearance();
 }
 
 void AnnotLine::setCaption(bool new_cap) {
-  Object obj1;
-
   caption = new_cap;
-  obj1.initBool(new_cap);
-  update ("Cap", &obj1);
+  update ("Cap", Object(new_cap));
   invalidateAppearance();
 }
 
 void AnnotLine::setIntent(AnnotLineIntent new_intent) {
-  Object obj1;
+  const char *intentName;
 
   intent = new_intent;
   if (new_intent == intentLineArrow)
-    obj1.initName("LineArrow");
+    intentName = "LineArrow";
   else // intentLineDimension
-    obj1.initName("LineDimension");
-  update ("IT", &obj1);
+    intentName = "LineDimension";
+  update ("IT", Object(objName, intentName));
 }
 
 void AnnotLine::generateLineAppearance()
@@ -3463,12 +3277,13 @@
   const double captionhmargin = 2; // Left and right margin (inline caption only)
   const double captionmaxwidth = main_len - 2 * captionhmargin;
 
-  Object fontResDict;
+  Dict *fontResDict;
   GfxFont *font;
 
   // Calculate caption width and height
   if (caption) {
-    font = createAnnotDrawFont(xref, &fontResDict);
+    fontResDict = new Dict(xref);
+    font = createAnnotDrawFont(xref, fontResDict);
     int lines = 0;
     int i = 0;
     while (i < contents->getLength()) {
@@ -3487,7 +3302,7 @@
       actualCaptionPos = captionPosTop;
     }
   } else {
-    fontResDict.initNull();
+    fontResDict = nullptr;
     font = NULL;
   }
 
@@ -3579,23 +3394,19 @@
   double bbox[4];
   appearBBox->getBBoxRect(bbox);
   if (ca == 1) {
-    createForm(bbox, gFalse, &fontResDict, &appearance);
+    appearance = createForm(bbox, gFalse, fontResDict);
   } else {
-    Object aStream, resDict;
-
-    createForm(bbox, gTrue, &fontResDict, &aStream);
+    Object aStream = createForm(bbox, gTrue, fontResDict);
     delete appearBuf;
 
     appearBuf = new GooString ("/GS0 gs\n/Fm0 Do");
-    createResourcesDict("Fm0", &aStream, "GS0", ca, NULL, &resDict);
-    createForm(bbox, gFalse, &resDict, &appearance);
+    Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, NULL);
+    appearance = createForm(bbox, gFalse, resDict);
   }
   delete appearBuf;
 }
 
 void AnnotLine::draw(Gfx *gfx, GBool printing) {
-  Object obj;
-
   if (!isVisible (printing))
     return;
 
@@ -3605,7 +3416,7 @@
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   if (appearBBox) {
     gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                    appearBBox->getPageXMin(), appearBBox->getPageYMin(),
@@ -3615,16 +3426,15 @@
     gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                    rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   }
-  obj.free();
 }
 
 // Before retrieving the res dict, regenerate the appearance stream if needed,
 // because AnnotLine::draw may need to store font info in the res dict
-Object *AnnotLine::getAppearanceResDict(Object *dest) {
+Object AnnotLine::getAppearanceResDict() {
   if (appearance.isNull()) {
     generateLineAppearance();
   }
-  return Annot::getAppearanceResDict(dest);
+  return Annot::getAppearanceResDict();
 }
 
 //------------------------------------------------------------------------
@@ -3636,16 +3446,16 @@
 
   switch (subType) {
     case typeHighlight:
-      annotObj.dictSet ("Subtype", obj1.initName ("Highlight"));
+      annotObj.dictSet ("Subtype", Object(objName, "Highlight"));
       break;
     case typeUnderline:
-      annotObj.dictSet ("Subtype", obj1.initName ("Underline"));
+      annotObj.dictSet ("Subtype", Object(objName, "Underline"));
       break;
     case typeSquiggly:
-      annotObj.dictSet ("Subtype", obj1.initName ("Squiggly"));
+      annotObj.dictSet ("Subtype", Object(objName, "Squiggly"));
       break;
     case typeStrikeOut:
-      annotObj.dictSet ("Subtype", obj1.initName ("StrikeOut"));
+      annotObj.dictSet ("Subtype", Object(objName, "StrikeOut"));
       break;
     default:
       assert (0 && "Invalid subtype for AnnotTextMarkup\n");
@@ -3652,27 +3462,27 @@
   }
 
   // Store dummy quadrilateral with null coordinates
-  Object obj2, obj3;
-  obj2.initArray (doc->getXRef());
+  Array *quadPoints = new Array(doc->getXRef());
   for (int i = 0; i < 4*2; ++i) {
-    obj2.arrayAdd (obj3.initReal (0));
+    quadPoints->add(Object(0.));
   }
-  annotObj.dictSet ("QuadPoints", &obj2);
+  annotObj.dictSet ("QuadPoints", Object(quadPoints));
 
   initialize(docA, annotObj.getDict());
 }
 
-AnnotTextMarkup::AnnotTextMarkup(PDFDoc *docA, Dict *dict, Object *obj) :
-  AnnotMarkup(docA, dict, obj) {
+AnnotTextMarkup::AnnotTextMarkup(PDFDoc *docA, Object *dictObject, Object *obj) :
+  AnnotMarkup(docA, dictObject, obj) {
   // the real type will be read in initialize()
   type = typeHighlight;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 void AnnotTextMarkup::initialize(PDFDoc *docA, Dict *dict) {
   Object obj1;
 
-  if (dict->lookup("Subtype", &obj1)->isName()) {
+  obj1 = dict->lookup("Subtype");
+  if (obj1.isName()) {
     GooString typeName(obj1.getName());
     if (!typeName.cmp("Highlight")) {
       type = typeHighlight;
@@ -3684,9 +3494,9 @@
       type = typeStrikeOut;
     }
   }
-  obj1.free();
 
-  if(dict->lookup("QuadPoints", &obj1)->isArray()) {
+  obj1 = dict->lookup("QuadPoints");
+  if (obj1.isArray()) {
     quadrilaterals = new AnnotQuadrilaterals(obj1.getArray(), rect);
   } else {
     error(errSyntaxError, -1, "Bad Annot Text Markup QuadPoints");
@@ -3693,30 +3503,27 @@
     quadrilaterals = NULL;
     ok = gFalse;
   }
-  obj1.free();
 }
 
 AnnotTextMarkup::~AnnotTextMarkup() {
-  if(quadrilaterals) {
-    delete quadrilaterals;
-  }
+  delete quadrilaterals;
 }
 
 void AnnotTextMarkup::setType(AnnotSubtype new_type) {
-  Object obj1;
+  const char *typeName = nullptr; /* squelch bogus compiler warning */
 
   switch (new_type) {
     case typeHighlight:
-      obj1.initName("Highlight");
+      typeName = "Highlight";
       break;
     case typeUnderline:
-      obj1.initName("Underline");
+      typeName = "Underline";
       break;
     case typeSquiggly:
-      obj1.initName("Squiggly");
+      typeName = "Squiggly";
       break;
     case typeStrikeOut:
-      obj1.initName("StrikeOut");
+      typeName = "StrikeOut";
       break;
     default:
       assert(!"Invalid subtype");
@@ -3723,37 +3530,34 @@
   }
 
   type = new_type;
-  update("Subtype", &obj1);
+  update("Subtype", Object(objName, typeName));
   invalidateAppearance();
 }
 
 void AnnotTextMarkup::setQuadrilaterals(AnnotQuadrilaterals *quadPoints) {
-  Object obj1, obj2;
-  obj1.initArray (xref);
+  Array *a = new Array(xref);
 
   for (int i = 0; i < quadPoints->getQuadrilateralsLength(); ++i) {
-    obj1.arrayAdd (obj2.initReal (quadPoints->getX1(i)));
-    obj1.arrayAdd (obj2.initReal (quadPoints->getY1(i)));
-    obj1.arrayAdd (obj2.initReal (quadPoints->getX2(i)));
-    obj1.arrayAdd (obj2.initReal (quadPoints->getY2(i)));
-    obj1.arrayAdd (obj2.initReal (quadPoints->getX3(i)));
-    obj1.arrayAdd (obj2.initReal (quadPoints->getY3(i)));
-    obj1.arrayAdd (obj2.initReal (quadPoints->getX4(i)));
-    obj1.arrayAdd (obj2.initReal (quadPoints->getY4(i)));
+    a->add(Object(quadPoints->getX1(i)));
+    a->add(Object(quadPoints->getY1(i)));
+    a->add(Object(quadPoints->getX2(i)));
+    a->add(Object(quadPoints->getY2(i)));
+    a->add(Object(quadPoints->getX3(i)));
+    a->add(Object(quadPoints->getY3(i)));
+    a->add(Object(quadPoints->getX4(i)));
+    a->add(Object(quadPoints->getY4(i)));
   }
 
   delete quadrilaterals;
-  quadrilaterals = new AnnotQuadrilaterals(obj1.getArray(), rect);
+  quadrilaterals = new AnnotQuadrilaterals(a, rect);
 
-  annotObj.dictSet ("QuadPoints", &obj1);
+  annotObj.dictSet ("QuadPoints", Object(a));
   invalidateAppearance();
 }
 
 void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) {
-  Object obj;
   double ca = 1;
   int i;
-  Object obj1, obj2;
 
   if (!isVisible (printing))
     return;
@@ -3850,8 +3654,6 @@
       break;
     default:
     case typeHighlight:
-      appearance.free();
-
       if (color)
         setColor(color, gTrue);
 
@@ -3887,32 +3689,32 @@
     }
     appearBuf->append ("Q\n");
 
-    Object aStream, resDict;
+    Object aStream;
     double bbox[4];
     bbox[0] = appearBBox->getPageXMin();
     bbox[1] = appearBBox->getPageYMin();
     bbox[2] = appearBBox->getPageXMax();
     bbox[3] = appearBBox->getPageYMax();
-    createForm(bbox, gTrue, NULL, &aStream);
+    aStream = createForm(bbox, gTrue, NULL);
     delete appearBuf;
 
     appearBuf = new GooString ("/GS0 gs\n/Fm0 Do");
-    createResourcesDict("Fm0", &aStream, "GS0", 1, blendMultiply ? "Multiply" : NULL, &resDict);
+    Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", 1, blendMultiply ? "Multiply" : NULL);
     if (ca == 1) {
-      createForm(bbox, gFalse, &resDict, &appearance);
+      appearance = createForm(bbox, gFalse, resDict);
     } else {
-      createForm(bbox, gTrue, &resDict, &aStream);
+      aStream = createForm(bbox, gTrue, resDict);
       delete appearBuf;
 
       appearBuf = new GooString ("/GS0 gs\n/Fm0 Do");
-      createResourcesDict("Fm0", &aStream, "GS0", ca, NULL, &resDict);
-      createForm(bbox, gFalse, &resDict, &appearance);
+      Dict *resDict2 = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, NULL);
+      appearance = createForm(bbox, gFalse, resDict2);
     }
     delete appearBuf;
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   if (appearBBox) {
     gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                    appearBBox->getPageXMin(), appearBBox->getPageYMin(),
@@ -3922,7 +3724,6 @@
     gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                    rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   }
-  obj.free();
 }
 
 //------------------------------------------------------------------------
@@ -3929,18 +3730,18 @@
 // AnnotWidget
 //------------------------------------------------------------------------
 
-AnnotWidget::AnnotWidget(PDFDoc *docA, Dict *dict, Object *obj) :
-    Annot(docA, dict, obj) {
+AnnotWidget::AnnotWidget(PDFDoc *docA, Object *dictObject, Object *obj) :
+    Annot(docA, dictObject, obj) {
   type = typeWidget;
   field = NULL;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
-AnnotWidget::AnnotWidget(PDFDoc *docA, Dict *dict, Object *obj, FormField *fieldA) :
-    Annot(docA, dict, obj) {
+AnnotWidget::AnnotWidget(PDFDoc *docA, Object *dictObject, Object *obj, FormField *fieldA) :
+    Annot(docA, dictObject, obj) {
   type = typeWidget;
   field = fieldA;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotWidget::~AnnotWidget() {
@@ -3950,8 +3751,6 @@
   if (action)
     delete action;
 
-  additionalActions.free();
-
   if (parent)
     delete parent;
 }
@@ -3961,7 +3760,8 @@
 
   form = doc->getCatalog()->getForm();
 
-  if(dict->lookup("H", &obj1)->isName()) {
+  obj1 = dict->lookup("H");
+  if (obj1.isName()) {
     const char *modeName = obj1.getName();
 
     if(!strcmp(modeName, "N")) {
@@ -3976,35 +3776,34 @@
   } else {
     mode = highlightModeInvert;
   }
-  obj1.free();
 
-  if(dict->lookup("MK", &obj1)->isDict()) {
+  obj1 = dict->lookup("MK");
+  if (obj1.isDict()) {
     appearCharacs = new AnnotAppearanceCharacs(obj1.getDict());
   } else {
     appearCharacs = NULL;
   }
-  obj1.free();
 
   action = NULL;
-  if(dict->lookup("A", &obj1)->isDict()) {
+  obj1 = dict->lookup("A");
+  if (obj1.isDict()) {
     action = LinkAction::parseAction(&obj1, doc->getCatalog()->getBaseURI());
   }
-  obj1.free();
 
-  dict->lookupNF("AA", &additionalActions);
+  additionalActions = dict->lookupNF("AA");
 
-  if(dict->lookup("Parent", &obj1)->isDict()) {
+  obj1 = dict->lookup("Parent");
+  if (obj1.isDict()) {
     parent = NULL;
   } else {
     parent = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("BS", &obj1)->isDict()) {
+  obj1 = dict->lookup("BS");
+  if (obj1.isDict()) {
     delete border;
     border = new AnnotBorderBS(obj1.getDict());
   }
-  obj1.free();
 
   updatedAppearanceStream.num = updatedAppearanceStream.gen = -1;
 }
@@ -4882,7 +4681,7 @@
         appearBuf->appendf(" {0:.2f}", dash[i]);
       }
       appearBuf->append("] 0 d\n");
-      // fall through to the solid case
+      // fallthrough
     case AnnotBorder::borderSolid:
     case AnnotBorder::borderUnderlined:
       appearBuf->appendf("{0:.2f} w\n", w);
@@ -4914,7 +4713,7 @@
         appearBuf->appendf(" {0:.2f}", dash[i]);
       }
       appearBuf->append("] 0 d\n");
-      // fall through to the solid case
+      // fallthrough
     case AnnotBorder::borderSolid:
       appearBuf->appendf("{0:.2f} w\n", w);
       setColor(aColor, gFalse);
@@ -5037,9 +4836,7 @@
 }
 
 void AnnotWidget::generateFieldAppearance() {
-  Object appearDict, obj1, obj2;
   GfxResources *resources;
-  MemStream *appearStream;
   GooString *da;
 
   appearBuf = new GooString ();
@@ -5084,28 +4881,26 @@
   }
 
   // build the appearance stream dictionary
-  appearDict.initDict(xref);
-  appearDict.dictAdd(copyString("Length"),
-      obj1.initInt(appearBuf->getLength()));
-  appearDict.dictAdd(copyString("Subtype"), obj1.initName("Form"));
-  obj1.initArray(xref);
-  obj1.arrayAdd(obj2.initReal(0));
-  obj1.arrayAdd(obj2.initReal(0));
-  obj1.arrayAdd(obj2.initReal(rect->x2 - rect->x1));
-  obj1.arrayAdd(obj2.initReal(rect->y2 - rect->y1));
-  appearDict.dictAdd(copyString("BBox"), &obj1);
+  Dict *appearDict = new Dict(xref);
+  appearDict->add(copyString("Length"), Object(appearBuf->getLength()));
+  appearDict->add(copyString("Subtype"), Object(objName, "Form"));
+  Array *bbox = new Array(xref);
+  bbox->add(Object(0));
+  bbox->add(Object(0));
+  bbox->add(Object(rect->x2 - rect->x1));
+  bbox->add(Object(rect->y2 - rect->y1));
+  appearDict->add(copyString("BBox"), Object(bbox));
 
   // set the resource dictionary
   Object *resDict = form->getDefaultResourcesObj();
   if (resDict->isDict()) {
-    appearDict.dictAdd(copyString("Resources"), resDict->copy(&obj1));
+    appearDict->add(copyString("Resources"), resDict->copy());
   }
 
   // build the appearance stream
-  appearStream = new MemStream(copyString(appearBuf->getCString()), 0,
-      appearBuf->getLength(), &appearDict);
-  appearance.free();
-  appearance.initStream(appearStream);
+  MemStream *appearStream = new MemStream(copyString(appearBuf->getCString()), 0,
+      appearBuf->getLength(), Object(appearDict));
+  appearance = Object(static_cast<Stream*>(appearStream));
   delete appearBuf;
 
   appearStream->setNeedFree(gTrue);
@@ -5128,8 +4923,7 @@
   generateFieldAppearance();
 
   // Fetch the appearance stream we've just created
-  Object obj1;
-  appearance.fetch(xref, &obj1);
+  Object obj1 = appearance.fetch(xref);
 
   // If this the first time updateAppearanceStream() is called on this widget,
   // create a new AP dictionary containing the new appearance stream.
@@ -5137,26 +4931,22 @@
   if (updatedAppearanceStream.num == -1) {
     // Write the appearance stream
     updatedAppearanceStream = xref->addIndirectObject(&obj1);
-    obj1.free();
 
     // Write the AP dictionary
-    Object obj2;
-    obj1.initDict(xref);
-    obj1.dictAdd(copyString("N"), obj2.initRef(updatedAppearanceStream.num, updatedAppearanceStream.gen));
-    update("AP", &obj1);
+    obj1 = Object(new Dict(xref));
+    obj1.dictAdd(copyString("N"), Object(updatedAppearanceStream.num, updatedAppearanceStream.gen));
 
     // Update our internal pointers to the appearance dictionary
     appearStreams = new AnnotAppearance(doc, &obj1);
+
+    update("AP", std::move(obj1));
   } else {
     // Replace the existing appearance stream
     xref->setModifiedObject(&obj1, updatedAppearanceStream);
-    obj1.free();
   }
 }
 
 void AnnotWidget::draw(Gfx *gfx, GBool printing) {
-  Object obj;
-
   if (!isVisible (printing))
     return;
 
@@ -5172,29 +4962,19 @@
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   if (addDingbatsResource) {
     // We are forcing ZaDb but the font does not exist
     // so create a fake one
-    Object baseFontObj, subtypeObj;
-    baseFontObj.initName("ZapfDingbats");
-    subtypeObj.initName("Type1");
-
-    Object fontDictObj;
     Dict *fontDict = new Dict(gfx->getXRef());
-    fontDict->decRef();
-    fontDict->add(copyString("BaseFont"), &baseFontObj);
-    fontDict->add(copyString("Subtype"), &subtypeObj);
-    fontDictObj.initDict(fontDict);
+    fontDict->add(copyString("BaseFont"), Object(objName, "ZapfDingbats"));
+    fontDict->add(copyString("Subtype"), Object(objName, "Type1"));
 
-    Object fontsDictObj;
     Dict *fontsDict = new Dict(gfx->getXRef());
-    fontsDict->decRef();
-    fontsDict->add(copyString("ZaDb"), &fontDictObj);
-    fontsDictObj.initDict(fontsDict);
+    fontsDict->add(copyString("ZaDb"), Object(fontDict));
 
     Dict *dict = new Dict(gfx->getXRef());
-    dict->add(copyString("Font"), &fontsDictObj);
+    dict->add(copyString("Font"), Object(fontsDict));
     gfx->pushResources(dict);
     delete dict;
   }
@@ -5203,7 +4983,6 @@
   if (addDingbatsResource) {
     gfx->popResources();
   }
-  obj.free();
 }
 
 
@@ -5215,7 +4994,7 @@
   Object obj1;
 
   type = typeMovie;
-  annotObj.dictSet ("Subtype", obj1.initName ("Movie"));
+  annotObj.dictSet ("Subtype", Object(objName, "Movie"));
 
   movie = movieA->copy();
   // TODO: create movie dict from movieA
@@ -5223,10 +5002,10 @@
   initialize(docA, annotObj.getDict());
 }
 
-AnnotMovie::AnnotMovie(PDFDoc *docA, Dict *dict, Object *obj) :
-  Annot(docA, dict, obj) {
+AnnotMovie::AnnotMovie(PDFDoc *docA, Object *dictObject, Object *obj) :
+  Annot(docA, dictObject, obj) {
   type = typeMovie;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotMovie::~AnnotMovie() {
@@ -5238,17 +5017,16 @@
 void AnnotMovie::initialize(PDFDoc *docA, Dict* dict) {
   Object obj1;
 
-  if (dict->lookup("T", &obj1)->isString()) {
+  obj1 = dict->lookup("T");
+  if (obj1.isString()) {
     title = obj1.getString()->copy();
   } else {
     title = NULL;
   }
-  obj1.free();
 
-  Object movieDict;
-  if (dict->lookup("Movie", &movieDict)->isDict()) {
-    Object obj2;
-    dict->lookup("A", &obj2);
+  Object movieDict = dict->lookup("Movie");
+  if (movieDict.isDict()) {
+    Object obj2 = dict->lookup("A");
     if (obj2.isDict())
       movie = new Movie (&movieDict, &obj2);
     else
@@ -5258,18 +5036,14 @@
       movie = NULL;
       ok = gFalse;
     }
-    obj2.free();
   } else {
     error(errSyntaxError, -1, "Bad Annot Movie");
     movie = NULL;
     ok = gFalse;
   }
-  movieDict.free();
 }
 
 void AnnotMovie::draw(Gfx *gfx, GBool printing) {
-  Object obj;
-
   if (!isVisible (printing))
     return;
 
@@ -5276,13 +5050,10 @@
   annotLocker();
   if (appearance.isNull() && movie->getShowPoster()) {
     int width, height;
-    Object poster;
-    movie->getPoster(&poster);
+    Object poster = movie->getPoster();
     movie->getAspect(&width, &height);
 
     if (width != -1 && height != -1 && !poster.isNone()) {
-      MemStream *mStream;
-
       appearBuf = new GooString ();
       appearBuf->append ("q\n");
       appearBuf->appendf ("{0:d} 0 0 {1:d} 0 0 cm\n", width, height);
@@ -5289,48 +5060,42 @@
       appearBuf->append ("/MImg Do\n");
       appearBuf->append ("Q\n");
 
-      Object imgDict;
-      imgDict.initDict(gfx->getXRef());
-      imgDict.dictSet ("MImg", &poster);
+      Dict *imgDict = new Dict(gfx->getXRef());
+      imgDict->set("MImg", std::move(poster));
 
-      Object resDict;
-      resDict.initDict(gfx->getXRef());
-      resDict.dictSet ("XObject", &imgDict);
+      Dict *resDict = new Dict(gfx->getXRef());
+      resDict->set("XObject", Object(imgDict));
 
-      Object formDict, obj1, obj2;
-      formDict.initDict(gfx->getXRef());
-      formDict.dictSet("Length", obj1.initInt(appearBuf->getLength()));
-      formDict.dictSet("Subtype", obj1.initName("Form"));
-      formDict.dictSet("Name", obj1.initName("FRM"));
-      obj1.initArray(gfx->getXRef());
-      obj1.arrayAdd(obj2.initInt(0));
-      obj1.arrayAdd(obj2.initInt(0));
-      obj1.arrayAdd(obj2.initInt(width));
-      obj1.arrayAdd(obj2.initInt(height));
-      formDict.dictSet("BBox", &obj1);
-      obj1.initArray(gfx->getXRef());
-      obj1.arrayAdd(obj2.initInt(1));
-      obj1.arrayAdd(obj2.initInt(0));
-      obj1.arrayAdd(obj2.initInt(0));
-      obj1.arrayAdd(obj2.initInt(1));
-      obj1.arrayAdd(obj2.initInt(-width / 2));
-      obj1.arrayAdd(obj2.initInt(-height / 2));
-      formDict.dictSet("Matrix", &obj1);
-      formDict.dictSet("Resources", &resDict);
+      Dict *formDict = new Dict(gfx->getXRef());
+      formDict->set("Length", Object(appearBuf->getLength()));
+      formDict->set("Subtype", Object(objName, "Form"));
+      formDict->set("Name", Object(objName, "FRM"));
+      Array *bboxArray = new Array(gfx->getXRef());
+      bboxArray->add(Object(0));
+      bboxArray->add(Object(0));
+      bboxArray->add(Object(width));
+      bboxArray->add(Object(height));
+      formDict->set("BBox", Object(bboxArray));
+      Array *matrix = new Array(gfx->getXRef());
+      matrix->add(Object(1));
+      matrix->add(Object(0));
+      matrix->add(Object(0));
+      matrix->add(Object(1));
+      matrix->add(Object(-width / 2));
+      matrix->add(Object(-height / 2));
+      formDict->set("Matrix", Object(matrix));
+      formDict->set("Resources", Object(resDict));
 
-      Object aStream;
-      mStream = new MemStream(copyString(appearBuf->getCString()), 0,
-			      appearBuf->getLength(), &formDict);
+      MemStream *mStream = new MemStream(copyString(appearBuf->getCString()), 0,
+			      appearBuf->getLength(), Object(formDict));
       mStream->setNeedFree(gTrue);
-      aStream.initStream(mStream);
       delete appearBuf;
 
-      Object objDict;
-      objDict.initDict(gfx->getXRef());
-      objDict.dictSet ("FRM", &aStream);
+      Dict *dict = new Dict(gfx->getXRef());
+      dict->set("FRM", Object(static_cast<Stream*>(mStream)));
 
-      resDict.initDict(gfx->getXRef());
-      resDict.dictSet ("XObject", &objDict);
+      Dict *resDict2 = new Dict(gfx->getXRef());
+      resDict2->set("XObject", Object(dict));
 
       appearBuf = new GooString ();
       appearBuf->append ("q\n");
@@ -5346,17 +5111,15 @@
       bbox[0] = bbox[1] = 0;
       bbox[2] = width;
       bbox[3] = height;
-      createForm(bbox, gFalse, &resDict, &appearance);
+      appearance = createForm(bbox, gFalse, resDict2);
       delete appearBuf;
     }
-    poster.free();
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
 		 rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
-  obj.free();
 }
 
 //------------------------------------------------------------------------
@@ -5368,25 +5131,20 @@
 
   type = typeScreen;
 
-  annotObj.dictSet ("Subtype", obj1.initName ("Screen"));
+  annotObj.dictSet ("Subtype", Object(objName, "Screen"));
   initialize(docA, annotObj.getDict());
 }
 
-AnnotScreen::AnnotScreen(PDFDoc *docA, Dict *dict, Object *obj) :
-  Annot(docA, dict, obj) {
+AnnotScreen::AnnotScreen(PDFDoc *docA, Object *dictObject, Object *obj) :
+  Annot(docA, dictObject, obj) {
   type = typeScreen;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotScreen::~AnnotScreen() {
-  if (title)
-    delete title;
-  if (appearCharacs)
-    delete appearCharacs;
-  if (action)
-    delete action;
-
-  additionalActions.free();
+  delete title;
+  delete appearCharacs;
+  delete action;
 }
 
 void AnnotScreen::initialize(PDFDoc *docA, Dict* dict) {
@@ -5393,15 +5151,16 @@
   Object obj1;
 
   title = NULL;
-  if (dict->lookup("T", &obj1)->isString()) {
+  obj1 = dict->lookup("T");
+  if (obj1.isString()) {
     title = obj1.getString()->copy();
   }
-  obj1.free();
 
   action = NULL;
-  if (dict->lookup("A", &obj1)->isDict()) {
+  obj1 = dict->lookup("A");
+  if (obj1.isDict()) {
     action = LinkAction::parseAction(&obj1, doc->getCatalog()->getBaseURI());
-    if (action->getKind() == actionRendition && page == 0) {
+    if (action && action->getKind() == actionRendition && page == 0) {
       error (errSyntaxError, -1, "Invalid Rendition action: associated screen annotation without P");
       delete action;
       action = NULL;
@@ -5408,15 +5167,14 @@
       ok = gFalse;
     }
   }
-  obj1.free();
 
-  dict->lookupNF("AA", &additionalActions);
+  additionalActions = dict->lookupNF("AA");
 
   appearCharacs = NULL;
-  if(dict->lookup("MK", &obj1)->isDict()) {
+  obj1 = dict->lookup("MK");
+  if (obj1.isDict()) {
     appearCharacs = new AnnotAppearanceCharacs(obj1.getDict());
   }
-  obj1.free();
 }
 
 LinkAction* AnnotScreen::getAdditionalAction(AdditionalActionsType type)
@@ -5435,14 +5193,14 @@
   Object obj1;
 
   type = typeStamp;
-  annotObj.dictSet ("Subtype", obj1.initName ("Stamp"));
+  annotObj.dictSet ("Subtype", Object(objName, "Stamp"));
   initialize(docA, annotObj.getDict());
 }
 
-AnnotStamp::AnnotStamp(PDFDoc *docA, Dict *dict, Object *obj) :
-  AnnotMarkup(docA, dict, obj) {
+AnnotStamp::AnnotStamp(PDFDoc *docA, Object *dictObject, Object *obj) :
+  AnnotMarkup(docA, dictObject, obj) {
   type = typeStamp;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotStamp::~AnnotStamp() {
@@ -5450,14 +5208,12 @@
 }
 
 void AnnotStamp::initialize(PDFDoc *docA, Dict* dict) {
-  Object obj1;
-
-  if (dict->lookup("Name", &obj1)->isName()) {
+  Object obj1 = dict->lookup("Name");
+  if (obj1.isName()) {
     icon = new GooString(obj1.getName());
   } else {
     icon = new GooString("Draft");
   }
-  obj1.free();
 
 }
 
@@ -5470,9 +5226,7 @@
     icon = new GooString();
   }
 
-  Object obj1;
-  obj1.initName (icon->getCString());
-  update("Name", &obj1);
+  update("Name", Object(objName, icon->getCString()));
   invalidateAppearance();
 }
 
@@ -5485,10 +5239,10 @@
 
   switch (subType) {
     case typeSquare:
-      annotObj.dictSet ("Subtype", obj1.initName ("Square"));
+      annotObj.dictSet ("Subtype", Object(objName, "Square"));
       break;
     case typeCircle:
-      annotObj.dictSet ("Subtype", obj1.initName ("Circle"));
+      annotObj.dictSet ("Subtype", Object(objName, "Circle"));
       break;
     default:
       assert (0 && "Invalid subtype for AnnotGeometry\n");
@@ -5497,11 +5251,11 @@
   initialize(docA, annotObj.getDict());
 }
 
-AnnotGeometry::AnnotGeometry(PDFDoc *docA, Dict *dict, Object *obj) :
-  AnnotMarkup(docA, dict, obj) {
+AnnotGeometry::AnnotGeometry(PDFDoc *docA, Object *dictObject, Object *obj) :
+  AnnotMarkup(docA, dictObject, obj) {
   // the real type will be read in initialize()
   type = typeSquare;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotGeometry::~AnnotGeometry() {
@@ -5513,7 +5267,8 @@
 void AnnotGeometry::initialize(PDFDoc *docA, Dict* dict) {
   Object obj1;
 
-  if (dict->lookup("Subtype", &obj1)->isName()) {
+  obj1 = dict->lookup("Subtype");
+  if (obj1.isName()) {
     GooString typeName(obj1.getName());
     if (!typeName.cmp("Square")) {
       type = typeSquare;
@@ -5521,47 +5276,45 @@
       type = typeCircle;
     }
   }
-  obj1.free();
 
-  if (dict->lookup("IC", &obj1)->isArray()) {
+  obj1 = dict->lookup("IC");
+  if (obj1.isArray()) {
     interiorColor = new AnnotColor(obj1.getArray());
   } else {
     interiorColor = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("BS", &obj1)->isDict()) {
+  obj1 = dict->lookup("BS");
+  if (obj1.isDict()) {
     delete border;
     border = new AnnotBorderBS(obj1.getDict());
   } else if (!border) {
     border = new AnnotBorderBS();
   }
-  obj1.free();
 
-  if (dict->lookup("BE", &obj1)->isDict()) {
+  obj1 = dict->lookup("BE");
+  if (obj1.isDict()) {
     borderEffect = new AnnotBorderEffect(obj1.getDict());
   } else {
     borderEffect = NULL;
   }
-  obj1.free();
 
   geometryRect = NULL;
-  if (dict->lookup("RD", &obj1)->isArray()) {
+  obj1 = dict->lookup("RD");
+  if (obj1.isArray()) {
     geometryRect = parseDiffRectangle(obj1.getArray(), rect);
   }
-  obj1.free();
-
 }
 
 void AnnotGeometry::setType(AnnotSubtype new_type) {
-  Object obj1;
+  const char *typeName = nullptr; /* squelch bogus compiler warning */
 
   switch (new_type) {
     case typeSquare:
-      obj1.initName("Square");
+      typeName = "Square";
       break;
     case typeCircle:
-      obj1.initName("Circle");
+      typeName = "Circle";
       break;
     default:
       assert(!"Invalid subtype");
@@ -5568,7 +5321,7 @@
   }
 
   type = new_type;
-  update("Subtype", &obj1);
+  update("Subtype", Object(objName, typeName));
   invalidateAppearance();
 }
 
@@ -5576,9 +5329,8 @@
   delete interiorColor;
 
   if (new_color) {
-    Object obj1;
-    new_color->writeToObject(xref, &obj1);
-    update ("IC", &obj1);
+    Object obj1 = new_color->writeToObject(xref);
+    update ("IC", std::move(obj1));
     interiorColor = new_color;
   } else {
     interiorColor = NULL;
@@ -5587,7 +5339,6 @@
 }
 
 void AnnotGeometry::draw(Gfx *gfx, GBool printing) {
-  Object obj;
   double ca = 1;
 
   if (!isVisible (printing))
@@ -5673,26 +5424,22 @@
     bbox[2] = rect->x2 - rect->x1;
     bbox[3] = rect->y2 - rect->y1;
     if (ca == 1) {
-      createForm(bbox, gFalse, NULL, &appearance);
+      appearance = createForm(bbox, gFalse, nullptr);
     } else {
-      Object aStream;
-
-      createForm(bbox, gTrue, NULL, &aStream);
+      Object aStream = createForm(bbox, gTrue, nullptr);
       delete appearBuf;
 
-      Object resDict;
       appearBuf = new GooString ("/GS0 gs\n/Fm0 Do");
-      createResourcesDict("Fm0", &aStream, "GS0", ca, NULL, &resDict);
-      createForm(bbox, gFalse, &resDict, &appearance);
+      Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, NULL);
+      appearance = createForm(bbox, gFalse, resDict);
     }
     delete appearBuf;
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
 		 rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
-  obj.free();
 }
 
 //------------------------------------------------------------------------
@@ -5704,10 +5451,10 @@
 
   switch (subType) {
     case typePolygon:
-      annotObj.dictSet ("Subtype", obj1.initName ("Polygon"));
+      annotObj.dictSet ("Subtype", Object(objName, "Polygon"));
       break;
     case typePolyLine:
-      annotObj.dictSet ("Subtype", obj1.initName ("PolyLine"));
+      annotObj.dictSet ("Subtype", Object(objName, "PolyLine"));
       break;
     default:
       assert (0 && "Invalid subtype for AnnotGeometry\n");
@@ -5714,20 +5461,19 @@
   }
 
   // Store dummy path with one null vertex only
-  Object obj2, obj3;
-  obj2.initArray (doc->getXRef());
-  obj2.arrayAdd (obj3.initReal (0));
-  obj2.arrayAdd (obj3.initReal (0));
-  annotObj.dictSet ("Vertices", &obj2);
+  Array *a = new Array(doc->getXRef());
+  a->add(Object(0.));
+  a->add(Object(0.));
+  annotObj.dictSet("Vertices", Object(a));
 
   initialize(docA, annotObj.getDict());
 }
 
-AnnotPolygon::AnnotPolygon(PDFDoc *docA, Dict *dict, Object *obj) :
-  AnnotMarkup(docA, dict, obj) {
+AnnotPolygon::AnnotPolygon(PDFDoc *docA, Object *dictObject, Object *obj) :
+  AnnotMarkup(docA, dictObject, obj) {
   // the real type will be read in initialize()
   type = typePolygon;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotPolygon::~AnnotPolygon() {
@@ -5743,7 +5489,8 @@
 void AnnotPolygon::initialize(PDFDoc *docA, Dict* dict) {
   Object obj1;
 
-  if (dict->lookup("Subtype", &obj1)->isName()) {
+  obj1 = dict->lookup("Subtype");
+  if (obj1.isName()) {
     GooString typeName(obj1.getName());
     if (!typeName.cmp("Polygon")) {
       type = typePolygon;
@@ -5751,9 +5498,9 @@
       type = typePolyLine;
     }
   }
-  obj1.free();
 
-  if (dict->lookup("Vertices", &obj1)->isArray()) {
+  obj1 = dict->lookup("Vertices");
+  if (obj1.isArray()) {
     vertices = new AnnotPath(obj1.getArray());
   } else {
     vertices = new AnnotPath();
@@ -5760,51 +5507,49 @@
     error(errSyntaxError, -1, "Bad Annot Polygon Vertices");
     ok = gFalse;
   }
-  obj1.free();
 
-  if (dict->lookup("LE", &obj1)->isArray() && obj1.arrayGetLength() == 2) {
-    Object obj2;
-
-    if(obj1.arrayGet(0, &obj2)->isString())
+  obj1 = dict->lookup("LE");
+  if (obj1.isArray() && obj1.arrayGetLength() == 2) {
+    Object obj2 = obj1.arrayGet(0);
+    if(obj2.isString())
       startStyle = parseAnnotLineEndingStyle(obj2.getString());
     else
       startStyle = annotLineEndingNone;
-    obj2.free();
 
-    if(obj1.arrayGet(1, &obj2)->isString())
+    obj2 = obj1.arrayGet(1);
+    if(obj2.isString())
       endStyle = parseAnnotLineEndingStyle(obj2.getString());
     else
       endStyle = annotLineEndingNone;
-    obj2.free();
 
   } else {
     startStyle = endStyle = annotLineEndingNone;
   }
-  obj1.free();
 
-  if (dict->lookup("IC", &obj1)->isArray()) {
+  obj1 = dict->lookup("IC");
+  if (obj1.isArray()) {
     interiorColor = new AnnotColor(obj1.getArray());
   } else {
     interiorColor = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("BS", &obj1)->isDict()) {
+  obj1 = dict->lookup("BS");
+  if (obj1.isDict()) {
     delete border;
     border = new AnnotBorderBS(obj1.getDict());
   } else if (!border) {
     border = new AnnotBorderBS();
   }
-  obj1.free();
 
-  if (dict->lookup("BE", &obj1)->isDict()) {
+  obj1 = dict->lookup("BE");
+  if (obj1.isDict()) {
     borderEffect = new AnnotBorderEffect(obj1.getDict());
   } else {
     borderEffect = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("IT", &obj1)->isName()) {
+  obj1 = dict->lookup("IT");
+  if (obj1.isName()) {
     const char *intentName = obj1.getName();
 
     if(!strcmp(intentName, "PolygonCloud")) {
@@ -5817,18 +5562,17 @@
   } else {
     intent = polygonCloud;
   }
-  obj1.free();
 }
 
 void AnnotPolygon::setType(AnnotSubtype new_type) {
-  Object obj1;
+  const char *typeName = nullptr; /* squelch bogus compiler warning */
 
   switch (new_type) {
     case typePolygon:
-      obj1.initName("Polygon");
+      typeName = "Polygon";
       break;
     case typePolyLine:
-      obj1.initName("PolyLine");
+      typeName = "PolyLine";
       break;
     default:
       assert(!"Invalid subtype");
@@ -5835,38 +5579,34 @@
   }
 
   type = new_type;
-  update("Subtype", &obj1);
+  update("Subtype", Object(objName, typeName));
   invalidateAppearance();
 }
 
 void AnnotPolygon::setVertices(AnnotPath *path) {
-  Object obj1, obj2;
   delete vertices;
 
-  obj1.initArray(xref);
-
+  Array *a = new Array(xref);
   for (int i = 0; i < path->getCoordsLength(); i++) {
-    obj1.arrayAdd (obj2.initReal (path->getX(i)));
-    obj1.arrayAdd (obj2.initReal (path->getY(i)));
+    a->add(Object(path->getX(i)));
+    a->add(Object(path->getY(i)));
   }
 
-  vertices = new AnnotPath(obj1.getArray());
+  vertices = new AnnotPath(a);
 
-  update("Vertices", &obj1);
+  update("Vertices", Object(a));
   invalidateAppearance();
 }
 
 void AnnotPolygon::setStartEndStyle(AnnotLineEndingStyle start, AnnotLineEndingStyle end) {
-  Object obj1, obj2;
-
   startStyle = start;
   endStyle = end;
 
-  obj1.initArray(xref);
-  obj1.arrayAdd( obj2.initName(convertAnnotLineEndingStyle( startStyle )) );
-  obj1.arrayAdd( obj2.initName(convertAnnotLineEndingStyle( endStyle )) );
+  Array *a = new Array(xref);
+  a->add( Object(objName, convertAnnotLineEndingStyle( startStyle )) );
+  a->add( Object(objName, convertAnnotLineEndingStyle( endStyle )) );
 
-  update("LE", &obj1);
+  update("LE", Object(a));
   invalidateAppearance();
 }
 
@@ -5874,9 +5614,8 @@
   delete interiorColor;
 
   if (new_color) {
-    Object obj1;
-    new_color->writeToObject(xref, &obj1);
-    update ("IC", &obj1);
+    Object obj1 = new_color->writeToObject(xref);
+    update ("IC", std::move(obj1));
     interiorColor = new_color;
   } else {
     interiorColor = NULL;
@@ -5885,20 +5624,19 @@
 }
 
 void AnnotPolygon::setIntent(AnnotPolygonIntent new_intent) {
-  Object obj1;
+  const char *intentName;
 
   intent = new_intent;
   if (new_intent == polygonCloud)
-    obj1.initName("PolygonCloud");
+    intentName = "PolygonCloud";
   else if (new_intent == polylineDimension)
-    obj1.initName("PolyLineDimension");
+    intentName = "PolyLineDimension";
   else // polygonDimension
-    obj1.initName("PolygonDimension");
-  update ("IT", &obj1);
+    intentName = "PolygonDimension";
+  update ("IT", Object(objName, intentName));
 }
 
 void AnnotPolygon::draw(Gfx *gfx, GBool printing) {
-  Object obj;
   double ca = 1;
 
   if (!isVisible (printing))
@@ -5948,22 +5686,20 @@
     double bbox[4];
     appearBBox->getBBoxRect(bbox);
     if (ca == 1) {
-      createForm(bbox, gFalse, NULL, &appearance);
+      appearance = createForm(bbox, gFalse, nullptr);
     } else {
-      Object aStream, resDict;
-
-      createForm(bbox, gTrue, NULL, &aStream);
+      Object aStream = createForm(bbox, gTrue, nullptr);
       delete appearBuf;
 
       appearBuf = new GooString ("/GS0 gs\n/Fm0 Do");
-      createResourcesDict("Fm0", &aStream, "GS0", ca, NULL, &resDict);
-      createForm(bbox, gFalse, &resDict, &appearance);
+      Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, NULL);
+      appearance = createForm(bbox, gFalse, resDict);
     }
     delete appearBuf;
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   if (appearBBox) {
     gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                    appearBBox->getPageXMin(), appearBBox->getPageYMin(),
@@ -5973,7 +5709,6 @@
     gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                    rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   }
-  obj.free();
 }
 
 //------------------------------------------------------------------------
@@ -5985,14 +5720,14 @@
 
   type = typeCaret;
 
-  annotObj.dictSet ("Subtype", obj1.initName ("Caret"));
+  annotObj.dictSet ("Subtype", Object(objName, "Caret"));
   initialize(docA, annotObj.getDict());
 }
 
-AnnotCaret::AnnotCaret(PDFDoc *docA, Dict *dict, Object *obj) :
-  AnnotMarkup(docA, dict, obj) {
+AnnotCaret::AnnotCaret(PDFDoc *docA, Object *dictObject, Object *obj) :
+  AnnotMarkup(docA, dictObject, obj) {
   type = typeCaret;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotCaret::~AnnotCaret() {
@@ -6003,7 +5738,8 @@
   Object obj1;
 
   symbol = symbolNone;
-  if (dict->lookup("Sy", &obj1)->isName()) {
+  obj1 = dict->lookup("Sy");
+  if (obj1.isName()) {
     GooString typeName(obj1.getName());
     if (!typeName.cmp("P")) {
       symbol = symbolP;
@@ -6011,22 +5747,18 @@
       symbol = symbolNone;
     }
   }
-  obj1.free();
 
-  if (dict->lookup("RD", &obj1)->isArray()) {
+  obj1 = dict->lookup("RD");
+  if (obj1.isArray()) {
     caretRect = parseDiffRectangle(obj1.getArray(), rect);
   } else {
     caretRect = NULL;
   }
-  obj1.free();
-
 }
 
 void AnnotCaret::setSymbol(AnnotCaretSymbol new_symbol) {
-  Object obj1;
-  obj1.initName( new_symbol == symbolP ? "P" : "None" );
   symbol = new_symbol;
-  update("Sy", &obj1);
+  update("Sy", Object(objName, new_symbol == symbolP ? "P" : "None"));
   invalidateAppearance();
 }
 
@@ -6039,23 +5771,24 @@
 
   type = typeInk;
 
-  annotObj.dictSet ("Subtype", obj1.initName ("Ink"));
+  annotObj.dictSet ("Subtype", Object(objName, "Ink"));
 
   // Store dummy path with one null vertex only
-  Object obj2, obj3, obj4;
-  obj2.initArray (doc->getXRef());
-  obj2.arrayAdd (obj3.initArray (doc->getXRef()));
-  obj3.arrayAdd (obj4.initReal (0));
-  obj3.arrayAdd (obj4.initReal (0));
-  annotObj.dictSet ("InkList", &obj2);
+  Object obj3, obj4;
+  Array *inkList = new Array(doc->getXRef());
+  Array *vList = new Array(doc->getXRef());
+  vList->add(Object(0.));
+  vList->add(Object(0.));
+  inkList->add(Object(vList));
+  annotObj.dictSet("InkList", Object(inkList));
 
   initialize(docA, annotObj.getDict());
 }
 
-AnnotInk::AnnotInk(PDFDoc *docA, Dict *dict, Object *obj) :
-  AnnotMarkup(docA, dict, obj) {
+AnnotInk::AnnotInk(PDFDoc *docA, Object *dictObject, Object *obj) :
+  AnnotMarkup(docA, dictObject, obj) {
   type = typeInk;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotInk::~AnnotInk() {
@@ -6065,7 +5798,8 @@
 void AnnotInk::initialize(PDFDoc *docA, Dict* dict) {
   Object obj1;
 
-  if (dict->lookup("InkList", &obj1)->isArray()) {
+  obj1 = dict->lookup("InkList");
+  if (obj1.isArray()) {
     parseInkList(obj1.getArray());
   } else {
     inkListLength = 0;
@@ -6073,27 +5807,25 @@
     error(errSyntaxError, -1, "Bad Annot Ink List");
     ok = gFalse;
   }
-  obj1.free();
 
-  if (dict->lookup("BS", &obj1)->isDict()) {
+  obj1 = dict->lookup("BS");
+  if (obj1.isDict()) {
     delete border;
     border = new AnnotBorderBS(obj1.getDict());
   } else if (!border) {
     border = new AnnotBorderBS();
   }
-  obj1.free();
 }
 
 void AnnotInk::writeInkList(AnnotPath **paths, int n_paths, Array *dest_array) {
-  Object obj1, obj2;
   for (int i = 0; i < n_paths; ++i) {
     AnnotPath *path = paths[i];
-    obj1.initArray (xref);
+    Array *a = new Array(xref);
     for (int j = 0; j < path->getCoordsLength(); ++j) {
-      obj1.arrayAdd (obj2.initReal (path->getX(j)));
-      obj1.arrayAdd (obj2.initReal (path->getY(j)));
+      a->add(Object(path->getX(j)));
+      a->add(Object(path->getY(j)));
     }
-    dest_array->add (&obj1);
+    dest_array->add(Object(a));
   }
 }
 
@@ -6102,10 +5834,9 @@
   inkList = (AnnotPath **) gmallocn ((inkListLength), sizeof(AnnotPath *));
   memset(inkList, 0, inkListLength * sizeof(AnnotPath *));
   for (int i = 0; i < inkListLength; i++) {
-    Object obj2;
-    if (array->get(i, &obj2)->isArray())
+    Object obj2 = array->get(i);
+    if (obj2.isArray())
       inkList[i] = new AnnotPath(obj2.getArray());
-    obj2.free();
   }
 }
 
@@ -6118,20 +5849,17 @@
 }
 
 void AnnotInk::setInkList(AnnotPath **paths, int n_paths) {
-  Object obj1;
-
   freeInkList();
 
-  obj1.initArray (xref);
-  writeInkList(paths, n_paths, obj1.getArray());
+  Array *a = new Array(xref);
+  writeInkList(paths, n_paths, a);
 
-  parseInkList(obj1.getArray());
-  annotObj.dictSet ("InkList", &obj1);
+  parseInkList(a);
+  annotObj.dictSet ("InkList", Object(a));
   invalidateAppearance();
 }
 
 void AnnotInk::draw(Gfx *gfx, GBool printing) {
-  Object obj;
   double ca = 1;
 
   if (!isVisible (printing))
@@ -6172,22 +5900,20 @@
     double bbox[4];
     appearBBox->getBBoxRect(bbox);
     if (ca == 1) {
-      createForm(bbox, gFalse, NULL, &appearance);
+      appearance = createForm(bbox, gFalse, nullptr);
     } else {
-      Object aStream, resDict;
-
-      createForm(bbox, gTrue, NULL, &aStream);
+      Object aStream = createForm(bbox, gTrue, nullptr);
       delete appearBuf;
 
       appearBuf = new GooString ("/GS0 gs\n/Fm0 Do");
-      createResourcesDict("Fm0", &aStream, "GS0", ca, NULL, &resDict);
-      createForm(bbox, gFalse, &resDict, &appearance);
+      Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, NULL);
+      appearance = createForm(bbox, gFalse, resDict);
     }
     delete appearBuf;
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   if (appearBBox) {
     gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                    appearBBox->getPageXMin(), appearBBox->getPageYMin(),
@@ -6197,7 +5923,6 @@
     gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
                    rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   }
-  obj.free();
 }
 
 //------------------------------------------------------------------------
@@ -6209,45 +5934,39 @@
 
   type = typeFileAttachment;
 
-  annotObj.dictSet ("Subtype", obj1.initName ("FileAttachment"));
+  annotObj.dictSet("Subtype", Object(objName, "FileAttachment"));
+  annotObj.dictSet("FS", Object(filename->copy()));
 
-  Object obj2;
-  obj2.initString(filename->copy());
-  annotObj.dictSet ("FS", &obj2);
-
   initialize(docA, annotObj.getDict());
 }
 
-AnnotFileAttachment::AnnotFileAttachment(PDFDoc *docA, Dict *dict, Object *obj) :
-  AnnotMarkup(docA, dict, obj) {
+AnnotFileAttachment::AnnotFileAttachment(PDFDoc *docA, Object *dictObject, Object *obj) :
+  AnnotMarkup(docA, dictObject, obj) {
   type = typeFileAttachment;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotFileAttachment::~AnnotFileAttachment() {
-  file.free();
-
-  if (name)
-    delete name;
+  delete name;
 }
 
 void AnnotFileAttachment::initialize(PDFDoc *docA, Dict* dict) {
   Object obj1;
 
-  if (dict->lookup("FS", &obj1)->isDict() || dict->lookup("FS", &obj1)->isString()) {
-    obj1.copy(&file);
+  obj1 = dict->lookup("FS");
+  if (obj1.isDict() || obj1.isString()) {
+    file = obj1.copy();
   } else {
     error(errSyntaxError, -1, "Bad Annot File Attachment");
     ok = gFalse;
   }
-  obj1.free();
 
-  if (dict->lookup("Name", &obj1)->isName()) {
+  obj1 = dict->lookup("Name");
+  if (obj1.isName()) {
     name = new GooString(obj1.getName());
   } else {
     name = new GooString("PushPin");
   }
-  obj1.free();
 }
 
 #define ANNOT_FILE_ATTACHMENT_AP_PUSHPIN                                         \
@@ -6363,7 +6082,6 @@
   "19.5 17.699 20.91 17.418 22.5 17.5 c S\n"
 
 void AnnotFileAttachment::draw(Gfx *gfx, GBool printing) {
-  Object obj;
   double ca = 1;
 
   if (!isVisible (printing))
@@ -6394,26 +6112,22 @@
     bbox[0] = bbox[1] = 0;
     bbox[2] = bbox[3] = 24;
     if (ca == 1) {
-      createForm (bbox, gFalse, NULL, &appearance);
+      appearance = createForm (bbox, gFalse, nullptr);
     } else {
-      Object aStream;
-
-      createForm (bbox, gTrue, NULL, &aStream);
+      Object aStream = createForm (bbox, gTrue, nullptr);
       delete appearBuf;
 
-      Object resDict;
       appearBuf = new GooString ("/GS0 gs\n/Fm0 Do");
-      createResourcesDict("Fm0", &aStream, "GS0", ca, NULL, &resDict);
-      createForm(bbox, gFalse, &resDict, &appearance);
+      Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, NULL);
+      appearance = createForm(bbox, gFalse, resDict);
     }
     delete appearBuf;
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  Object obj = appearance.fetch(gfx->getXRef());
   gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
 		 rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
-  obj.free();
 }
 
 //------------------------------------------------------------------------
@@ -6425,21 +6139,16 @@
 
   type = typeSound;
 
-  annotObj.dictSet ("Subtype", obj1.initName ("Sound"));
+  annotObj.dictSet ("Subtype", Object(objName, "Sound"));
+  annotObj.dictSet ("Sound", soundA->getObject()->copy());
 
-  Object obj2;
-  Stream *str = soundA->getStream();
-  obj2.initStream (str);
-  str->incRef(); //FIXME: initStream should do this?
-  annotObj.dictSet ("Sound", &obj2);
-
   initialize(docA, annotObj.getDict());
 }
 
-AnnotSound::AnnotSound(PDFDoc *docA, Dict *dict, Object *obj) :
-  AnnotMarkup(docA, dict, obj) {
+AnnotSound::AnnotSound(PDFDoc *docA, Object *dictObject, Object *obj) :
+  AnnotMarkup(docA, dictObject, obj) {
   type = typeSound;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotSound::~AnnotSound() {
@@ -6449,21 +6158,20 @@
 }
 
 void AnnotSound::initialize(PDFDoc *docA, Dict* dict) {
-  Object obj1;
+  Object obj1 = dict->lookup("Sound");
 
-  sound = Sound::parseSound(dict->lookup("Sound", &obj1));
+  sound = Sound::parseSound(&obj1);
   if (!sound) {
     error(errSyntaxError, -1, "Bad Annot Sound");
     ok = gFalse;
   }
-  obj1.free();
 
-  if (dict->lookup("Name", &obj1)->isName()) {
+  obj1 = dict->lookup("Name");
+  if (obj1.isName()) {
     name = new GooString(obj1.getName());
   } else {
     name = new GooString("Speaker");
   }
-  obj1.free();
 }
 
 #define ANNOT_SOUND_AP_SPEAKER                                               \
@@ -6557,25 +6265,22 @@
     bbox[0] = bbox[1] = 0;
     bbox[2] = bbox[3] = 24;
     if (ca == 1) {
-      createForm(bbox, gFalse, NULL, &appearance);
+      appearance = createForm(bbox, gFalse, nullptr);
     } else {
-      Object aStream, resDict;
-
-      createForm(bbox, gTrue, NULL, &aStream);
+      Object aStream = createForm(bbox, gTrue, nullptr);
       delete appearBuf;
 
       appearBuf = new GooString ("/GS0 gs\n/Fm0 Do");
-      createResourcesDict("Fm0", &aStream, "GS0", ca, NULL, &resDict);
-      createForm(bbox, gFalse, &resDict, &appearance);
+      Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, NULL);
+      appearance = createForm(bbox, gFalse, resDict);
     }
     delete appearBuf;
   }
 
   // draw the appearance stream
-  appearance.fetch(gfx->getXRef(), &obj);
+  obj = appearance.fetch(gfx->getXRef());
   gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
 		 rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
-  obj.free();
 }
 
 //------------------------------------------------------------------------
@@ -6587,15 +6292,15 @@
 
   type = type3D;
 
-  annotObj.dictSet ("Subtype", obj1.initName ("3D"));
+  annotObj.dictSet ("Subtype", Object(objName, "3D"));
 
   initialize(docA, annotObj.getDict());
 }
 
-Annot3D::Annot3D(PDFDoc *docA, Dict *dict, Object *obj) :
-  Annot(docA, dict, obj) {
+Annot3D::Annot3D(PDFDoc *docA, Object *dictObject, Object *obj) :
+  Annot(docA, dictObject, obj) {
   type = type3D;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 Annot3D::~Annot3D() {
@@ -6604,20 +6309,19 @@
 }
 
 void Annot3D::initialize(PDFDoc *docA, Dict* dict) {
-  Object obj1;
-
-  if (dict->lookup("3DA", &obj1)->isDict()) {
+  Object obj1 = dict->lookup("3DA");
+  if (obj1.isDict()) {
     activation = new Activation(obj1.getDict());
   } else {
     activation = NULL;
   }
-  obj1.free();
 }
 
 Annot3D::Activation::Activation(Dict *dict) {
   Object obj1;
 
-  if (dict->lookup("A", &obj1)->isName()) {
+  obj1 = dict->lookup("A");
+  if (obj1.isName()) {
     const char *name = obj1.getName();
 
     if(!strcmp(name, "PO")) {
@@ -6632,9 +6336,9 @@
   } else {
     aTrigger = aTriggerUnknown;
   }
-  obj1.free();
 
-  if(dict->lookup("AIS", &obj1)->isName()) {
+  obj1 = dict->lookup("AIS");
+  if (obj1.isName()) {
     const char *name = obj1.getName();
 
     if(!strcmp(name, "I")) {
@@ -6647,9 +6351,9 @@
   } else {
     aState = aStateUnknown;
   }
-  obj1.free();
 
-  if(dict->lookup("D", &obj1)->isName()) {
+  obj1 = dict->lookup("D");
+  if (obj1.isName()) {
     const char *name = obj1.getName();
 
     if(!strcmp(name, "PC")) {
@@ -6664,9 +6368,9 @@
   } else {
     dTrigger = dTriggerUnknown;
   }
-  obj1.free();
 
-  if(dict->lookup("DIS", &obj1)->isName()) {
+  obj1 = dict->lookup("DIS");
+  if (obj1.isName()) {
     const char *name = obj1.getName();
 
     if(!strcmp(name, "U")) {
@@ -6681,21 +6385,20 @@
   } else {
     dState = dStateUnknown;
   }
-  obj1.free();
 
-  if (dict->lookup("TB", &obj1)->isBool()) {
+  obj1 = dict->lookup("TB");
+  if (obj1.isBool()) {
     displayToolbar = obj1.getBool();
   } else {
     displayToolbar = gTrue;
   }
-  obj1.free();
 
-  if (dict->lookup("NP", &obj1)->isBool()) {
+  obj1 = dict->lookup("NP");
+  if (obj1.isBool()) {
     displayNavigation = obj1.getBool();
   } else {
     displayNavigation = gFalse;
   }
-  obj1.free();
 }
 
 //------------------------------------------------------------------------
@@ -6707,15 +6410,15 @@
 
   type = typeRichMedia;
 
-  annotObj.dictSet ("Subtype", obj1.initName ("RichMedia"));
+  annotObj.dictSet ("Subtype", Object(objName, "RichMedia"));
 
   initialize(docA, annotObj.getDict());
 }
 
-AnnotRichMedia::AnnotRichMedia(PDFDoc *docA, Dict *dict, Object *obj) :
-  Annot(docA, dict, obj) {
+AnnotRichMedia::AnnotRichMedia(PDFDoc *docA, Object *dictObject, Object *obj) :
+  Annot(docA, dictObject, obj) {
   type = typeRichMedia;
-  initialize(docA, dict);
+  initialize(docA, dictObject->getDict());
 }
 
 AnnotRichMedia::~AnnotRichMedia() {
@@ -6724,21 +6427,19 @@
 }
 
 void AnnotRichMedia::initialize(PDFDoc *docA, Dict* dict) {
-  Object obj1;
-
-  if (dict->lookup("RichMediaContent", &obj1)->isDict()) {
+  Object obj1 = dict->lookup("RichMediaContent");
+  if (obj1.isDict()) {
     content = new AnnotRichMedia::Content(obj1.getDict());
   } else {
     content = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("RichMediaSettings", &obj1)->isDict()) {
+  obj1 = dict->lookup("RichMediaSettings");
+  if (obj1.isDict()) {
     settings = new AnnotRichMedia::Settings(obj1.getDict());
   } else {
     settings = NULL;
   }
-  obj1.free();
 }
 
 AnnotRichMedia::Content* AnnotRichMedia::getContent() const {
@@ -6750,21 +6451,19 @@
 }
 
 AnnotRichMedia::Settings::Settings(Dict *dict) {
-  Object obj1;
-
-  if (dict->lookup("Activation", &obj1)->isDict()) {
+  Object obj1 = dict->lookup("Activation");
+  if (obj1.isDict()) {
     activation = new AnnotRichMedia::Activation(obj1.getDict());
   } else {
     activation = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("Deactivation", &obj1)->isDict()) {
+  obj1 = dict->lookup("Deactivation");
+  if (obj1.isDict()) {
     deactivation = new AnnotRichMedia::Deactivation(obj1.getDict());
   } else {
     deactivation = NULL;
   }
-  obj1.free();
 }
 
 AnnotRichMedia::Settings::~Settings() {
@@ -6781,9 +6480,8 @@
 }
 
 AnnotRichMedia::Activation::Activation(Dict *dict) {
-  Object obj1;
-
-  if (dict->lookup("Condition", &obj1)->isName()) {
+  Object obj1 = dict->lookup("Condition");
+  if (obj1.isName()) {
     const char *name = obj1.getName();
 
     if (!strcmp(name, "PO")) {
@@ -6798,7 +6496,6 @@
   } else {
     condition = conditionUserAction;
   }
-  obj1.free();
 }
 
 AnnotRichMedia::Activation::Condition AnnotRichMedia::Activation::getCondition() const {
@@ -6806,9 +6503,8 @@
 }
 
 AnnotRichMedia::Deactivation::Deactivation(Dict *dict) {
-  Object obj1;
-
-  if (dict->lookup("Condition", &obj1)->isName()) {
+  Object obj1 = dict->lookup("Condition");
+  if (obj1.isName()) {
     const char *name = obj1.getName();
 
     if (!strcmp(name, "PC")) {
@@ -6823,7 +6519,6 @@
   } else {
     condition = conditionUserAction;
   }
-  obj1.free();
 }
 
 AnnotRichMedia::Deactivation::Condition AnnotRichMedia::Deactivation::getCondition() const {
@@ -6831,57 +6526,48 @@
 }
 
 AnnotRichMedia::Content::Content(Dict *dict) {
-  Object obj1;
-
-  if (dict->lookup("Configurations", &obj1)->isArray()) {
+  Object obj1 = dict->lookup("Configurations");
+  if (obj1.isArray()) {
     nConfigurations = obj1.arrayGetLength();
 
     configurations = (Configuration **)gmallocn(nConfigurations, sizeof(Configuration *));
 
     for (int i = 0; i < nConfigurations; ++i) {
-      Object obj2;
-
-      if (obj1.arrayGet(i, &obj2)->isDict()) {
+      Object obj2 = obj1.arrayGet(i);
+      if (obj2.isDict()) {
         configurations[i] = new AnnotRichMedia::Configuration(obj2.getDict());
       } else {
         configurations[i] = NULL;
       }
-      obj2.free();
     }
   } else {
     nConfigurations = 0;
     configurations = NULL;
   }
-  obj1.free();
 
   nAssets = 0;
   assets = NULL;
-  if (dict->lookup("Assets", &obj1)->isDict()) {
-    Object obj2;
-
-    if (obj1.getDict()->lookup("Names", &obj2)->isArray()) {
+  obj1 = dict->lookup("Assets");
+  if (obj1.isDict()) {
+    Object obj2 = obj1.getDict()->lookup("Names");
+    if (obj2.isArray()) {
       nAssets = obj2.arrayGetLength() / 2;
 
       assets = (Asset **)gmallocn(nAssets, sizeof(Asset *));
 
       int counter = 0;
-      for (int i = 0; i < obj2.arrayGetLength(); i += 2) {
-        Object objKey;
-
+      for (int i = 0; i < nAssets; ++i) {
         assets[counter] = new AnnotRichMedia::Asset;
 
-        obj2.arrayGet(i, &objKey);
-        obj2.arrayGet(i + 1, &assets[counter]->fileSpec);
+        Object objKey = obj2.arrayGet(i * 2);
+        assets[counter]->fileSpec = obj2.arrayGet(i * 2 + 1);
 
         assets[counter]->name = new GooString( objKey.getString() );
         ++counter;
 
-        objKey.free();
       }
     }
-    obj2.free();
   }
-  obj1.free();
 }
 
 AnnotRichMedia::Content::~Content() {
@@ -6928,7 +6614,6 @@
 AnnotRichMedia::Asset::~Asset()
 {
   delete name;
-  fileSpec.free();
 }
 
 GooString* AnnotRichMedia::Asset::getName() const {
@@ -6941,36 +6626,33 @@
 
 AnnotRichMedia::Configuration::Configuration(Dict *dict)
 {
-  Object obj1;
-
-  if (dict->lookup("Instances", &obj1)->isArray()) {
+  Object obj1 = dict->lookup("Instances");
+  if (obj1.isArray()) {
     nInstances = obj1.arrayGetLength();
 
     instances = (Instance **)gmallocn(nInstances, sizeof(Instance *));
 
     for (int i = 0; i < nInstances; ++i) {
-      Object obj2;
-
-      if (obj1.arrayGet(i, &obj2)->isDict()) {
+      Object obj2 = obj1.arrayGet(i);
+      if (obj2.isDict()) {
         instances[i] = new AnnotRichMedia::Instance(obj2.getDict());
       } else {
         instances[i] = NULL;
       }
-      obj2.free();
     }
   } else {
     instances = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("Name", &obj1)->isString()) {
+  obj1 = dict->lookup("Name");
+  if (obj1.isString()) {
     name = new GooString(obj1.getString());
   } else {
     name = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("Subtype", &obj1)->isName()) {
+  obj1 = dict->lookup("Subtype");
+  if (obj1.isName()) {
     const char *name = obj1.getName();
 
     if (!strcmp(name, "3D")) {
@@ -6982,30 +6664,33 @@
     } else if (!strcmp(name, "Video")) {
       type = typeVideo;
     } else {
-      // determine from first instance
+      // determine from first non null instance
+      type = typeFlash; // default in case all instances are null
       if (instances && nInstances > 0) {
-        AnnotRichMedia::Instance *instance = instances[0];
-        switch (instance->getType()) {
-          case AnnotRichMedia::Instance::type3D:
-            type = type3D;
-            break;
-          case AnnotRichMedia::Instance::typeFlash:
-            type = typeFlash;
-            break;
-          case AnnotRichMedia::Instance::typeSound:
-            type = typeSound;
-            break;
-          case AnnotRichMedia::Instance::typeVideo:
-            type = typeVideo;
-            break;
-          default:
-            type = typeFlash;
-            break;
-        }
+	for (int i = 0; i < nInstances; ++i) {
+	  AnnotRichMedia::Instance *instance = instances[i];
+	  if (instance) {
+	    switch (instance->getType()) {
+	      case AnnotRichMedia::Instance::type3D:
+		type = type3D;
+		break;
+	      case AnnotRichMedia::Instance::typeFlash:
+		type = typeFlash;
+		break;
+	      case AnnotRichMedia::Instance::typeSound:
+		type = typeSound;
+		break;
+	      case AnnotRichMedia::Instance::typeVideo:
+		type = typeVideo;
+		break;
+	    }
+	    // break the loop since we found the first non null instance
+	    break;
+	  }
+	}
       }
     }
   }
-  obj1.free();
 }
 
 AnnotRichMedia::Configuration::~Configuration()
@@ -7040,9 +6725,7 @@
 
 AnnotRichMedia::Instance::Instance(Dict *dict)
 {
-  Object obj1;
-
-  dict->lookup("Subtype", &obj1);
+  Object obj1 = dict->lookup("Subtype");
   const char *name = obj1.isName() ? obj1.getName() : "";
 
   if (!strcmp(name, "3D")) {
@@ -7056,14 +6739,13 @@
   } else {
     type = typeFlash;
   }
-  obj1.free();
 
-  if (dict->lookup("Params", &obj1)->isDict()) {
+  obj1 = dict->lookup("Params");
+  if (obj1.isDict()) {
     params = new AnnotRichMedia::Params(obj1.getDict());
   } else {
     params = NULL;
   }
-  obj1.free();
 }
 
 AnnotRichMedia::Instance::~Instance()
@@ -7081,14 +6763,12 @@
 
 AnnotRichMedia::Params::Params(Dict *dict)
 {
-  Object obj1;
-
-  if (dict->lookup("FlashVars", &obj1)->isString()) {
+  Object obj1 = dict->lookup("FlashVars");
+  if (obj1.isString()) {
     flashVars = new GooString(obj1.getString());
   } else {
     flashVars = NULL;
   }
-  obj1.free();
 }
 
 AnnotRichMedia::Params::~Params()
@@ -7106,7 +6786,6 @@
 
 Annots::Annots(PDFDoc *docA, int page, Object *annotsObj) {
   Annot *annot;
-  Object obj1;
   int i;
 
   doc = docA;
@@ -7119,10 +6798,10 @@
       //get the Ref to this annot and pass it to Annot constructor 
       //this way, it'll be possible for the annot to retrieve the corresponding
       //form widget
-      Object obj2;
-      if (annotsObj->arrayGet(i, &obj1)->isDict()) {
-        annotsObj->arrayGetNF(i, &obj2);
-        annot = createAnnot (obj1.getDict(), &obj2);
+      Object obj1 = annotsObj->arrayGet(i);
+      if (obj1.isDict()) {
+	Object obj2 = annotsObj->arrayGetNF(i);
+        annot = createAnnot (&obj1, &obj2);
         if (annot) {
           if (annot->isOk()) {
             annot->setPage(page, gFalse); // Don't change /P
@@ -7131,8 +6810,6 @@
           annot->decRefCnt();
         }
       }
-      obj2.free();
-      obj1.free();
     }
   }
 }
@@ -7166,49 +6843,48 @@
   }
 }
 
-Annot *Annots::createAnnot(Dict* dict, Object *obj) {
-  Annot *annot = NULL;
-  Object obj1;
-
-  if (dict->lookup("Subtype", &obj1)->isName()) {
+Annot *Annots::createAnnot(Object* dictObject, Object *obj) {
+  Annot *annot = nullptr;
+  Object obj1 = dictObject->dictLookup("Subtype");
+  if (obj1.isName()) {
     const char *typeName = obj1.getName();
 
     if (!strcmp(typeName, "Text")) {
-      annot = new AnnotText(doc, dict, obj);
+      annot = new AnnotText(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Link")) {
-      annot = new AnnotLink(doc, dict, obj);
+      annot = new AnnotLink(doc, dictObject, obj);
     } else if (!strcmp(typeName, "FreeText")) {
-      annot = new AnnotFreeText(doc, dict, obj);
+      annot = new AnnotFreeText(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Line")) {
-      annot = new AnnotLine(doc, dict, obj);
+      annot = new AnnotLine(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Square")) {
-      annot = new AnnotGeometry(doc, dict, obj);
+      annot = new AnnotGeometry(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Circle")) {
-      annot = new AnnotGeometry(doc, dict, obj);
+      annot = new AnnotGeometry(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Polygon")) {
-      annot = new AnnotPolygon(doc, dict, obj);
+      annot = new AnnotPolygon(doc, dictObject, obj);
     } else if (!strcmp(typeName, "PolyLine")) {
-      annot = new AnnotPolygon(doc, dict, obj);
+      annot = new AnnotPolygon(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Highlight")) {
-      annot = new AnnotTextMarkup(doc, dict, obj);
+      annot = new AnnotTextMarkup(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Underline")) {
-      annot = new AnnotTextMarkup(doc, dict, obj);
+      annot = new AnnotTextMarkup(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Squiggly")) {
-      annot = new AnnotTextMarkup(doc, dict, obj);
+      annot = new AnnotTextMarkup(doc, dictObject, obj);
     } else if (!strcmp(typeName, "StrikeOut")) {
-      annot = new AnnotTextMarkup(doc, dict, obj);
+      annot = new AnnotTextMarkup(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Stamp")) {
-      annot = new AnnotStamp(doc, dict, obj);
+      annot = new AnnotStamp(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Caret")) {
-      annot = new AnnotCaret(doc, dict, obj);
+      annot = new AnnotCaret(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Ink")) {
-      annot = new AnnotInk(doc, dict, obj);
+      annot = new AnnotInk(doc, dictObject, obj);
     } else if (!strcmp(typeName, "FileAttachment")) {
-      annot = new AnnotFileAttachment(doc, dict, obj);
+      annot = new AnnotFileAttachment(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Sound")) {
-      annot = new AnnotSound(doc, dict, obj);
+      annot = new AnnotSound(doc, dictObject, obj);
     } else if(!strcmp(typeName, "Movie")) {
-      annot = new AnnotMovie(doc, dict, obj);
+      annot = new AnnotMovie(doc, dictObject, obj);
     } else if(!strcmp(typeName, "Widget")) {
       // Find the annot in forms
       if (obj->isRef()) {
@@ -7222,37 +6898,33 @@
         }
       }
       if (!annot)
-        annot = new AnnotWidget(doc, dict, obj);
+        annot = new AnnotWidget(doc, dictObject, obj);
     } else if(!strcmp(typeName, "Screen")) {
-      annot = new AnnotScreen(doc, dict, obj);
+      annot = new AnnotScreen(doc, dictObject, obj);
     } else if(!strcmp(typeName, "PrinterMark")) {
-      annot = new Annot(doc, dict, obj);
+      annot = new Annot(doc, dictObject, obj);
     } else if (!strcmp(typeName, "TrapNet")) {
-      annot = new Annot(doc, dict, obj);
+      annot = new Annot(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Watermark")) {
-      annot = new Annot(doc, dict, obj);
+      annot = new Annot(doc, dictObject, obj);
     } else if (!strcmp(typeName, "3D")) {
-      annot = new Annot3D(doc, dict, obj);
+      annot = new Annot3D(doc, dictObject, obj);
     } else if (!strcmp(typeName, "RichMedia")) {
-      annot = new AnnotRichMedia(doc, dict, obj);
+      annot = new AnnotRichMedia(doc, dictObject, obj);
     } else if (!strcmp(typeName, "Popup")) {
       /* Popup annots are already handled by markup annots
        * Here we only care about popup annots without a
        * markup annotation associated
        */
-      Object obj2;
-
-      if (dict->lookup("Parent", &obj2)->isNull())
-        annot = new AnnotPopup(doc, dict, obj);
+      Object obj2 = dictObject->dictLookup("Parent");
+      if (obj2.isNull())
+        annot = new AnnotPopup(doc, dictObject, obj);
       else
         annot = NULL;
-      
-      obj2.free();
     } else {
-      annot = new Annot(doc, dict, obj);
+      annot = new Annot(doc, dictObject, obj);
     }
   }
-  obj1.free();
 
   return annot;
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Annot.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Annot.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Annot.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -21,11 +21,11 @@
 // Copyright (C) 2008 Hugo Mercier <hmercier31 at gmail.com>
 // Copyright (C) 2008 Pino Toscano <pino at kde.org>
 // Copyright (C) 2008 Tomas Are Haavet <tomasare at gmail.com>
-// Copyright (C) 2009-2011, 2013, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009-2011, 2013, 2016, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2012, 2015 Tobias Koenig <tokoe at kdab.com>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
-// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -239,7 +239,7 @@
   virtual double *getDash() const { return dash; }
   virtual AnnotBorderStyle getStyle() const { return style; }
 
-  virtual void writeToObject(XRef *xref, Object *obj1) const = 0;
+  virtual Object writeToObject(XRef *xref) const = 0;
 
 protected:
   AnnotBorder();
@@ -270,8 +270,8 @@
   double getVerticalCorner() const { return verticalCorner; }
 
 private:
-  virtual AnnotBorderType getType() const { return typeArray; }
-  virtual void writeToObject(XRef *xref, Object *obj1) const;
+  AnnotBorderType getType() const override { return typeArray; }
+  Object writeToObject(XRef *xref) const override;
 
   double horizontalCorner;          // (Default 0)
   double verticalCorner;            // (Default 0)
@@ -289,8 +289,8 @@
   AnnotBorderBS(Dict *dict);
 
 private:
-  virtual AnnotBorderType getType() const { return typeBS; }
-  virtual void writeToObject(XRef *xref, Object *obj1) const;
+  AnnotBorderType getType() const override { return typeBS; }
+  Object writeToObject(XRef *xref) const override;
 
   const char *getStyleName() const;
 
@@ -324,7 +324,7 @@
   AnnotColorSpace getSpace() const { return (AnnotColorSpace) length; }
   const double *getValues() const { return values; }
 
-  void writeToObject(XRef *xref, Object *dest) const;
+  Object writeToObject(XRef *xref) const;
 
 private:
 
@@ -385,7 +385,7 @@
   ~AnnotAppearance();
 
   // State is ignored if no subdictionary is present
-  void getAppearanceStream(AnnotAppearanceType type, const char *state, Object *dest);
+  Object getAppearanceStream(AnnotAppearanceType type, const char *state);
 
   // Access keys in normal appearance subdictionary (N)
   GooString * getStateKey(int i);
@@ -555,8 +555,8 @@
   };
 
   Annot(PDFDoc *docA, PDFRectangle *rectA);
-  Annot(PDFDoc *docA, Dict *dict);
-  Annot(PDFDoc *docA, Dict *dict, Object *obj);
+  Annot(PDFDoc *docA, Object *dictObject);
+  Annot(PDFDoc *docA, Object *dictObject, Object *obj);
   GBool isOk() { return ok; }
 
   void incRefCnt();
@@ -564,7 +564,7 @@
 
   virtual void draw(Gfx *gfx, GBool printing);
   // Get the resource dict of the appearance stream
-  virtual Object *getAppearanceResDict(Object *dest);
+  virtual Object getAppearanceResDict();
 
   GBool match(Ref *refA)
     { return ref.num == refA->num && ref.gen == refA->gen; }
@@ -638,15 +638,15 @@
 		  double *width, double widthLimit, int *charCount,
 		  GBool noReencode);
   void writeString(GooString *str, GooString *appearBuf);
-  void createForm(double *bbox, GBool transparencyGroup, Object *resDict, Object *aStream);
-  void createResourcesDict(const char *formName, Object *formStream, const char *stateName,
-			   double opacity, const char *blendMode, Object *resDict);
+  Object createForm(double *bbox, GBool transparencyGroup, Dict *resDict);
+  Dict *createResourcesDict(const char *formName, Object &&formStream, const char *stateName,
+			   double opacity, const char *blendMode);
   GBool isVisible(GBool printing);
   int getRotation() const;
 
   // Updates the field key of the annotation dictionary
   // and sets M to the current time
-  void update(const char *key, Object *value);
+  void update(const char *key, Object &&value);
 
   // Delete appearance streams and reset appearance state
   void invalidateAppearance();
@@ -683,7 +683,7 @@
   GBool ok;
 
   bool hasRef;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 };
@@ -695,10 +695,9 @@
 class AnnotPopup: public Annot {
 public:
   AnnotPopup(PDFDoc *docA, PDFRectangle *rect);
-  AnnotPopup(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotPopup(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotPopup();
 
-  Object *getParent(Object *obj) { return parent.fetch (xref, obj); }
   Object *getParentNF() { return &parent; }
   void setParent(Object *parentA);
   void setParent(Annot *parentA);
@@ -724,8 +723,8 @@
   };
 
   AnnotMarkup(PDFDoc *docA, PDFRectangle *rect);
-  AnnotMarkup(PDFDoc *docA, Dict *dict, Object *obj);
-  virtual ~AnnotMarkup();
+  AnnotMarkup(PDFDoc *docA, Object *dictObject, Object *obj);
+  ~AnnotMarkup();
 
   // getters
   GooString *getLabel() const { return label; }
@@ -745,7 +744,7 @@
   void setDate(GooString *new_date);
 
 protected:
-  virtual void removeReferencedObjects();
+  void removeReferencedObjects() override;
 
   GooString *label;             // T            (Default autor)
   AnnotPopup *popup;            // Popup
@@ -784,10 +783,10 @@
   };
 
   AnnotText(PDFDoc *docA, PDFRectangle *rect);
-  AnnotText(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotText(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotText();
 
-  virtual void draw(Gfx *gfx, GBool printing);
+  void draw(Gfx *gfx, GBool printing) override;
 
   // getters
   GBool getOpen() const { return open; }
@@ -817,10 +816,10 @@
 class AnnotMovie: public Annot {
  public:
   AnnotMovie(PDFDoc *docA, PDFRectangle *rect, Movie *movieA);
-  AnnotMovie(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotMovie(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotMovie();
 
-  virtual void draw(Gfx *gfx, GBool printing);
+  void draw(Gfx *gfx, GBool printing) override;
 
   GooString* getTitle() { return title; }
   Movie* getMovie() { return movie; }
@@ -841,7 +840,7 @@
  public:
 
   AnnotScreen(PDFDoc *docA, PDFRectangle *rect);
-  AnnotScreen(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotScreen(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotScreen();
 
   GooString* getTitle() { return title; }
@@ -877,10 +876,10 @@
   };
 
   AnnotLink(PDFDoc *docA, PDFRectangle *rect);
-  AnnotLink(PDFDoc *docA, Dict *dict, Object *obj);
-  virtual ~AnnotLink();
+  AnnotLink(PDFDoc *docA, Object *dictObject, Object *obj);
+  ~AnnotLink();
 
-  virtual void draw(Gfx *gfx, GBool printing);
+  void draw(Gfx *gfx, GBool printing) override;
 
   // getters
   LinkAction *getAction() const { return action; }
@@ -919,12 +918,12 @@
   };
 
   AnnotFreeText(PDFDoc *docA, PDFRectangle *rect, GooString *da);
-  AnnotFreeText(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotFreeText(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotFreeText();
 
-  virtual void draw(Gfx *gfx, GBool printing);
-  virtual Object *getAppearanceResDict(Object *dest);
-  virtual void setContents(GooString *new_content);
+  void draw(Gfx *gfx, GBool printing) override;
+  Object getAppearanceResDict() override;
+  void setContents(GooString *new_content) override;
 
   void setAppearanceString(GooString *new_string);
   void setQuadding(AnnotFreeTextQuadding new_quadding);
@@ -983,12 +982,12 @@
   };
 
   AnnotLine(PDFDoc *docA, PDFRectangle *rect);
-  AnnotLine(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotLine(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotLine();
 
-  virtual void draw(Gfx *gfx, GBool printing);
-  virtual Object *getAppearanceResDict(Object *dest);
-  virtual void setContents(GooString *new_content);
+  void draw(Gfx *gfx, GBool printing) override;
+  Object getAppearanceResDict() override;
+  void setContents(GooString *new_content) override;
 
   void setVertices(double x1, double y1, double x2, double y2);
   void setStartEndStyle(AnnotLineEndingStyle start, AnnotLineEndingStyle end);
@@ -1049,10 +1048,10 @@
 public:
 
   AnnotTextMarkup(PDFDoc *docA, PDFRectangle *rect, AnnotSubtype subType);
-  AnnotTextMarkup(PDFDoc *docA, Dict *dict, Object *obj);
-  virtual ~AnnotTextMarkup();
+  AnnotTextMarkup(PDFDoc *docA, Object *dictObject, Object *obj);
+  ~AnnotTextMarkup();
 
-  virtual void draw(Gfx *gfx, GBool printing);
+  void draw(Gfx *gfx, GBool printing) override;
 
   // typeHighlight, typeUnderline, typeSquiggly or typeStrikeOut
   void setType(AnnotSubtype new_type);
@@ -1076,7 +1075,7 @@
 public:
 
   AnnotStamp(PDFDoc *docA, PDFRectangle *rect);
-  AnnotStamp(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotStamp(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotStamp();
 
   void setIcon(GooString *new_icon);
@@ -1099,10 +1098,10 @@
 public:
 
   AnnotGeometry(PDFDoc *docA, PDFRectangle *rect, AnnotSubtype subType);
-  AnnotGeometry(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotGeometry(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotGeometry();
 
-  virtual void draw(Gfx *gfx, GBool printing);
+  void draw(Gfx *gfx, GBool printing) override;
 
   void setType(AnnotSubtype new_type); // typeSquare or typeCircle
   void setInteriorColor(AnnotColor *new_color);
@@ -1135,10 +1134,10 @@
   };
 
   AnnotPolygon(PDFDoc *docA, PDFRectangle *rect, AnnotSubtype subType);
-  AnnotPolygon(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotPolygon(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotPolygon();
 
-  virtual void draw(Gfx *gfx, GBool printing);
+  void draw(Gfx *gfx, GBool printing) override;
 
   void setType(AnnotSubtype new_type); // typePolygon or typePolyLine
   void setVertices(AnnotPath *path);
@@ -1185,7 +1184,7 @@
   };
 
   AnnotCaret(PDFDoc *docA, PDFRectangle *rect);
-  AnnotCaret(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotCaret(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotCaret();
 
   void setSymbol(AnnotCaretSymbol new_symbol);
@@ -1210,10 +1209,10 @@
 public:
 
   AnnotInk(PDFDoc *docA, PDFRectangle *rect);
-  AnnotInk(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotInk(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotInk();
 
-  virtual void draw(Gfx *gfx, GBool printing);
+  void draw(Gfx *gfx, GBool printing) override;
 
   void setInkList(AnnotPath **paths, int n_paths);
 
@@ -1245,10 +1244,10 @@
 public:
 
   AnnotFileAttachment(PDFDoc *docA, PDFRectangle *rect, GooString *filename);
-  AnnotFileAttachment(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotFileAttachment(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotFileAttachment();
 
-  virtual void draw(Gfx *gfx, GBool printing);
+  void draw(Gfx *gfx, GBool printing) override;
 
   // getters
   Object *getFile() { return &file; }
@@ -1273,10 +1272,10 @@
 public:
 
   AnnotSound(PDFDoc *docA, PDFRectangle *rect, Sound *soundA);
-  AnnotSound(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotSound(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotSound();
 
-  virtual void draw(Gfx *gfx, GBool printing);
+  void draw(Gfx *gfx, GBool printing) override;
 
   // getters
   Sound *getSound() { return sound; }
@@ -1307,11 +1306,11 @@
     highlightModePush     // P,T
   };
 
-  AnnotWidget(PDFDoc *docA, Dict *dict, Object *obj);
-  AnnotWidget(PDFDoc *docA, Dict *dict, Object *obj, FormField *fieldA);
-  virtual ~AnnotWidget();
+  AnnotWidget(PDFDoc *docA, Object *dictObject, Object *obj);
+  AnnotWidget(PDFDoc *docA, Object *dictObject, Object *obj, FormField *fieldA);
+  ~AnnotWidget();
 
-  virtual void draw(Gfx *gfx, GBool printing);
+  void draw(Gfx *gfx, GBool printing) override;
 
   void drawBorder();
   void drawFormFieldButton(GfxResources *resources, GooString *da);
@@ -1398,7 +1397,7 @@
 public:
 
   Annot3D(PDFDoc *docA, PDFRectangle *rect);
-  Annot3D(PDFDoc *docA, Dict *dict, Object *obj);
+  Annot3D(PDFDoc *docA, Object *dictObject, Object *obj);
   ~Annot3D();
 
   // getters
@@ -1560,7 +1559,7 @@
   };
 
   AnnotRichMedia(PDFDoc *docA, PDFRectangle *rect);
-  AnnotRichMedia(PDFDoc *docA, Dict *dict, Object *obj);
+  AnnotRichMedia(PDFDoc *docA, Object *dictObject, Object *obj);
   ~AnnotRichMedia();
 
   Content* getContent() const;
@@ -1597,7 +1596,7 @@
   GBool removeAnnot(Annot *annot);
 
 private:
-  Annot* createAnnot(Dict* dict, Object *obj);
+  Annot* createAnnot(Object* dictObject, Object *obj);
   Annot *findAnnot(Ref *ref);
 
   PDFDoc *doc;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Array.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Array.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Array.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -16,7 +16,8 @@
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
-// Copyright (C) 2013 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2013, 2017 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -35,7 +36,7 @@
 #include "Object.h"
 #include "Array.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define arrayLocker()   MutexLocker locker(&mutex)
 #else
 #  define arrayLocker()
@@ -49,7 +50,7 @@
   elems = NULL;
   size = length = 0;
   ref = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -60,19 +61,18 @@
   for (i = 0; i < length; ++i)
     elems[i].free();
   gfree(elems);
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }
 
-Object *Array::copy(XRef *xrefA, Object *obj) {
+Object Array::copy(XRef *xrefA) const {
   arrayLocker();
-  obj->initArray(xrefA);
+  Array *a = new Array(xrefA);
   for (int i = 0; i < length; ++i) {
-    Object obj1;
-    obj->arrayAdd(elems[i].copy(&obj1));
+    a->add(elems[i].copy());
   }
-  return obj;
+  return Object(a);
 }
 
 int Array::incRef() {
@@ -87,7 +87,7 @@
   return ref;
 }
 
-void Array::add(Object *elem) {
+void Array::add(Object &&elem) {
   arrayLocker();
   if (length == size) {
     if (length == 0) {
@@ -97,7 +97,8 @@
     }
     elems = (Object *)greallocn(elems, size, sizeof(Object));
   }
-  elems[length] = *elem;
+  elems[length].initNullAfterMalloc();
+  elems[length] = std::move(elem);
   ++length;
 }
 
@@ -114,39 +115,36 @@
   memmove( elems + i, elems + i + 1, sizeof(elems[0]) * (length - i) );
 }
 
-Object *Array::get(int i, Object *obj, int recursion) {
+Object Array::get(int i, int recursion) const {
   if (i < 0 || i >= length) {
 #ifdef DEBUG_MEM
     abort();
 #else
-    return obj->initNull();
+    return Object(objNull);
 #endif
   }
-  return elems[i].fetch(xref, obj, recursion);
+  return elems[i].fetch(xref, recursion);
 }
 
-Object *Array::getNF(int i, Object *obj) {
+Object Array::getNF(int i) const {
   if (i < 0 || i >= length) {
 #ifdef DEBUG_MEM
     abort();
 #else
-    return obj->initNull();
+    return Object(objNull);
 #endif
   }
-  return elems[i].copy(obj);
+  return elems[i].copy();
 }
 
-GBool Array::getString(int i, GooString *string)
+GBool Array::getString(int i, GooString *string) const
 {
-  Object obj;
-
-  if (getNF(i, &obj)->isString()) {
+  Object obj = getNF(i);
+  if (obj.isString()) {
     string->clear();
     string->append(obj.getString());
-    obj.free();
     return gTrue;
   } else {
-    obj.free();
     return gFalse;
   }
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Array.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Array.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Array.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -16,6 +16,8 @@
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2017 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -48,36 +50,38 @@
   // Destructor.
   ~Array();
 
-  // Reference counting.
-  int incRef();
-  int decRef();
-
   // Get number of elements.
-  int getLength() { return length; }
+  int getLength() const { return length; }
 
   // Copy array with new xref
-  Object *copy(XRef *xrefA, Object *obj);
+  Object copy(XRef *xrefA) const;
 
-  // Add an element.
-  void add(Object *elem);
+  // Add an element
+  // elem becomes a dead object after this call
+  void add(Object &&elem);
 
   // Remove an element by position
   void remove(int i);
 
   // Accessors.
-  Object *get(int i, Object *obj, int resursion = 0);
-  Object *getNF(int i, Object *obj);
-  GBool getString(int i, GooString *string);
+  Object get(int i, int resursion = 0) const;
+  Object getNF(int i) const;
+  GBool getString(int i, GooString *string) const;
 
 private:
+  friend class Object; // for incRef/decRef
 
+  // Reference counting.
+  int incRef();
+  int decRef();
+
   XRef *xref;			// the xref table for this PDF file
   Object *elems;		// array of elements
   int size;			// size of <elems> array
   int length;			// number of elements in array
   int ref;			// reference count
-#if MULTITHREADED
-  GooMutex mutex;
+#ifdef MULTITHREADED
+  mutable GooMutex mutex;
 #endif
 };
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CMap.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CMap.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CMap.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -14,8 +14,9 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2008 Koji Otani <sho at bbr.jp>
-// Copyright (C) 2008, 2009 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2009, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2013 Fabio D'Urso <fabiodurso at hotmail.it>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -116,15 +117,11 @@
 }
 
 CMap *CMap::parse(CMapCache *cache, GooString *collectionA, Stream *str) {
-  Object obj1;
-  CMap *cMap;
-
-  cMap = new CMap(collectionA->copy(), NULL);
-
-  if (!str->getDict()->lookup("UseCMap", &obj1)->isNull()) {
+  CMap *cMap = new CMap(collectionA->copy(), NULL);
+  Object obj1 = str->getDict()->lookup("UseCMap");
+  if (!obj1.isNull()) {
     cMap->useCMap(cache, &obj1);
   }
-  obj1.free();
 
   str->reset();
   cMap->parse2(cache, &getCharFromStream, str);
@@ -316,7 +313,7 @@
     vector[i].cid = 0;
   }
   refCnt = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -328,7 +325,7 @@
   wMode = wModeA;
   vector = NULL;
   refCnt = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -436,7 +433,7 @@
   if (vector) {
     freeCMapVector(vector);
   }
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }
@@ -453,11 +450,11 @@
 }
 
 void CMap::incRefCnt() {
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gLockMutex(&mutex);
 #endif
   ++refCnt;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gUnlockMutex(&mutex);
 #endif
 }
@@ -465,11 +462,11 @@
 void CMap::decRefCnt() {
   GBool done;
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gLockMutex(&mutex);
 #endif
   done = --refCnt == 0;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gUnlockMutex(&mutex);
 #endif
   if (done) {

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CMap.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CMap.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CMap.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2008 Koji Otani <sho at bbr.jp>
 // Copyright (C) 2009 Albert Astals Cid <aacid at kde.org>
-// Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -33,7 +33,7 @@
 #include "goo/gtypes.h"
 #include "CharTypes.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #include "goo/GooMutex.h"
 #endif
 
@@ -114,7 +114,7 @@
   CMapVectorEntry *vector;	// vector for first byte (NULL for
 				//   identity CMap)
   int refCnt;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 };

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoFontEngine.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoFontEngine.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoFontEngine.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -17,11 +17,11 @@
 // Copyright (C) 2005-2007 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
-// Copyright (C) 2005, 2009, 2012, 2013, 2015 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2009, 2012, 2013, 2015, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006, 2007, 2010, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2007 Koji Otani <sho at bbr.jp>
 // Copyright (C) 2008, 2009 Chris Wilson <chris at chris-wilson.co.uk>
-// Copyright (C) 2008, 2012, 2014, 2016 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2008, 2012, 2014, 2016, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2009 Darren Kenny <darren.kenny at sun.com>
 // Copyright (C) 2010 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 // Copyright (C) 2010 Jan Kümmel <jan+freedesktop at snorc.org>
@@ -49,7 +49,7 @@
 #include "Gfx.h"
 #include "Page.h"
 
-#if HAVE_FCNTL_H && HAVE_SYS_MMAN_H && HAVE_SYS_STAT_H
+#if defined(HAVE_FCNTL_H) && defined(HAVE_SYS_MMAN_H) && defined(HAVE_SYS_STAT_H)
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
@@ -60,7 +60,7 @@
 #pragma implementation
 #endif
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define fontEngineLocker()   MutexLocker locker(&mutex)
 #else
 #  define fontEngineLocker()
@@ -207,7 +207,7 @@
   return gTrue;
 }
 
-#if CAN_CHECK_OPEN_FACES
+#ifdef CAN_CHECK_OPEN_FACES
 static struct _ft_face_data {
   struct _ft_face_data *prev, *next, **head;
 
@@ -708,7 +708,8 @@
   output_dev->startDoc(info->doc, info->fontEngine);
   output_dev->startPage (1, gfx->getState(), gfx->getXRef());
   output_dev->setInType3Char(gTrue);
-  gfx->display(charProcs->getVal(glyph, &charProc));
+  charProc = charProcs->getVal(glyph);
+  gfx->display(&charProc);
 
   output_dev->getType3GlyphWidth (&wx, &wy);
   cairo_matrix_transform_distance (&matrix, &wx, &wy);
@@ -727,7 +728,6 @@
 
   delete gfx;
   delete output_dev;
-  charProc.free();
 
   return CAIRO_STATUS_SUCCESS;
 }
@@ -817,7 +817,7 @@
   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 @@
     if (fontCache[i])
       delete fontCache[i];
   }
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoFontEngine.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoFontEngine.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoFontEngine.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -18,7 +18,7 @@
 // Copyright (C) 2005 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc at gnome.org>
-// Copyright (C) 2008 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2008, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 //
 // To see a description of the changes please see the Changelog file that
@@ -74,7 +74,7 @@
 class CairoFreeTypeFont : public CairoFont {
 public:
   static CairoFreeTypeFont *create(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs);
-  virtual ~CairoFreeTypeFont();
+  ~CairoFreeTypeFont();
 
 private:
   CairoFreeTypeFont(Ref ref, cairo_font_face_t *cairo_font_face,
@@ -88,9 +88,9 @@
   static CairoType3Font *create(GfxFont *gfxFont, PDFDoc *doc,
 				CairoFontEngine *fontEngine,
 				GBool printing, XRef *xref);
-  virtual ~CairoType3Font();
+  ~CairoType3Font();
 
-  virtual GBool matches(Ref &other, GBool printing);
+  GBool matches(Ref &other, GBool printing) override;
 
 private:
   CairoType3Font(Ref ref, PDFDoc *doc,
@@ -121,7 +121,7 @@
   CairoFont *fontCache[cairoFontCacheSize];
   FT_Library lib;
   GBool useCIDs;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 };

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoOutputDev.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoOutputDev.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoOutputDev.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -16,11 +16,11 @@
 //
 // Copyright (C) 2005-2008 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005, 2009, 2012 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2009, 2012, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Nickolay V. Shmyrev <nshmyrev at yandex.ru>
-// Copyright (C) 2006-2011, 2013, 2014 Carlos Garcia Campos <carlosgc at gnome.org>
+// Copyright (C) 2006-2011, 2013, 2014, 2017 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2008 Carl Worth <cworth at cworth.org>
-// Copyright (C) 2008-2016 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2008-2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2008 Michael Vrable <mvrable at cs.ucsd.edu>
 // Copyright (C) 2008, 2009 Chris Wilson <chris at chris-wilson.co.uk>
 // Copyright (C) 2008, 2012 Hib Eris <hib at hiberis.nl>
@@ -41,6 +41,7 @@
 #pragma implementation
 #endif
 
+#include <cstdint>
 #include <string.h>
 #include <math.h>
 #include <assert.h>
@@ -47,7 +48,6 @@
 #include <cairo.h>
 
 #include "goo/gfile.h"
-#include "goo/gtypes_p.h"
 #include "GlobalParams.h"
 #include "Error.h"
 #include "Object.h"
@@ -143,7 +143,11 @@
   strokePathClip = NULL;
   cairo = NULL;
   currentFont = NULL;
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0)
+  prescaleImages = gFalse;
+#else
   prescaleImages = gTrue;
+#endif
   printing = gTrue;
   use_show_text_glyphs = gFalse;
   inUncoloredPattern = gFalse;
@@ -165,7 +169,7 @@
 
   // the SA parameter supposedly defaults to false, but Acrobat
   // apparently hardwires it to true
-  stroke_adjust = globalParams->getStrokeAdjust();
+  stroke_adjust = gTrue;
   align_stroke_coords = gFalse;
   adjusted_stroke_width = gFalse;
   xref = NULL;
@@ -1830,7 +1834,7 @@
     /* convert to a luminocity map */
     uint32_t *source_data = (uint32_t*)cairo_image_surface_get_data(source);
     /* get stride in units of 32 bits */
-    int stride = cairo_image_surface_get_stride(source)/4;
+    ptrdiff_t stride = cairo_image_surface_get_stride(source)/4;
     for (int y=0; y<height; y++) {
       for (int x=0; x<width; x++) {
 	int lum = alpha ? fill_opacity : luminocity(source_data[y*stride + x]);
@@ -1961,7 +1965,7 @@
 				    GBool interpolate)
 {
   if (interpolate)
-    return CAIRO_FILTER_BILINEAR;
+    return CAIRO_FILTER_BEST;
 
   int orig_width = cairo_image_surface_get_width (image);
   int orig_height = cairo_image_surface_get_height (image);
@@ -1981,7 +1985,7 @@
   if (scaled_width / orig_width >= 4 || scaled_height / orig_height >= 4)
 	  return CAIRO_FILTER_NEAREST;
 
-  return CAIRO_FILTER_BILINEAR;
+  return CAIRO_FILTER_BEST;
 }
 
 void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
@@ -2123,7 +2127,7 @@
   Guchar *pix;
   cairo_matrix_t matrix;
   int invert_bit;
-  int row_stride;
+  ptrdiff_t row_stride;
   cairo_filter_t filter;
 
   /* TODO: Do we want to cache these? */
@@ -2174,9 +2178,6 @@
 
   cairo_pattern_set_filter (pattern, filter);
 
-  if (!printing)
-    cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
-
   cairo_matrix_init_translate (&matrix, 0, height);
   cairo_matrix_scale (&matrix, width, -height);
   cairo_pattern_set_matrix (pattern, &matrix);
@@ -2192,6 +2193,11 @@
     cairo_save (cairo);
     cairo_rectangle (cairo, 0., 0., 1., 1.);
     cairo_clip (cairo);
+    if (strokePathClip) {
+      cairo_push_group (cairo);
+      fillToStrokePathClip (state);
+      cairo_pop_group_to_source (cairo);
+    }
     cairo_mask (cairo, pattern);
     cairo_restore (cairo);
   } else {
@@ -2228,7 +2234,7 @@
   Guchar *pix;
   cairo_matrix_t matrix;
   int invert_bit;
-  int row_stride;
+  ptrdiff_t row_stride;
 
   /* cairo does a very poor job of scaling down images so we scale them ourselves */
 
@@ -2521,7 +2527,7 @@
 				     GBool maskInterpolate)
 {
   ImageStream *maskImgStr, *imgStr;
-  int row_stride;
+  ptrdiff_t row_stride;
   unsigned char *maskBuffer, *buffer;
   unsigned char *maskDest;
   unsigned int *dest;
@@ -2679,7 +2685,7 @@
 					 GBool maskInterpolate)
 {
   ImageStream *maskImgStr, *imgStr;
-  int row_stride;
+  ptrdiff_t row_stride;
   unsigned char *maskBuffer, *buffer;
   unsigned char *maskDest;
   unsigned int *dest;
@@ -2708,7 +2714,9 @@
   for (y = 0; y < maskHeight; y++) {
     maskDest = (unsigned char *) (maskBuffer + y * row_stride);
     pix = maskImgStr->getLine();
-    maskColorMap->getGrayLine (pix, maskDest, maskWidth);
+    if (likely(pix != nullptr)) {
+        maskColorMap->getGrayLine (pix, maskDest, maskWidth);
+    }
   }
 
   maskImgStr->close();
@@ -2956,9 +2964,8 @@
       return;
   }
 
-  str->getDict()->lookup("ColorSpace", &obj);
+  obj = str->getDict()->lookup("ColorSpace");
   colorSpace = GfxColorSpace::parse(NULL, &obj, this, state);
-  obj.free();
 
   // colorspace in stream dict may be different from colorspace in jpx
   // data
@@ -3072,10 +3079,16 @@
       }
     }
 
-    if (printing || scaledWidth >= width || scaledHeight >= height) {
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0)
+    bool needsCustomDownscaling = false;
+#else
+    bool needsCustomDownscaling = true;
+#endif
+
+    if (!needsCustomDownscaling || printing || scaledWidth >= width || scaledHeight >= height) {
       // No downscaling. Create cairo image containing the source image data.
       unsigned char *buffer;
-      int stride;
+      ptrdiff_t stride;
 
       image = cairo_image_surface_create (maskColors ?
                                           CAIRO_FORMAT_ARGB32 :
@@ -3119,7 +3132,7 @@
     return image;
   }
 
-  void getRow(int row_num, uint32_t *row_data) {
+  void getRow(int row_num, uint32_t *row_data) override {
     int i;
     Guchar *pix;
 
@@ -3186,7 +3199,7 @@
   cairo_matrix_t matrix;
   int width, height;
   int scaledWidth, scaledHeight;
-  cairo_filter_t filter = CAIRO_FILTER_BILINEAR;
+  cairo_filter_t filter = CAIRO_FILTER_BEST;
   RescaleDrawImage rescale;
 
   LOG (printf ("drawImage %dx%d\n", widthA, heightA));

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoOutputDev.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoOutputDev.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoOutputDev.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -97,121 +97,121 @@
 
   // Does this device use upside-down coordinates?
   // (Upside-down means (0,0) is the top left corner of the page.)
-  virtual GBool upsideDown() { return gTrue; }
+  GBool upsideDown() override { return gTrue; }
 
   // Does this device use drawChar() or drawString()?
-  virtual GBool useDrawChar() { return gTrue; }
+  GBool useDrawChar() override { return gTrue; }
 
   // Does this device use tilingPatternFill()?  If this returns false,
   // tiling pattern fills will be reduced to a series of other drawing
   // operations.
-  virtual GBool useTilingPatternFill() { return gTrue; }
+  GBool useTilingPatternFill() override { return gTrue; }
 
   // Does this device use functionShadedFill(), axialShadedFill(), and
   // radialShadedFill()?  If this returns false, these shaded fills
   // will be reduced to a series of other drawing operations.
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
-  virtual GBool useShadedFills(int type) { return type <= 7; }
+  GBool useShadedFills(int type) override { return type <= 7; }
 #else
-  virtual GBool useShadedFills(int type) { return type > 1 && type < 4; }
+  GBool useShadedFills(int type) override { return type > 1 && type < 4; }
 #endif
 
   // Does this device use FillColorStop()?
-  virtual GBool useFillColorStop() { return gTrue; }
+  GBool useFillColorStop() override { return gTrue; }
 
   // Does this device use beginType3Char/endType3Char?  Otherwise,
   // text in Type 3 fonts will be drawn with drawChar/drawString.
-  virtual GBool interpretType3Chars() { return gFalse; }
+  GBool interpretType3Chars() override { return gFalse; }
 
   // Does this device need to clip pages to the crop box even when the
   // box is the crop box?
-  virtual GBool needClipToCropBox() { return gTrue; }
+  GBool needClipToCropBox() override { return gTrue; }
 
   //----- initialization and control
 
   // Start a page.
-  virtual void startPage(int pageNum, GfxState *state, XRef *xref);
+  void startPage(int pageNum, GfxState *state, XRef *xref) override;
 
   // End a page.
-  virtual void endPage();
+  void endPage() override;
 
   //----- save/restore graphics state
-  virtual void saveState(GfxState *state);
-  virtual void restoreState(GfxState *state);
+  void saveState(GfxState *state) override;
+  void restoreState(GfxState *state) override;
 
   //----- update graphics state
-  virtual void updateAll(GfxState *state);
-  virtual void setDefaultCTM(double *ctm);
-  virtual void updateCTM(GfxState *state, double m11, double m12,
-			 double m21, double m22, double m31, double m32);
-  virtual void updateLineDash(GfxState *state);
-  virtual void updateFlatness(GfxState *state);
-  virtual void updateLineJoin(GfxState *state);
-  virtual void updateLineCap(GfxState *state);
-  virtual void updateMiterLimit(GfxState *state);
-  virtual void updateLineWidth(GfxState *state);
-  virtual void updateFillColor(GfxState *state);
-  virtual void updateStrokeColor(GfxState *state);
-  virtual void updateFillOpacity(GfxState *state);
-  virtual void updateStrokeOpacity(GfxState *state);
-  virtual void updateFillColorStop(GfxState *state, double offset);
-  virtual void updateBlendMode(GfxState *state);
+  void updateAll(GfxState *state) override;
+  void setDefaultCTM(double *ctm) override;
+  void updateCTM(GfxState *state, double m11, double m12,
+		 double m21, double m22, double m31, double m32) override;
+  void updateLineDash(GfxState *state) override;
+  void updateFlatness(GfxState *state) override;
+  void updateLineJoin(GfxState *state) override;
+  void updateLineCap(GfxState *state) override;
+  void updateMiterLimit(GfxState *state) override;
+  void updateLineWidth(GfxState *state) override;
+  void updateFillColor(GfxState *state) override;
+  void updateStrokeColor(GfxState *state) override;
+  void updateFillOpacity(GfxState *state) override;
+  void updateStrokeOpacity(GfxState *state) override;
+  void updateFillColorStop(GfxState *state, double offset) override;
+  void updateBlendMode(GfxState *state) override;
 
   //----- update text state
-  virtual void updateFont(GfxState *state);
+  void updateFont(GfxState *state) override;
 
   //----- path painting
-  virtual void stroke(GfxState *state);
-  virtual void fill(GfxState *state);
-  virtual void eoFill(GfxState *state);
-  virtual void clipToStrokePath(GfxState *state);
-  virtual GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
-				  double *pmat, int paintType, int tilingType, Dict *resDict,
-				  double *mat, double *bbox,
-				  int x0, int y0, int x1, int y1,
-				  double xStep, double yStep);
+  void stroke(GfxState *state) override;
+  void fill(GfxState *state) override;
+  void eoFill(GfxState *state) override;
+  void clipToStrokePath(GfxState *state) override;
+  GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
+			  double *pmat, int paintType, int tilingType, Dict *resDict,
+			  double *mat, double *bbox,
+			  int x0, int y0, int x1, int y1,
+			  double xStep, double yStep) override;
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
-  virtual GBool functionShadedFill(GfxState *state, GfxFunctionShading *shading);
+  GBool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override;
 #endif
-  virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax);
-  virtual GBool axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading);
-  virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax);
-  virtual GBool radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading);
+  GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override;
+  GBool axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) override;
+  GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) override;
+  GBool radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) override;
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
-  virtual GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading);
-  virtual GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading);
+  GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) override;
+  GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override;
 #endif
 
   //----- path clipping
-  virtual void clip(GfxState *state);
-  virtual void eoClip(GfxState *state);
+  void clip(GfxState *state) override;
+  void eoClip(GfxState *state) override;
 
   //----- text drawing
-  void beginString(GfxState *state, GooString *s);
-  void endString(GfxState *state);
+  void beginString(GfxState *state, GooString *s) override;
+  void endString(GfxState *state) override;
   void drawChar(GfxState *state, double x, double y,
 		double dx, double dy,
 		double originX, double originY,
-		CharCode code, int nBytes, Unicode *u, int uLen);
-  void beginActualText(GfxState *state, GooString *text);
-  void endActualText(GfxState *state);
+		CharCode code, int nBytes, Unicode *u, int uLen) override;
+  void beginActualText(GfxState *state, GooString *text) override;
+  void endActualText(GfxState *state) override;
 
-  virtual GBool beginType3Char(GfxState *state, double x, double y,
-			       double dx, double dy,
-			       CharCode code, Unicode *u, int uLen);
-  virtual void endType3Char(GfxState *state);
-  virtual void beginTextObject(GfxState *state);
-  virtual void endTextObject(GfxState *state);
+  GBool beginType3Char(GfxState *state, double x, double y,
+		       double dx, double dy,
+		       CharCode code, Unicode *u, int uLen) override;
+  void endType3Char(GfxState *state) override;
+  void beginTextObject(GfxState *state) override;
+  void endTextObject(GfxState *state) override;
 
   //----- image drawing
-  virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
-			     int width, int height, GBool invert, GBool interpolate,
-			     GBool inlineImg);
-  virtual void setSoftMaskFromImageMask(GfxState *state,
-					Object *ref, Stream *str,
-					int width, int height, GBool invert,
-					GBool inlineImg, double *baseMatrix);
-  virtual void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix);
+  void drawImageMask(GfxState *state, Object *ref, Stream *str,
+		     int width, int height, GBool invert, GBool interpolate,
+		     GBool inlineImg) override;
+  void setSoftMaskFromImageMask(GfxState *state,
+				Object *ref, Stream *str,
+				int width, int height, GBool invert,
+				GBool inlineImg, double *baseMatrix) override;
+  void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override;
   void drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str,
 			      int width, int height, GBool invert, GBool interpolate,
 			      GBool inlineImg);
@@ -219,42 +219,42 @@
 			    int width, int height, GBool invert, GBool interpolate,
 			    GBool inlineImg);
 
-  virtual void drawImage(GfxState *state, Object *ref, Stream *str,
-			 int width, int height, GfxImageColorMap *colorMap,
-			 GBool interpolate, int *maskColors, GBool inlineImg);
-  virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
-				   int width, int height,
-				   GfxImageColorMap *colorMap,
-				   GBool interpolate,
-				   Stream *maskStr,
-				   int maskWidth, int maskHeight,
-				   GfxImageColorMap *maskColorMap,
-				   GBool maskInterpolate);
+  void drawImage(GfxState *state, Object *ref, Stream *str,
+		 int width, int height, GfxImageColorMap *colorMap,
+		 GBool interpolate, int *maskColors, GBool inlineImg) override;
+  void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
+			   int width, int height,
+			   GfxImageColorMap *colorMap,
+			   GBool interpolate,
+			   Stream *maskStr,
+			   int maskWidth, int maskHeight,
+			   GfxImageColorMap *maskColorMap,
+			   GBool maskInterpolate) override;
 
-  virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
-			       int width, int height,
-			       GfxImageColorMap *colorMap,
-			       GBool interpolate,
-			       Stream *maskStr,
-			       int maskWidth, int maskHeight,
-			       GBool maskInvert, GBool maskInterpolate);
+  void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
+		       int width, int height,
+		       GfxImageColorMap *colorMap,
+		       GBool interpolate,
+		       Stream *maskStr,
+		       int maskWidth, int maskHeight,
+		       GBool maskInvert, GBool maskInterpolate) override;
 
   //----- transparency groups and soft masks
-  virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
+  void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
                                       GfxColorSpace * /*blendingColorSpace*/,
                                       GBool /*isolated*/, GBool /*knockout*/,
-                                      GBool /*forSoftMask*/);
-  virtual void endTransparencyGroup(GfxState * /*state*/);
+                                      GBool /*forSoftMask*/) override;
+  void endTransparencyGroup(GfxState * /*state*/) override;
   void popTransparencyGroup();
-  virtual void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/);
-  virtual void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/,
-                           Function * /*transferFunc*/, GfxColor * /*backdropColor*/);
-  virtual void clearSoftMask(GfxState * /*state*/);
+  void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) override;
+  void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/,
+		   Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override;
+  void clearSoftMask(GfxState * /*state*/) override;
 
   //----- Type 3 font operators
-  virtual void type3D0(GfxState *state, double wx, double wy);
-  virtual void type3D1(GfxState *state, double wx, double wy,
-      double llx, double lly, double urx, double ury);
+  void type3D0(GfxState *state, double wx, double wy) override;
+  void type3D1(GfxState *state, double wx, double wy,
+	       double llx, double lly, double urx, double ury) override;
 
   //----- special access
   
@@ -388,118 +388,118 @@
 
   // Does this device use upside-down coordinates?
   // (Upside-down means (0,0) is the top left corner of the page.)
-  virtual GBool upsideDown() { return gTrue; }
+  GBool upsideDown() override { return gTrue; }
 
   // Does this device use drawChar() or drawString()?
-  virtual GBool useDrawChar() { return gFalse; }
+  GBool useDrawChar() override { return gFalse; }
 
   // Does this device use tilingPatternFill()?  If this returns false,
   // tiling pattern fills will be reduced to a series of other drawing
   // operations.
-  virtual GBool useTilingPatternFill() { return gTrue; }
+  GBool useTilingPatternFill() override { return gTrue; }
 
   // Does this device use functionShadedFill(), axialShadedFill(), and
   // radialShadedFill()?  If this returns false, these shaded fills
   // will be reduced to a series of other drawing operations.
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2)
-  virtual GBool useShadedFills(int type) { return type <= 7; }
+  GBool useShadedFills(int type) override { return type <= 7; }
 #else
-  virtual GBool useShadedFills(int type) { return type < 4; }
+  GBool useShadedFills(int type) override { return type < 4; }
 #endif
 
   // Does this device use FillColorStop()?
-  virtual GBool useFillColorStop() { return gFalse; }
+  GBool useFillColorStop() override { return gFalse; }
 
   // Does this device use beginType3Char/endType3Char?  Otherwise,
   // text in Type 3 fonts will be drawn with drawChar/drawString.
-  virtual GBool interpretType3Chars() { return gFalse; }
+  GBool interpretType3Chars() override { return gFalse; }
 
   // Does this device need non-text content?
-  virtual GBool needNonText() { return gTrue; }
+  GBool needNonText() override { return gTrue; }
 
   //----- save/restore graphics state
-  virtual void saveState(GfxState *state) { }
-  virtual void restoreState(GfxState *state) { }
+  void saveState(GfxState *state) override { }
+  void restoreState(GfxState *state) override { }
 
   //----- update graphics state
-  virtual void updateAll(GfxState *state) { }
-  virtual void setDefaultCTM(double *ctm) { }
-  virtual void updateCTM(GfxState *state, double m11, double m12,
-				 double m21, double m22, double m31, double m32) { }
-  virtual void updateLineDash(GfxState *state) { }
-  virtual void updateFlatness(GfxState *state) { }
-  virtual void updateLineJoin(GfxState *state) { }
-  virtual void updateLineCap(GfxState *state) { }
-  virtual void updateMiterLimit(GfxState *state) { }
-  virtual void updateLineWidth(GfxState *state) { }
-  virtual void updateFillColor(GfxState *state) { }
-  virtual void updateStrokeColor(GfxState *state) { }
-  virtual void updateFillOpacity(GfxState *state) { }
-  virtual void updateStrokeOpacity(GfxState *state) { }
-  virtual void updateBlendMode(GfxState *state) { }
+  void updateAll(GfxState *state) override { }
+  void setDefaultCTM(double *ctm) override { }
+  void updateCTM(GfxState *state, double m11, double m12,
+		 double m21, double m22, double m31, double m32) override { }
+  void updateLineDash(GfxState *state) override { }
+  void updateFlatness(GfxState *state) override { }
+  void updateLineJoin(GfxState *state) override { }
+  void updateLineCap(GfxState *state) override { }
+  void updateMiterLimit(GfxState *state) override { }
+  void updateLineWidth(GfxState *state) override { }
+  void updateFillColor(GfxState *state) override { }
+  void updateStrokeColor(GfxState *state) override { }
+  void updateFillOpacity(GfxState *state) override { }
+  void updateStrokeOpacity(GfxState *state) override { }
+  void updateBlendMode(GfxState *state) override { }
 
   //----- update text state
-  virtual void updateFont(GfxState *state) { }
+  void updateFont(GfxState *state) override { }
 
   //----- path painting
-  virtual void stroke(GfxState *state) { }
-  virtual void fill(GfxState *state) { }
-  virtual void eoFill(GfxState *state) { }
-  virtual void clipToStrokePath(GfxState *state) { }
-  virtual GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
-				  double *pmat, int paintType, int tilingType, Dict *resDict,
-				  double *mat, double *bbox,
-				  int x0, int y0, int x1, int y1,
-				  double xStep, double yStep) { return gTrue; }
-  virtual GBool axialShadedFill(GfxState *state,
-				GfxAxialShading *shading,
-				double tMin, double tMax) { return gTrue; }
-  virtual GBool radialShadedFill(GfxState *state,
-				 GfxRadialShading *shading,
-				 double sMin, double sMax) { return gTrue; }
+  void stroke(GfxState *state) override { }
+  void fill(GfxState *state) override { }
+  void eoFill(GfxState *state) override { }
+  void clipToStrokePath(GfxState *state) override { }
+  GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
+			  double *pmat, int paintType, int tilingType, Dict *resDict,
+			  double *mat, double *bbox,
+			  int x0, int y0, int x1, int y1,
+			  double xStep, double yStep) override { return gTrue; }
+  GBool axialShadedFill(GfxState *state,
+			GfxAxialShading *shading,
+			double tMin, double tMax) override { return gTrue; }
+  GBool radialShadedFill(GfxState *state,
+			 GfxRadialShading *shading,
+			 double sMin, double sMax) override { return gTrue; }
 
   //----- path clipping
-  virtual void clip(GfxState *state) { }
-  virtual void eoClip(GfxState *state) { }
+  void clip(GfxState *state) override { }
+  void eoClip(GfxState *state) override { }
 
   //----- image drawing
-  virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
-			     int width, int height, GBool invert,
-			     GBool interpolate, GBool inlineImg);
-  virtual void drawImage(GfxState *state, Object *ref, Stream *str,
-			 int width, int height, GfxImageColorMap *colorMap,
-			 GBool interpolate, int *maskColors, GBool inlineImg);
-  virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
-				   int width, int height,
-				   GfxImageColorMap *colorMap,
-				   GBool interpolate,
-				   Stream *maskStr,
-				   int maskWidth, int maskHeight,
-				   GfxImageColorMap *maskColorMap,
-				   GBool maskInterpolate);
-  virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
-			       int width, int height,
-			       GfxImageColorMap *colorMap,
-			       GBool interpolate,
-			       Stream *maskStr,
-			       int maskWidth, int maskHeight,
-			       GBool maskInvert, GBool maskInterpolate);
-  virtual void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str,
-                                        int width, int height, GBool invert,
-                                        GBool inlineImg, double *baseMatrix);
-  virtual void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) {}
+  void drawImageMask(GfxState *state, Object *ref, Stream *str,
+		     int width, int height, GBool invert,
+		     GBool interpolate, GBool inlineImg) override;
+  void drawImage(GfxState *state, Object *ref, Stream *str,
+		 int width, int height, GfxImageColorMap *colorMap,
+		 GBool interpolate, int *maskColors, GBool inlineImg) override;
+  void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
+			   int width, int height,
+			   GfxImageColorMap *colorMap,
+			   GBool interpolate,
+			   Stream *maskStr,
+			   int maskWidth, int maskHeight,
+			   GfxImageColorMap *maskColorMap,
+			   GBool maskInterpolate) override;
+  void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
+		       int width, int height,
+		       GfxImageColorMap *colorMap,
+		       GBool interpolate,
+		       Stream *maskStr,
+		       int maskWidth, int maskHeight,
+		       GBool maskInvert, GBool maskInterpolate) override;
+  void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str,
+				int width, int height, GBool invert,
+				GBool inlineImg, double *baseMatrix) override;
+  void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override {}
 
 
   //----- transparency groups and soft masks
-  virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
-				      GfxColorSpace * /*blendingColorSpace*/,
-				      GBool /*isolated*/, GBool /*knockout*/,
-				      GBool /*forSoftMask*/) {}
-  virtual void endTransparencyGroup(GfxState * /*state*/) {}
-  virtual void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) {}
-  virtual void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/,
-			   Function * /*transferFunc*/, GfxColor * /*backdropColor*/) {}
-  virtual void clearSoftMask(GfxState * /*state*/) {}
+  void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
+			      GfxColorSpace * /*blendingColorSpace*/,
+			      GBool /*isolated*/, GBool /*knockout*/,
+			      GBool /*forSoftMask*/) override {}
+  void endTransparencyGroup(GfxState * /*state*/) override {}
+  void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) override {}
+  void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/,
+		   Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override {}
+  void clearSoftMask(GfxState * /*state*/) override {}
 
   //----- Image list
   // By default images are not rendred

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CairoRescaleBox.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -31,7 +31,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2012 Hib Eris <hib at hiberis.nl>
-// Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -41,10 +41,9 @@
 
 /* This implements a box filter that supports non-integer box sizes */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
+#include <cstdint>
 #include <stdint.h>
 #include <stdio.h>
 #include <assert.h>
@@ -51,7 +50,6 @@
 #include <stdlib.h>
 #include <math.h>
 #include "goo/gmem.h"
-#include "goo/gtypes_p.h"
 #include "CairoRescaleBox.h"
 
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Catalog.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Catalog.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Catalog.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005-2013, 2015 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2013, 2015, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Jeff Muizelaar <jrmuizel at nit.ca>
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2005 Marco Pesenti Gritti <mpg at redhat.com>
@@ -28,7 +28,7 @@
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2013 Julien Nabet <serval2412 at yahoo.fr>
 // Copyright (C) 2013 Adrian Perez de Castro <aperez at igalia.com>
-// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 José Aliste <jaliste at src.gnome.org>
 // Copyright (C) 2014 Ed Porras <ed at moto-research.com>
 // Copyright (C) 2015 Even Rouault <even.rouault at spatialys.com>
@@ -64,7 +64,7 @@
 #include "FileSpec.h"
 #include "StructTreeRoot.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define catalogLocker()   MutexLocker locker(&mutex)
 #else
 #  define catalogLocker()
@@ -74,11 +74,7 @@
 //------------------------------------------------------------------------
 
 Catalog::Catalog(PDFDoc *docA) {
-  Object catDict, pagesDict, pagesDictRef;
-  Object obj, obj2;
-  Object optContentProps;
-
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
   ok = gTrue;
@@ -107,25 +103,27 @@
   lastCachedPage = 0;
   markInfo = markInfoNull;
 
-  xref->getCatalog(&catDict);
+  Object catDict = xref->getCatalog();
   if (!catDict.isDict()) {
     error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
-    goto err1;
+    ok = gFalse;
+    return;
   }
   // get the AcroForm dictionary
-  catDict.dictLookup("AcroForm", &acroForm);
+  acroForm = catDict.dictLookup("AcroForm");
 
   // read base URI
-  if (catDict.dictLookup("URI", &obj)->isDict()) {
-    if (obj.dictLookup("Base", &obj2)->isString()) {
+  Object obj = catDict.dictLookup("URI");
+  if (obj.isDict()) {
+    Object obj2 = obj.dictLookup("Base");
+    if (obj2.isString()) {
       baseURI = obj2.getString()->copy();
     }
-    obj2.free();
   }
-  obj.free();
 
   // get the Optional Content dictionary
-  if (catDict.dictLookup("OCProperties", &optContentProps)->isDict()) {
+  Object optContentProps = catDict.dictLookup("OCProperties");
+  if (optContentProps.isDict()) {
     optContent = new OCGs(&optContentProps, xref);
     if (!optContent->isOk ()) {
       delete optContent;
@@ -132,19 +130,12 @@
       optContent = NULL;
     }
   }
-  optContentProps.free();
 
   // actions
-  catDict.dictLookupNF("AA", &additionalActions);
+  additionalActions = catDict.dictLookupNF("AA");
 
   // get the ViewerPreferences dictionary
-  catDict.dictLookup("ViewerPreferences", &viewerPreferences);
-  catDict.free();
-  return;
-
- err1:
-  catDict.free();
-  ok = gFalse;
+  viewerPreferences = catDict.dictLookup("ViewerPreferences");
 }
 
 Catalog::~Catalog() {
@@ -157,15 +148,7 @@
     delete attrsList;
   }
   delete pagesRefList;
-  if (pagesList) {
-    std::vector<Dict *>::iterator it;
-    for (it = pagesList->begin() ; it != pagesList->end(); ++it ) {
-      if (!(*it)->decRef()) {
-         delete *it;
-      }
-    }
-    delete pagesList;
-  }
+  delete pagesList;
   if (pages) {
     for (int i = 0; i < pagesSize; ++i) {
       if (pages[i]) {
@@ -175,8 +158,6 @@
     gfree(pages);
   }
   gfree(pageRefs);
-  names.free();
-  dests.free();
   delete destNameTree;
   delete embeddedFileNameTree;
   delete jsNameTree;
@@ -188,45 +169,32 @@
   delete optContent;
   delete viewerPrefs;
   delete structTreeRoot;
-  metadata.free();
-  outline.free();
-  acroForm.free();
-  viewerPreferences.free();
-  additionalActions.free();
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }
 
 GooString *Catalog::readMetadata() {
-  GooString *s;
-  Dict *dict;
-  Object obj;
-
   catalogLocker();
   if (metadata.isNone()) {
-    Object catDict;
-
-    xref->getCatalog(&catDict);
+    Object catDict = xref->getCatalog();
     if (catDict.isDict()) {
-      catDict.dictLookup("Metadata", &metadata);
+      metadata = catDict.dictLookup("Metadata");
     } else {
       error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
-      metadata.initNull();
+      metadata.setToNull();
     }
-    catDict.free();
   }
 
   if (!metadata.isStream()) {
-    return NULL;
+    return nullptr;
   }
-  dict = metadata.streamGetDict();
-  if (!dict->lookup("Subtype", &obj)->isName("XML")) {
+  Object obj = metadata.streamGetDict()->lookup("Subtype");
+  if (!obj.isName("XML")) {
     error(errSyntaxWarning, -1, "Unknown Metadata type: '{0:s}'",
 	  obj.isName() ? obj.getName() : "???");
   }
-  obj.free();
-  s = new GooString();
+  GooString *s = new GooString();
   metadata.getStream()->fillGooString(s);
   metadata.streamClose();
   return s;
@@ -262,47 +230,32 @@
 
 GBool Catalog::cachePageTree(int page)
 {
-  Dict *pagesDict;
-
   if (pagesList == NULL) {
 
-    Object catDict;
     Ref pagesRef;
 
-    xref->getCatalog(&catDict);
+    Object catDict = xref->getCatalog();
 
     if (catDict.isDict()) {
-      Object pagesDictRef;
-      if (catDict.dictLookupNF("Pages", &pagesDictRef)->isRef() &&
+      Object pagesDictRef = catDict.dictLookupNF("Pages");
+      if (pagesDictRef.isRef() &&
           pagesDictRef.getRefNum() >= 0 &&
           pagesDictRef.getRefNum() < xref->getNumObjects()) {
         pagesRef = pagesDictRef.getRef();
-        pagesDictRef.free();
       } else {
         error(errSyntaxError, -1, "Catalog dictionary does not contain a valid \"Pages\" entry");
-        pagesDictRef.free();
-        catDict.free();
         return gFalse;
       }
     } else {
       error(errSyntaxError, -1, "Could not find catalog dictionary");
-      catDict.free();
       return gFalse;
     }
 
-    Object obj;
-    catDict.dictLookup("Pages", &obj);
-    catDict.free();
+    Object obj = catDict.dictLookup("Pages");
     // This should really be isDict("Pages"), but I've seen at least one
     // PDF file where the /Type entry is missing.
-    if (obj.isDict()) {
-      obj.getDict()->incRef();
-      pagesDict = obj.getDict();
-      obj.free();
-    }
-    else {
+    if (!obj.isDict()) {
       error(errSyntaxError, -1, "Top-level pages object is wrong type ({0:s})", obj.getTypeName());
-      obj.free();
       return gFalse;
     }
 
@@ -311,7 +264,6 @@
     pageRefs = (Ref *)gmallocn_checkoverflow(pagesSize, sizeof(Ref));
     if (pages == NULL || pageRefs == NULL ) {
       error(errSyntaxError, -1, "Cannot allocate page cache");
-      pagesDict->decRef();
       pagesSize = 0;
       return gFalse;
     }
@@ -321,12 +273,12 @@
       pageRefs[i].gen = -1;
     }
 
-    pagesList = new std::vector<Dict *>();
-    pagesList->push_back(pagesDict);
+    attrsList = new std::vector<PageAttrs *>();
+    attrsList->push_back(new PageAttrs(NULL, obj.getDict()));
+    pagesList = new std::vector<Object>();
+    pagesList->push_back(std::move(obj));
     pagesRefList = new std::vector<Ref>();
     pagesRefList->push_back(pagesRef);
-    attrsList = new std::vector<PageAttrs *>();
-    attrsList->push_back(new PageAttrs(NULL, pagesDict));
     kidsIdxList = new std::vector<int>();
     kidsIdxList->push_back(0);
     lastCachedPage = 0;
@@ -339,21 +291,16 @@
 
     if (pagesList->empty()) return gFalse;
 
-    pagesDict = pagesList->back();
-    Object kids;
-    pagesDict->lookup("Kids", &kids);
+    Object pagesDict = pagesList->back().copy();
+    Object kids = pagesDict.dictLookup("Kids");
     if (!kids.isArray()) {
       error(errSyntaxError, -1, "Kids object (page {0:d}) is wrong type ({1:s})",
             lastCachedPage+1, kids.getTypeName());
-      kids.free();
       return gFalse;
     }
 
     int kidsIdx = kidsIdxList->back();
     if (kidsIdx >= kids.arrayGetLength()) {
-       if (!pagesList->back()->decRef()) {
-         delete pagesList->back();
-       }
        pagesList->pop_back();
        pagesRefList->pop_back();
        delete attrsList->back();
@@ -360,17 +307,13 @@
        attrsList->pop_back();
        kidsIdxList->pop_back();
        if (!kidsIdxList->empty()) kidsIdxList->back()++;
-       kids.free();
        continue;
     }
 
-    Object kidRef;
-    kids.arrayGetNF(kidsIdx, &kidRef);
+    Object kidRef = kids.arrayGetNF(kidsIdx);
     if (!kidRef.isRef()) {
       error(errSyntaxError, -1, "Kid object (page {0:d}) is not an indirect reference ({1:s})",
             lastCachedPage+1, kidRef.getTypeName());
-      kidRef.free();
-      kids.free();
       return gFalse;
     }
 
@@ -383,31 +326,23 @@
     }
     if (loop) {
       error(errSyntaxError, -1, "Loop in Pages tree");
-      kidRef.free();
-      kids.free();
       kidsIdxList->back()++;
       continue;
     }
 
-    Object kid;
-    kids.arrayGet(kidsIdx, &kid);
-    kids.free();
+    Object kid = kids.arrayGet(kidsIdx);
     if (kid.isDict("Page") || (kid.isDict() && !kid.getDict()->hasKey("Kids"))) {
       PageAttrs *attrs = new PageAttrs(attrsList->back(), kid.getDict());
-      Page *p = new Page(doc, lastCachedPage+1, kid.getDict(),
+      Page *p = new Page(doc, lastCachedPage+1, &kid,
                      kidRef.getRef(), attrs, form);
       if (!p->isOk()) {
         error(errSyntaxError, -1, "Failed to create page (page {0:d})", lastCachedPage+1);
         delete p;
-        kidRef.free();
-        kid.free();
         return gFalse;
       }
 
       if (lastCachedPage >= numPages) {
         error(errSyntaxError, -1, "Page count in top-level pages object is incorrect");
-        kidRef.free();
-        kid.free();
         return gFalse;
       }
 
@@ -423,8 +358,7 @@
     } else if (kid.isDict()) {
       attrsList->push_back(new PageAttrs(attrsList->back(), kid.getDict()));
       pagesRefList->push_back(kidRef.getRef());
-      kid.getDict()->incRef();
-      pagesList->push_back(kid.getDict());
+      pagesList->push_back(std::move(kid));
       kidsIdxList->push_back(0);
     } else {
       error(errSyntaxError, -1, "Kid object (page {0:d}) is wrong type ({1:s})",
@@ -431,9 +365,6 @@
             lastCachedPage+1, kid.getTypeName());
       kidsIdxList->back()++;
     }
-    kidRef.free();
-    kid.free();
-
   }
 
   return gFalse;
@@ -451,48 +382,28 @@
 }
 
 LinkDest *Catalog::findDest(GooString *name) {
-  LinkDest *dest;
-  Object obj1;
-  GBool found;
-
   // try named destination dictionary then name tree
-  found = gFalse;
   if (getDests()->isDict()) {
-    if (!getDests()->dictLookup(name->getCString(), &obj1)->isNull())
-      found = gTrue;
-    else
-      obj1.free();
+    Object obj1 = getDests()->dictLookup(name->getCString());
+    return createLinkDest(&obj1);
   }
-  if (!found) {
-    catalogLocker();
-    if (getDestNameTree()->lookup(name, &obj1))
-      found = gTrue;
-    else
-      obj1.free();
-  }
-  if (!found)
-    return NULL;
 
-  dest = createLinkDest(&obj1);
-  obj1.free();
-
-  return dest;
+  catalogLocker();
+  Object obj2 = getDestNameTree()->lookup(name);
+  return createLinkDest(&obj2);
 }
 
 LinkDest *Catalog::createLinkDest(Object *obj)
 {
-  LinkDest *dest;
-  Object obj2;
-
-  dest = NULL;
+  LinkDest *dest = nullptr;
   if (obj->isArray()) {
     dest = new LinkDest(obj->getArray());
   } else if (obj->isDict()) {
-    if (obj->dictLookup("D", &obj2)->isArray())
+    Object obj2 = obj->dictLookup("D");
+    if (obj2.isArray())
       dest = new LinkDest(obj2.getArray());
     else
       error(errSyntaxWarning, -1, "Bad named destination value");
-    obj2.free();
   } else {
     error(errSyntaxWarning, -1, "Bad named destination value");
   }
@@ -528,46 +439,37 @@
 
 LinkDest *Catalog::getDestsDest(int i)
 {
-  LinkDest *dest;
-  Object *obj, obj1;
-
-  obj= getDests();
+  Object *obj = getDests();
   if (!obj->isDict()) {
     return NULL;
   }
-  obj->dictGetVal(i, &obj1);
-  dest = createLinkDest(&obj1);
-  obj1.free();
-
-  return dest;
+  Object obj1 = obj->dictGetVal(i);
+  return createLinkDest(&obj1);
 }
 
 LinkDest *Catalog::getDestNameTreeDest(int i)
 {
-  LinkDest *dest;
   Object obj;
 
   catalogLocker();
-  getDestNameTree()->getValue(i).fetch(xref, &obj);
-  dest = createLinkDest(&obj);
-  obj.free();
-
-  return dest;
+  Object *aux = getDestNameTree()->getValue(i);
+  if (aux) {
+    obj = aux->fetch(xref);
+  }
+  return createLinkDest(&obj);
 }
 
 FileSpec *Catalog::embeddedFile(int i)
 {
     Object efDict;
-    Object obj;
     catalogLocker();
-    obj = getEmbeddedFileNameTree()->getValue(i);
+    Object *obj = getEmbeddedFileNameTree()->getValue(i);
     FileSpec *embeddedFile = 0;
-    if (obj.isRef()) {
-      Object fsDict;
-      embeddedFile = new FileSpec(obj.fetch(xref, &fsDict));
-      fsDict.free();
-    } else if (obj.isDict()) {
-      embeddedFile = new FileSpec(&obj);
+    if (obj->isRef()) {
+      Object fsDict = obj->fetch(xref);
+      embeddedFile = new FileSpec(&fsDict);
+    } else if (obj->isDict()) {
+      embeddedFile = new FileSpec(obj);
     } else {
       Object null;
       embeddedFile = new FileSpec(&null);
@@ -581,26 +483,23 @@
   // getJSNameTree()->getValue(i) returns a shallow copy of the object so we
   // do not need to free it
   catalogLocker();
-  getJSNameTree()->getValue(i).fetch(xref, &obj);
+  Object *aux = getJSNameTree()->getValue(i);
+  if (aux) {
+    obj = aux->fetch(xref);
+  }
 
   if (!obj.isDict()) {
-    obj.free();
-    return 0;
+    return nullptr;
   }
-  Object obj2;
-  if (!obj.dictLookup("S", &obj2)->isName()) {
-    obj2.free();
-    obj.free();
-    return 0;
+  Object obj2 = obj.dictLookup("S");
+  if (!obj2.isName()) {
+    return nullptr;
   }
   if (strcmp(obj2.getName(), "JavaScript")) {
-    obj2.free();
-    obj.free();
-    return 0;
+    return nullptr;
   }
-  obj2.free();
-  obj.dictLookup("JS", &obj2);
-  GooString *js = 0;
+  obj2 = obj.dictLookup("JS");
+  GooString *js = nullptr;
   if (obj2.isString()) {
     js = new GooString(obj2.getString());
   }
@@ -609,8 +508,6 @@
     js = new GooString();
     stream->fillGooString(js);
   }
-  obj2.free();
-  obj.free();
   return js;
 }
 
@@ -619,18 +516,16 @@
   catalogLocker();
   if (pageMode == pageModeNull) {
 
-    Object catDict, obj;
-
     pageMode = pageModeNone;
 
-    xref->getCatalog(&catDict);
+    Object catDict = xref->getCatalog();
     if (!catDict.isDict()) {
       error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
-      catDict.free();
       return pageMode;
     }
 
-    if (catDict.dictLookup("PageMode", &obj)->isName()) {
+    Object obj = catDict.dictLookup("PageMode");
+    if (obj.isName()) {
       if (obj.isName("UseNone"))
         pageMode = pageModeNone;
       else if (obj.isName("UseOutlines"))
@@ -644,8 +539,6 @@
       else if (obj.isName("UseAttachments"))
         pageMode = pageModeAttach;
     }
-    obj.free();
-    catDict.free();
   }
   return pageMode;
 }
@@ -655,19 +548,17 @@
   catalogLocker();
   if (pageLayout == pageLayoutNull) {
 
-    Object catDict, obj;
-
     pageLayout = pageLayoutNone;
 
-    xref->getCatalog(&catDict);
+    Object catDict = xref->getCatalog();
     if (!catDict.isDict()) {
       error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
-      catDict.free();
       return pageLayout;
     }
 
     pageLayout = pageLayoutNone;
-    if (catDict.dictLookup("PageLayout", &obj)->isName()) {
+    Object obj = catDict.dictLookup("PageLayout");
+    if (obj.isName()) {
       if (obj.isName("SinglePage"))
         pageLayout = pageLayoutSinglePage;
       if (obj.isName("OneColumn"))
@@ -681,8 +572,6 @@
       if (obj.isName("TwoPageRight"))
         pageLayout = pageLayoutTwoPageRight;
     }
-    obj.free();
-    catDict.free();
   }
   return pageLayout;
 }
@@ -705,20 +594,19 @@
 }
 
 NameTree::Entry::Entry(Array *array, int index) {
-    if (!array->getString(index, &name) || !array->getNF(index + 1, &value)) {
-      Object aux;
-      array->get(index, &aux);
-      if (aux.isString() && array->getNF(index + 1, &value) )
-      {
-        name.append(aux.getString());
-      }
-      else
-        error(errSyntaxError, -1, "Invalid page tree");
+  if (!array->getString(index, &name)) {
+    Object aux = array->get(index);
+    if (aux.isString())
+    {
+      name.append(aux.getString());
     }
+    else
+      error(errSyntaxError, -1, "Invalid page tree");
+  }
+  value = array->getNF(index + 1);
 }
 
 NameTree::Entry::~Entry() {
-  value.free();
 }
 
 void NameTree::addEntry(Entry *entry)
@@ -746,23 +634,21 @@
 
 void NameTree::init(XRef *xrefA, Object *tree) {
   xref = xrefA;
-  parse(tree);
+  std::set<int> seen;
+  parse(tree, seen);
   if (entries && length > 0) {
     qsort(entries, length, sizeof(Entry *), Entry::cmpEntry);
   }
 }
 
-void NameTree::parse(Object *tree) {
-  Object names;
-  Object kids, kid;
-  int i;
-
+void NameTree::parse(Object *tree, std::set<int> &seen) {
   if (!tree->isDict())
     return;
 
   // leaf node
-  if (tree->dictLookup("Names", &names)->isArray()) {
-    for (i = 0; i < names.arrayGetLength(); i += 2) {
+  Object names = tree->dictLookup("Names");
+  if (names.isArray()) {
+    for (int i = 0; i < names.arrayGetLength(); i += 2) {
       NameTree::Entry *entry;
 
       entry = new Entry(names.getArray(), i);
@@ -769,17 +655,25 @@
       addEntry(entry);
     }
   }
-  names.free();
 
   // root or intermediate node
-  if (tree->dictLookup("Kids", &kids)->isArray()) {
-    for (i = 0; i < kids.arrayGetLength(); ++i) {
-      if (kids.arrayGet(i, &kid)->isDict())
-	parse(&kid);
-      kid.free();
+  Object kids = tree->dictLookup("Kids");
+  if (kids.isArray()) {
+    for (int i = 0; i < kids.arrayGetLength(); ++i) {
+      Object kidRef = kids.arrayGetNF(i);
+      if (kidRef.isRef()) {
+	const int numObj = kidRef.getRef().num;
+	if (seen.find(numObj) != seen.end()) {
+	  error(errSyntaxError, -1, "loop in NameTree (numObj: {0:d})", numObj);
+	  continue;
+	}
+	seen.insert(numObj);
+      }
+      Object kid = kids.arrayGet(i);
+      if (kid.isDict())
+	parse(&kid, seen);
     }
   }
-  kids.free();
 }
 
 int NameTree::Entry::cmp(const void *voidKey, const void *voidEntry)
@@ -790,7 +684,7 @@
   return key->cmp(&entry->name);
 }
 
-GBool NameTree::lookup(GooString *name, Object *obj)
+Object NameTree::lookup(GooString *name)
 {
   Entry **entry;
 
@@ -797,21 +691,19 @@
   entry = (Entry **) bsearch(name, entries,
 			     length, sizeof(Entry *), Entry::cmp);
   if (entry != NULL) {
-    (*entry)->value.fetch(xref, obj);
-    return gTrue;
+    return (*entry)->value.fetch(xref);
   } else {
     error(errSyntaxError, -1, "failed to look up ({0:s})", name->getCString());
-    obj->initNull();
-    return gFalse;
+    return Object(objNull);
   }
 }
 
-Object NameTree::getValue(int index)
+Object *NameTree::getValue(int index)
 {
   if (index < length) {
-    return entries[index]->value;
+    return &entries[index]->value;
   } else {
-    return Object();
+    return nullptr;
   }
 }
 
@@ -866,15 +758,12 @@
   catalogLocker();
   if (numPages == -1)
   {
-    Object catDict, pagesDict, obj;
-
-    xref->getCatalog(&catDict);
+    Object catDict = xref->getCatalog();
     if (!catDict.isDict()) {
       error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
-      catDict.free();
       return 0;
     }
-    catDict.dictLookup("Pages", &pagesDict);
+    Object pagesDict = catDict.dictLookup("Pages");
 
     // This should really be isDict("Pages"), but I've seen at least one
     // PDF file where the /Type entry is missing.
@@ -881,17 +770,14 @@
     if (!pagesDict.isDict()) {
       error(errSyntaxError, -1, "Top-level pages object is wrong type ({0:s})",
           pagesDict.getTypeName());
-      pagesDict.free();
-      catDict.free();
       return 0;
     }
 
-    pagesDict.dictLookup("Count", &obj);
+    Object obj = pagesDict.dictLookup("Count");
     // some PDF files actually use real numbers here ("/Count 9.0")
     if (!obj.isNum()) {
       if (pagesDict.dictIs("Page")) {
-	Object pageRootRef;
-	catDict.dictLookupNF("Pages", &pageRootRef);
+	Object pageRootRef = catDict.dictLookupNF("Pages");
 
 	error(errSyntaxError, -1, "Pages top-level is a single Page. The document is malformed, trying to recover...");
 
@@ -898,7 +784,7 @@
 	Dict *pageDict = pagesDict.getDict();
 	if (pageRootRef.isRef()) {
 	  const Ref pageRef = pageRootRef.getRef();
-	  Page *p = new Page(doc, 1, pageDict, pageRef, new PageAttrs(NULL, pageDict), form);
+	  Page *p = new Page(doc, 1, &pagesDict, pageRef, new PageAttrs(NULL, pageDict), form);
 	  if (p->isOk()) {
 	    pages = (Page **)gmallocn(1, sizeof(Page *));
 	    pageRefs = (Ref *)gmallocn(1, sizeof(Ref));
@@ -936,10 +822,6 @@
       }
 
     }
-
-    catDict.free();
-    obj.free();
-    pagesDict.free();
   }
 
   return numPages;
@@ -949,21 +831,16 @@
 {
   catalogLocker();
   if (!pageLabelInfo) {
-    Object catDict;
-    Object obj;
-
-    xref->getCatalog(&catDict);
+    Object catDict = xref->getCatalog();
     if (!catDict.isDict()) {
       error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
-      catDict.free();
-      return NULL;
+      return nullptr;
     }
 
-    if (catDict.dictLookup("PageLabels", &obj)->isDict()) {
+    Object obj = catDict.dictLookup("PageLabels");
+    if (obj.isDict()) {
       pageLabelInfo = new PageLabelInfo(&obj, getNumPages());
     }
-    obj.free();
-    catDict.free();
   }
 
   return pageLabelInfo;
@@ -973,22 +850,16 @@
 {
   catalogLocker();
   if (!structTreeRoot) {
-    Object catalog;
-    Object root;
-
-    xref->getCatalog(&catalog);
+    Object catalog = xref->getCatalog();
     if (!catalog.isDict()) {
       error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catalog.getTypeName());
-      catalog.free();
       return NULL;
     }
 
-    if (catalog.dictLookup("StructTreeRoot", &root)->isDict("StructTreeRoot")) {
+    Object root = catalog.dictLookup("StructTreeRoot");
+    if (root.isDict("StructTreeRoot")) {
       structTreeRoot = new StructTreeRoot(doc, root.getDict());
     }
-
-    root.free();
-    catalog.free();
   }
   return structTreeRoot;
 }
@@ -998,41 +869,35 @@
   if (markInfo == markInfoNull) {
     markInfo = 0;
 
-    Object catDict;
     catalogLocker();
-    xref->getCatalog(&catDict);
+    Object catDict = xref->getCatalog();
 
     if (catDict.isDict()) {
-      Object markInfoDict;
-      catDict.dictLookup("MarkInfo", &markInfoDict);
+      Object markInfoDict = catDict.dictLookup("MarkInfo");
       if (markInfoDict.isDict()) {
-        Object value;
-
-        if (markInfoDict.dictLookup("Marked", &value)->isBool() && value.getBool())
+        Object value = markInfoDict.dictLookup("Marked");
+        if (value.isBool() && value.getBool())
           markInfo |= markInfoMarked;
         else if (!value.isNull())
           error(errSyntaxError, -1, "Marked object is wrong type ({0:s})", value.getTypeName());
-        value.free();
 
-        if (markInfoDict.dictLookup("Suspects", &value)->isBool() && value.getBool())
+        value = markInfoDict.dictLookup("Suspects");
+        if (value.isBool() && value.getBool())
           markInfo |= markInfoSuspects;
         else if (!value.isNull())
           error(errSyntaxError, -1, "Suspects object is wrong type ({0:s})", value.getTypeName());
-        value.free();
 
-        if (markInfoDict.dictLookup("UserProperties", &value)->isBool() && value.getBool())
+        value = markInfoDict.dictLookup("UserProperties");
+        if (value.isBool() && value.getBool())
           markInfo |= markInfoUserProperties;
         else if (!value.isNull())
           error(errSyntaxError, -1, "UserProperties object is wrong type ({0:s})", value.getTypeName());
-        value.free();
       } else if (!markInfoDict.isNull()) {
         error(errSyntaxError, -1, "MarkInfo object is wrong type ({0:s})", markInfoDict.getTypeName());
       }
-      markInfoDict.free();
     } else {
       error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
     }
-    catDict.free();
   }
   return markInfo;
 }
@@ -1042,16 +907,13 @@
   catalogLocker();
   if (outline.isNone())
   {
-     Object catDict;
-
-     xref->getCatalog(&catDict);
+     Object catDict = xref->getCatalog();
      if (catDict.isDict()) {
-       catDict.dictLookup("Outlines", &outline);
+       outline = catDict.dictLookup("Outlines");
      } else {
        error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
-       outline.initNull();
+       outline.setToNull();
      }
-     catDict.free();
   }
 
   return &outline;
@@ -1062,16 +924,13 @@
   catalogLocker();
   if (dests.isNone())
   {
-     Object catDict;
-
-     xref->getCatalog(&catDict);
+     Object catDict = xref->getCatalog();
      if (catDict.isDict()) {
-       catDict.dictLookup("Dests", &dests);
+       dests = catDict.dictLookup("Dests");
      } else {
        error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
-       dests.initNull();
+       dests.setToNull();
      }
-     catDict.free();
   }
 
   return &dests;
@@ -1083,13 +942,12 @@
   FormType res = NoForm;
 
   if (acroForm.isDict()) {
-    acroForm.dictLookup("XFA", &xfa);
+    xfa = acroForm.dictLookup("XFA");
     if (xfa.isStream() || xfa.isArray()) {
       res = XfaForm;
     } else {
       res = AcroForm;
     }
-    xfa.free();
   }
 
   return res;
@@ -1125,16 +983,13 @@
 {
   if (names.isNone())
   {
-     Object catDict;
-
-     xref->getCatalog(&catDict);
+     Object catDict = xref->getCatalog();
      if (catDict.isDict()) {
-       catDict.dictLookup("Names", &names);
+       names = catDict.dictLookup("Names");
      } else {
        error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName());
-       names.initNull();
+       names.setToNull();
      }
-     catDict.free();
   }
 
   return &names;
@@ -1147,11 +1002,8 @@
     destNameTree = new NameTree();
 
     if (getNames()->isDict()) {
-       Object obj;
-
-       getNames()->dictLookup("Dests", &obj);
+       Object obj = getNames()->dictLookup("Dests");
        destNameTree->init(xref, &obj);
-       obj.free();
     }
 
   }
@@ -1166,11 +1018,8 @@
     embeddedFileNameTree = new NameTree();
 
     if (getNames()->isDict()) {
-       Object obj;
-
-       getNames()->dictLookup("EmbeddedFiles", &obj);
+       Object obj = getNames()->dictLookup("EmbeddedFiles");
        embeddedFileNameTree->init(xref, &obj);
-       obj.free();
     }
 
   }
@@ -1185,11 +1034,8 @@
     jsNameTree = new NameTree();
 
     if (getNames()->isDict()) {
-       Object obj;
-
-       getNames()->dictLookup("JavaScript", &obj);
+       Object obj = getNames()->dictLookup("JavaScript");
        jsNameTree->init(xref, &obj);
-       obj.free();
     }
 
   }
@@ -1198,10 +1044,9 @@
 }
 
 LinkAction* Catalog::getAdditionalAction(DocumentAdditionalActionsType type) {
-  Object additionalActionsObject;
-  LinkAction *linkAction = NULL;
-
-  if (additionalActions.fetch(doc->getXRef(), &additionalActionsObject)->isDict()) {
+  LinkAction *linkAction = nullptr;
+  Object additionalActionsObject = additionalActions.fetch(doc->getXRef());
+  if (additionalActionsObject.isDict()) {
     const char *key = (type == actionCloseDocument ?       "WC" :
                        type == actionSaveDocumentStart ?   "WS" :
                        type == actionSaveDocumentFinish ?  "DS" :
@@ -1208,14 +1053,9 @@
                        type == actionPrintDocumentStart ?  "WP" :
                        type == actionPrintDocumentFinish ? "DP" : NULL);
 
-    Object actionObject;
-
-    if (additionalActionsObject.dictLookup(key, &actionObject)->isDict())
+    Object actionObject = additionalActionsObject.dictLookup(key);
+    if (actionObject.isDict())
       linkAction = LinkAction::parseAction(&actionObject, doc->getCatalog()->getBaseURI());
-    actionObject.free();
   }
-
-  additionalActionsObject.free();
-
   return linkAction;
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Catalog.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Catalog.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Catalog.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005, 2007, 2009-2011, 2013 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2007, 2009-2011, 2013, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2005, 2006, 2008 Brad Hards <bradh at frogmouth.net>
 // Copyright (C) 2007 Julien Rebetez <julienr at svn.gnome.org>
@@ -23,7 +23,7 @@
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2013 Adrian Perez de Castro <aperez at igalia.com>
-// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 José Aliste <jaliste at src.gnome.org>
 // Copyright (C) 2016 Masamichi Hosoda <trueroad at trueroad.jp>
 //
@@ -69,10 +69,10 @@
   NameTree();
   ~NameTree();
   void init(XRef *xref, Object *tree);
-  GBool lookup(GooString *name, Object *obj);
+  Object lookup(GooString *name);
   int numEntries() { return length; };
-  // iterator accessor, note it returns a shallow copy, do not free the object
-  Object getValue(int i);
+  // iterator accessor, note it returns a pointer to the internal object, do not free nor delete it
+  Object *getValue(int i);
   GooString *getName(int i);
 
 private:
@@ -86,7 +86,7 @@
     static int cmp(const void *key, const void *entry);
   };
 
-  void parse(Object *tree);
+  void parse(Object *tree, std::set<int> &seen);
   void addEntry(Entry *entry);
 
   XRef *xref;
@@ -248,7 +248,7 @@
   Page **pages;			// array of pages
   Ref *pageRefs;		// object ID for each page
   int lastCachedPage;
-  std::vector<Dict *> *pagesList;
+  std::vector<Object> *pagesList;
   std::vector<Ref> *pagesRefList;
   std::vector<PageAttrs *> *attrsList;
   std::vector<int> *kidsIdxList;
@@ -283,7 +283,7 @@
   NameTree *getEmbeddedFileNameTree();
   NameTree *getJSNameTree();
   LinkDest *createLinkDest(Object *obj);
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CharCodeToUnicode.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -21,9 +21,10 @@
 // Copyright (C) 2010 William Bader <williambader at hotmail.com>
 // Copyright (C) 2010 Jakub Wilk <jwilk at jwilk.net>
 // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
-// Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2014 Jiri Slaby <jirislaby at gmail.com>
 // Copyright (C) 2015 Marek Kasik <mkasik at redhat.com>
+// Copyright (C) 2017 Jean Ghali <jghali at libertysurf.fr>
 //
 // 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
@@ -38,6 +39,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include "goo/glibc.h"
 #include "goo/gmem.h"
 #include "goo/gfile.h"
 #include "goo/GooLikely.h"
@@ -484,7 +486,7 @@
   sMapLen = sMapSize = 0;
   refCnt = 1;
   isIdentity = gFalse;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -502,7 +504,7 @@
   sMapLen = sMapSize = 0;
   refCnt = 1;
   isIdentity = gFalse;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -524,7 +526,7 @@
   sMapSize = sMapSizeA;
   refCnt = 1;
   isIdentity = gFalse;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -538,17 +540,17 @@
     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 +558,11 @@
 void CharCodeToUnicode::decRefCnt() {
   GBool done;
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gLockMutex(&mutex);
 #endif
   done = --refCnt == 0;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gUnlockMutex(&mutex);
 #endif
   if (done) {

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CharCodeToUnicode.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -18,6 +18,7 @@
 // Copyright (C) 2007 Julien Rebetez <julienr at svn.gnome.org>
 // Copyright (C) 2007 Koji Otani <sho at bbr.jp>
 // Copyright (C) 2008, 2011, 2012 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -35,7 +36,7 @@
 #include "CharTypes.h"
 #include "goo/gtypes.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #include "goo/GooMutex.h"
 #endif
 
@@ -116,7 +117,7 @@
   int sMapLen, sMapSize;
   int refCnt;
   GBool isIdentity;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
 #endif
 };

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlCachedFile.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlCachedFile.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlCachedFile.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -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:
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlPDFDocBuilder.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlPDFDocBuilder.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlPDFDocBuilder.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -5,7 +5,7 @@
 // This file is licensed under the GPLv2 or later
 //
 // Copyright 2010 Hib Eris <hib at hiberis.nl>
-// Copyright 2010 Albert Astals Cid <aacid at kde.org>
+// Copyright 2010, 2017 Albert Astals Cid <aacid at kde.org>
 //
 //========================================================================
 
@@ -15,6 +15,7 @@
 
 #include "CachedFile.h"
 #include "CurlCachedFile.h"
+#include "ErrorCodes.h"
 
 //------------------------------------------------------------------------
 // CurlPDFDocBuilder
@@ -24,14 +25,16 @@
 CurlPDFDocBuilder::buildPDFDoc(const GooString &uri,
         GooString *ownerPassword, GooString *userPassword, void *guiDataA)
 {
-    Object obj;
-
     CachedFile *cachedFile = new CachedFile(
         new CurlCachedFileLoader(), uri.copy());
 
-    obj.initNull();
+    if (cachedFile->getLength() == ((Guint) -1)) {
+        cachedFile->decRefCnt();
+        return PDFDoc::ErrorPDFDoc(errOpenFile, uri.copy());
+    }
+
     BaseStream *str = new CachedFileStream(
-         cachedFile, 0, gFalse, cachedFile->getLength(), &obj);
+         cachedFile, 0, gFalse, cachedFile->getLength(), Object(objNull));
 
     return new PDFDoc(str, ownerPassword, userPassword, guiDataA);
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlPDFDocBuilder.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlPDFDocBuilder.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/CurlPDFDocBuilder.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -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;
 
 };
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/DCTStream.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/DCTStream.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/DCTStream.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -5,12 +5,13 @@
 // This file is licensed under the GPLv2 or later
 //
 // Copyright 2005 Jeff Muizelaar <jeff at infidigm.net>
-// Copyright 2005-2010, 2012 Albert Astals Cid <aacid at kde.org>
+// Copyright 2005-2010, 2012, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright 2009 Ryszard Trojnacki <rysiek at menel.com>
 // Copyright 2010 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright 2011 Daiki Ueno <ueno at unixuser.org>
 // Copyright 2011 Tomas Hoger <thoger at redhat.com>
 // Copyright 2012, 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 //========================================================================
 
@@ -60,18 +61,14 @@
 {
 }
 
-DCTStream::DCTStream(Stream *strA, int colorXformA, Object *dict, int recursion) :
+DCTStream::DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion) :
   FilterStream(strA) {
   colorXform = colorXformA;
   if (dict != NULL) {
-    Object obj;
-
-    dict->dictLookup("Width", &obj, recursion);
+    Object obj = dict->lookup("Width", recursion);
     err.width = (obj.isInt() && obj.getInt() <= JPEG_MAX_DIMENSION) ? obj.getInt() : 0;
-    obj.free();
-    dict->dictLookup("Height", &obj, recursion);
+    obj = dict->lookup("Height", recursion);
     err.height = (obj.isInt() && obj.getInt() <= JPEG_MAX_DIMENSION) ? obj.getInt() : 0;
-    obj.free();
   } else
     err.height = err.width = 0;
   init();
@@ -232,8 +229,10 @@
 }
 
 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;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/DCTStream.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/DCTStream.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/DCTStream.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -6,7 +6,7 @@
 //
 // Copyright 2005 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright 2005 Martin Kretzschmar <martink at gnome.org>
-// Copyright 2005-2007, 2009-2011 Albert Astals Cid <aacid at kde.org>
+// Copyright 2005-2007, 2009-2011, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright 2010 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright 2011 Daiki Ueno <ueno at unixuser.org>
 // Copyright 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
@@ -64,20 +64,20 @@
 class DCTStream: public FilterStream {
 public:
 
-  DCTStream(Stream *strA, int colorXformA, Object *dict, int recursion);
-  virtual ~DCTStream();
-  virtual StreamKind getKind() { return strDCT; }
-  virtual void reset();
-  virtual int getChar();
-  virtual int lookChar();
-  virtual GooString *getPSFilter(int psLevel, const char *indent);
-  virtual GBool isBinary(GBool last = gTrue);
+  DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion);
+  ~DCTStream();
+  StreamKind getKind() override { return strDCT; }
+  void reset() override;
+  int getChar() override;
+  int lookChar() override;
+  GooString *getPSFilter(int psLevel, const char *indent) override;
+  GBool isBinary(GBool last = gTrue) override;
 
 private:
   void init();
 
-  virtual GBool hasGetChars() { return true; }
-  virtual int getChars(int nChars, Guchar *buffer);
+  GBool hasGetChars() override { return true; }
+  int getChars(int nChars, Guchar *buffer) override;
 
   int colorXform;
   JSAMPLE *current;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Decrypt.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Decrypt.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Decrypt.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -14,11 +14,11 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2008 Julien Rebetez <julien at fhtagn.net>
-// Copyright (C) 2008, 2010, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2010, 2016, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Matthias Franz <matthias at ktug.or.kr>
 // Copyright (C) 2009 David Benjamin <davidben at mit.edu>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
-// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2016 Alok Anand <alok4nand at gmail.com>
 // Copyright (C) 2016 Thomas Freitag <Thomas.Freitag at alfa.de>
 //
@@ -33,10 +33,10 @@
 #pragma implementation
 #endif
 
+#include <cstdint>
 #include <string.h>
 #include "goo/gmem.h"
 #include "goo/grandom.h"
-#include "goo/gtypes_p.h"
 #include "Decrypt.h"
 #include "Error.h"
 
@@ -1345,7 +1345,7 @@
   return rotr(x, 17) ^ rotr(x, 19) ^ (x >> 10);
 }
 
-void sha256HashBlock(Guchar *blk, Guint *H) {
+static void sha256HashBlock(Guchar *blk, Guint *H) {
   Guint W[64];
   Guint a, b, c, d, e, f, g, h;
   Guint T1, T2;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Decrypt.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Decrypt.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Decrypt.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -105,14 +105,14 @@
 
   BaseCryptStream(Stream *strA, Guchar *fileKey, CryptAlgorithm algoA,
                   int keyLength, int objNum, int objGen);
-  virtual ~BaseCryptStream();
-  virtual StreamKind getKind() { return strCrypt; }
-  virtual void reset();
-  virtual int getChar();
-  virtual int lookChar() = 0;
-  virtual Goffset getPos();
-  virtual GBool isBinary(GBool last);
-  virtual Stream *getUndecodedStream() { return this; }
+  ~BaseCryptStream();
+  StreamKind getKind() override { return strCrypt; }
+  void reset() override;
+  int getChar() override;
+  int lookChar() override = 0;
+  Goffset getPos() override;
+  GBool isBinary(GBool last) override;
+  Stream *getUndecodedStream() override { return this; }
   void setAutoDelete(GBool val);
 
 protected:
@@ -140,8 +140,8 @@
   EncryptStream(Stream *strA, Guchar *fileKey, CryptAlgorithm algoA,
                 int keyLength, int objNum, int objGen);
   ~EncryptStream();
-  virtual void reset();
-  virtual int lookChar();
+  void reset() override;
+  int lookChar() override;
 };
 
 class DecryptStream : public BaseCryptStream {
@@ -150,8 +150,8 @@
   DecryptStream(Stream *strA, Guchar *fileKey, CryptAlgorithm algoA,
                 int keyLength, int objNum, int objGen);
   ~DecryptStream();
-  virtual void reset();
-  virtual int lookChar();
+  void reset() override;
+  int lookChar() override;
 };
  
 //------------------------------------------------------------------------

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Dict.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Dict.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Dict.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -16,11 +16,12 @@
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 // Copyright (C) 2007-2008 Julien Rebetez <julienr at svn.gnome.org>
-// Copyright (C) 2008, 2010, 2013, 2014 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2010, 2013, 2014, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2010 Paweł Wiejacha <pawel.wiejacha at gmail.com>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2014 Scott West <scott.gregory.west at gmail.com>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -41,7 +42,7 @@
 #include "XRef.h"
 #include "Dict.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define dictLocker()   MutexLocker locker(&mutex)
 #else
 #  define dictLocker()
@@ -81,7 +82,7 @@
   size = length = 0;
   ref = 1;
   sorted = gFalse;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 }
@@ -90,7 +91,7 @@
   xref = dictA->xref;
   size = length = dictA->length;
   ref = 1;
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
 
@@ -98,7 +99,8 @@
   entries = (DictEntry *)gmallocn(size, sizeof(DictEntry));
   for (int i=0; i<length; i++) {
     entries[i].key = copyString(dictA->entries[i].key);
-    dictA->entries[i].val.copy(&entries[i].val);
+    entries[i].val.initNullAfterMalloc();
+    entries[i].val = dictA->entries[i].val.copy();
   }
 }
 
@@ -108,12 +110,8 @@
   dictA->xref = xrefA;
   for (int i=0; i<length; i++) {
     if (dictA->entries[i].val.getType() == objDict) {
-       Dict *dict = dictA->entries[i].val.getDict();
-       Object obj;
-       obj.initDict(dict->copy(xrefA));
-       dictA->entries[i].val.free();
-       dictA->entries[i].val = obj;
-       obj.free();
+       Dict *copy = dictA->entries[i].val.getDict()->copy(xrefA);
+       dictA->entries[i].val = Object(copy);
     }
   }
   return dictA;
@@ -127,7 +125,7 @@
     entries[i].val.free();
   }
   gfree(entries);
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }
@@ -144,7 +142,7 @@
   return ref;
 }
 
-void Dict::add(char *key, Object *val) {
+void Dict::add(char *key, Object &&val) {
   dictLocker();
   if (sorted) {
     // We use add on very few occasions so
@@ -161,11 +159,12 @@
     entries = (DictEntry *)greallocn(entries, size, sizeof(DictEntry));
   }
   entries[length].key = key;
-  entries[length].val = *val;
+  entries[length].val.initNullAfterMalloc();
+  entries[length].val = std::move(val);
   ++length;
 }
 
-inline DictEntry *Dict::find(const char *key) {
+inline DictEntry *Dict::find(const char *key) const {
   if (!sorted && length >= SORT_LENGTH_LOWER_LIMIT)
   {
       dictLocker();
@@ -189,7 +188,7 @@
   return NULL;
 }
 
-GBool Dict::hasKey(const char *key) {
+GBool Dict::hasKey(const char *key) const {
   return find(key) != NULL;
 }
 
@@ -208,7 +207,6 @@
   } else {
     int i; 
     bool found = false;
-    DictEntry tmp;
     if(length == 0) {
       return;
     }
@@ -226,15 +224,17 @@
     gfree(entries[i].key);
     entries[i].val.free();
     length -= 1;
-    tmp = entries[length];
-    if (i!=length) //don't copy the last entry if it is deleted 
-      entries[i] = tmp;
+    if (i!=length) {
+      //don't copy the last entry if it is deleted
+      entries[i].key = entries[length].key;
+      entries[i].val = std::move(entries[length].val);
+    }
   }
 }
 
-void Dict::set(const char *key, Object *val) {
+void Dict::set(const char *key, Object &&val) {
   DictEntry *e;
-  if (val->isNull()) {
+  if (val.isNull()) {
     remove(key);
     return;
   }
@@ -241,41 +241,38 @@
   e = find (key);
   if (e) {
     dictLocker();
-    e->val.free();
-    e->val = *val;
+    e->val = std::move(val);
   } else {
-    add (copyString(key), val);
+    add (copyString(key), std::move(val));
   }
 }
 
 
-GBool Dict::is(const char *type) {
+GBool Dict::is(const char *type) const {
   DictEntry *e;
 
   return (e = find("Type")) && e->val.isName(type);
 }
 
-Object *Dict::lookup(const char *key, Object *obj, int recursion) {
+Object Dict::lookup(const char *key, int recursion) const {
   DictEntry *e;
 
-  return (e = find(key)) ? e->val.fetch(xref, obj, recursion) : obj->initNull();
+  return (e = find(key)) ? e->val.fetch(xref, recursion) : Object(objNull);
 }
 
-Object *Dict::lookupNF(const char *key, Object *obj) {
+Object Dict::lookupNF(const char *key) const {
   DictEntry *e;
 
-  return (e = find(key)) ? e->val.copy(obj) : obj->initNull();
+  return (e = find(key)) ? e->val.copy() : Object(objNull);
 }
 
-GBool Dict::lookupInt(const char *key, const char *alt_key, int *value)
+GBool Dict::lookupInt(const char *key, const char *alt_key, int *value) const
 {
-  Object obj1;
   GBool success = gFalse;
-  
-  lookup ((char *) key, &obj1);
+  Object obj1 = lookup ((char *) key);
   if (obj1.isNull () && alt_key != NULL) {
     obj1.free ();
-    lookup ((char *) alt_key, &obj1);
+    obj1 = lookup ((char *) alt_key);
   }
   if (obj1.isInt ()) {
     *value = obj1.getInt ();
@@ -287,14 +284,14 @@
   return success;
 }
 
-char *Dict::getKey(int i) {
+char *Dict::getKey(int i) const {
   return entries[i].key;
 }
 
-Object *Dict::getVal(int i, Object *obj) {
-  return entries[i].val.fetch(xref, obj);
+Object Dict::getVal(int i) const {
+  return entries[i].val.fetch(xref);
 }
 
-Object *Dict::getValNF(int i, Object *obj) {
-  return entries[i].val.copy(obj);
+Object Dict::getValNF(int i) const {
+  return entries[i].val.copy();
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Dict.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Dict.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Dict.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -16,9 +16,10 @@
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 // Copyright (C) 2007-2008 Julien Rebetez <julienr at svn.gnome.org>
-// Copyright (C) 2010 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2010, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2010 Paweł Wiejacha <pawel.wiejacha at gmail.com>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -56,34 +57,32 @@
   // Destructor.
   ~Dict();
 
-  // Reference counting.
-  int incRef();
-  int decRef();
-
   // Get number of entries.
-  int getLength() { return length; }
+  int getLength() const { return length; }
 
   // Add an entry.  NB: does not copy key.
-  void add(char *key, Object *val);
+  // val becomes a dead object after the call
+  void add(char *key, Object &&val);
 
   // Update the value of an existing entry, otherwise create it
-  void set(const char *key, Object *val);
+  // val becomes a dead object after the call
+  void set(const char *key, Object &&val);
   // Remove an entry. This invalidate indexes
   void remove(const char *key);
 
   // Check if dictionary is of specified type.
-  GBool is(const char *type);
+  GBool is(const char *type) const;
 
   // Look up an entry and return the value.  Returns a null object
   // if <key> is not in the dictionary.
-  Object *lookup(const char *key, Object *obj, int recursion = 0);
-  Object *lookupNF(const char *key, Object *obj);
-  GBool lookupInt(const char *key, const char *alt_key, int *value);
+  Object lookup(const char *key, int recursion = 0) const;
+  Object lookupNF(const char *key) const;
+  GBool lookupInt(const char *key, const char *alt_key, int *value) const;
 
   // Iterative accessors.
-  char *getKey(int i);
-  Object *getVal(int i, Object *obj);
-  Object *getValNF(int i, Object *obj);
+  char *getKey(int i) const;
+  Object getVal(int i) const;
+  Object getValNF(int i) const;
 
   // Set the xref pointer.  This is only used in one special case: the
   // trailer dictionary, which is read before the xref table is
@@ -90,23 +89,28 @@
   // parsed.
   void setXRef(XRef *xrefA) { xref = xrefA; }
   
-  XRef *getXRef() { return xref; }
+  XRef *getXRef() const { return xref; }
   
-  GBool hasKey(const char *key);
+  GBool hasKey(const char *key) const;
 
 private:
+  friend class Object; // for incRef/decRef
 
-  GBool sorted;
+  // Reference counting.
+  int incRef();
+  int decRef();
+
+  mutable GBool sorted;
   XRef *xref;			// the xref table for this PDF file
   DictEntry *entries;		// array of entries
   int size;			// size of <entries> array
   int length;			// number of entries in dictionary
   int ref;			// reference count
-#if MULTITHREADED
-  GooMutex mutex;
+#ifdef MULTITHREADED
+  mutable GooMutex mutex;
 #endif
 
-  DictEntry *find(const char *key);
+  DictEntry *find(const char *key) const;
 };
 
 #endif

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Error.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Error.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Error.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -17,7 +17,7 @@
 // Copyright (C) 2005 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 // Copyright (C) 2012 Marek Kasik <mkasik at redhat.com>
-// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -25,6 +25,7 @@
 //========================================================================
 
 #include <config.h>
+#include <poppler-config.h>
 
 #ifdef USE_GCC_PRAGMAS
 #pragma implementation

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/FileSpec.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/FileSpec.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/FileSpec.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -7,7 +7,7 @@
 //
 // Copyright (C) 2008-2009 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
-// Copyright (C) 2012 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2012, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2012 Hib Eris <hib at hiberis.nl>
 //
 // To see a description of the changes please see the Changelog file that
@@ -35,7 +35,7 @@
   m_checksum = NULL;
   m_mimetype = NULL;
 
-  efStream->copy(&m_objStr);
+  m_objStr = efStream->copy();
 
   if (efStream->isStream()) {
     // dataDict corresponds to Table 3.41 in the PDF1.6 spec.
@@ -42,33 +42,30 @@
     Dict *dataDict = efStream->streamGetDict();
 
     // subtype is normally the mimetype
-    Object subtypeName;
-    if (dataDict->lookup("Subtype", &subtypeName)->isName()) {
+    Object subtypeName = dataDict->lookup("Subtype");
+    if (subtypeName.isName()) {
       m_mimetype = new GooString(subtypeName.getName());
     }
-    subtypeName.free();
 
     // paramDict corresponds to Table 3.42 in the PDF1.6 spec
-    Object paramDict;
-    if (dataDict->lookup("Params", &paramDict)->isDict()) {
-      Object paramObj;
-      if (paramDict.dictLookup("ModDate", &paramObj)->isString())
+    Object paramDict = dataDict->lookup("Params");
+    if (paramDict.isDict()) {
+      Object paramObj = paramDict.dictLookup("ModDate");
+      if (paramObj.isString())
         m_modDate = new GooString(paramObj.getString());
-      paramObj.free();
 
-      if (paramDict.dictLookup("CreationDate", &paramObj)->isString())
+      paramObj = paramDict.dictLookup("CreationDate");
+      if (paramObj.isString())
         m_createDate = new GooString(paramObj.getString());
-      paramObj.free();
 
-      if (paramDict.dictLookup("Size", &paramObj)->isInt())
+      paramObj = paramDict.dictLookup("Size");
+      if (paramObj.isInt())
         m_size = paramObj.getInt();
-      paramObj.free();
 
-      if (paramDict.dictLookup("CheckSum", &paramObj)->isString())
+      paramObj = paramDict.dictLookup("CheckSum");
+      if (paramObj.isString())
         m_checksum = new GooString(paramObj.getString());
-      paramObj.free();
     }
-    paramDict.free();
   }
 }
 
@@ -78,7 +75,6 @@
   delete m_modDate;
   delete m_checksum;
   delete m_mimetype;
-  m_objStr.free();
 }
 
 GBool EmbFile::save(const char *path) {
@@ -110,41 +106,37 @@
   platformFileName = NULL;
   embFile = NULL;
   desc = NULL;
-  fileSpecA->copy(&fileSpec);
+  fileSpec = fileSpecA->copy();
 
-  Object obj1;
-  if (!getFileSpecName(fileSpecA, &obj1)) {
+  Object obj1 = getFileSpecName(fileSpecA);
+  if (!obj1.isString()) {
     ok = gFalse;
-    obj1.free();
     error(errSyntaxError, -1, "Invalid FileSpec");
     return;
   }
 
   fileName = obj1.getString()->copy();
-  obj1.free();
 
   if (fileSpec.isDict()) {
-    if (fileSpec.dictLookup("EF", &obj1)->isDict()) {
-      if (!obj1.dictLookupNF("F", &fileStream)->isRef()) {
+    obj1 = fileSpec.dictLookup("EF");
+    if (obj1.isDict()) {
+      fileStream = obj1.dictLookupNF("F");
+      if (!fileStream.isRef()) {
         ok = gFalse;
-        fileStream.free();
+        fileStream.setToNull();
         error(errSyntaxError, -1, "Invalid FileSpec: Embedded file stream is not an indirect reference");
-        obj1.free();
         return;
       }
     }
-    obj1.free();
   }
 
-  if (fileSpec.dictLookup("Desc", &obj1)->isString())
+  obj1 = fileSpec.dictLookup("Desc");
+  if (obj1.isString())
     desc = obj1.getString()->copy();
-  obj1.free();
 }
 
 FileSpec::~FileSpec()
 {
-  fileSpec.free();
-  fileStream.free();
   delete fileName;
   delete platformFileName;
   delete embFile;
@@ -161,8 +153,8 @@
 
   Object obj1;
   XRef *xref = fileSpec.getDict()->getXRef();
-  embFile = new EmbFile(fileStream.fetch(xref, &obj1));
-  obj1.free();
+  obj1 = fileStream.fetch(xref);
+  embFile = new EmbFile(&obj1);
 
   return embFile;
 }
@@ -172,84 +164,77 @@
   if (platformFileName)
     return platformFileName;
 
-  Object obj1;
-  if (getFileSpecNameForPlatform(&fileSpec, &obj1))
+  Object obj1 = getFileSpecNameForPlatform(&fileSpec);
+  if (obj1.isString())
     platformFileName = obj1.getString()->copy();
-  obj1.free();
 
   return platformFileName;
 }
 
-GBool getFileSpecName (Object *fileSpec, Object *fileName)
+Object getFileSpecName (Object *fileSpec)
 {
   if (fileSpec->isString()) {
-    fileSpec->copy(fileName);
-    return gTrue;
+    return fileSpec->copy();
   }
   
   if (fileSpec->isDict()) {
-    fileSpec->dictLookup("UF", fileName);
-    if (fileName->isString()) {
-      return gTrue;
+    Object fileName = fileSpec->dictLookup("UF");
+    if (fileName.isString()) {
+      return fileName;
     }
-    fileName->free();
-    fileSpec->dictLookup("F", fileName);
-    if (fileName->isString()) {
-      return gTrue;
+    fileName = fileSpec->dictLookup("F");
+    if (fileName.isString()) {
+      return fileName;
     }
-    fileName->free();
-    fileSpec->dictLookup("DOS", fileName);
-    if (fileName->isString()) {
-      return gTrue;
+    fileName = fileSpec->dictLookup("DOS");
+    if (fileName.isString()) {
+      return fileName;
     }
-    fileName->free();
-    fileSpec->dictLookup("Mac", fileName);
-    if (fileName->isString()) {
-      return gTrue;
+    fileName = fileSpec->dictLookup("Mac");
+    if (fileName.isString()) {
+      return fileName;
     }
-    fileName->free();
-    fileSpec->dictLookup("Unix", fileName);
-    if (fileName->isString()) {
-      return gTrue;
+    fileName = fileSpec->dictLookup("Unix");
+    if (fileName.isString()) {
+      return fileName;
     }
-    fileName->free();
   }
-  return gFalse;
+  return Object();
 }
 
-GBool getFileSpecNameForPlatform (Object *fileSpec, Object *fileName)
+Object getFileSpecNameForPlatform (Object *fileSpec)
 {
   if (fileSpec->isString()) {
-    fileSpec->copy(fileName);
-    return gTrue;
+    return fileSpec->copy();
   }
 
+  Object fileName;
   if (fileSpec->isDict()) {
-    if (!fileSpec->dictLookup("UF", fileName)->isString ()) {
-      fileName->free();
-      if (!fileSpec->dictLookup("F", fileName)->isString ()) {
-        fileName->free();
+    fileName = fileSpec->dictLookup("UF");
+    if (!fileName.isString ()) {
+      fileName = fileSpec->dictLookup("F");
+      if (!fileName.isString ()) {
 #ifdef _WIN32
 	const char *platform = "DOS";
 #else
 	const char *platform = "Unix";
 #endif
-	if (!fileSpec->dictLookup(platform, fileName)->isString ()) {
-	  fileName->free();
+        fileName = fileSpec->dictLookup(platform);
+	if (!fileName.isString ()) {
 	  error(errSyntaxError, -1, "Illegal file spec");
-	  return gFalse;
+	  return Object();
 	}
       }
     }
   } else {
     error(errSyntaxError, -1, "Illegal file spec");
-    return gFalse;
+    return Object();
   }
 
   // system-dependent path manipulation
 #ifdef _WIN32
   int i, j;
-  GooString *name = fileName->getString();
+  GooString *name = fileName.getString();
   // "//...."             --> "\...."
   // "/x/...."            --> "x:\...."
   // "/server/share/...." --> "\\server\share\...."
@@ -291,5 +276,5 @@
   }
 #endif /* _WIN32 */
 
-  return gTrue;
+  return fileName;
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/FileSpec.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/FileSpec.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/FileSpec.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -6,6 +6,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2008 Carlos Garcia Campos <carlosgc at gnome.org>
+// Copyright (C) 2017 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
@@ -31,6 +32,7 @@
   GooString *createDate() { return m_createDate; }
   GooString *checksum() { return m_checksum; }
   GooString *mimeType() { return m_mimetype; }
+  Object *streamObject() { return &m_objStr; }
   Stream *stream() { return isOk() ? m_objStr.getStream() : NULL; }
   GBool isOk() { return m_objStr.isStream(); }
   GBool save(const char *path);
@@ -70,7 +72,7 @@
   GooString *desc;             // Desc
 };
 
-GBool getFileSpecName (Object *fileSpec, Object *fileName);
-GBool getFileSpecNameForPlatform (Object *fileSpec, Object *fileName);
+Object getFileSpecName (Object *fileSpec);
+Object getFileSpecNameForPlatform (Object *fileSpec);
 
 #endif /* FILE_SPEC_H */

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateEncoder.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateEncoder.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateEncoder.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -3,6 +3,7 @@
 // FlateEncoder.cc
 //
 // Copyright (C) 2016, William Bader <williambader at hotmail.com>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // This file is under the GPLv2 or later license
 //
@@ -127,7 +128,6 @@
     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;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateEncoder.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateEncoder.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateEncoder.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -44,16 +44,16 @@
 public:
 
   FlateEncoder(Stream *strA);
-  virtual ~FlateEncoder();
-  virtual StreamKind getKind() { return strWeird; }
-  virtual void reset();
-  virtual int getChar()
+  ~FlateEncoder();
+  StreamKind getKind() override { return strWeird; }
+  void reset() override;
+  int getChar() override
     { return (outBufPtr >= outBufEnd && !fillBuf()) ? EOF : (*outBufPtr++ & 0xff); }
-  virtual int lookChar()
+  int lookChar() override
     { return (outBufPtr >= outBufEnd && !fillBuf()) ? EOF : (*outBufPtr & 0xff); }
-  virtual GooString *getPSFilter(int psLevel, const char *indent) { return NULL; }
-  virtual GBool isBinary(GBool last = gTrue) { return gTrue; }
-  virtual GBool isEncoder() { return gTrue; }
+  GooString *getPSFilter(int psLevel, const char *indent) override { return NULL; }
+  GBool isBinary(GBool last = gTrue) override { return gTrue; }
+  GBool isEncoder() override { return gTrue; }
 
 private:
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateStream.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateStream.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateStream.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -5,6 +5,7 @@
 // Copyright (C) 2005, Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2010, Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2016, William Bader <williambader at hotmail.com>
+// Copyright (C) 2017, Adrian Johnson <ajohnson at redneon.com>
 //
 // This file is under the GPLv2 or later license
 //
@@ -18,7 +19,7 @@
 
 #include "poppler-config.h"
 
-#if ENABLE_ZLIB_UNCOMPRESS
+#ifdef ENABLE_ZLIB_UNCOMPRESS
 
 #include "FlateStream.h"
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateStream.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateStream.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/FlateStream.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -46,14 +46,14 @@
 
   FlateStream(Stream *strA, int predictor, int columns, int colors, int bits);
   virtual ~FlateStream();
-  virtual StreamKind getKind() { return strFlate; }
-  virtual void reset();
-  virtual int getChar();
-  virtual int lookChar();
-  virtual int getRawChar();
-  virtual void getRawChars(int nChars, int *buffer);
-  virtual GooString *getPSFilter(int psLevel, const char *indent);
-  virtual GBool isBinary(GBool last = gTrue);
+  virtual StreamKind getKind() override { return strFlate; }
+  virtual void reset() override;
+  virtual int getChar() override;
+  virtual int lookChar() override;
+  virtual int getRawChar() override;
+  virtual void getRawChars(int nChars, int *buffer) override;
+  virtual GooString *getPSFilter(int psLevel, const char *indent) override;
+  virtual GBool isBinary(GBool last = gTrue) override;
 
 private:
   inline int doGetRawChar() {

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/FontInfo.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/FontInfo.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/FontInfo.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -3,7 +3,7 @@
 // FontInfo.cc
 //
 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005-2008, 2010 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2008, 2010, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Brad Hards <bradh at frogmouth.net>
 // Copyright (C) 2006 Kouhei Sutou <kou at cozmixng.org>
 // Copyright (C) 2009 Pino Toscano <pino at kde.org>
@@ -54,7 +54,6 @@
   Page *page;
   Dict *resDict;
   Annots *annots;
-  Object obj1;
   int lastPage;
 
   if (currentPage > doc->getNumPages()) {
@@ -79,10 +78,10 @@
     }
     annots = page->getAnnots();
     for (int i = 0; i < annots->getNumAnnots(); ++i) {
-      if (annots->getAnnot(i)->getAppearanceResDict(&obj1)->isDict()) {
+      Object obj1 = annots->getAnnot(i)->getAppearanceResDict();
+      if (obj1.isDict()) {
         scanFonts(xrefA, obj1.getDict(), result);
       }
-      obj1.free();
     }
   }
 
@@ -93,27 +92,24 @@
 }
 
 void FontInfoScanner::scanFonts(XRef *xrefA, Dict *resDict, GooList *fontsList) {
-  Object obj1, obj2, objDict, resObj;
   Ref r;
   GfxFontDict *gfxFontDict;
   GfxFont *font;
-  int i;
 
   // scan the fonts in this resource dictionary
   gfxFontDict = NULL;
-  resDict->lookupNF("Font", &obj1);
+  Object obj1 = resDict->lookupNF("Font");
   if (obj1.isRef()) {
-    obj1.fetch(xrefA, &obj2);
+    Object obj2 = obj1.fetch(xrefA);
     if (obj2.isDict()) {
       r = obj1.getRef();
       gfxFontDict = new GfxFontDict(xrefA, &r, obj2.getDict());
     }
-    obj2.free();
   } else if (obj1.isDict()) {
     gfxFontDict = new GfxFontDict(xrefA, NULL, obj1.getDict());
   }
   if (gfxFontDict) {
-    for (i = 0; i < gfxFontDict->getNumFonts(); ++i) {
+    for (int i = 0; i < gfxFontDict->getNumFonts(); ++i) {
       if ((font = gfxFontDict->getFont(i))) {
         Ref fontRef = *font->getID();
 
@@ -126,21 +122,19 @@
     }
     delete gfxFontDict;
   }
-  obj1.free();
 
   // recursively scan any resource dictionaries in objects in this
   // resource dictionary
   const char *resTypes[] = { "XObject", "Pattern" };
   for (Guint resType = 0; resType < sizeof(resTypes) / sizeof(resTypes[0]); ++resType) {
-    resDict->lookup(resTypes[resType], &objDict);
+    Object objDict = resDict->lookup(resTypes[resType]);
     if (objDict.isDict()) {
-      for (i = 0; i < objDict.dictGetLength(); ++i) {
-        objDict.dictGetValNF(i, &obj1);
+      for (int i = 0; i < objDict.dictGetLength(); ++i) {
+        obj1 = objDict.dictGetValNF(i);
         if (obj1.isRef()) {
           // check for an already-seen object
           const Ref r = obj1.getRef();
           if (visitedObjects.find(r.num) != visitedObjects.end()) {
-            obj1.free();
             continue;
           }
 
@@ -147,27 +141,20 @@
           visitedObjects.insert(r.num);
         }
 
-        obj1.fetch(xrefA, &obj2);
-
+        Object obj2 = obj1.fetch(xrefA);
         if (obj2.isStream()) {
-          obj2.streamGetDict()->lookup("Resources", &resObj);
+          Object resObj = obj2.streamGetDict()->lookup("Resources");
           if (resObj.isDict() && resObj.getDict() != resDict) {
             scanFonts(xrefA, resObj.getDict(), fontsList);
           }
-          resObj.free();
         }
-        obj1.free();
-        obj2.free();
       }
     }
-    objDict.free();
   }
 }
 
 FontInfo::FontInfo(GfxFont *font, XRef *xref) {
   GooString *origName;
-  Object fontObj, toUnicodeObj;
-  int i;
 
   fontRef = *font->getID();
 
@@ -204,16 +191,16 @@
 
   // look for a ToUnicode map
   hasToUnicode = gFalse;
-  if (xref->fetch(fontRef.num, fontRef.gen, &fontObj)->isDict()) {
-    hasToUnicode = fontObj.dictLookup("ToUnicode", &toUnicodeObj)->isStream();
-    toUnicodeObj.free();
+  Object fontObj = xref->fetch(fontRef.num, fontRef.gen);
+  if (fontObj.isDict()) {
+    hasToUnicode = fontObj.dictLookup("ToUnicode").isStream();
   }
-  fontObj.free();
 
   // check for a font subset name: capital letters followed by a '+'
   // sign
   subset = gFalse;
   if (name) {
+    int i;
     for (i = 0; i < name->getLength(); ++i) {
       if (name->getChar(i) < 'A' || name->getChar(i) > 'Z') {
 	break;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Form.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Form.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Form.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -5,7 +5,7 @@
 // This file is licensed under the GPLv2 or later
 //
 // Copyright 2006-2008 Julien Rebetez <julienr at svn.gnome.org>
-// Copyright 2007-2012, 2015, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright 2007-2012, 2015-2017 Albert Astals Cid <aacid at kde.org>
 // Copyright 2007-2008, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright 2007, 2013, 2016 Adrian Johnson <ajohnson at redneon.com>
 // Copyright 2007 Iñigo Martínez <inigomartinez at gmail.com>
@@ -17,6 +17,8 @@
 // Copyright 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright 2015 André Guerreiro <aguerreiro1985 at gmail.com>
 // Copyright 2015 André Esser <bepandre at hotmail.com>
+// Copyright 2017 Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
+// Copyright 2017 Bernd Kuhls <berndkuhls at hotmail.com>
 //
 //========================================================================
 
@@ -27,8 +29,11 @@
 #endif
 
 #include <set>
+#include <limits>
 #include <stddef.h>
+#include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include "goo/gmem.h"
 #include "goo/GooString.h"
 #include "Error.h"
@@ -47,6 +52,7 @@
 #include "PDFDocEncoding.h"
 #include "Annot.h"
 #include "Link.h"
+#include "Lexer.h"
 
 //return a newly allocated char* containing an UTF16BE string of size length
 char* pdfDocEncodingToUTF16 (GooString* orig, int* length)
@@ -56,8 +62,8 @@
   char *result = new char[(*length)];
   char *cstring = orig->getCString();
   //unicode marker
-  result[0] = 0xfe;
-  result[1] = 0xff;
+  result[0] = (char)0xfe;
+  result[1] = (char)0xff;
   //convert to utf16
   for(int i=2,j=0; i<(*length); i+=2,j++) {
     Unicode u = pdfDocEncoding[(unsigned int)((unsigned char)cstring[j])]&0xffff;
@@ -85,7 +91,7 @@
   childNum = num;
   doc = docA;
   xref = doc->getXRef();
-  aobj->copy(&obj);
+  obj = aobj->copy();
   type = formUndef;
   field = fieldA;
   widget = NULL;
@@ -95,7 +101,6 @@
 {
   if (widget)
     widget->decRefCnt();
-  obj.free ();
 }
 
 #ifdef DEBUG_FORMS
@@ -108,10 +113,8 @@
   if (widget)
     return;
 
-  Object obj1;
-  obj1.initRef(ref.num, ref.gen);
-  widget = new AnnotWidget(doc, obj.getDict(), &obj1, field);
-  obj1.free();
+  Object obj1(ref.num, ref.gen);
+  widget = new AnnotWidget(doc, &obj, &obj1, field);
 }
 
 GBool FormWidget::inRect(double x, double y) const {
@@ -178,13 +181,13 @@
   type = formButton;
   onStr = NULL;
 
-  Object obj1, obj2;
-
   // Find the name of the ON state in the AP dictionnary
   // The reference say the Off state, if it existe, _must_ be stored in the AP dict under the name /Off
   // The "on" state may be stored under any other name
-  if (obj.dictLookup("AP", &obj1)->isDict()) {
-    if (obj1.dictLookup("N", &obj2)->isDict()) {
+  Object obj1 = obj.dictLookup("AP");
+  if (obj1.isDict()) {
+    Object obj2 = obj1.dictLookup("N");
+    if (obj2.isDict()) {
       for (int i = 0; i < obj2.dictGetLength(); i++) {
         char *key = obj2.dictGetKey(i);
         if (strcmp (key, "Off") != 0) {
@@ -193,9 +196,7 @@
         }
       }
     }
-    obj2.free();
   }
-  obj1.free();
 }
 
 char *FormWidgetButton::getOnStr() {
@@ -315,13 +316,18 @@
   return parent()->getMaxLen ();
 }
 
+double FormWidgetText::getTextFontSize()
+{
+  return parent()->getTextFontSize();
+}
+
+void FormWidgetText::setTextFontSize(int fontSize)
+{
+  parent()->setTextFontSize(fontSize);
+}
+
 void FormWidgetText::setContent(GooString* new_content)
 {
-  if (isReadOnly()) {
-    error(errInternal, -1, "FormWidgetText::setContentCopy called on a read only field\n");
-    return;
-  }
-
   parent()->setContentCopy(new_content);
 }
 
@@ -351,10 +357,6 @@
 
 void FormWidgetChoice::select (int i)
 {
-  if (isReadOnly()) {
-    error(errInternal, -1, "FormWidgetChoice::select called on a read only field\n");
-    return;
-  }
   if (!_checkRange(i)) return;
   parent()->select(i);
 }
@@ -361,10 +363,6 @@
 
 void FormWidgetChoice::toggle (int i)
 {
-  if (isReadOnly()) {
-    error(errInternal, -1, "FormWidgetChoice::toggle called on a read only field\n");
-    return;
-  }
   if (!_checkRange(i)) return;
   parent()->toggle(i);
 }
@@ -371,10 +369,6 @@
 
 void FormWidgetChoice::deselectAll ()
 {
-  if (isReadOnly()) {
-    error(errInternal, -1, "FormWidgetChoice::deselectAll called on a read only field\n");
-    return;
-  }
   parent()->deselectAll();
 }
 
@@ -401,10 +395,6 @@
 
 void FormWidgetChoice::setEditChoice (GooString* new_content)
 {
-  if (isReadOnly()) {
-    error(errInternal, -1, "FormWidgetText::setEditChoice called on a read only field\n");
-    return;
-  }
   if (!hasEdit()) {
     error(errInternal, -1, "FormFieldChoice::setEditChoice : trying to edit an non-editable choice\n");
     return;
@@ -464,11 +454,150 @@
   type = formSignature;
 }
 
-SignatureInfo *FormWidgetSignature::validateSignature(bool doVerifyCert, bool forceRevalidation)
+SignatureInfo *FormWidgetSignature::validateSignature(bool doVerifyCert, bool forceRevalidation, time_t validationTime)
 {
-  return static_cast<FormFieldSignature*>(field)->validateSignature(doVerifyCert, forceRevalidation);
+  return static_cast<FormFieldSignature*>(field)->validateSignature(doVerifyCert, forceRevalidation, validationTime);
 }
 
+std::vector<Goffset> FormWidgetSignature::getSignedRangeBounds()
+{
+  Object* obj = static_cast<FormFieldSignature*>(field)->getByteRange();
+  std::vector<Goffset> range_vec;
+  if (obj->isArray())
+  {
+    if (obj->arrayGetLength() == 4)
+    {
+      for (int i = 0; i < 2; ++i)
+      {
+        Object offsetObj(obj->arrayGet(2*i));
+        Object lenObj(obj->arrayGet(2*i+1));
+        if (offsetObj.isIntOrInt64() && lenObj.isIntOrInt64())
+        {
+          Goffset offset = offsetObj.getIntOrInt64();
+          Goffset len = lenObj.getIntOrInt64();
+          range_vec.push_back(offset);
+          range_vec.push_back(offset+len);
+        }
+      }
+    }
+  }
+  return range_vec;
+}
+
+GooString* FormWidgetSignature::getCheckedSignature(Goffset *checkedFileSize)
+{
+  Goffset start = 0;
+  Goffset end = 0;
+  const std::vector<Goffset> ranges = getSignedRangeBounds();
+  if (ranges.size() == 4)
+  {
+    start = ranges[1];
+    end = ranges[2];
+  }
+  if (end >= start+6)
+  {
+    BaseStream* stream = doc->getBaseStream();
+    *checkedFileSize = stream->getLength();
+    Goffset len = end-start;
+    stream->setPos(end-1);
+    int c2 = stream->lookChar();
+    stream->setPos(start);
+    int c1 = stream->getChar();
+    // PDF signatures are first ASN1 DER, then hex encoded PKCS#7 structures,
+    // possibly padded with 0 characters and enclosed in '<' and '>'.
+    // The ASN1 DER encoding of a PKCS#7 structure must start with the tag 0x30
+    // for SEQUENCE. The next byte must be 0x80 for ASN1 DER indefinite length
+    // encoding or (0x80 + n) for ASN1 DER definite length encoding
+    // where n is the number of subsequent "length bytes" which big-endian
+    // encode the length of the content of the SEQUENCE following them.
+    if (len <= std::numeric_limits<int>::max() && *checkedFileSize > end && c1 == '<' && c2 == '>')
+    {
+      GooString gstr;
+      ++start;
+      --end;
+      len = end-start;
+      Goffset pos = 0;
+      do
+      {
+        c1 = stream->getChar();
+        if (c1 == EOF)
+          return nullptr;
+        gstr.append(static_cast<char>(c1));
+      } while (++pos < len);
+      if (gstr.getChar(0) == '3' && gstr.getChar(1) == '0')
+      {
+        if (gstr.getChar(2) == '8' && gstr.getChar(3) == '0')
+        {
+          // ASN1 DER indefinite length encoding:
+          // We only check that all characters up to the enclosing '>'
+          // are hex characters and that there are two hex encoded 0 bytes
+          // just before the enclosing '>' marking the end of the indefinite
+          // length encoding.
+          int paddingCount = 0;
+          while (gstr.getChar(len-1) == '0' && gstr.getChar(len-2) == '0')
+          {
+            ++paddingCount;
+            len -= 2;
+          }
+          if (paddingCount < 2 || len%2 == 1)
+            len = 0;
+        }
+        else if (gstr.getChar(2) == '8')
+        {
+          // ASN1 DER definite length encoding:
+          // We calculate the length of the following bytes from the length bytes and
+          // check that after the length bytes and the following calculated number of
+          // bytes all bytes up to the enclosing '>' character are hex encoded 0 bytes.
+          int lenBytes = gstr.getChar(3) - '0';
+          if (lenBytes > 0 && lenBytes <= 4)
+          {
+            int sigLen = 0;
+            for (int i = 0; i < 2*lenBytes; ++i)
+            {
+              sigLen <<= 4;
+              char c = gstr.getChar(i+4);
+              if (isdigit(c))
+                sigLen += c - '0';
+              else if (isxdigit(c) && c >= 'a')
+                sigLen += c - 'a' + 10;
+              else if (isxdigit(c) && c >= 'A')
+                sigLen += c - 'A' + 10;
+              else
+              {
+                len = 0;
+                break;
+              }
+            }
+            if (sigLen > 0 && 2*(sigLen+lenBytes) <= len-4)
+            {
+              for (int i = 2*(sigLen+lenBytes)+4; i < len; ++i)
+              {
+                if (gstr.getChar(i) != '0')
+                {
+                  len = 0;
+                  break;
+                }
+              }
+            }
+            else
+              len = 0;
+          }
+        }
+        for (int i = 0; i < len; ++i)
+        {
+          if (!isxdigit(gstr.getChar(i)))
+            len = 0;
+        }
+        if (len > 0)
+        {
+          return new GooString(&gstr, 0, len);
+        }
+      }
+    }
+  }
+  return nullptr;
+}
+
 void FormWidgetSignature::updateWidgetAppearance()
 {
   // Unimplemented
@@ -483,7 +612,7 @@
 {
   doc = docA;
   xref = doc->getXRef();
-  aobj->copy(&obj);
+  obj = aobj->copy();
   Dict* dict = obj.getDict();
   ref.num = ref.gen = 0;
   type = ty;
@@ -500,42 +629,36 @@
 
   ref = aref;
 
-  Object obj1;
   //childs
-  if (dict->lookup("Kids", &obj1)->isArray()) {
+  Object obj1 = dict->lookup("Kids");
+  if (obj1.isArray()) {
     // Load children
     for (int i = 0 ; i < obj1.arrayGetLength(); i++) {
-      Object childRef, childObj;
-
-      if (!obj1.arrayGetNF(i, &childRef)->isRef()) {
+      Object childRef = obj1.arrayGetNF(i);
+      if (!childRef.isRef()) {
         error (errSyntaxError, -1, "Invalid form field renference");
-        childRef.free();
         continue;
       }
-      if (!obj1.arrayGet(i, &childObj)->isDict()) {
+      Object childObj = obj1.arrayGet(i);
+      if (!childObj.isDict()) {
         error (errSyntaxError, -1, "Form field child is not a dictionary");
-        childObj.free();
-        childRef.free();
         continue;
       }
 
       const Ref ref = childRef.getRef();
       if (usedParents->find(ref.num) == usedParents->end()) {
-        Object obj2, obj3;
         // Field child: it could be a form field or a widget or composed dict
-        if (childObj.dictLookupNF("Parent", &obj2)->isRef() || childObj.dictLookup("Parent", &obj3)->isDict()) {
+        Object obj2 = childObj.dictLookupNF("Parent");
+	Object obj3 = childObj.dictLookup("Parent");
+        if (obj2.isRef() || obj3.isDict()) {
           // Child is a form field or composed dict
           // We create the field, if it's composed
           // it will create the widget as a child
           std::set<int> usedParentsAux = *usedParents;
           usedParentsAux.insert(ref.num);
-          obj2.free();
-          obj3.free();
 
           if (terminal) {
             error(errSyntaxWarning, -1, "Field can't have both Widget AND Field as kids\n");
-            childObj.free();
-            childRef.free();
             continue;
           }
 
@@ -542,34 +665,29 @@
           numChildren++;
           children = (FormField**)greallocn(children, numChildren, sizeof(FormField*));
           children[numChildren - 1] = Form::createFieldFromDict(&childObj, doc, ref, this, &usedParentsAux);
-        } else if (childObj.dictLookup("Subtype", &obj2)->isName("Widget")) {
-          // Child is a widget annotation
-          if (!terminal && numChildren > 0) {
-            error(errSyntaxWarning, -1, "Field can't have both Widget AND Field as kids\n");
-            obj2.free();
-            obj3.free();
-            childObj.free();
-            childRef.free();
-            continue;
-          }
-          _createWidget(&childObj, ref);
-        }
-        obj2.free();
-        obj3.free();
+        } else {
+	  obj2 = childObj.dictLookup("Subtype");
+	  if (obj2.isName("Widget")) {
+	    // Child is a widget annotation
+	    if (!terminal && numChildren > 0) {
+	      error(errSyntaxWarning, -1, "Field can't have both Widget AND Field as kids\n");
+	      continue;
+	    }
+	    _createWidget(&childObj, ref);
+	  }
+	}
       }
-      childObj.free();
-      childRef.free();
     }
   } else {
     // No children, if it's a composed dict, create the child widget
-    obj1.free();
-    if (dict->lookup("Subtype", &obj1)->isName("Widget"))
+    obj1 = dict->lookup("Subtype");
+    if (obj1.isName("Widget"))
       _createWidget(&obj, ref);
   }
-  obj1.free();
 
   //flags
-  if (Form::fieldLookup(dict, "Ff", &obj1)->isInt()) {
+  obj1 = Form::fieldLookup(dict, "Ff");
+  if (obj1.isInt()) {
     int flags = obj1.getInt();
     if (flags & 0x1) { // 1 -> ReadOnly
       readOnly = true;
@@ -581,39 +699,38 @@
       //TODO
     }
   }
-  obj1.free();
 
   // Variable Text
-  if (Form::fieldLookup(dict, "DA", &obj1)->isString())
+  obj1 = Form::fieldLookup(dict, "DA");
+  if (obj1.isString())
     defaultAppearance = obj1.getString()->copy();
-  obj1.free();
 
-  if (Form::fieldLookup(dict, "Q", &obj1)->isInt()) {
+  obj1 = Form::fieldLookup(dict, "Q");
+  if (obj1.isInt()) {
     quadding = static_cast<VariableTextQuadding>(obj1.getInt());
     hasQuadding = gTrue;
   }
-  obj1.free();
 
-  if (dict->lookup("T", &obj1)->isString()) {
+  obj1 = dict->lookup("T");
+  if (obj1.isString()) {
     partialName = obj1.getString()->copy();
   } else {
     partialName = NULL;
   }
-  obj1.free();
 
-  if (dict->lookup("TU", &obj1)->isString()) {
+  obj1 = dict->lookup("TU");
+  if (obj1.isString()) {
     alternateUiName = obj1.getString()->copy();
   } else {
     alternateUiName = NULL;
   }
-  obj1.free();
 
-  if(dict->lookup("TM", &obj1)->isString()) {
+  obj1 = dict->lookup("TM");
+  if(obj1.isString()) {
     mappingName = obj1.getString()->copy();
   } else {
     mappingName = NULL;
   }
-  obj1.free();
 }
 
 void FormField::setPartialName(const GooString &name)
@@ -621,9 +738,7 @@
   delete partialName;
   partialName = name.copy();
 
-  Object obj1;
-  obj1.initString(name.copy());
-  obj.getDict()->set("T", &obj1);
+  obj.getDict()->set("T", Object(name.copy()));
   xref->setModifiedObject(&obj, ref);
 }
 
@@ -640,7 +755,6 @@
       delete widgets[i];
     gfree (widgets);
   }
-  obj.free();
 
   delete defaultAppearance;
   delete partialName;
@@ -710,7 +824,6 @@
   default:
     error(errSyntaxWarning, -1, "SubType on non-terminal field, invalid document?");
     numChildren--;
-    terminal = false;
   }
 }
 
@@ -732,7 +845,7 @@
 }
 
 GooString* FormField::getFullyQualifiedName() {
-  Object obj1, obj2;
+  Object obj1;
   Object parent;
   GooString *parent_name;
   GooString *full_name;
@@ -743,9 +856,10 @@
 
   full_name = new GooString();
 
-  obj.copy(&obj1);
-  while (obj1.dictLookup("Parent", &parent)->isDict()) {
-    if (parent.dictLookup("T", &obj2)->isString()) {
+  obj1 = obj.copy();
+  while (parent = obj1.dictLookup("Parent"), parent.isDict()) {
+    Object obj2 = parent.dictLookup("T");
+    if (obj2.isString()) {
       parent_name = obj2.getString();
 
       if (unicode_encoded) {
@@ -768,14 +882,9 @@
           full_name->insert(0, parent_name);
         }
       }
-      obj2.free();
     }
-    obj1.free();
-    parent.copy(&obj1);
-    parent.free();
+    obj1 = parent.copy();
   }
-  obj1.free();
-  parent.free();
 
   if (partialName) {
     if (unicode_encoded) {
@@ -811,8 +920,7 @@
   }
   
   if (unicode_encoded) {
-    full_name->insert(0, 0xff);
-    full_name->insert(0, 0xfe);
+    full_name->prependUnicodeMarker();
   }
 
   fullyQualifiedName = full_name;
@@ -842,11 +950,11 @@
   noAllOff = false;
   siblings = NULL;
   numSiblings = 0;
-  appearanceState.initNull();
+  appearanceState.setToNull();
 
-  Object obj1;
-  btype = formButtonCheck; 
-  if (Form::fieldLookup(dict, "Ff", &obj1)->isInt()) {
+  btype = formButtonCheck;
+  Object obj1 = Form::fieldLookup(dict, "Ff");
+  if (obj1.isInt()) {
     int flags = obj1.getInt();
     
     if (flags & 0x10000) { // 17 -> push button
@@ -865,7 +973,7 @@
   if (btype != formButtonPush) {
     // Even though V is inheritable we are interested in the value of this
     // field, if not present it's probably because it's a button in a set.
-    dict->lookup("V", &appearanceState);
+    appearanceState = dict->lookup("V");
   }
 }
 
@@ -924,11 +1032,6 @@
 
 GBool FormFieldButton::setState(char *state)
 {
-  if (readOnly) {
-    error(errInternal, -1, "FormFieldButton::setState called on a readOnly field\n");
-    return gFalse;
-  }
-
   // A check button could behave as a radio button
   // when it's in a set of more than 1 buttons
   if (btype != formButtonRadio && btype != formButtonCheck)
@@ -994,19 +1097,13 @@
 }
 
 void FormFieldButton::updateState(char *state) {
-  Object obj1;
-
-  appearanceState.free();
-  appearanceState.initName(state);
-
-  appearanceState.copy(&obj1);
-  obj.getDict()->set("V", &obj1);
+  appearanceState = Object(objName, state);
+  obj.getDict()->set("V", appearanceState.copy());
   xref->setModifiedObject(&obj, ref);
 }
 
 FormFieldButton::~FormFieldButton()
 {
-  appearanceState.free();
   if (siblings)
     gfree(siblings);
 }
@@ -1023,7 +1120,8 @@
   multiline = password = fileSelect = doNotSpellCheck = doNotScroll = comb = richText = false;
   maxLen = 0;
 
-  if (Form::fieldLookup(dict, "Ff", &obj1)->isInt()) {
+  obj1 = Form::fieldLookup(dict, "Ff");
+  if (obj1.isInt()) {
     int flags = obj1.getInt();
     if (flags & 0x1000) // 13 -> Multiline
       multiline = true;
@@ -1040,14 +1138,14 @@
     if (flags & 0x2000000)// 26 -> RichText
       richText = true;
   }
-  obj1.free();
 
-  if (Form::fieldLookup(dict, "MaxLen", &obj1)->isInt()) {
+  obj1 = Form::fieldLookup(dict, "MaxLen");
+  if (obj1.isInt()) {
     maxLen = obj1.getInt();
   }
-  obj1.free();
 
-  if (Form::fieldLookup(dict, "V", &obj1)->isString()) {
+  obj1 = Form::fieldLookup(dict, "V");
+  if (obj1.isString()) {
     if (obj1.getString()->hasUnicodeMarker()) {
       if (obj1.getString()->getLength() > 2)
         content = obj1.getString()->copy();
@@ -1059,7 +1157,6 @@
       delete [] tmp_str;
     }
   }
-  obj1.free();
 }
 
 #ifdef DEBUG_FORMS
@@ -1086,14 +1183,11 @@
 
     //append the unicode marker <FE FF> if needed
     if (!content->hasUnicodeMarker()) {
-      content->insert(0, 0xff);
-      content->insert(0, 0xfe);
+      content->prependUnicodeMarker();
     }
   }
 
-  Object obj1;
-  obj1.initString(content ? content->copy() : new GooString(""));
-  obj.getDict()->set("V", &obj1);
+  obj.getDict()->set("V", Object(content ? content->copy() : new GooString("")));
   xref->setModifiedObject(&obj, ref);
   updateChildrenAppearance();
 }
@@ -1103,7 +1197,88 @@
   delete content;
 }
 
+double FormFieldText::getTextFontSize()
+{
+  GooList* daToks = new GooList();
+  int idx = parseDA(daToks);
+  double fontSize = -1;
+  if (idx >= 0) {
+    char* p = nullptr;
+    fontSize = strtod(static_cast<GooString*>(daToks->get(idx))->getCString(), &p);
+    if (!p || *p)
+      fontSize = -1;
+  }
+  deleteGooList(daToks, GooString);
+  return fontSize;
+}
 
+void FormFieldText::setTextFontSize(int fontSize)
+{
+  if (fontSize > 0 && obj.isDict()) {
+    GooList* daToks = new GooList();
+    int idx = parseDA(daToks);
+    if (idx == -1) {
+      error(errSyntaxError, -1, "FormFieldText:: invalid DA object\n");
+      deleteGooList(daToks, GooString);
+      return;
+    }
+    if (defaultAppearance)
+      delete defaultAppearance;
+    defaultAppearance = new GooString;
+    for (int i = 0; i < daToks->getLength(); ++i) {
+      if (i > 0)
+        defaultAppearance->append(' ');
+      if (i == idx) {
+        defaultAppearance->appendf("{0:d}", fontSize);
+      } else {
+        defaultAppearance->append(static_cast<GooString*>(daToks->get(i)));
+      }
+    }
+    deleteGooList(daToks, GooString);
+    obj.dictSet("DA", Object(defaultAppearance->copy()));
+    xref->setModifiedObject(&obj, ref);
+    updateChildrenAppearance();
+  }
+}
+
+int FormFieldText::tokenizeDA(GooString* da, GooList* daToks, const char* searchTok)
+{
+  int idx = -1;
+  if(da && daToks) {
+    int i = 0;
+    int j = 0;
+    while (i < da->getLength()) {
+      while (i < da->getLength() && Lexer::isSpace(da->getChar(i))) {
+        ++i;
+      }
+      if (i < da->getLength()) {
+        for (j = i + 1; j < da->getLength() && !Lexer::isSpace(da->getChar(j)); ++j) {
+        }
+        GooString* tok = new GooString(da, i, j - i);
+        if (searchTok && !tok->cmp(searchTok))
+          idx = daToks->getLength();
+        daToks->append(tok);
+        i = j;
+      }
+    }
+  }
+  return idx;
+}
+
+int FormFieldText::parseDA(GooList* daToks)
+{
+  int idx = -1;
+  if (obj.isDict()) {
+    Object objDA(obj.dictLookup("DA"));
+    if (objDA.isString()) {
+      GooString* da = objDA.getString();
+      idx = tokenizeDA(da, daToks, "Tf") - 1;
+    }
+  }
+  return idx;
+}
+
+
 //------------------------------------------------------------------------
 // FormFieldChoice
 //------------------------------------------------------------------------
@@ -1120,7 +1295,8 @@
 
   combo = edit = multiselect = doNotSpellCheck = doCommitOnSelChange = false;
 
-  if (Form::fieldLookup(dict, "Ff", &obj1)->isInt()) {
+  obj1 = Form::fieldLookup(dict, "Ff");
+  if (obj1.isInt()) {
     int flags = obj1.getInt();
     if (flags & 0x20000) // 18 -> Combo
       combo = true; 
@@ -1133,67 +1309,62 @@
     if (flags & 0x4000000) // 27 -> CommitOnSelChange
       doCommitOnSelChange = true;
   }
-  obj1.free();
 
-  if (dict->lookup("TI", &obj1)->isInt())
+  obj1 = dict->lookup("TI");
+  if (obj1.isInt())
     topIdx = obj1.getInt();
-  obj1.free();
 
-  if (dict->lookup("Opt", &obj1)->isArray()) {
-    Object obj2;
-
+  obj1 = dict->lookup("Opt");
+  if (obj1.isArray()) {
     numChoices = obj1.arrayGetLength();
     choices = new ChoiceOpt[numChoices];
     memset(choices, 0, sizeof(ChoiceOpt) * numChoices);
 
     for (int i = 0; i < numChoices; i++) {
-      if (obj1.arrayGet(i, &obj2)->isString()) {
+      Object obj2 = obj1.arrayGet(i);
+      if (obj2.isString()) {
         choices[i].optionName = obj2.getString()->copy();
       } else if (obj2.isArray()) { // [Export_value, Displayed_text]
-        Object obj3;
-
         if (obj2.arrayGetLength() < 2) {
           error(errSyntaxError, -1, "FormWidgetChoice:: invalid Opt entry -- array's length < 2\n");
           continue;
         }
-        if (obj2.arrayGet(0, &obj3)->isString())
+        Object obj3 = obj2.arrayGet(0);
+        if (obj3.isString())
           choices[i].exportVal = obj3.getString()->copy();
         else
           error(errSyntaxError, -1, "FormWidgetChoice:: invalid Opt entry -- exported value not a string\n");
-        obj3.free();
 
-        if (obj2.arrayGet(1, &obj3)->isString())
+        obj3 = obj2.arrayGet(1);
+        if (obj3.isString())
           choices[i].optionName = obj3.getString()->copy();
         else
           error(errSyntaxError, -1, "FormWidgetChoice:: invalid Opt entry -- choice name not a string\n");
-        obj3.free();
       } else {
         error(errSyntaxError, -1, "FormWidgetChoice:: invalid {0:d} Opt entry\n", i);
       }
-      obj2.free();
     }
   } else {
     //empty choice
   }
-  obj1.free();
 
   // Find selected items
   // Note: PDF specs say that /V has precedence over /I, but acroread seems to
   // do the opposite. We do the same.
-  if (Form::fieldLookup(dict, "I", &obj1)->isArray()) {
+  obj1 = Form::fieldLookup(dict, "I");
+  if (obj1.isArray()) {
     for (int i = 0; i < obj1.arrayGetLength(); i++) {
-      Object obj2;
-      if (obj1.arrayGet(i, &obj2)->isInt() && obj2.getInt() >= 0 && obj2.getInt() < numChoices) {
+      Object obj2 = obj1.arrayGet(i);
+      if (obj2.isInt() && obj2.getInt() >= 0 && obj2.getInt() < numChoices) {
         choices[obj2.getInt()].selected = true;
       }
-      obj2.free();
     }
   } else {
-    obj1.free();
     // Note: According to PDF specs, /V should *never* contain the exportVal.
     // However, if /Opt is an array of (exportVal,optionName) pairs, acroread
     // seems to expect the exportVal instead of the optionName and so we do too.
-    if (Form::fieldLookup(dict, "V", &obj1)->isString()) {
+    obj1 = Form::fieldLookup(dict, "V");
+    if (obj1.isString()) {
       GBool optionFound = gFalse;
 
       for (int i = 0; i < numChoices; i++) {
@@ -1220,8 +1391,7 @@
     } else if (obj1.isArray()) {
       for (int i = 0; i < numChoices; i++) {
         for (int j = 0; j < obj1.arrayGetLength(); j++) {
-          Object obj2;
-          obj1.arrayGet(j, &obj2);
+          Object obj2 = obj1.arrayGet(j);
           GBool matches = gFalse;
 
           if (choices[i].exportVal) {
@@ -1234,8 +1404,6 @@
             }
           }
 
-          obj2.free();
-
           if (matches) {
             choices[i].selected = true;
             break; // We've determined that this option is selected. No need to keep on scanning
@@ -1244,7 +1412,6 @@
       }
     }
   }
-  obj1.free();
 }
 
 FormFieldChoice::~FormFieldChoice()
@@ -1266,35 +1433,35 @@
 #endif
 
 void FormFieldChoice::updateSelection() {
-  Object objV, objI, obj1;
-  objI.initNull();
+  Object objV, obj1;
+  Object objI(objNull);
 
   if (edit && editedChoice) {
     // This is an editable combo-box with user-entered text
-    objV.initString(editedChoice->copy());
+    objV = Object(editedChoice->copy());
   } else {
     const int numSelected = getNumSelected();
 
     // Create /I array only if multiple selection is allowed (as per PDF spec)
     if (multiselect) {
-      objI.initArray(xref);
+      objI = Object(new Array(xref));
     }
 
     if (numSelected == 0) {
       // No options are selected
-      objV.initString(new GooString(""));
+      objV = Object(new GooString(""));
     } else if (numSelected == 1) {
       // Only one option is selected
       for (int i = 0; i < numChoices; i++) {
         if (choices[i].selected) {
           if (multiselect) {
-            objI.arrayAdd(obj1.initInt(i));
+            objI.arrayAdd(Object(i));
           }
 
           if (choices[i].exportVal) {
-            objV.initString(choices[i].exportVal->copy());
+            objV = Object(choices[i].exportVal->copy());
           } else if (choices[i].optionName) {
-            objV.initString(choices[i].optionName->copy());
+            objV = Object(choices[i].optionName->copy());
           }
 
           break; // We've just written the selected option. No need to keep on scanning
@@ -1302,17 +1469,17 @@
       }
     } else {
       // More than one option is selected
-      objV.initArray(xref);
+      objV = Object(new Array(xref));
       for (int i = 0; i < numChoices; i++) {
         if (choices[i].selected) {
           if (multiselect) {
-            objI.arrayAdd(obj1.initInt(i));
+            objI.arrayAdd(Object(i));
           }
 
           if (choices[i].exportVal) {
-            objV.arrayAdd(obj1.initString(choices[i].exportVal->copy()));
+            objV.arrayAdd(Object(choices[i].exportVal->copy()));
           } else if (choices[i].optionName) {
-            objV.arrayAdd(obj1.initString(choices[i].optionName->copy()));
+            objV.arrayAdd(Object(choices[i].optionName->copy()));
           }
         }
       }
@@ -1319,8 +1486,8 @@
     }
   }
 
-  obj.getDict()->set("V", &objV);
-  obj.getDict()->set("I", &objI);
+  obj.getDict()->set("V", std::move(objV));
+  obj.getDict()->set("I", std::move(objI));
   xref->setModifiedObject(&obj, ref);
   updateChildrenAppearance();
 }
@@ -1373,8 +1540,7 @@
 
     //append the unicode marker <FE FF> if needed
     if (!editedChoice->hasUnicodeMarker()) {
-      editedChoice->insert(0, 0xff);
-      editedChoice->insert(0, 0xfe);
+      editedChoice->prependUnicodeMarker();
     }
   }
   updateSelection();
@@ -1411,7 +1577,9 @@
 // FormFieldSignature
 //------------------------------------------------------------------------
 FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents)
-  : FormField(docA, dict, ref, parent, usedParents, formSignature)
+  : FormField(docA, dict, ref, parent, usedParents, formSignature),
+    signature_type(adbe_pkcs7_detached),
+    signature(nullptr), signature_info(nullptr)
 {
   signature = NULL;
 
@@ -1421,7 +1589,6 @@
 
 FormFieldSignature::~FormFieldSignature()
 {
-  byte_range.free();
   delete signature_info;
   delete signature;
 }
@@ -1431,39 +1598,40 @@
   if (!obj.isDict())
     return;
 
-  Object sig_dict, contents_obj, time_of_signing, subfilterName;
-
   // retrieve PKCS#7
-  obj.dictLookup("V", &sig_dict);
+  Object sig_dict = obj.dictLookup("V");
   if (!sig_dict.isDict()) {
-    sig_dict.free();
     return;
   }
 
-  sig_dict.dictLookup("Contents", &contents_obj);
+  Object contents_obj = sig_dict.dictLookup("Contents");
   if (contents_obj.isString()) {
     signature = contents_obj.getString()->copy();
   }
-  contents_obj.free();
 
-  sig_dict.dictLookup("ByteRange", &byte_range);
+  byte_range = sig_dict.dictLookup("ByteRange");
 
   // retrieve SigningTime
-  sig_dict.dictLookup("M", &time_of_signing);
+  Object time_of_signing = sig_dict.dictLookup("M");
   if (time_of_signing.isString()) {
     GooString *time_str = time_of_signing.getString();
     signature_info->setSigningTime(dateStringToTime(time_str)); // Put this information directly in SignatureInfo object
-    time_of_signing.free();
   }
 
   // check if subfilter is supported for signature validation, only detached signatures work for now
-  sig_dict.dictLookup("SubFilter", &subfilterName);
-  if (subfilterName.isName("adbe.pkcs7.detached") || subfilterName.isName("adbe.pkcs7.sha1")) {
+  Object subfilterName = sig_dict.dictLookup("SubFilter");
+  if (subfilterName.isName("adbe.pkcs7.sha1")) {
+    signature_type = adbe_pkcs7_sha1;
     signature_info->setSubFilterSupport(true);
   }
-
-  subfilterName.free();
-  sig_dict.free();
+  else if (subfilterName.isName("adbe.pkcs7.detached")) {
+    signature_type = adbe_pkcs7_detached;
+    signature_info->setSubFilterSupport(true);
+  }
+  else if (subfilterName.isName("ETSI.CAdES.detached")) {
+    signature_type = ETSI_CAdES_detached;
+    signature_info->setSubFilterSupport(true);
+  }
 }
 
 void FormFieldSignature::hashSignedDataBlock(SignatureHandler *handler, Goffset block_len)
@@ -1492,8 +1660,12 @@
 #endif
 }
 
+FormSignatureType FormWidgetSignature::signatureType()
+{
+  return static_cast<FormFieldSignature*>(field)->signature_type;
+}
 
-SignatureInfo *FormFieldSignature::validateSignature(bool doVerifyCert, bool forceRevalidation)
+SignatureInfo *FormFieldSignature::validateSignature(bool doVerifyCert, bool forceRevalidation, time_t validationTime)
 {
 #ifdef ENABLE_NSS3
   if (!signature_info->isSubfilterSupported()) {
@@ -1530,9 +1702,8 @@
 
   Goffset fileLength = doc->getBaseStream()->getLength();
   for (int i = 0; i < arrayLen/2; i++) {
-    Object offsetObj, lenObj;
-    byte_range.arrayGet(i*2, &offsetObj);
-    byte_range.arrayGet(i*2+1, &lenObj);
+    Object offsetObj = byte_range.arrayGet(i*2);
+    Object lenObj = byte_range.arrayGet(i*2+1);
 
     if (!offsetObj.isIntOrInt64() || !lenObj.isIntOrInt64()) {
       error(errSyntaxError, 0, "Illegal values in ByteRange array");
@@ -1554,6 +1725,8 @@
   sig_val_state = signature_handler.validateSignature();
   signature_info->setSignatureValStatus(SignatureHandler::NSS_SigTranslate(sig_val_state));
   signature_info->setSignerName(signature_handler.getSignerName());
+  signature_info->setSubjectDN(signature_handler.getSignerSubjectDN());
+  signature_info->setHashAlgorithm(signature_handler.getHashAlgorithm());
 
   // verify if signature contains a 'signing time' attribute
   if (signature_handler.getSigningTime() != 0) {
@@ -1564,7 +1737,7 @@
     return signature_info;
   }
 
-  cert_val_state = signature_handler.validateCertificate();
+  cert_val_state = signature_handler.validateCertificate(validationTime);
   signature_info->setCertificateValStatus(SignatureHandler::NSS_CertTranslate(cert_val_state));
 
 #endif
@@ -1598,50 +1771,41 @@
   defaultAppearance = NULL;
   defaultResources = NULL;
 
-  acroForm->dictLookup("NeedAppearances", &obj1);
+  obj1 = acroForm->dictLookup("NeedAppearances");
   needAppearances = (obj1.isBool() && obj1.getBool());
-  obj1.free();
 
-  if (acroForm->dictLookup("DA", &obj1)->isString())
+  obj1 = acroForm->dictLookup("DA");
+  if (obj1.isString())
     defaultAppearance = obj1.getString()->copy();
-  obj1.free();
 
-  if (acroForm->dictLookup("Q", &obj1)->isInt())
+  obj1 = acroForm->dictLookup("Q");
+  if (obj1.isInt())
     quadding = static_cast<VariableTextQuadding>(obj1.getInt());
-  obj1.free();
 
-  acroForm->dictLookup("DR", &resDict);
+  resDict = acroForm->dictLookup("DR");
   if (resDict.isDict()) {
     // At a minimum, this dictionary shall contain a Font entry
-    if (resDict.dictLookup("Font", &obj1)->isDict())
+    obj1 = resDict.dictLookup("Font");
+    if (obj1.isDict())
       defaultResources = new GfxResources(xref, resDict.getDict(), NULL);
-    obj1.free();
   }
   if (!defaultResources) {
-    resDict.free();
-    resDict.initNull();
+    resDict.setToNull();
   }
 
-  acroForm->dictLookup("Fields", &obj1);
+  obj1 = acroForm->dictLookup("Fields");
   if (obj1.isArray()) {
     Array *array = obj1.getArray();
-    Object obj2;
-    
     for(int i=0; i<array->getLength(); i++) {
-      Object oref;
-      array->get(i, &obj2);
-      array->getNF(i, &oref);
+      Object obj2 = array->get(i);
+      Object oref = array->getNF(i);
       if (!oref.isRef()) {
         error(errSyntaxWarning, -1, "Direct object in rootFields");
-	obj2.free();
-	oref.free();
         continue;
       }
 
       if (!obj2.isDict()) {
         error(errSyntaxWarning, -1, "Reference in Fields array to an invalid or non existent object");
-	obj2.free();
-	oref.free();
 	continue;
       }
 
@@ -1653,14 +1817,25 @@
       std::set<int> usedParents;
       rootFields[numFields++] = createFieldFromDict (&obj2, doc, oref.getRef(), NULL, &usedParents);
 
-      obj2.free();
-      oref.free();
     }
   } else {
     error(errSyntaxError, -1, "Can't get Fields array\n");
   }
-  obj1.free ();
 
+  obj1 = acroForm->dictLookup("CO");
+  if (obj1.isArray()) {
+    Array *array = obj1.getArray();
+    calculateOrder.reserve(array->getLength());
+    for(int i=0; i<array->getLength(); i++) {
+      Object oref = array->getNF(i);
+      if (!oref.isRef()) {
+        error(errSyntaxWarning, -1, "Direct object in CO");
+        continue;
+      }
+      calculateOrder.push_back(oref.getRef());
+    }
+  }
+
 #ifdef DEBUG_FORMS
   for (int i = 0; i < numFields; i++)
     rootFields[i]->printTree();
@@ -1674,54 +1849,43 @@
   gfree (rootFields);
   delete defaultAppearance;
   delete defaultResources;
-  resDict.free();
 }
 
 // Look up an inheritable field dictionary entry.
-static Object *fieldLookup(Dict *field, const char *key, Object *obj, std::set<int> *usedParents) {
-  Dict *dict;
-  Object parent;
-
-  dict = field;
-  if (!dict->lookup(key, obj)->isNull()) {
+static Object fieldLookup(Dict *field, const char *key, std::set<int> *usedParents) {
+  Dict *dict = field;
+  Object obj = dict->lookup(key);
+  if (!obj.isNull()) {
     return obj;
   }
-  obj->free();
-  dict->lookupNF("Parent", &parent);
+  Object parent = dict->lookupNF("Parent");
   if (parent.isRef()) {
     const Ref ref = parent.getRef();
     if (usedParents->find(ref.num) == usedParents->end()) {
       usedParents->insert(ref.num);
 
-      Object obj2;
-      parent.fetch(dict->getXRef(), &obj2);
+      Object obj2 = parent.fetch(dict->getXRef());
       if (obj2.isDict()) {
-        fieldLookup(obj2.getDict(), key, obj, usedParents);
-      } else {
-        obj->initNull();
+        return fieldLookup(obj2.getDict(), key, usedParents);
       }
-      obj2.free();
     }
   } else if (parent.isDict()) {
-    fieldLookup(parent.getDict(), key, obj, usedParents);
-  } else {
-    obj->initNull();
+    return fieldLookup(parent.getDict(), key, usedParents);
   }
-  parent.free();
-  return obj;
+  return Object(objNull);
 }
 
-Object *Form::fieldLookup(Dict *field, const char *key, Object *obj) {
+Object Form::fieldLookup(Dict *field, const char *key) {
   std::set<int> usedParents;
-  return ::fieldLookup(field, key, obj, &usedParents);
+  return ::fieldLookup(field, key, &usedParents);
 }
 
 FormField *Form::createFieldFromDict (Object* obj, PDFDoc *docA, const Ref& pref, FormField *parent, std::set<int> *usedParents)
 {
-    Object obj2;
     FormField *field;
 
-    if (Form::fieldLookup(obj->getDict (), "FT", &obj2)->isName("Btn")) {
+    Object obj2 = Form::fieldLookup(obj->getDict (), "FT");
+    if (obj2.isName("Btn")) {
       field = new FormFieldButton(docA, obj, pref, parent, usedParents);
     } else if (obj2.isName("Tx")) {
       field = new FormFieldText(docA, obj, pref, parent, usedParents);
@@ -1732,7 +1896,6 @@
     } else { //we don't have an FT entry => non-terminal field
       field = new FormField(docA, obj, pref, parent, usedParents);
     }
-    obj2.free();
 
     return field;
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Form.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Form.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Form.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -6,7 +6,7 @@
 //
 // Copyright 2006 Julien Rebetez <julienr at svn.gnome.org>
 // Copyright 2007, 2008, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
-// Copyright 2007-2010, 2012, 2015, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright 2007-2010, 2012, 2015-2017 Albert Astals Cid <aacid at kde.org>
 // Copyright 2010 Mark Riedesel <mark at klowner.com>
 // Copyright 2011 Pino Toscano <pino at kde.org>
 // Copyright 2012 Fabio D'Urso <fabiodurso at hotmail.it>
@@ -13,6 +13,8 @@
 // Copyright 2013 Adrian Johnson <ajohnson at redneon.com>
 // Copyright 2015 André Guerreiro <aguerreiro1985 at gmail.com>
 // Copyright 2015 André Esser <bepandre at hotmail.com>
+// Copyright 2017 Roland Hieber <r.hieber at pengutronix.de>
+// Copyright 2017 Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
 //
 //========================================================================
 
@@ -23,10 +25,13 @@
 #pragma interface
 #endif
 
+#include "goo/GooList.h"
 #include "Object.h"
 #include "Annot.h"
 
 #include <set>
+#include <vector>
+#include <ctime>
 
 class GooString;
 class Array;
@@ -60,6 +65,12 @@
   quaddingRightJustified
 };
 
+enum FormSignatureType {
+  adbe_pkcs7_sha1,
+  adbe_pkcs7_detached,
+  ETSI_CAdES_detached
+};
+
 class Form;
 class FormField;
 class FormFieldButton;
@@ -165,7 +176,7 @@
 
   char* getOnStr();
   void setAppearanceState(const char *state);
-  void updateWidgetAppearance();
+  void updateWidgetAppearance() override;
 
 protected:
   FormFieldButton *parent() const;
@@ -187,7 +198,7 @@
   //except a UTF16BE string
   void setContent(GooString* new_content);
 
-  void updateWidgetAppearance();
+  void updateWidgetAppearance() override;
 
   bool isMultiline () const; 
   bool isPassword () const; 
@@ -197,6 +208,11 @@
   bool isComb () const; 
   bool isRichText () const;
   int getMaxLen () const;
+  //return the font size of the field's text
+  double getTextFontSize();
+  //set the font size of the field's text (currently only integer values)
+  void setTextFontSize(int fontSize);
+
 protected:
   FormFieldText *parent() const;
 };
@@ -228,7 +244,7 @@
 
   GooString* getEditChoice ();
 
-  void updateWidgetAppearance();
+  void updateWidgetAppearance() override;
   bool isSelected (int i);
 
   bool isCombo () const; 
@@ -249,9 +265,20 @@
 class FormWidgetSignature: public FormWidget {
 public:
   FormWidgetSignature(PDFDoc *docA, Object *dict, unsigned num, Ref ref, FormField *p);
-  void updateWidgetAppearance();
+  void updateWidgetAppearance() override;
 
-  SignatureInfo *validateSignature(bool doVerifyCert, bool forceRevalidation);
+  FormSignatureType signatureType();
+  // Use -1 for now as validationTime
+  SignatureInfo *validateSignature(bool doVerifyCert, bool forceRevalidation, time_t validationTime);
+
+  // returns a list with the boundaries of the signed ranges
+  // the elements of the list are of type Goffset
+  std::vector<Goffset> getSignedRangeBounds();
+
+  // checks the length encoding of the signature and returns the hex encoded signature
+  // if the check passed (and the checked file size as output parameter in checkedFileSize)
+  // otherwise a nullptr is returned
+  GooString* getCheckedSignature(Goffset *checkedFileSize);
 };
 
 //------------------------------------------------------------------------
@@ -350,7 +377,7 @@
 
   char *getAppearanceState() { return appearanceState.isName() ? appearanceState.getName() : NULL; }
 
-  void fillChildrenSiblingsID ();
+  void fillChildrenSiblingsID () override;
   
   void setNumSiblings (int num);
   void setSibling (int i, FormFieldButton *id) { siblings[i] = id; }
@@ -363,7 +390,7 @@
   void print(int indent = 0);
 #endif
 
-  virtual ~FormFieldButton();
+  ~FormFieldButton();
 protected:
   void updateState(char *state);
 
@@ -389,7 +416,7 @@
   GooString* getContent () { return content; }
   GooString* getContentCopy ();
   void setContentCopy (GooString* new_content);
-  virtual ~FormFieldText();
+  ~FormFieldText();
 
   bool isMultiline () const { return multiline; }
   bool isPassword () const { return password; }
@@ -401,10 +428,20 @@
 
   int getMaxLen () const { return maxLen; }
 
+  //return the font size of the field's text
+  double getTextFontSize();
+  //set the font size of the field's text (currently only integer values)
+  void setTextFontSize(int fontSize);
+
 #ifdef DEBUG_FORMS
   void print(int indent = 0);
 #endif
+
+  static int tokenizeDA(GooString* daString, GooList* daToks, const char* searchTok);
+
 protected:
+  int parseDA(GooList* daToks);
+
   GooString* content;
   bool multiline;
   bool password;
@@ -424,7 +461,7 @@
 public:
   FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set<int> *usedParents);
 
-  virtual ~FormFieldChoice();
+  ~FormFieldChoice();
 
   int getNumChoices() { return numChoices; }
   GooString* getChoice(int i) { return choices ? choices[i].optionName : NULL; }
@@ -490,16 +527,22 @@
 //------------------------------------------------------------------------
 
 class FormFieldSignature: public FormField {
+  friend class FormWidgetSignature;
 public:
   FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents);
 
-  SignatureInfo *validateSignature(bool doVerifyCert, bool forceRevalidation);
+  // Use -1 for now as validationTime
+  SignatureInfo *validateSignature(bool doVerifyCert, bool forceRevalidation, time_t validationTime);
 
-  virtual ~FormFieldSignature();
+  ~FormFieldSignature();
+  Object* getByteRange() { return &byte_range; }
+  GooString* getSignature() { return signature; }
 
 private:
   void parseInfo();
   void hashSignedDataBlock(SignatureHandler *handler, Goffset block_len);
+
+  FormSignatureType signature_type;
   Object byte_range;
   GooString *signature;
   SignatureInfo *signature_info;
@@ -522,7 +565,7 @@
   ~Form();
 
   // Look up an inheritable field dictionary entry.
-  static Object *fieldLookup(Dict *field, const char *key, Object *obj);
+  static Object fieldLookup(Dict *field, const char *key);
   
   /* Creates a new Field of the type specified in obj's dict.
      used in Form::Form and FormField::FormField */
@@ -540,6 +583,9 @@
   FormWidget* findWidgetByRef (Ref aref);
 
   void postWidgetsLoad();
+
+  const std::vector<Ref> &getCalculateOrder() const { return calculateOrder; }
+
 private:
   FormField** rootFields;
   int numFields;
@@ -550,6 +596,7 @@
   GBool needAppearances;
   GfxResources *defaultResources;
   Object resDict;
+  std::vector<Ref> calculateOrder;
 
   // Variable Text
   GooString *defaultAppearance;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Function.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Function.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Function.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2006, 2008-2010, 2013-2015 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006, 2008-2010, 2013-2015, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2010 Christian Feuers\xE4nger <cfeuersaenger at googlemail.com>
 // Copyright (C) 2011 Andrea Canciani <ranma42 at gmail.com>
@@ -67,7 +67,6 @@
   Function *func;
   Dict *dict;
   int funcType;
-  Object obj1;
 
   if (funcObj->isStream()) {
     dict = funcObj->streamGetDict();
@@ -80,13 +79,12 @@
     return NULL;
   }
 
-  if (!dict->lookup("FunctionType", &obj1)->isInt()) {
+  Object obj1 = dict->lookup("FunctionType");
+  if (!obj1.isInt()) {
     error(errSyntaxError, -1, "Function type is missing or wrong type");
-    obj1.free();
-    return NULL;
+    return nullptr;
   }
   funcType = obj1.getInt();
-  obj1.free();
 
   if (funcType == 0) {
     func = new SampledFunction(funcObj, dict);
@@ -119,75 +117,65 @@
 }
 
 GBool Function::init(Dict *dict) {
-  Object obj1, obj2;
+  Object obj1;
   int i;
 
   //----- Domain
-  if (!dict->lookup("Domain", &obj1)->isArray()) {
+  obj1 = dict->lookup("Domain");
+  if (!obj1.isArray()) {
     error(errSyntaxError, -1, "Function is missing domain");
-    goto err2;
+    return gFalse;
   }
   m = obj1.arrayGetLength() / 2;
   if (m > funcMaxInputs) {
     error(errSyntaxError, -1, "Functions with more than {0:d} inputs are unsupported",
 	  funcMaxInputs);
-    goto err2;
+    return gFalse;
   }
   for (i = 0; i < m; ++i) {
-    obj1.arrayGet(2*i, &obj2);
+    Object obj2 = obj1.arrayGet(2*i);
     if (!obj2.isNum()) {
       error(errSyntaxError, -1, "Illegal value in function domain array");
-      goto err1;
+      return gFalse;
     }
     domain[i][0] = obj2.getNum();
-    obj2.free();
-    obj1.arrayGet(2*i+1, &obj2);
+    obj2 = obj1.arrayGet(2*i+1);
     if (!obj2.isNum()) {
       error(errSyntaxError, -1, "Illegal value in function domain array");
-      goto err1;
+      return gFalse;
     }
     domain[i][1] = obj2.getNum();
-    obj2.free();
   }
-  obj1.free();
 
   //----- Range
   hasRange = gFalse;
   n = 0;
-  if (dict->lookup("Range", &obj1)->isArray()) {
+  obj1 = dict->lookup("Range");
+  if (obj1.isArray()) {
     hasRange = gTrue;
     n = obj1.arrayGetLength() / 2;
     if (n > funcMaxOutputs) {
       error(errSyntaxError, -1, "Functions with more than {0:d} outputs are unsupported",
 	    funcMaxOutputs);
-      goto err2;
+      return gFalse;
     }
     for (i = 0; i < n; ++i) {
-      obj1.arrayGet(2*i, &obj2);
+      Object obj2 = obj1.arrayGet(2*i);
       if (!obj2.isNum()) {
 	error(errSyntaxError, -1, "Illegal value in function range array");
-	goto err1;
+	return gFalse;
       }
       range[i][0] = obj2.getNum();
-      obj2.free();
-      obj1.arrayGet(2*i+1, &obj2);
+      obj2 = obj1.arrayGet(2*i+1);
       if (!obj2.isNum()) {
 	error(errSyntaxError, -1, "Illegal value in function range array");
-	goto err1;
+	return gFalse;
       }
       range[i][1] = obj2.getNum();
-      obj2.free();
     }
   }
-  obj1.free();
 
   return gTrue;
-
- err1:
-  obj2.free();
- err2:
-  obj1.free();
-  return gFalse;
 }
 
 //------------------------------------------------------------------------
@@ -227,7 +215,7 @@
   Stream *str;
   int sampleBits;
   double sampleMul;
-  Object obj1, obj2;
+  Object obj1;
   Guint buf, bitMask;
   int bits;
   Guint s;
@@ -241,16 +229,16 @@
 
   //----- initialize the generic stuff
   if (!init(dict)) {
-    goto err1;
+    return;
   }
   if (!hasRange) {
     error(errSyntaxError, -1, "Type 0 function is missing range");
-    goto err1;
+    return;
   }
   if (m > sampledFuncMaxInputs) {
     error(errSyntaxError, -1, "Sampled functions with more than {0:d} inputs are unsupported",
 	  sampledFuncMaxInputs);
-    goto err1;
+    return;
   }
 
   //----- buffer
@@ -259,30 +247,28 @@
   //----- get the stream
   if (!funcObj->isStream()) {
     error(errSyntaxError, -1, "Type 0 function isn't a stream");
-    goto err1;
+    return;
   }
   str = funcObj->getStream();
 
   //----- Size
-  if (!dict->lookup("Size", &obj1)->isArray() ||
-      obj1.arrayGetLength() != m) {
+  obj1 = dict->lookup("Size");
+  if (!obj1.isArray() || obj1.arrayGetLength() != m) {
     error(errSyntaxError, -1, "Function has missing or invalid size array");
-    goto err2;
+    return;
   }
   for (i = 0; i < m; ++i) {
-    obj1.arrayGet(i, &obj2);
+    Object obj2 = obj1.arrayGet(i);
     if (!obj2.isInt()) {
       error(errSyntaxError, -1, "Illegal value in function size array");
-      goto err3;
+      return;
     }
     sampleSize[i] = obj2.getInt();
     if (sampleSize[i] <= 0) {
       error(errSyntaxError, -1, "Illegal non-positive value in function size array");
-      goto err3;
+      return;
     }
-    obj2.free();
   }
-  obj1.free();
   idxOffset = (int *)gmallocn(1 << m, sizeof(int));
   for (i = 0; i < (1<<m); ++i) {
     idx = 0;
@@ -303,32 +289,30 @@
   }
 
   //----- BitsPerSample
-  if (!dict->lookup("BitsPerSample", &obj1)->isInt()) {
+  obj1 = dict->lookup("BitsPerSample");
+  if (!obj1.isInt()) {
     error(errSyntaxError, -1, "Function has missing or invalid BitsPerSample");
-    goto err2;
+    return;
   }
   sampleBits = obj1.getInt();
   sampleMul = 1.0 / (pow(2.0, (double)sampleBits) - 1);
-  obj1.free();
 
   //----- Encode
-  if (dict->lookup("Encode", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 2*m) {
+  obj1 = dict->lookup("Encode");
+  if (obj1.isArray() && obj1.arrayGetLength() == 2*m) {
     for (i = 0; i < m; ++i) {
-      obj1.arrayGet(2*i, &obj2);
+      Object obj2 = obj1.arrayGet(2*i);
       if (!obj2.isNum()) {
 	error(errSyntaxError, -1, "Illegal value in function encode array");
-	goto err3;
+	return;
       }
       encode[i][0] = obj2.getNum();
-      obj2.free();
-      obj1.arrayGet(2*i+1, &obj2);
+      obj2 = obj1.arrayGet(2*i+1);
       if (!obj2.isNum()) {
 	error(errSyntaxError, -1, "Illegal value in function encode array");
-	goto err3;
+	return;
       }
       encode[i][1] = obj2.getNum();
-      obj2.free();
     }
   } else {
     for (i = 0; i < m; ++i) {
@@ -336,7 +320,6 @@
       encode[i][1] = sampleSize[i] - 1;
     }
   }
-  obj1.free();
   for (i = 0; i < m; ++i) {
     inputMul[i] = (encode[i][1] - encode[i][0]) /
                   (domain[i][1] - domain[i][0]);
@@ -343,23 +326,22 @@
   }
 
   //----- Decode
-  if (dict->lookup("Decode", &obj1)->isArray() &&
+  obj1 = dict->lookup("Decode");
+  if (obj1.isArray() &&
       obj1.arrayGetLength() == 2*n) {
     for (i = 0; i < n; ++i) {
-      obj1.arrayGet(2*i, &obj2);
+      Object obj2 = obj1.arrayGet(2*i);
       if (!obj2.isNum()) {
 	error(errSyntaxError, -1, "Illegal value in function decode array");
-	goto err3;
+	return;
       }
       decode[i][0] = obj2.getNum();
-      obj2.free();
-      obj1.arrayGet(2*i+1, &obj2);
+      obj2 = obj1.arrayGet(2*i+1);
       if (!obj2.isNum()) {
 	error(errSyntaxError, -1, "Illegal value in function decode array");
-	goto err3;
+	return;
       }
       decode[i][1] = obj2.getNum();
-      obj2.free();
     }
   } else {
     for (i = 0; i < n; ++i) {
@@ -367,7 +349,6 @@
       decode[i][1] = range[i][1];
     }
   }
-  obj1.free();
 
   //----- samples
   nSamples = n;
@@ -409,14 +390,6 @@
   transform(in, cacheOut);
 
   ok = gTrue;
-  return;
-
- err3:
-  obj2.free();
- err2:
-  obj1.free();
- err1:
-  return;
 }
 
 SampledFunction::~SampledFunction() {
@@ -556,25 +529,25 @@
 //------------------------------------------------------------------------
 
 ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) {
-  Object obj1, obj2;
-  int i;
+  Object obj1;
 
   ok = gFalse;
 
   //----- initialize the generic stuff
   if (!init(dict)) {
-    goto err1;
+    return;
   }
   if (m != 1) {
     error(errSyntaxError, -1, "Exponential function with more than one input");
-    goto err1;
+    return;
   }
 
   //----- C0
-  if (dict->lookup("C0", &obj1)->isArray()) {
+  obj1 = dict->lookup("C0");
+  if (obj1.isArray()) {
     if (hasRange && obj1.arrayGetLength() != n) {
       error(errSyntaxError, -1, "Function's C0 array is wrong length");
-      goto err2;
+      return;
     }
     n = obj1.arrayGetLength();
     if (unlikely(n > funcMaxOutputs)) {
@@ -581,67 +554,56 @@
       error(errSyntaxError, -1, "Function's C0 array is wrong length");
       n = funcMaxOutputs;
     }
-    for (i = 0; i < n; ++i) {
-      obj1.arrayGet(i, &obj2);
+    for (int i = 0; i < n; ++i) {
+      Object obj2 = obj1.arrayGet(i);
       if (!obj2.isNum()) {
 	error(errSyntaxError, -1, "Illegal value in function C0 array");
-	goto err3;
+	return;
       }
       c0[i] = obj2.getNum();
-      obj2.free();
     }
   } else {
     if (hasRange && n != 1) {
       error(errSyntaxError, -1, "Function's C0 array is wrong length");
-      goto err2;
+      return;
     }
     n = 1;
     c0[0] = 0;
   }
-  obj1.free();
 
   //----- C1
-  if (dict->lookup("C1", &obj1)->isArray()) {
+  obj1 = dict->lookup("C1");
+  if (obj1.isArray()) {
     if (obj1.arrayGetLength() != n) {
       error(errSyntaxError, -1, "Function's C1 array is wrong length");
-      goto err2;
+      return;
     }
-    for (i = 0; i < n; ++i) {
-      obj1.arrayGet(i, &obj2);
+    for (int i = 0; i < n; ++i) {
+      Object obj2 = obj1.arrayGet(i);
       if (!obj2.isNum()) {
 	error(errSyntaxError, -1, "Illegal value in function C1 array");
-	goto err3;
+	return;
       }
       c1[i] = obj2.getNum();
-      obj2.free();
     }
   } else {
     if (n != 1) {
       error(errSyntaxError, -1, "Function's C1 array is wrong length");
-      goto err2;
+      return;
     }
     c1[0] = 1;
   }
-  obj1.free();
 
   //----- N (exponent)
-  if (!dict->lookup("N", &obj1)->isNum()) {
+  obj1 = dict->lookup("N");
+  if (!obj1.isNum()) {
     error(errSyntaxError, -1, "Function has missing or invalid N");
-    goto err2;
+    return;
   }
   e = obj1.getNum();
-  obj1.free();
 
   isLinear = fabs(e-1.) < 1e-10;
   ok = gTrue;
-  return;
-
- err3:
-  obj2.free();
- err2:
-  obj1.free();
- err1:
-  return;
 }
 
 ExponentialFunction::~ExponentialFunction() {
@@ -685,7 +647,7 @@
 //------------------------------------------------------------------------
 
 StitchingFunction::StitchingFunction(Object *funcObj, Dict *dict, std::set<int> *usedParents) {
-  Object obj1, obj2;
+  Object obj1;
   int i;
 
   ok = gFalse;
@@ -696,17 +658,18 @@
 
   //----- initialize the generic stuff
   if (!init(dict)) {
-    goto err1;
+    return;
   }
   if (m != 1) {
     error(errSyntaxError, -1, "Stitching function with more than one input");
-    goto err1;
+    return;
   }
 
   //----- Functions
-  if (!dict->lookup("Functions", &obj1)->isArray()) {
+  obj1 = dict->lookup("Functions");
+  if (!obj1.isArray()) {
     error(errSyntaxError, -1, "Missing 'Functions' entry in stitching function");
-    goto err1;
+    return;
   }
   k = obj1.arrayGetLength();
   funcs = (Function **)gmallocn(k, sizeof(Function *));
@@ -718,63 +681,58 @@
   }
   for (i = 0; i < k; ++i) {
     std::set<int> usedParentsAux = *usedParents;
-    obj1.arrayGetNF(i, &obj2);
+    Object obj2 = obj1.arrayGetNF(i);
     if (obj2.isRef()) {
       const Ref ref = obj2.getRef();
       if (usedParentsAux.find(ref.num) == usedParentsAux.end()) {
         usedParentsAux.insert(ref.num);
-        obj2.free();
-        obj1.arrayGet(i, &obj2);
+        obj2 = obj1.arrayGet(i);
       } else {
-        goto err2;
+        return;
       }
     }
     if (!(funcs[i] = Function::parse(&obj2, &usedParentsAux))) {
-      goto err2;
+      return;
     }
     if (funcs[i]->getInputSize() != 1 ||
 	(i > 0 && funcs[i]->getOutputSize() != funcs[0]->getOutputSize())) {
       error(errSyntaxError, -1,
 	    "Incompatible subfunctions in stitching function");
-      goto err2;
+      return;
     }
-    obj2.free();
   }
-  obj1.free();
 
   //----- Bounds
-  if (!dict->lookup("Bounds", &obj1)->isArray() ||
-      obj1.arrayGetLength() != k - 1) {
+  obj1 = dict->lookup("Bounds");
+  if (!obj1.isArray() || obj1.arrayGetLength() != k - 1) {
     error(errSyntaxError, -1, "Missing or invalid 'Bounds' entry in stitching function");
-    goto err1;
+    return;
   }
   bounds[0] = domain[0][0];
   for (i = 1; i < k; ++i) {
-    if (!obj1.arrayGet(i - 1, &obj2)->isNum()) {
+    Object obj2 = obj1.arrayGet(i - 1);
+    if (!obj2.isNum()) {
       error(errSyntaxError, -1, "Invalid type in 'Bounds' array in stitching function");
-      goto err2;
+      return;
     }
     bounds[i] = obj2.getNum();
-    obj2.free();
   }
   bounds[k] = domain[0][1];
-  obj1.free();
 
   //----- Encode
-  if (!dict->lookup("Encode", &obj1)->isArray() ||
-      obj1.arrayGetLength() != 2 * k) {
+  obj1 = dict->lookup("Encode");
+  if (!obj1.isArray() || obj1.arrayGetLength() != 2 * k) {
     error(errSyntaxError, -1, "Missing or invalid 'Encode' entry in stitching function");
-    goto err1;
+    return;
   }
   for (i = 0; i < 2 * k; ++i) {
-    if (!obj1.arrayGet(i, &obj2)->isNum()) {
+    Object obj2 = obj1.arrayGet(i);
+    if (!obj2.isNum()) {
       error(errSyntaxError, -1, "Invalid type in 'Encode' array in stitching function");
-      goto err2;
+      return;
     }
     encode[i] = obj2.getNum();
-    obj2.free();
   }
-  obj1.free();
 
   //----- pre-compute the scale factors
   for (i = 0; i < k; ++i) {
@@ -790,11 +748,6 @@
   n = funcs[0]->getOutputSize();
   ok = gTrue;
   return;
-
- err2:
-  obj2.free();
- err1:
-  obj1.free();
 }
 
 StitchingFunction::StitchingFunction(const StitchingFunction *func) : Function(func) {
@@ -1623,7 +1576,9 @@
       case psOpIdiv:
 	i2 = stack->popInt();
 	i1 = stack->popInt();
-	stack->pushInt(i1 / i2);
+	if (likely(i2 != 0)) {
+	  stack->pushInt(i1 / i2);
+	}
 	break;
       case psOpIndex:
 	stack->index(stack->popInt());
@@ -1659,7 +1614,9 @@
       case psOpMod:
 	i2 = stack->popInt();
 	i1 = stack->popInt();
-	stack->pushInt(i1 % i2);
+	if (likely(i2 != 0)) {
+	  stack->pushInt(i1 % i2);
+	}
 	break;
       case psOpMul:
 	if (stack->topTwoAreInts()) {

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Function.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Function.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Function.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -109,11 +109,11 @@
 public:
 
   IdentityFunction();
-  virtual ~IdentityFunction();
-  virtual Function *copy() { return new IdentityFunction(); }
-  virtual int getType() { return -1; }
-  virtual void transform(double *in, double *out);
-  virtual GBool isOk() { return gTrue; }
+  ~IdentityFunction();
+  Function *copy() override { return new IdentityFunction(); }
+  int getType() override { return -1; }
+  void transform(double *in, double *out) override;
+  GBool isOk() override { return gTrue; }
 
 private:
 };
@@ -126,12 +126,12 @@
 public:
 
   SampledFunction(Object *funcObj, Dict *dict);
-  virtual ~SampledFunction();
-  virtual Function *copy() { return new SampledFunction(this); }
-  virtual int getType() { return 0; }
-  virtual void transform(double *in, double *out);
-  virtual GBool isOk() { return ok; }
-  virtual GBool hasDifferentResultSet(Function *func);
+  ~SampledFunction();
+  Function *copy() override { return new SampledFunction(this); }
+  int getType() override { return 0; }
+  void transform(double *in, double *out) override;
+  GBool isOk() override { return ok; }
+  GBool hasDifferentResultSet(Function *func) override;
 
   int getSampleSize(int i) { return sampleSize[i]; }
   double getEncodeMin(int i) { return encode[i][0]; }
@@ -170,11 +170,11 @@
 public:
 
   ExponentialFunction(Object *funcObj, Dict *dict);
-  virtual ~ExponentialFunction();
-  virtual Function *copy() { return new ExponentialFunction(this); }
-  virtual int getType() { return 2; }
-  virtual void transform(double *in, double *out);
-  virtual GBool isOk() { return ok; }
+  ~ExponentialFunction();
+  Function *copy() override { return new ExponentialFunction(this); }
+  int getType() override { return 2; }
+  void transform(double *in, double *out) override;
+  GBool isOk() override { return ok; }
 
   double *getC0() { return c0; }
   double *getC1() { return c1; }
@@ -199,11 +199,11 @@
 public:
 
   StitchingFunction(Object *funcObj, Dict *dict, std::set<int> *usedParents);
-  virtual ~StitchingFunction();
-  virtual Function *copy() { return new StitchingFunction(this); }
-  virtual int getType() { return 3; }
-  virtual void transform(double *in, double *out);
-  virtual GBool isOk() { return ok; }
+  ~StitchingFunction();
+  Function *copy() override { return new StitchingFunction(this); }
+  int getType() override { return 3; }
+  void transform(double *in, double *out) override;
+  GBool isOk() override { return ok; }
 
   int getNumFuncs() { return k; }
   Function *getFunc(int i) { return funcs[i]; }
@@ -231,11 +231,11 @@
 public:
 
   PostScriptFunction(Object *funcObj, Dict *dict);
-  virtual ~PostScriptFunction();
-  virtual Function *copy() { return new PostScriptFunction(this); }
-  virtual int getType() { return 4; }
-  virtual void transform(double *in, double *out);
-  virtual GBool isOk() { return ok; }
+  ~PostScriptFunction();
+  Function *copy() override { return new PostScriptFunction(this); }
+  int getType() override { return 4; }
+  void transform(double *in, double *out) override;
+  GBool isOk() override { return ok; }
 
   GooString *getCodeString() { return codeString; }
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Gfx.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Gfx.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Gfx.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -14,13 +14,13 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
-// Copyright (C) 2005-2013, 2015, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2013, 2015-2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Thorkild Stray <thorkild at ifi.uio.no>
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006-2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2007, 2008 Brad Hards <bradh at kde.org>
-// Copyright (C) 2007, 2011 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2007, 2011, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2007, 2008 Iñigo Martínez <inigomartinez at gmail.com>
 // Copyright (C) 2007 Koji Otani <sho at bbr.jp>
 // Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
@@ -55,6 +55,7 @@
 #include <stddef.h>
 #include <string.h>
 #include <math.h>
+#include <memory>
 #include "goo/gmem.h"
 #include "goo/GooTimer.h"
 #include "goo/GooHash.h"
@@ -132,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},
@@ -305,10 +302,6 @@
           &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) {
@@ -334,46 +327,44 @@
     // build font dictionary
     Dict *resDict = resDictA->copy(xref);
     fonts = NULL;
-    resDict->lookupNF("Font", &obj1);
+    obj1 = resDict->lookupNF("Font");
     if (obj1.isRef()) {
-      obj1.fetch(xref, &obj2);
+      obj2 = obj1.fetch(xref);
       if (obj2.isDict()) {
 	r = obj1.getRef();
 	fonts = new GfxFontDict(xref, &r, obj2.getDict());
       }
-      obj2.free();
     } else if (obj1.isDict()) {
       fonts = new GfxFontDict(xref, NULL, obj1.getDict());
     }
-    obj1.free();
 
     // get XObject dictionary
-    resDict->lookup("XObject", &xObjDict);
+    xObjDict = resDict->lookup("XObject");
 
     // get color space dictionary
-    resDict->lookup("ColorSpace", &colorSpaceDict);
+    colorSpaceDict = resDict->lookup("ColorSpace");
 
     // get pattern dictionary
-    resDict->lookup("Pattern", &patternDict);
+    patternDict = resDict->lookup("Pattern");
 
     // get shading dictionary
-    resDict->lookup("Shading", &shadingDict);
+    shadingDict = resDict->lookup("Shading");
 
     // get graphics state parameter dictionary
-    resDict->lookup("ExtGState", &gStateDict);
+    gStateDict = resDict->lookup("ExtGState");
 
     // get properties dictionary
-    resDict->lookup("Properties", &propertiesDict);
+    propertiesDict = resDict->lookup("Properties");
 
     delete resDict;
   } else {
     fonts = NULL;
-    xObjDict.initNull();
-    colorSpaceDict.initNull();
-    patternDict.initNull();
-    shadingDict.initNull();
-    gStateDict.initNull();
-    propertiesDict.initNull();
+    xObjDict.setToNull();
+    colorSpaceDict.setToNull();
+    patternDict.setToNull();
+    shadingDict.setToNull();
+    gStateDict.setToNull();
+    propertiesDict.setToNull();
   }
 
   next = nextA;
@@ -380,15 +371,7 @@
 }
 
 GfxResources::~GfxResources() {
-  if (fonts) {
-    delete fonts;
-  }
-  xObjDict.free();
-  colorSpaceDict.free();
-  patternDict.free();
-  shadingDict.free();
-  gStateDict.free();
-  propertiesDict.free();
+  delete fonts;
 }
 
 GfxFont *GfxResources::lookupFont(char *name) {
@@ -405,75 +388,79 @@
   return NULL;
 }
 
-GBool GfxResources::lookupXObject(char *name, Object *obj) {
+Object GfxResources::lookupXObject(char *name) {
   GfxResources *resPtr;
 
   for (resPtr = this; resPtr; resPtr = resPtr->next) {
     if (resPtr->xObjDict.isDict()) {
-      if (!resPtr->xObjDict.dictLookup(name, obj)->isNull())
-	return gTrue;
-      obj->free();
+      Object obj = resPtr->xObjDict.dictLookup(name);
+      if (!obj.isNull())
+	return obj;
     }
   }
   error(errSyntaxError, -1, "XObject '{0:s}' is unknown", name);
-  return gFalse;
+  return Object(objNull);
 }
 
-GBool GfxResources::lookupXObjectNF(char *name, Object *obj) {
+Object GfxResources::lookupXObjectNF(char *name) {
   GfxResources *resPtr;
 
   for (resPtr = this; resPtr; resPtr = resPtr->next) {
     if (resPtr->xObjDict.isDict()) {
-      if (!resPtr->xObjDict.dictLookupNF(name, obj)->isNull())
-	return gTrue;
-      obj->free();
+      Object obj = resPtr->xObjDict.dictLookupNF(name);
+      if (!obj.isNull())
+	return obj;
     }
   }
   error(errSyntaxError, -1, "XObject '{0:s}' is unknown", name);
-  return gFalse;
+  return Object(objNull);
 }
 
-GBool GfxResources::lookupMarkedContentNF(char *name, Object *obj) {
+Object GfxResources::lookupMarkedContentNF(char *name) {
   GfxResources *resPtr;
 
   for (resPtr = this; resPtr; resPtr = resPtr->next) {
     if (resPtr->propertiesDict.isDict()) {
-      if (!resPtr->propertiesDict.dictLookupNF(name, obj)->isNull())
-	return gTrue;
-      obj->free();
+      Object obj = resPtr->propertiesDict.dictLookupNF(name);
+      if (!obj.isNull())
+	return obj;
     }
   }
   error(errSyntaxError, -1, "Marked Content '{0:s}' is unknown", name);
-  return gFalse;
+  return Object(objNull);
 }
 
-void GfxResources::lookupColorSpace(const char *name, Object *obj) {
+Object GfxResources::lookupColorSpace(const char *name) {
   GfxResources *resPtr;
 
   for (resPtr = this; resPtr; resPtr = resPtr->next) {
     if (resPtr->colorSpaceDict.isDict()) {
-      if (!resPtr->colorSpaceDict.dictLookup(name, obj)->isNull()) {
-	return;
+      Object obj = resPtr->colorSpaceDict.dictLookup(name);
+      if (!obj.isNull()) {
+	return obj;
       }
-      obj->free();
     }
   }
-  obj->initNull();
+  return Object(objNull);
 }
 
 GfxPattern *GfxResources::lookupPattern(char *name, OutputDev *out, GfxState *state) {
   GfxResources *resPtr;
   GfxPattern *pattern;
-  Object obj;
 
   for (resPtr = this; resPtr; resPtr = resPtr->next) {
     if (resPtr->patternDict.isDict()) {
-      if (!resPtr->patternDict.dictLookup(name, &obj)->isNull()) {
-	pattern = GfxPattern::parse(resPtr, &obj, out, state);
-	obj.free();
+      Object obj = resPtr->patternDict.dictLookupNF(name);
+      if (!obj.isNull()) {
+	Ref patternRef = { -1, -1 };
+	if (obj.isRef()) {
+	  patternRef = obj.getRef();
+	  obj = obj.fetch(resPtr->patternDict.getDict()->getXRef());
+	}
+
+	pattern = GfxPattern::parse(resPtr, &obj, out, state, patternRef.num);
 	return pattern;
       }
-      obj.free();
     }
   }
   error(errSyntaxError, -1, "Unknown pattern '{0:s}'", name);
@@ -483,16 +470,14 @@
 GfxShading *GfxResources::lookupShading(char *name, OutputDev *out, GfxState *state) {
   GfxResources *resPtr;
   GfxShading *shading;
-  Object obj;
 
   for (resPtr = this; resPtr; resPtr = resPtr->next) {
     if (resPtr->shadingDict.isDict()) {
-      if (!resPtr->shadingDict.dictLookup(name, &obj)->isNull()) {
+      Object obj = resPtr->shadingDict.dictLookup(name);
+      if (!obj.isNull()) {
 	shading = GfxShading::parse(resPtr, &obj, out, state);
-	obj.free();
 	return shading;
       }
-      obj.free();
     }
   }
   error(errSyntaxError, -1, "ExtGState '{0:s}' is unknown", name);
@@ -499,35 +484,36 @@
   return NULL;
 }
 
-GBool GfxResources::lookupGState(char *name, Object *obj) {
-  if (!lookupGStateNF(name, obj))
-    return gFalse;
+Object GfxResources::lookupGState(char *name) {
+  Object obj = lookupGStateNF(name);
+  if (obj.isNull())
+    return Object(objNull);
 
-  if (!obj->isRef())
-    return gTrue;
+  if (!obj.isRef())
+    return obj;
   
-  const Ref ref = obj->getRef();
-  if (!gStateCache.lookup(ref, obj)->isNull())
-    return gTrue;
-  obj->free();
+  const Ref ref = obj.getRef();
+  obj = gStateCache.lookup(ref);
+  if (!obj.isNull())
+    return obj;
 
-  gStateCache.put(ref)->copy(obj);
-  return gTrue;
+  obj = gStateCache.put(ref)->copy();
+  return obj;
 }
 
-GBool GfxResources::lookupGStateNF(char *name, Object *obj) {
+Object GfxResources::lookupGStateNF(char *name) {
   GfxResources *resPtr;
 
   for (resPtr = this; resPtr; resPtr = resPtr->next) {
     if (resPtr->gStateDict.isDict()) {
-      if (!resPtr->gStateDict.dictLookupNF(name, obj)->isNull()) {
-	return gTrue;
+      Object obj = resPtr->gStateDict.dictLookupNF(name);
+      if (!obj.isNull()) {
+	return obj;
       }
-      obj->free();
     }
   }
   error(errSyntaxError, -1, "ExtGState '{0:s}' is unknown", name);
-  return gFalse;
+  return Object(objNull);
 }
 
 //------------------------------------------------------------------------
@@ -644,25 +630,16 @@
 
 #ifdef USE_CMS
 
-#ifdef USE_LCMS1
-#include <lcms.h>
-#else
 #include <lcms2.h>
-#define LCMS_FLAGS cmsFLAGS_NOOPTIMIZE
-#endif
 
 void Gfx::initDisplayProfile() {
-   Object catDict;
-   xref->getCatalog(&catDict);
+   Object catDict = xref->getCatalog();
    if (catDict.isDict()) {
-     Object outputIntents;
-     catDict.dictLookup("OutputIntents", &outputIntents);
+     Object outputIntents = catDict.dictLookup("OutputIntents");
      if (outputIntents.isArray() && outputIntents.arrayGetLength() == 1) {
-          Object firstElement;
-          outputIntents.arrayGet(0, &firstElement);
+          Object firstElement = outputIntents.arrayGet(0);
           if (firstElement.isDict()) {
-              Object profile;
-              firstElement.dictLookup("DestOutputProfile", &profile);
+              Object profile = firstElement.dictLookup("DestOutputProfile");
               if (profile.isStream()) {
                 Stream *iccStream = profile.getStream();
                 int length = 0;
@@ -675,13 +652,9 @@
                 }
                 gfree(profBuf);
               }
-              profile.free();
           }
-          firstElement.free();
      }
-     outputIntents.free();
    }
-   catDict.free();
 }
 
 #endif
@@ -708,18 +681,15 @@
 }
 
 void Gfx::display(Object *obj, GBool topLevel) {
-  Object obj2;
   int i;
 
   if (obj->isArray()) {
     for (i = 0; i < obj->arrayGetLength(); ++i) {
-      obj->arrayGet(i, &obj2);
+      Object obj2 = obj->arrayGet(i);
       if (!obj2.isStream()) {
 	error(errSyntaxError, -1, "Weird page contents");
-	obj2.free();
 	return;
       }
-      obj2.free();
     }
   } else if (!obj->isStream()) {
     error(errSyntaxError, -1, "Weird page contents");
@@ -742,7 +712,7 @@
   updateLevel = 1; // make sure even empty pages trigger a call to dump()
   lastAbortCheck = 0;
   numArgs = 0;
-  parser->getObj(&obj);
+  obj = parser->getObj();
   while (!obj.isEOF()) {
     commandAborted = gFalse;
 
@@ -757,13 +727,17 @@
 	printf("\n");
 	fflush(stdout);
       }
-      GooTimer timer;
+      GooTimer *timer = nullptr;
 
+      if (unlikely(profileCommands)) {
+          timer = new GooTimer();
+      }
+
       // Run the operation
       execOp(&obj, args, numArgs);
 
       // Update the profile information
-      if (profileCommands) {
+      if (unlikely(profileCommands)) {
 	GooHash *hash;
 
 	hash = out->getProfileHash ();
@@ -778,12 +752,12 @@
 	    hash->add (cmd_g, data_p);
 	  }
 	  
-	  data_p->addElement(timer.getElapsed ());
+	  data_p->addElement(timer->getElapsed ());
 	}
+	delete timer;
       }
-      obj.free();
       for (i = 0; i < numArgs; ++i)
-	args[i].free();
+	args[i].setToNull(); // Free memory early
       numArgs = 0;
 
       // periodically update display
@@ -812,8 +786,7 @@
 
     // got an argument - save it
     } else if (numArgs < maxArgs) {
-      args[numArgs++] = obj;
-
+      args[numArgs++] = std::move(obj);
     // too many arguments - something is wrong
     } else {
       error(errSyntaxError, getPos(), "Too many args in content stream");
@@ -823,13 +796,11 @@
 	printf("\n");
 	fflush(stdout);
       }
-      obj.free();
     }
 
     // grab the next object
-    parser->getObj(&obj);
+    obj = parser->getObj();
   }
-  obj.free();
 
   // args at end with no command
   if (numArgs > 0) {
@@ -843,8 +814,6 @@
       printf("\n");
       fflush(stdout);
     }
-    for (i = 0; i < numArgs; ++i)
-      args[i].free();
   }
 
   popStateGuard();
@@ -970,7 +939,6 @@
 void Gfx::opSetDash(Object args[], int numArgs) {
   Array *a;
   int length;
-  Object obj;
   double *dash;
   int i;
 
@@ -981,11 +949,10 @@
   } else {
     dash = (double *)gmallocn(length, sizeof(double));
     for (i = 0; i < length; ++i) {
-      a->get(i, &obj);
+      Object obj = a->get(i);
       if (obj.isNum()) {
 	dash[i] = obj.getNum();
       }
-      obj.free();
     }
   }
   state->setLineDash(dash, length, args[1].getNum());
@@ -1018,8 +985,7 @@
 }
 
 void Gfx::opSetExtGState(Object args[], int numArgs) {
-  Object obj1, obj2, obj3, obj4, obj5;
-  Object args2[2];
+  Object obj1, obj2;
   GfxBlendMode mode;
   GBool haveFillOP;
   Function *funcs[4];
@@ -1030,12 +996,12 @@
   double opac;
   int i;
 
-  if (!res->lookupGState(args[0].getName(), &obj1)) {
+  obj1 = res->lookupGState(args[0].getName());
+  if (obj1.isNull()) {
     return;
   }
   if (!obj1.isDict()) {
     error(errSyntaxError, getPos(), "ExtGState '{0:s}' is wrong type", args[0].getName());
-    obj1.free();
     return;
   }
   if (printCommands) {
@@ -1045,33 +1011,31 @@
   }
 
   // parameters that are also set by individual PDF operators
-  if (obj1.dictLookup("LW", &obj2)->isNum()) {
+  obj2 = obj1.dictLookup("LW");
+  if (obj2.isNum()) {
     opSetLineWidth(&obj2, 1);
   }
-  obj2.free();
-  if (obj1.dictLookup("LC", &obj2)->isInt()) {
+  obj2 = obj1.dictLookup("LC");
+  if (obj2.isInt()) {
     opSetLineCap(&obj2, 1);
   }
-  obj2.free();
-  if (obj1.dictLookup("LJ", &obj2)->isInt()) {
+  obj2 = obj1.dictLookup("LJ");
+  if (obj2.isInt()) {
     opSetLineJoin(&obj2, 1);
   }
-  obj2.free();
-  if (obj1.dictLookup("ML", &obj2)->isNum()) {
+  obj2 = obj1.dictLookup("ML");
+  if (obj2.isNum()) {
     opSetMiterLimit(&obj2, 1);
   }
-  obj2.free();
-  if (obj1.dictLookup("D", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 2) {
-    obj2.arrayGet(0, &args2[0]);
-    obj2.arrayGet(1, &args2[1]);
+  obj2 = obj1.dictLookup("D");
+  if (obj2.isArray() && obj2.arrayGetLength() == 2) {
+    Object args2[2];
+    args2[0] = obj2.arrayGet(0);
+    args2[1] = obj2.arrayGet(1);
     if (args2[0].isArray() && args2[1].isNum()) {
       opSetDash(args2, 2);
     }
-    args2[0].free();
-    args2[1].free();
   }
-  obj2.free();
 #if 0 //~ need to add a new version of GfxResources::lookupFont() that
       //~ takes an indirect ref instead of a name
   if (obj1.dictLookup("Font", &obj2)->isArray() &&
@@ -1086,13 +1050,14 @@
   }
   obj2.free();
 #endif
-  if (obj1.dictLookup("FL", &obj2)->isNum()) {
+  obj2 = obj1.dictLookup("FL");
+  if (obj2.isNum()) {
     opSetFlat(&obj2, 1);
   }
-  obj2.free();
 
   // transparency support: blend mode, fill/stroke opacity
-  if (!obj1.dictLookup("BM", &obj2)->isNull()) {
+  obj2 = obj1.dictLookup("BM");
+  if (!obj2.isNull()) {
     if (state->parseBlendMode(&obj2, &mode)) {
       state->setBlendMode(mode);
       out->updateBlendMode(state);
@@ -1100,27 +1065,27 @@
       error(errSyntaxError, getPos(), "Invalid blend mode in ExtGState");
     }
   }
-  obj2.free();
-  if (obj1.dictLookup("ca", &obj2)->isNum()) {
+  obj2 = obj1.dictLookup("ca");
+  if (obj2.isNum()) {
     opac = obj2.getNum();
     state->setFillOpacity(opac < 0 ? 0 : opac > 1 ? 1 : opac);
     out->updateFillOpacity(state);
   }
-  obj2.free();
-  if (obj1.dictLookup("CA", &obj2)->isNum()) {
+  obj2 = obj1.dictLookup("CA");
+  if (obj2.isNum()) {
     opac = obj2.getNum();
     state->setStrokeOpacity(opac < 0 ? 0 : opac > 1 ? 1 : opac);
     out->updateStrokeOpacity(state);
   }
-  obj2.free();
 
   // fill/stroke overprint, overprint mode
-  if ((haveFillOP = (obj1.dictLookup("op", &obj2)->isBool()))) {
+  obj2 = obj1.dictLookup("op");
+  if ((haveFillOP = obj2.isBool())) {
     state->setFillOverprint(obj2.getBool());
     out->updateFillOverprint(state);
   }
-  obj2.free();
-  if (obj1.dictLookup("OP", &obj2)->isBool()) {
+  obj2 = obj1.dictLookup("OP");
+  if (obj2.isBool()) {
     state->setStrokeOverprint(obj2.getBool());
     out->updateStrokeOverprint(state);
     if (!haveFillOP) {
@@ -1128,24 +1093,23 @@
       out->updateFillOverprint(state);
     }
   }
-  obj2.free();
-  if (obj1.dictLookup("OPM", &obj2)->isInt()) {
+  obj2 = obj1.dictLookup("OPM");
+  if (obj2.isInt()) {
     state->setOverprintMode(obj2.getInt());
     out->updateOverprintMode(state);
   }
-  obj2.free();
 
   // stroke adjust
-  if (obj1.dictLookup("SA", &obj2)->isBool()) {
+  obj2 = obj1.dictLookup("SA");
+  if (obj2.isBool()) {
     state->setStrokeAdjust(obj2.getBool());
     out->updateStrokeAdjust(state);
   }
-  obj2.free();
 
   // transfer function
-  if (obj1.dictLookup("TR2", &obj2)->isNull()) {
-    obj2.free();
-    obj1.dictLookup("TR", &obj2);
+  obj2 = obj1.dictLookup("TR2");
+  if (obj2.isNull()) {
+    obj2 = obj1.dictLookup("TR");
   }
   if (obj2.isName("Default") ||
       obj2.isName("Identity")) {
@@ -1154,9 +1118,8 @@
     out->updateTransfer(state);
   } else if (obj2.isArray() && obj2.arrayGetLength() == 4) {
     for (i = 0; i < 4; ++i) {
-      obj2.arrayGet(i, &obj3);
+      Object obj3 = obj2.arrayGet(i);
       funcs[i] = Function::parse(&obj3);
-      obj3.free();
       if (!funcs[i]) {
 	break;
       }
@@ -1174,80 +1137,81 @@
   } else if (!obj2.isNull()) {
     error(errSyntaxError, getPos(), "Invalid transfer function in ExtGState");
   }
-  obj2.free();
 
   // alpha is shape
-  if (obj1.dictLookup("AIS", &obj2)->isBool()) {
+  obj2 = obj1.dictLookup("AIS");
+  if (obj2.isBool()) {
     state->setAlphaIsShape(obj2.getBool());
     out->updateAlphaIsShape(state);
   }
-  obj2.free();
 
   // text knockout
-  if (obj1.dictLookup("TK", &obj2)->isBool()) {
+  obj2 = obj1.dictLookup("TK");
+  if (obj2.isBool()) {
     state->setTextKnockout(obj2.getBool());
     out->updateTextKnockout(state);
   }
-  obj2.free();
 
   // soft mask
-  if (!obj1.dictLookup("SMask", &obj2)->isNull()) {
+  obj2 = obj1.dictLookup("SMask");
+  if (!obj2.isNull()) {
     if (obj2.isName("None")) {
       out->clearSoftMask(state);
     } else if (obj2.isDict()) {
-      if (obj2.dictLookup("S", &obj3)->isName("Alpha")) {
+      Object obj3 = obj2.dictLookup("S");
+      if (obj3.isName("Alpha")) {
 	alpha = gTrue;
       } else { // "Luminosity"
 	alpha = gFalse;
       }
-      obj3.free();
       funcs[0] = NULL;
-      if (!obj2.dictLookup("TR", &obj3)->isNull()) {
+      obj3 = obj2.dictLookup("TR");
+      if (!obj3.isNull()) {
 	if (obj3.isName("Default") ||
 	    obj3.isName("Identity")) {
 	  funcs[0] = NULL;
 	} else {
 	  funcs[0] = Function::parse(&obj3);
-      if (funcs[0] == NULL ||
-          funcs[0]->getInputSize() != 1 ||
-          funcs[0]->getOutputSize() != 1) {
-	    error(errSyntaxError, getPos(),
+	  if (funcs[0] == NULL ||
+	    funcs[0]->getInputSize() != 1 ||
+	    funcs[0]->getOutputSize() != 1) {
+	      error(errSyntaxError, getPos(),
 		  "Invalid transfer function in soft mask in ExtGState");
-	    delete funcs[0];
-	    funcs[0] = NULL;
+	      delete funcs[0];
+	      funcs[0] = NULL;
 	  }
 	}
       }
-      obj3.free();
-      if ((haveBackdropColor = obj2.dictLookup("BC", &obj3)->isArray())) {
+      obj3 = obj2.dictLookup("BC");
+      if ((haveBackdropColor = obj3.isArray())) {
 	for (i = 0; i < gfxColorMaxComps; ++i) {
 	  backdropColor.c[i] = 0;
 	}
 	for (i = 0; i < obj3.arrayGetLength() && i < gfxColorMaxComps; ++i) {
-	  obj3.arrayGet(i, &obj4);
+	  Object obj4 = obj3.arrayGet(i);
 	  if (obj4.isNum()) {
 	    backdropColor.c[i] = dblToCol(obj4.getNum());
 	  }
-	  obj4.free();
 	}
       }
-      obj3.free();
-      if (obj2.dictLookup("G", &obj3)->isStream()) {
-	if (obj3.streamGetDict()->lookup("Group", &obj4)->isDict()) {
+      obj3 = obj2.dictLookup("G");
+      if (obj3.isStream()) {
+	Object obj4 = obj3.streamGetDict()->lookup("Group");
+	if (obj4.isDict()) {
 	  blendingColorSpace = NULL;
 	  isolated = knockout = gFalse;
-	  if (!obj4.dictLookup("CS", &obj5)->isNull()) {
+	  Object obj5 = obj4.dictLookup("CS");
+	  if (!obj5.isNull()) {
 	    blendingColorSpace = GfxColorSpace::parse(res, &obj5, out, state);
 	  }
-	  obj5.free();
-	  if (obj4.dictLookup("I", &obj5)->isBool()) {
+	  obj5 = obj4.dictLookup("I");
+	  if (obj5.isBool()) {
 	    isolated = obj5.getBool();
 	  }
-	  obj5.free();
-	  if (obj4.dictLookup("K", &obj5)->isBool()) {
+	  obj5 = obj4.dictLookup("K");
+	  if (obj5.isBool()) {
 	    knockout = obj5.getBool();
 	  }
-	  obj5.free();
 	  if (!haveBackdropColor) {
 	    if (blendingColorSpace) {
 	      blendingColorSpace->getDefaultColor(&backdropColor);
@@ -1266,85 +1230,70 @@
 	} else {
 	  error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group");
 	}
-	obj4.free();
       } else {
 	error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group");
       }
-      obj3.free();
     } else if (!obj2.isNull()) {
       error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState");
     }
   }
-  obj2.free();
-  if (obj1.dictLookup("Font", &obj2)->isArray()) {
+  obj2 = obj1.dictLookup("Font");
+  if (obj2.isArray()) {
     GfxFont *font;
     if (obj2.arrayGetLength() == 2) {
-      Object fargs0, fargs1;
-
-      obj2.arrayGetNF(0,&fargs0);
-      obj2.arrayGet(1,&fargs1);
+      Object fargs0 = obj2.arrayGetNF(0);
+      Object fargs1 = obj2.arrayGet(1);
       if (fargs0.isRef() && fargs1.isNum()) {
-	Object fobj;
-	Ref r;
-
-	fargs0.fetch(xref, &fobj);
+	Object fobj = fargs0.fetch(xref);
 	if (fobj.isDict()) {
-	  r = fargs0.getRef();
+	  Ref r = fargs0.getRef();
 	  font = GfxFont::makeFont(xref,args[0].getName(),r,fobj.getDict());
 	  state->setFont(font,fargs1.getNum());
 	  fontChanged = gTrue;
 	}
-	fobj.free();
       }
-      fargs0.free();
-      fargs1.free();
     } else {
       error(errSyntaxError, getPos(), "Number of args mismatch for /Font in ExtGState");
     }
   }
-  obj2.free();
-  if (obj1.dictLookup("LW", &obj2)->isNum()) {
+  obj2 = obj1.dictLookup("LW");
+  if (obj2.isNum()) {
     opSetLineWidth(&obj2,1);
   }
-  obj2.free();
-  if (obj1.dictLookup("LC", &obj2)->isInt()) {
+  obj2 = obj1.dictLookup("LC");
+  if (obj2.isInt()) {
     opSetLineCap(&obj2,1);
   }
-  obj2.free();
-  if (obj1.dictLookup("LJ", &obj2)->isInt()) {
+  obj2 = obj1.dictLookup("LJ");
+  if (obj2.isInt()) {
     opSetLineJoin(&obj2,1);
   }
-  obj2.free();
-  if (obj1.dictLookup("ML", &obj2)->isNum()) {
+  obj2 = obj1.dictLookup("ML");
+  if (obj2.isNum()) {
     opSetMiterLimit(&obj2,1);
   }
-  obj2.free();
-  if (obj1.dictLookup("D", &obj2)->isArray()) {
+  obj2 = obj1.dictLookup("D");
+  if (obj2.isArray()) {
     if (obj2.arrayGetLength() == 2) {
       Object dargs[2];
 
-      obj2.arrayGetNF(0,&dargs[0]);
-      obj2.arrayGet(1,&dargs[1]);
+      dargs[0] = obj2.arrayGetNF(0);
+      dargs[1] = obj2.arrayGet(1);
       if (dargs[0].isArray() && dargs[1].isInt()) {
 	opSetDash(dargs,2);
       }
-      dargs[0].free();
-      dargs[1].free();
     } else {
       error(errSyntaxError, getPos(), "Number of args mismatch for /D in ExtGState");
     }
   }
-  obj2.free();
-  if (obj1.dictLookup("RI", &obj2)->isName()) {
+  obj2 = obj1.dictLookup("RI");
+  if (obj2.isName()) {
     opSetRenderingIntent(&obj2,1);
   }
-  obj2.free();
-  if (obj1.dictLookup("FL", &obj2)->isNum()) {
+  obj2 = obj1.dictLookup("FL");
+  if (obj2.isNum()) {
     opSetFlat(&obj2,1);
   }
-  obj2.free();
-
-  obj1.free();
 }
 
 void Gfx::doSoftMask(Object *str, GBool alpha,
@@ -1353,7 +1302,7 @@
 		     Function *transferFunc, GfxColor *backdropColor) {
   Dict *dict, *resDict;
   double m[6], bbox[4];
-  Object obj1, obj2;
+  Object obj1;
   int i;
 
   // check for excessive recursion
@@ -1365,40 +1314,33 @@
   dict = str->streamGetDict();
 
   // check form type
-  dict->lookup("FormType", &obj1);
+  obj1 = dict->lookup("FormType");
   if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) {
     error(errSyntaxError, getPos(), "Unknown form type");
   }
-  obj1.free();
 
   // get bounding box
-  dict->lookup("BBox", &obj1);
+  obj1 = dict->lookup("BBox");
   if (!obj1.isArray()) {
-    obj1.free();
     error(errSyntaxError, getPos(), "Bad form bounding box");
     return;
   }
   for (i = 0; i < 4; ++i) {
-    obj1.arrayGet(i, &obj2);
+    Object obj2 = obj1.arrayGet(i);
     if (likely(obj2.isNum())) bbox[i] = obj2.getNum();
     else {
-      obj2.free();
-      obj1.free();
       error(errSyntaxError, getPos(), "Bad form bounding box (non number)");
       return;
     }
-    obj2.free();
   }
-  obj1.free();
 
   // get matrix
-  dict->lookup("Matrix", &obj1);
+  obj1 = dict->lookup("Matrix");
   if (obj1.isArray()) {
     for (i = 0; i < 6; ++i) {
-      obj1.arrayGet(i, &obj2);
+      Object obj2 = obj1.arrayGet(i);
       if (likely(obj2.isNum())) m[i] = obj2.getNum();
       else m[i] = 0;
-      obj2.free();
     }
   } else {
     m[0] = 1; m[1] = 0;
@@ -1405,10 +1347,9 @@
     m[2] = 0; m[3] = 1;
     m[4] = 0; m[5] = 0;
   }
-  obj1.free();
 
   // get resources
-  dict->lookup("Resources", &obj1);
+  obj1 = dict->lookup("Resources");
   resDict = obj1.isDict() ? obj1.getDict() : (Dict *)NULL;
 
   // draw it
@@ -1421,7 +1362,6 @@
   if (blendingColorSpace) {
     delete blendingColorSpace;
   }
-  obj1.free();
 }
 
 void Gfx::opSetRenderingIntent(Object args[], int numArgs) {
@@ -1435,10 +1375,9 @@
 void Gfx::opSetFillGray(Object args[], int numArgs) {
   GfxColor color;
   GfxColorSpace *colorSpace = NULL;
-  Object obj;
 
   state->setFillPattern(NULL);
-  res->lookupColorSpace("DefaultGray", &obj);
+  Object obj = res->lookupColorSpace("DefaultGray");
   if (!obj.isNull()) {
     colorSpace = GfxColorSpace::parse(res, &obj, out, state);
   }
@@ -1445,7 +1384,6 @@
   if (colorSpace == NULL) {
     colorSpace = new GfxDeviceGrayColorSpace();
   }
-  obj.free();
   state->setFillColorSpace(colorSpace);
   out->updateFillColorSpace(state);
   color.c[0] = dblToCol(args[0].getNum());
@@ -1456,10 +1394,9 @@
 void Gfx::opSetStrokeGray(Object args[], int numArgs) {
   GfxColor color;
   GfxColorSpace *colorSpace = NULL;
-  Object obj;
 
   state->setStrokePattern(NULL);
-  res->lookupColorSpace("DefaultGray", &obj);
+  Object obj = res->lookupColorSpace("DefaultGray");
   if (!obj.isNull()) {
     colorSpace = GfxColorSpace::parse(res, &obj, out, state);
   }
@@ -1466,7 +1403,6 @@
   if (colorSpace == NULL) {
     colorSpace = new GfxDeviceGrayColorSpace();
   }
-  obj.free();
   state->setStrokeColorSpace(colorSpace);
   out->updateStrokeColorSpace(state);
   color.c[0] = dblToCol(args[0].getNum());
@@ -1477,10 +1413,9 @@
 void Gfx::opSetFillCMYKColor(Object args[], int numArgs) {
   GfxColor color;
   GfxColorSpace *colorSpace = NULL;
-  Object obj;
   int i;
 
-  res->lookupColorSpace("DefaultCMYK", &obj);
+  Object obj = res->lookupColorSpace("DefaultCMYK");
   if (!obj.isNull()) {
     colorSpace = GfxColorSpace::parse(res, &obj, out, state);
   }
@@ -1487,7 +1422,6 @@
   if (colorSpace == NULL) {
     colorSpace = new GfxDeviceCMYKColorSpace();
   }
-  obj.free();
   state->setFillPattern(NULL);
   state->setFillColorSpace(colorSpace);
   out->updateFillColorSpace(state);
@@ -1501,11 +1435,10 @@
 void Gfx::opSetStrokeCMYKColor(Object args[], int numArgs) {
   GfxColor color;
   GfxColorSpace *colorSpace = NULL;
-  Object obj;
   int i;
 
   state->setStrokePattern(NULL);
-  res->lookupColorSpace("DefaultCMYK", &obj);
+  Object obj = res->lookupColorSpace("DefaultCMYK");
   if (!obj.isNull()) {
     colorSpace = GfxColorSpace::parse(res, &obj, out, state);
   }
@@ -1512,7 +1445,6 @@
   if (colorSpace == NULL) {
     colorSpace = new GfxDeviceCMYKColorSpace();
   }
-  obj.free();
   state->setStrokeColorSpace(colorSpace);
   out->updateStrokeColorSpace(state);
   for (i = 0; i < 4; ++i) {
@@ -1523,13 +1455,12 @@
 }
 
 void Gfx::opSetFillRGBColor(Object args[], int numArgs) {
-  Object obj;
   GfxColorSpace *colorSpace = NULL;
   GfxColor color;
   int i;
 
   state->setFillPattern(NULL);
-  res->lookupColorSpace("DefaultRGB", &obj);
+  Object obj = res->lookupColorSpace("DefaultRGB");
   if (!obj.isNull()) {
     colorSpace = GfxColorSpace::parse(res, &obj, out, state);
   }
@@ -1536,7 +1467,6 @@
   if (colorSpace == NULL) {
     colorSpace = new GfxDeviceRGBColorSpace();
   }
-  obj.free();
   state->setFillColorSpace(colorSpace);
   out->updateFillColorSpace(state);
   for (i = 0; i < 3; ++i) {
@@ -1547,13 +1477,12 @@
 }
 
 void Gfx::opSetStrokeRGBColor(Object args[], int numArgs) {
-  Object obj;
   GfxColorSpace *colorSpace = NULL;
   GfxColor color;
   int i;
 
   state->setStrokePattern(NULL);
-  res->lookupColorSpace("DefaultRGB", &obj);
+  Object obj = res->lookupColorSpace("DefaultRGB");
   if (!obj.isNull()) {
     colorSpace = GfxColorSpace::parse(res, &obj, out, state);
   }
@@ -1560,7 +1489,6 @@
   if (colorSpace == NULL) {
     colorSpace = new GfxDeviceRGBColorSpace();
   }
-  obj.free();
   state->setStrokeColorSpace(colorSpace);
   out->updateStrokeColorSpace(state);
   for (i = 0; i < 3; ++i) {
@@ -1571,17 +1499,15 @@
 }
 
 void Gfx::opSetFillColorSpace(Object args[], int numArgs) {
-  Object obj;
   GfxColorSpace *colorSpace;
   GfxColor color;
 
-  res->lookupColorSpace(args[0].getName(), &obj);
+  Object obj = res->lookupColorSpace(args[0].getName());
   if (obj.isNull()) {
     colorSpace = GfxColorSpace::parse(res, &args[0], out, state);
   } else {
     colorSpace = GfxColorSpace::parse(res, &obj, out, state);
   }
-  obj.free();
   if (colorSpace) {
     state->setFillPattern(NULL);
     state->setFillColorSpace(colorSpace);
@@ -1595,18 +1521,16 @@
 }
 
 void Gfx::opSetStrokeColorSpace(Object args[], int numArgs) {
-  Object obj;
   GfxColorSpace *colorSpace;
   GfxColor color;
 
   state->setStrokePattern(NULL);
-  res->lookupColorSpace(args[0].getName(), &obj);
+  Object obj = res->lookupColorSpace(args[0].getName());
   if (obj.isNull()) {
     colorSpace = GfxColorSpace::parse(res, &args[0], out, state);
   } else {
     colorSpace = GfxColorSpace::parse(res, &obj, out, state);
   }
-  obj.free();
   if (colorSpace) {
     state->setStrokeColorSpace(colorSpace);
     out->updateStrokeColorSpace(state);
@@ -2293,18 +2217,34 @@
 		       xi0, yi0, xi1, yi1, xstep, ystep)) {
     goto restore;
   } else {
-    out->updatePatternOpacity(state);
-    for (yi = yi0; yi < yi1; ++yi) {
-      for (xi = xi0; xi < xi1; ++xi) {
-        x = xi * xstep;
-        y = yi * ystep;
-        m1[4] = x * m[0] + y * m[2] + m[4];
-        m1[5] = x * m[1] + y * m[3] + m[5];
-        drawForm(tPat->getContentStream(), tPat->getResDict(),
-        	  m1, tPat->getBBox());
+    bool shouldDrawForm = gTrue;
+    std::set<int>::iterator patternRefIt;
+    const int patternRefNum = tPat->getPatternRefNum();
+    if (patternRefNum != -1) {
+      if (formsDrawing.find(patternRefNum) == formsDrawing.end()) {
+	patternRefIt = formsDrawing.insert(patternRefNum).first;
+      } else {
+	shouldDrawForm = gFalse;
       }
     }
-    out->clearPatternOpacity(state);
+
+    if (shouldDrawForm) {
+      out->updatePatternOpacity(state);
+      for (yi = yi0; yi < yi1; ++yi) {
+	for (xi = xi0; xi < xi1; ++xi) {
+	  x = xi * xstep;
+	  y = yi * ystep;
+	  m1[4] = x * m[0] + y * m[2] + m[4];
+	  m1[5] = x * m[1] + y * m[3] + m[5];
+	  drawForm(tPat->getContentStream(), tPat->getResDict(),
+		  m1, tPat->getBBox());
+	}
+      }
+      out->clearPatternOpacity(state);
+      if (patternRefNum != -1) {
+	formsDrawing.erase(patternRefIt);
+      }
+    }
   }
 
   // restore graphics state
@@ -3881,7 +3821,6 @@
 
 void Gfx::opShowSpaceText(Object args[], int numArgs) {
   Array *a;
-  Object obj;
   int wMode;
   int i;
 
@@ -3897,7 +3836,7 @@
   wMode = state->getFont()->getWMode();
   a = args[0].getArray();
   for (i = 0; i < a->getLength(); ++i) {
-    a->get(i, &obj);
+    Object obj = a->get(i);
     if (obj.isNum()) {
       // this uses the absolute value of the font size to match
       // Acrobat's behavior
@@ -3916,17 +3855,15 @@
       error(errSyntaxError, getPos(),
         "Element of show/space array must be number or string");
     }
-    obj.free();
   }
   out->endStringOp(state);
   if (!ocState) {
     a = args[0].getArray();
     for (i = 0; i < a->getLength(); ++i) {
-      a->get(i, &obj);
+      Object obj = a->get(i);
       if (obj.isString()) {
 	doIncCharCount(obj.getString());
       }
-      obj.free();
     }
   }
 }
@@ -3942,7 +3879,6 @@
   double x0, y0, x1, y1;
   double oldCTM[6], newCTM[6];
   double *mat;
-  Object charProc;
   Dict *resDict;
   Parser *oldParser;
   GfxState *savedState;
@@ -4026,12 +3962,33 @@
       state->transformDelta(dx, dy, &ddx, &ddy);
       if (!out->beginType3Char(state, curX + riseX, curY + riseY, ddx, ddy,
 			       code, u, uLen)) {
-	((Gfx8BitFont *)font)->getCharProc(code, &charProc);
+	Object charProc = ((Gfx8BitFont *)font)->getCharProcNF(code);
+	int refNum = -1;
+	if (charProc.isRef()) {
+	  refNum = charProc.getRef().num;
+	  charProc = charProc.fetch(((Gfx8BitFont *)font)->getCharProcs()->getXRef());
+	}
 	if ((resDict = ((Gfx8BitFont *)font)->getResources())) {
 	  pushResources(resDict);
 	}
 	if (charProc.isStream()) {
-	  display(&charProc, gFalse);
+	  std::set<int>::iterator charProcDrawingIt;
+	  bool displayCharProc = true;
+	  if (refNum != -1) {
+	    if (charProcDrawing.find(refNum) == charProcDrawing.end()) {
+	      charProcDrawingIt = charProcDrawing.insert(refNum).first;
+	    } else {
+	      displayCharProc = false;
+	      error(errSyntaxError, -1, "CharProc wants to draw a CharProc that is already beign drawn");
+	    }
+	  }
+	  if (displayCharProc) {
+	    display(&charProc, gFalse);
+
+	    if (refNum != -1) {
+	      charProcDrawing.erase(charProcDrawingIt);
+	    }
+	  }
 	} else {
 	  error(errSyntaxError, getPos(), "Missing or bad Type3 CharProc entry");
 	}
@@ -4039,7 +3996,6 @@
 	if (resDict) {
 	  popResources();
 	}
-	charProc.free();
       }
       restoreStateStack(savedState);
       // GfxState::restore() does *not* restore the current position,
@@ -4177,39 +4133,34 @@
 
 void Gfx::opXObject(Object args[], int numArgs) {
   char *name;
-  Object obj1, obj2, obj3, refObj;
-#if OPI_SUPPORT
-  Object opiDict;
-#endif
 
   if (!ocState && !out->needCharCount()) {
     return;
   }
   name = args[0].getName();
-  if (!res->lookupXObject(name, &obj1)) {
+  Object obj1 = res->lookupXObject(name);
+  if (obj1.isNull()) {
     return;
   }
   if (!obj1.isStream()) {
       error(errSyntaxError, getPos(), "XObject '{0:s}' is wrong type", name);
-    obj1.free();
     return;
   }
 
-#if OPI_SUPPORT
-  obj1.streamGetDict()->lookup("OPI", &opiDict);
+#ifdef OPI_SUPPORT
+  Object opiDict = obj1.streamGetDict()->lookup("OPI");
   if (opiDict.isDict()) {
     out->opiBegin(state, opiDict.getDict());
   }
 #endif
-  obj1.streamGetDict()->lookup("Subtype", &obj2);
+  Object obj2 = obj1.streamGetDict()->lookup("Subtype");
   if (obj2.isName("Image")) {
     if (out->needNonText()) {
-      res->lookupXObjectNF(name, &refObj);
+      Object refObj = res->lookupXObjectNF(name);
       doImage(&refObj, obj1.getStream(), gFalse);
-      refObj.free();
     }
   } else if (obj2.isName("Form")) {
-    res->lookupXObjectNF(name, &refObj);
+    Object refObj = res->lookupXObjectNF(name);
     GBool shouldDoForm = gTrue;
     std::set<int>::iterator drawingFormIt;
     if (refObj.isRef()) {
@@ -4230,9 +4181,8 @@
     if (refObj.isRef() && shouldDoForm) {
       formsDrawing.erase(drawingFormIt);
     }
-    refObj.free();
   } else if (obj2.isName("PS")) {
-    obj1.streamGetDict()->lookup("Level1", &obj3);
+    Object obj3 = obj1.streamGetDict()->lookup("Level1");
     out->psXObject(obj1.getStream(),
 		   obj3.isStream() ? obj3.getStream() : (Stream *)NULL);
   } else if (obj2.isName()) {
@@ -4240,14 +4190,11 @@
   } else {
     error(errSyntaxError, getPos(), "XObject subtype is missing or wrong type");
   }
-  obj2.free();
-#if OPI_SUPPORT
+#ifdef OPI_SUPPORT
   if (opiDict.isDict()) {
     out->opiEnd(state, opiDict.getDict());
   }
-  opiDict.free();
 #endif
-  obj1.free();
 }
 
 void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
@@ -4259,8 +4206,6 @@
   GBool mask;
   GBool invert;
   GfxColorSpace *colorSpace, *maskColorSpace;
-  GfxImageColorMap *colorMap, *maskColorMap;
-  Object maskObj, smaskObj;
   GBool haveColorKeyMask, haveExplicitMask, haveSoftMask;
   int maskColors[2*gfxColorMaxComps];
   int maskWidth, maskHeight;
@@ -4267,7 +4212,7 @@
   GBool maskInvert;
   GBool maskInterpolate;
   Stream *maskStr;
-  Object obj1, obj2;
+  Object obj1;
   int i, n;
 
   // get info from the stream
@@ -4280,19 +4225,16 @@
 
   // check for optional content key
   if (ref) {
-    dict->lookupNF("OC", &obj1);
+    obj1 = dict->lookupNF("OC");
     if (catalog->getOptContentConfig() && !catalog->getOptContentConfig()->optContentIsVisible(&obj1)) {
-      obj1.free();
       return;
     }
-    obj1.free();
   }
 
   // get size
-  dict->lookup("Width", &obj1);
+  obj1 = dict->lookup("Width");
   if (obj1.isNull()) {
-    obj1.free();
-    dict->lookup("W", &obj1);
+    obj1 = dict->lookup("W");
   }
   if (obj1.isInt())
     width = obj1.getInt();
@@ -4299,12 +4241,10 @@
   else if (obj1.isReal())
     width = (int)obj1.getReal();
   else
-    goto err2;
-  obj1.free();
-  dict->lookup("Height", &obj1);
+    goto err1;
+  obj1 = dict->lookup("Height");
   if (obj1.isNull()) {
-    obj1.free();
-    dict->lookup("H", &obj1);
+    obj1 = dict->lookup("H");
   }
   if (obj1.isInt())
     height = obj1.getInt();
@@ -4311,44 +4251,38 @@
   else if (obj1.isReal())
     height = (int)obj1.getReal();
   else
-    goto err2;
-  obj1.free();
+    goto err1;
 
   if (width < 1 || height < 1)
     goto err1;
 
   // image interpolation
-  dict->lookup("Interpolate", &obj1);
+  obj1 = dict->lookup("Interpolate");
   if (obj1.isNull()) {
-    obj1.free();
-    dict->lookup("I", &obj1);
+    obj1 = dict->lookup("I");
   }
   if (obj1.isBool())
     interpolate = obj1.getBool();
   else
     interpolate = gFalse;
-  obj1.free();
   maskInterpolate = gFalse;
 
   // image or mask?
-  dict->lookup("ImageMask", &obj1);
+  obj1 = dict->lookup("ImageMask");
   if (obj1.isNull()) {
-    obj1.free();
-    dict->lookup("IM", &obj1);
+    obj1 = dict->lookup("IM");
   }
   mask = gFalse;
   if (obj1.isBool())
     mask = obj1.getBool();
   else if (!obj1.isNull())
-    goto err2;
-  obj1.free();
+    goto err1;
 
   // bit depth
   if (bits == 0) {
-    dict->lookup("BitsPerComponent", &obj1);
+    obj1 = dict->lookup("BitsPerComponent");
     if (obj1.isNull()) {
-      obj1.free();
-      dict->lookup("BPC", &obj1);
+      obj1 = dict->lookup("BPC");
     }
     if (obj1.isInt()) {
       bits = obj1.getInt();
@@ -4355,9 +4289,8 @@
     } else if (mask) {
       bits = 1;
     } else {
-      goto err2;
+      goto err1;
     }
-    obj1.free();
   }
 
   // display a mask
@@ -4367,22 +4300,20 @@
     if (bits != 1)
       goto err1;
     invert = gFalse;
-    dict->lookup("Decode", &obj1);
+    obj1 = dict->lookup("Decode");
     if (obj1.isNull()) {
-      obj1.free();
-      dict->lookup("D", &obj1);
+      obj1 = dict->lookup("D");
     }
     if (obj1.isArray()) {
-      obj1.arrayGet(0, &obj2);
+      Object obj2;
+      obj2 = obj1.arrayGet(0);
       // Table 4.39 says /Decode must be [1 0] or [0 1]. Adobe
       // accepts [1.0 0.0] as well.
       if (obj2.isNum() && obj2.getNum() >= 0.9)
 	invert = gTrue;
-      obj2.free();
     } else if (!obj1.isNull()) {
-      goto err2;
+      goto err1;
     }
-    obj1.free();
 
     // if drawing is disabled, skip over inline image data
     if (!ocState || !out->needNonText()) {
@@ -4402,26 +4333,24 @@
       }
     }
   } else {
+    if (bits == 0) {
+      goto err1;
+    }
 
     // get color space and color map
-    dict->lookup("ColorSpace", &obj1);
+    obj1 = dict->lookup("ColorSpace");
     if (obj1.isNull()) {
-      obj1.free();
-      dict->lookup("CS", &obj1);
+      obj1 = dict->lookup("CS");
     }
     if (obj1.isName() && inlineImg) {
-      res->lookupColorSpace(obj1.getName(), &obj2);
+      Object obj2 = res->lookupColorSpace(obj1.getName());
       if (!obj2.isNull()) {
-	obj1.free();
-	obj1 = obj2;
-      } else {
-	obj2.free();
+	obj1 = std::move(obj2);
       }
     }
     if (!obj1.isNull()) {
-      Object objIntent;
       char *tempIntent = NULL;
-      dict->lookup("Intent", &objIntent);
+      Object objIntent = dict->lookup("Intent");
       if (objIntent.isName()) {
         tempIntent = state->getRenderingIntent();
         if (tempIntent != NULL) {
@@ -4434,54 +4363,39 @@
         state->setRenderingIntent(tempIntent);
         free(tempIntent);
       }
-      objIntent.free();
     } else if (csMode == streamCSDeviceGray) {
-      Object objCS;
-      res->lookupColorSpace("DefaultGray", &objCS);
+      Object objCS = res->lookupColorSpace("DefaultGray");
       if (objCS.isNull()) {
         colorSpace = new GfxDeviceGrayColorSpace();
       } else {
         colorSpace = GfxColorSpace::parse(res, &objCS, out, state);
       }
-      objCS.free();
     } else if (csMode == streamCSDeviceRGB) {
-      Object objCS;
-      res->lookupColorSpace("DefaultRGB", &objCS);
+      Object objCS = res->lookupColorSpace("DefaultRGB");
       if (objCS.isNull()) {
         colorSpace = new GfxDeviceRGBColorSpace();
       } else {
         colorSpace = GfxColorSpace::parse(res, &objCS, out, state);
       }
-      objCS.free();
     } else if (csMode == streamCSDeviceCMYK) {
-      Object objCS;
-      res->lookupColorSpace("DefaultCMYK", &objCS);
+      Object objCS = res->lookupColorSpace("DefaultCMYK");
       if (objCS.isNull()) {
         colorSpace = new GfxDeviceCMYKColorSpace();
       } else {
         colorSpace = GfxColorSpace::parse(res, &objCS, out, state);
       }
-      objCS.free();
     } else {
       colorSpace = NULL;
     }
-    obj1.free();
     if (!colorSpace) {
       goto err1;
     }
-    dict->lookup("Decode", &obj1);
+    obj1 = dict->lookup("Decode");
     if (obj1.isNull()) {
-      obj1.free();
-      dict->lookup("D", &obj1);
+      obj1 = dict->lookup("D");
     }
-    if (bits == 0) {
-      delete colorSpace;
-      goto err2;
-    }
-    colorMap = new GfxImageColorMap(bits, &obj1, colorSpace);
-    obj1.free();
-    if (!colorMap->isOk()) {
-      delete colorMap;
+    GfxImageColorMap colorMap(bits, &obj1, colorSpace);
+    if (!colorMap.isOk()) {
       goto err1;
     }
 
@@ -4490,9 +4404,9 @@
     maskStr = NULL; // make gcc happy
     maskWidth = maskHeight = 0; // make gcc happy
     maskInvert = gFalse; // make gcc happy
-    maskColorMap = NULL; // make gcc happy
-    dict->lookup("Mask", &maskObj);
-    dict->lookup("SMask", &smaskObj);
+    std::unique_ptr<GfxImageColorMap> maskColorMap;
+    Object maskObj = dict->lookup("Mask");
+    Object smaskObj = dict->lookup("SMask");
     if (smaskObj.isStream()) {
       // soft mask
       if (inlineImg) {
@@ -4500,78 +4414,62 @@
       }
       maskStr = smaskObj.getStream();
       maskDict = smaskObj.streamGetDict();
-      maskDict->lookup("Width", &obj1);
+      obj1 = maskDict->lookup("Width");
       if (obj1.isNull()) {
-	obj1.free();
-	maskDict->lookup("W", &obj1);
+	obj1 = maskDict->lookup("W");
       }
       if (!obj1.isInt()) {
-	goto err2;
+	goto err1;
       }
       maskWidth = obj1.getInt();
-      obj1.free();
-      maskDict->lookup("Height", &obj1);
+      obj1 = maskDict->lookup("Height");
       if (obj1.isNull()) {
-	obj1.free();
-	maskDict->lookup("H", &obj1);
+	obj1 = maskDict->lookup("H");
       }
       if (!obj1.isInt()) {
-	goto err2;
+	goto err1;
       }
       maskHeight = obj1.getInt();
-      obj1.free();
-      maskDict->lookup("Interpolate", &obj1);
+      obj1 = maskDict->lookup("Interpolate");
       if (obj1.isNull()) {
-        obj1.free();
-        maskDict->lookup("I", &obj1);
+        obj1 = maskDict->lookup("I");
       }
       if (obj1.isBool())
         maskInterpolate = obj1.getBool();
       else
         maskInterpolate = gFalse;
-      obj1.free();
-      maskDict->lookup("BitsPerComponent", &obj1);
+      obj1 = maskDict->lookup("BitsPerComponent");
       if (obj1.isNull()) {
-	obj1.free();
-	maskDict->lookup("BPC", &obj1);
+	obj1 = maskDict->lookup("BPC");
       }
       if (!obj1.isInt()) {
-	goto err2;
+	goto err1;
       }
       maskBits = obj1.getInt();
-      obj1.free();
-      maskDict->lookup("ColorSpace", &obj1);
+      obj1 = maskDict->lookup("ColorSpace");
       if (obj1.isNull()) {
-	obj1.free();
-	maskDict->lookup("CS", &obj1);
+	obj1 = maskDict->lookup("CS");
       }
       if (obj1.isName()) {
-	res->lookupColorSpace(obj1.getName(), &obj2);
+	Object obj2 = res->lookupColorSpace(obj1.getName());
 	if (!obj2.isNull()) {
-	  obj1.free();
-	  obj1 = obj2;
-	} else {
-	  obj2.free();
+	  obj1 = std::move(obj2);
 	}
       }
       maskColorSpace = GfxColorSpace::parse(NULL, &obj1, out, state);
-      obj1.free();
       if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) {
 	goto err1;
       }
-      maskDict->lookup("Decode", &obj1);
+      obj1 = maskDict->lookup("Decode");
       if (obj1.isNull()) {
-	obj1.free();
-	maskDict->lookup("D", &obj1);
+	obj1 = maskDict->lookup("D");
       }
-      maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace);
-      obj1.free();
+      maskColorMap.reset(new GfxImageColorMap(maskBits, &obj1, maskColorSpace));
       if (!maskColorMap->isOk()) {
-	delete maskColorMap;
 	goto err1;
       }
       // handle the Matte entry
-      maskDict->lookup("Matte", &obj1);
+      obj1 = maskDict->lookup("Matte");
       if (obj1.isArray()) {
         if (obj1.getArray()->getLength() != colorSpace->getNComps()) {
           error(errSyntaxError, -1, "Matte entry should have {0:d} components but has {1:d}",
@@ -4582,15 +4480,13 @@
         } else {
           GfxColor matteColor;
           for (i = 0; i < colorSpace->getNComps(); i++) {
-            obj1.getArray()->get(i, &obj2);
+            Object obj2 = obj1.getArray()->get(i);
             if (!obj2.isNum()) {
-              obj2.free();
               error(errSyntaxError, -1, "Matte entry {0:d} should be a number but it's of type {1:d}", i, obj2.getType());
 
               break;
             }
             matteColor.c[i] = dblToCol(obj2.getNum());
-            obj2.free();
           }
           if (i == colorSpace->getNComps()) {
             maskColorMap->setMatteColor(&matteColor);
@@ -4597,7 +4493,6 @@
           }
         }
       }
-      obj1.free();
       haveSoftMask = gTrue;
     } else if (maskObj.isArray()) {
       // color key mask
@@ -4604,7 +4499,7 @@
       for (i = 0;
 	   i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps;
 	   ++i) {
-	maskObj.arrayGet(i, &obj1);
+	obj1 = maskObj.arrayGet(i);
 	if (obj1.isInt()) {
 	  maskColors[i] = obj1.getInt();
 	} else if (obj1.isReal()) {
@@ -4612,10 +4507,8 @@
 	  maskColors[i] = (int) obj1.getReal();
 	} else {
 	  error(errSyntaxError, -1, "Mask entry should be an integer but it's of type {0:d}", obj1.getType());
-	  obj1.free();
 	  goto err1;
 	}
-	obj1.free();
       }
       haveColorKeyMask = gTrue;
     } else if (maskObj.isStream()) {
@@ -4625,63 +4518,52 @@
       }
       maskStr = maskObj.getStream();
       maskDict = maskObj.streamGetDict();
-      maskDict->lookup("Width", &obj1);
+      obj1 = maskDict->lookup("Width");
       if (obj1.isNull()) {
-	obj1.free();
-	maskDict->lookup("W", &obj1);
+	obj1 = maskDict->lookup("W");
       }
       if (!obj1.isInt()) {
-	goto err2;
+	goto err1;
       }
       maskWidth = obj1.getInt();
-      obj1.free();
-      maskDict->lookup("Height", &obj1);
+      obj1 = maskDict->lookup("Height");
       if (obj1.isNull()) {
-	obj1.free();
-	maskDict->lookup("H", &obj1);
+	obj1 = maskDict->lookup("H");
       }
       if (!obj1.isInt()) {
-	goto err2;
+	goto err1;
       }
       maskHeight = obj1.getInt();
-      obj1.free();
-      maskDict->lookup("Interpolate", &obj1);
+      obj1 = maskDict->lookup("Interpolate");
       if (obj1.isNull()) {
-        obj1.free();
-	maskDict->lookup("I", &obj1);
+	obj1 = maskDict->lookup("I");
       }
       if (obj1.isBool())
         maskInterpolate = obj1.getBool();
       else
         maskInterpolate = gFalse;
-      obj1.free();
-      maskDict->lookup("ImageMask", &obj1);
+      obj1 = maskDict->lookup("ImageMask");
       if (obj1.isNull()) {
-	obj1.free();
-	maskDict->lookup("IM", &obj1);
+	obj1 = maskDict->lookup("IM");
       }
       if (!obj1.isBool() || !obj1.getBool()) {
-	goto err2;
+	goto err1;
       }
-      obj1.free();
       maskInvert = gFalse;
-      maskDict->lookup("Decode", &obj1);
+      obj1 = maskDict->lookup("Decode");
       if (obj1.isNull()) {
-	obj1.free();
-	maskDict->lookup("D", &obj1);
+	obj1 = maskDict->lookup("D");
       }
       if (obj1.isArray()) {
-	obj1.arrayGet(0, &obj2);
+	Object obj2 = obj1.arrayGet(0);
 	// Table 4.39 says /Decode must be [1 0] or [0 1]. Adobe
 	// accepts [1.0 0.0] as well.
 	if (obj2.isNum() && obj2.getNum() >= 0.9) {
 	  maskInvert = gTrue;
 	}
-	obj2.free();
       } else if (!obj1.isNull()) {
-	goto err2;
+	goto err1;
       }
-      obj1.free();
       haveExplicitMask = gTrue;
     }
 
@@ -4688,8 +4570,8 @@
     // if drawing is disabled, skip over inline image data
     if (!ocState || !out->needNonText()) {
       str->reset();
-      n = height * ((width * colorMap->getNumPixelComps() *
-		     colorMap->getBits() + 7) / 8);
+      n = height * ((width * colorMap.getNumPixelComps() *
+		     colorMap.getBits() + 7) / 8);
       for (i = 0; i < n; ++i) {
 	str->getChar();
       }
@@ -4698,21 +4580,16 @@
     // draw it
     } else {
       if (haveSoftMask) {
-	out->drawSoftMaskedImage(state, ref, str, width, height, colorMap, interpolate,
-				 maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate);
-	delete maskColorMap;
+	out->drawSoftMaskedImage(state, ref, str, width, height, &colorMap, interpolate,
+				 maskStr, maskWidth, maskHeight, maskColorMap.get(), maskInterpolate);
       } else if (haveExplicitMask) {
-	out->drawMaskedImage(state, ref, str, width, height, colorMap, interpolate,
+	out->drawMaskedImage(state, ref, str, width, height, &colorMap, interpolate,
 			     maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate);
       } else {
-	out->drawImage(state, ref, str, width, height, colorMap, interpolate,
+	out->drawImage(state, ref, str, width, height, &colorMap, interpolate,
 		       haveColorKeyMask ? maskColors : (int *)NULL, inlineImg);
       }
     }
-    delete colorMap;
-
-    maskObj.free();
-    smaskObj.free();
   }
 
   if ((i = width * height) > 1000) {
@@ -4722,8 +4599,6 @@
 
   return;
 
- err2:
-  obj1.free();
  err1:
   error(errSyntaxError, getPos(), "Bad image parameters");
 }
@@ -4731,7 +4606,6 @@
 GBool Gfx::checkTransparencyGroup(Dict *resDict) {
   // check the effect of compositing objects as a group:
   // look for ExtGState entries with ca != 1 or CA != 1 or BM != normal
-  Object extGStates;
   GBool transpGroup = gFalse;
   double opac;
 
@@ -4738,15 +4612,16 @@
   if (resDict == NULL)
     return gFalse;
   pushResources(resDict);
-  resDict->lookup("ExtGState", &extGStates);
+  Object extGStates = resDict->lookup("ExtGState");
   if (extGStates.isDict()) {
     Dict *dict = extGStates.getDict();
     for (int i = 0; i < dict->getLength() && !transpGroup; i++) {
-      Object obj1, obj2;
       GfxBlendMode mode;
 
-      if (res->lookupGState(dict->getKey(i), &obj1) && obj1.isDict()) {
-        if (!obj1.dictLookup("BM", &obj2)->isNull()) {
+      Object obj1 = res->lookupGState(dict->getKey(i));
+      if (obj1.isDict()) {
+        Object obj2 = obj1.dictLookup("BM");
+        if (!obj2.isNull()) {
           if (state->parseBlendMode(&obj2, &mode)) {
             if (mode != gfxBlendNormal)
               transpGroup = gTrue;
@@ -4754,38 +4629,35 @@
             error(errSyntaxError, getPos(), "Invalid blend mode in ExtGState");
           }
         }
-        obj2.free();
-        if (obj1.dictLookup("ca", &obj2)->isNum()) {
+        obj2 = obj1.dictLookup("ca");
+	if (obj2.isNum()) {
           opac = obj2.getNum();
           opac = opac < 0 ? 0 : opac > 1 ? 1 : opac;
           if (opac != 1)
             transpGroup = gTrue;
         }
-        obj2.free();
-        if (obj1.dictLookup("CA", &obj2)->isNum()) {
+        obj2 = obj1.dictLookup("CA");
+	if (obj2.isNum()) {
           opac = obj2.getNum();
           opac = opac < 0 ? 0 : opac > 1 ? 1 : opac;
           if (opac != 1)
             transpGroup = gTrue;
         }
-        obj2.free();
         // alpha is shape
-        if (!transpGroup && obj1.dictLookup("AIS", &obj2)->isBool()) {
+	obj2 = obj1.dictLookup("AIS");
+        if (!transpGroup && obj2.isBool()) {
           transpGroup = obj2.getBool();
         }
-        obj2.free();
         // soft mask
-        if (!transpGroup && !obj1.dictLookup("SMask", &obj2)->isNull()) {
+	obj2 = obj1.dictLookup("SMask");
+        if (!transpGroup && !obj2.isNull()) {
           if (!obj2.isName("None")) {
             transpGroup = gTrue;
           }
         }
-        obj2.free();
       }
-      obj1.free();
     }
   }
-  extGStates.free();
   popResources();
   return transpGroup;
 }
@@ -4794,12 +4666,10 @@
   Dict *dict;
   GBool transpGroup, isolated, knockout;
   GfxColorSpace *blendingColorSpace;
-  Object matrixObj, bboxObj;
   double m[6], bbox[4];
-  Object resObj;
   Dict *resDict;
   GBool ocSaved;
-  Object obj1, obj2, obj3;
+  Object obj1;
   int i;
 
   // check for excessive recursion
@@ -4811,17 +4681,15 @@
   dict = str->streamGetDict();
 
   // check form type
-  dict->lookup("FormType", &obj1);
+  obj1 = dict->lookup("FormType");
   if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) {
     error(errSyntaxError, getPos(), "Unknown form type");
   }
-  obj1.free();
 
   // check for optional content key
   ocSaved = ocState;
-  dict->lookupNF("OC", &obj1);
+  obj1 = dict->lookupNF("OC");
   if (catalog->getOptContentConfig() && !catalog->getOptContentConfig()->optContentIsVisible(&obj1)) {
-    obj1.free();
     if (out->needCharCount()) {
       ocState = gFalse;
     } else {
@@ -4828,37 +4696,31 @@
       return;
     }
   }
-  obj1.free();
 
   // get bounding box
-  dict->lookup("BBox", &bboxObj);
+  Object bboxObj = dict->lookup("BBox");
   if (!bboxObj.isArray()) {
-    bboxObj.free();
     error(errSyntaxError, getPos(), "Bad form bounding box");
     ocState = ocSaved;
     return;
   }
   for (i = 0; i < 4; ++i) {
-    bboxObj.arrayGet(i, &obj1);
+    obj1 = bboxObj.arrayGet(i);
     if (likely(obj1.isNum())) {
       bbox[i] = obj1.getNum();
-      obj1.free();
     } else {
-      obj1.free();
       error(errSyntaxError, getPos(), "Bad form bounding box value");
       return;
     }
   }
-  bboxObj.free();
 
   // get matrix
-  dict->lookup("Matrix", &matrixObj);
+  Object matrixObj = dict->lookup("Matrix");
   if (matrixObj.isArray()) {
     for (i = 0; i < 6; ++i) {
-      matrixObj.arrayGet(i, &obj1);
+      obj1 = matrixObj.arrayGet(i);
       if (likely(obj1.isNum())) m[i] = obj1.getNum();
       else m[i] = 0;
-      obj1.free();
     }
   } else {
     m[0] = 1; m[1] = 0;
@@ -4865,34 +4727,33 @@
     m[2] = 0; m[3] = 1;
     m[4] = 0; m[5] = 0;
   }
-  matrixObj.free();
 
   // get resources
-  dict->lookup("Resources", &resObj);
+  Object resObj = dict->lookup("Resources");
   resDict = resObj.isDict() ? resObj.getDict() : (Dict *)NULL;
 
   // check for a transparency group
   transpGroup = isolated = knockout = gFalse;
   blendingColorSpace = NULL;
-  if (dict->lookup("Group", &obj1)->isDict()) {
-    if (obj1.dictLookup("S", &obj2)->isName("Transparency")) {
-      if (!obj1.dictLookup("CS", &obj3)->isNull()) {
+  obj1 = dict->lookup("Group");
+  if (obj1.isDict()) {
+    Object obj2 = obj1.dictLookup("S");
+    if (obj2.isName("Transparency")) {
+      Object obj3 = obj1.dictLookup("CS");
+      if (!obj3.isNull()) {
 	blendingColorSpace = GfxColorSpace::parse(res, &obj3, out, state);
       }
-      obj3.free();
-      if (obj1.dictLookup("I", &obj3)->isBool()) {
+      obj3 = obj1.dictLookup("I");
+      if (obj3.isBool()) {
 	isolated = obj3.getBool();
       }
-      obj3.free();
-      if (obj1.dictLookup("K", &obj3)->isBool()) {
+      obj3 = obj1.dictLookup("K");
+      if (obj3.isBool()) {
 	knockout = obj3.getBool();
       }
-      obj3.free();
       transpGroup = isolated || out->checkTransparencyGroup(state, knockout) || checkTransparencyGroup(resDict);
     }
-    obj2.free();
   }
-  obj1.free();
 
   // draw it
   ++formDepth;
@@ -4903,7 +4764,6 @@
   if (blendingColorSpace) {
     delete blendingColorSpace;
   }
-  resObj.free();
 
   ocState = ocSaved;
 }
@@ -5044,45 +4904,37 @@
 }
 
 Stream *Gfx::buildImageStream() {
-  Object dict;
-  Object obj;
   char *key;
   Stream *str;
 
   // build dictionary
-  dict.initDict(xref);
-  parser->getObj(&obj);
+  Object dict(new Dict(xref));
+  Object obj = parser->getObj();
   while (!obj.isCmd("ID") && !obj.isEOF()) {
     if (!obj.isName()) {
       error(errSyntaxError, getPos(), "Inline image dictionary key must be a name object");
-      obj.free();
     } else {
       key = copyString(obj.getName());
-      obj.free();
-      parser->getObj(&obj);
+      obj = parser->getObj();
       if (obj.isEOF() || obj.isError()) {
 	gfree(key);
 	break;
       }
-      dict.dictAdd(key, &obj);
+      dict.dictAdd(key, std::move(obj));
     }
-    parser->getObj(&obj);
+    obj = parser->getObj();
   }
   if (obj.isEOF()) {
     error(errSyntaxError, getPos(), "End of file in inline image");
-    obj.free();
-    dict.free();
     return NULL;
   }
-  obj.free();
 
   // make stream
   if (parser->getStream()) {
-    str = new EmbedStream(parser->getStream(), &dict, gFalse, 0);
-    str = str->addFilters(&dict);
+    str = new EmbedStream(parser->getStream(), std::move(dict), gFalse, 0, gTrue);
+    str = str->addFilters(str->getDict());
   } else {
     str = NULL;
-    dict.free();
   }
 
   return str;
@@ -5175,27 +5027,25 @@
 	error(errSyntaxError, getPos(), "Unexpected MC Type: {0:d}", args[1].getType());
       }
       char* name1 = args[1].getName();
-      Object markedContent;
       MarkedContentStack *mc = mcStack;
       mc->kind = gfxMCOptionalContent;
-      if ( res->lookupMarkedContentNF( name1, &markedContent ) ) {
+      Object markedContent = res->lookupMarkedContentNF( name1 );
+      if (!markedContent.isNull()) {
         bool visible = contentConfig->optContentIsVisible(&markedContent);
         mc->ocSuppressed = !(visible);
       } else {
 	error(errSyntaxError, getPos(), "DID NOT find {0:s}", name1);
       }
-      markedContent.free();
     } else {
       error(errSyntaxError, getPos(), "insufficient arguments for Marked Content");
     }
   } else if (args[0].isName("Span") && numArgs == 2 && args[1].isDict()) {
-    Object obj;
-    if (args[1].dictLookup("ActualText", &obj)->isString()) {
+    Object obj = args[1].dictLookup("ActualText");
+    if (obj.isString()) {
       out->beginActualText(state, obj.getString());
       MarkedContentStack *mc = mcStack;
       mc->kind = gfxMCActualText;
     }
-    obj.free();
   }
 
   if (printCommands) {
@@ -5269,7 +5119,6 @@
 void Gfx::drawAnnot(Object *str, AnnotBorder *border, AnnotColor *aColor,
 		    double xMin, double yMin, double xMax, double yMax, int rotate) {
   Dict *dict, *resDict;
-  Object matrixObj, bboxObj, resObj, obj1;
   double formXMin, formYMin, formXMax, formYMax;
   double x, y, sx, sy, tx, ty;
   double m[6], bbox[4];
@@ -5317,37 +5166,29 @@
     dict = str->streamGetDict();
 
     // get the form bounding box
-    dict->lookup("BBox", &bboxObj);
+    Object bboxObj = dict->lookup("BBox");
     if (!bboxObj.isArray()) {
-      bboxObj.free();
       error(errSyntaxError, getPos(), "Bad form bounding box");
       return;
     }
     for (i = 0; i < 4; ++i) {
-      bboxObj.arrayGet(i, &obj1);
+      Object obj1 = bboxObj.arrayGet(i);
       if (likely(obj1.isNum())) {
         bbox[i] = obj1.getNum();
-        obj1.free();
       } else {
-        obj1.free();
-        bboxObj.free();
         error(errSyntaxError, getPos(), "Bad form bounding box value");
         return;
       }
     }
-    bboxObj.free();
 
     // get the form matrix
-    dict->lookup("Matrix", &matrixObj);
+    Object matrixObj = dict->lookup("Matrix");
     if (matrixObj.isArray() && matrixObj.arrayGetLength() >= 6) {
       for (i = 0; i < 6; ++i) {
-	matrixObj.arrayGet(i, &obj1);
+	Object obj1 = matrixObj.arrayGet(i);
 	if (likely(obj1.isNum())) {
 	  m[i] = obj1.getNum();
-	  obj1.free();
 	} else {
-	  obj1.free();
-	  matrixObj.free();
 	  error(errSyntaxError, getPos(), "Bad form matrix");
 	  return;
 	}
@@ -5357,7 +5198,6 @@
       m[2] = 0; m[3] = 1;
       m[4] = 0; m[5] = 0;
     }
-    matrixObj.free();
 
     // transform the four corners of the form bbox to default user
     // space, and construct the transformed bbox
@@ -5430,13 +5270,11 @@
     m[5] = m[5] * sy + ty;
 
     // get the resources
-    dict->lookup("Resources", &resObj);
+    Object resObj = dict->lookup("Resources");
     resDict = resObj.isDict() ? resObj.getDict() : (Dict *)NULL;
 
     // draw it
     drawForm(str, resDict, m, bbox);
-
-    resObj.free();
   }
 
   // draw the border

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Gfx.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Gfx.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Gfx.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -17,7 +17,7 @@
 // Copyright (C) 2007 Iñigo Martínez <inigomartinez at gmail.com>
 // Copyright (C) 2008 Brad Hards <bradh at kde.org>
 // Copyright (C) 2008, 2010 Carlos Garcia Campos <carlosgc at gnome.org>
-// Copyright (C) 2009-2013 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009-2013, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009, 2010, 2012, 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2010 David Benjamin <davidben at mit.edu>
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
@@ -113,14 +113,14 @@
   ~GfxResources();
 
   GfxFont *lookupFont(char *name);
-  GBool lookupXObject(char *name, Object *obj);
-  GBool lookupXObjectNF(char *name, Object *obj);
-  GBool lookupMarkedContentNF(char *name, Object *obj);
-  void lookupColorSpace(const char *name, Object *obj);
+  Object lookupXObject(char *name);
+  Object lookupXObjectNF(char *name);
+  Object lookupMarkedContentNF(char *name);
+  Object lookupColorSpace(const char *name);
   GfxPattern *lookupPattern(char *name, OutputDev *out, GfxState *state);
   GfxShading *lookupShading(char *name, OutputDev *out, GfxState *state);
-  GBool lookupGState(char *name, Object *obj);
-  GBool lookupGStateNF(char *name, Object *obj);
+  Object lookupGState(char *name);
+  Object lookupGStateNF(char *name);
 
   GfxResources *getNext() { return next; }
 
@@ -228,6 +228,7 @@
   Parser *parser;		// parser for page content stream(s)
   
   std::set<int> formsDrawing;	// the forms that are being drawn
+  std::set<int> charProcDrawing;	// the charProc that are being drawn
 
   GBool				// callback to check for an abort
     (*abortCheckCbk)(void *data);

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxFont.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxFont.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxFont.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2005, 2006, 2008-2010, 2012, 2014, 2015 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2006, 2008-2010, 2012, 2014, 2015, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
 // Copyright (C) 2007 Julien Rebetez <julienr at svn.gnome.org>
@@ -29,7 +29,7 @@
 // Copyright (C) 2011, 2012, 2014 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2012 Yi Yang <ahyangyi at gmail.com>
 // Copyright (C) 2012 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
-// Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2012, 2017 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2013-2016 Jason Crain <jason at aquaticape.us>
 // Copyright (C) 2014 Olly Betts <olly at survex.com>
 //
@@ -210,15 +210,13 @@
   Ref embFontIDA;
   GfxFontType typeA;
   GfxFont *font;
-  Object obj1;
 
   // get base font name
   nameA = NULL;
-  fontDict->lookup("BaseFont", &obj1);
+  Object obj1 = fontDict->lookup("BaseFont");
   if (obj1.isName()) {
     nameA = new GooString(obj1.getName());
   }
-  obj1.free();
 
   // get embedded font ID and font type
   typeA = getFontType(xref, fontDict, &embFontIDA);
@@ -290,7 +288,6 @@
   GfxFontType t, expectedType;
   FoFiIdentifierType fft;
   Dict *fontDict2;
-  Object subtype, fontDesc, obj1, obj2, obj3, obj4;
   GBool isType0, err;
 
   t = fontUnknownType;
@@ -297,7 +294,7 @@
   embID->num = embID->gen = -1;
   err = gFalse;
 
-  fontDict->lookup("Subtype", &subtype);
+  Object subtype = fontDict->lookup("Subtype");
   expectedType = fontUnknownType;
   isType0 = gFalse;
   if (subtype.isName("Type1") || subtype.isName("MMType1")) {
@@ -314,44 +311,45 @@
     error(errSyntaxWarning, -1, "Unknown font type: '{0:s}'",
 	  subtype.isName() ? subtype.getName() : "???");
   }
-  subtype.free();
 
   fontDict2 = fontDict;
-  if (fontDict->lookup("DescendantFonts", &obj1)->isArray()) {
+  Object obj1 = fontDict->lookup("DescendantFonts");
+  Object obj2; // Do not move to inside the if
+               // we need it around so that fontDict2 remains valid
+  if (obj1.isArray()) {
     if (obj1.arrayGetLength() == 0) {
       error(errSyntaxWarning, -1, "Empty DescendantFonts array in font");
-      obj2.initNull();
-    } else if (obj1.arrayGet(0, &obj2)->isDict()) {
-      if (!isType0) {
-	error(errSyntaxWarning, -1, "Non-CID font with DescendantFonts array");
-      }
-      fontDict2 = obj2.getDict();
-      fontDict2->lookup("Subtype", &subtype);
-      if (subtype.isName("CIDFontType0")) {
-	if (isType0) {
-	  expectedType = fontCIDType0;
+    } else {
+      obj2 = obj1.arrayGet(0);
+      if (obj2.isDict()) {
+	if (!isType0) {
+	  error(errSyntaxWarning, -1, "Non-CID font with DescendantFonts array");
 	}
-      } else if (subtype.isName("CIDFontType2")) {
-	if (isType0) {
-	  expectedType = fontCIDType2;
+	fontDict2 = obj2.getDict();
+	subtype = fontDict2->lookup("Subtype");
+	if (subtype.isName("CIDFontType0")) {
+	  if (isType0) {
+	    expectedType = fontCIDType0;
+	  }
+	} else if (subtype.isName("CIDFontType2")) {
+	  if (isType0) {
+	    expectedType = fontCIDType2;
+	  }
 	}
       }
-      subtype.free();
     }
-  } else {
-    obj2.initNull();
   }
 
-  if (fontDict2->lookup("FontDescriptor", &fontDesc)->isDict()) {
-    if (fontDesc.dictLookupNF("FontFile", &obj3)->isRef()) {
+  Object fontDesc = fontDict2->lookup("FontDescriptor");
+  if (fontDesc.isDict()) {
+    Object obj3 = fontDesc.dictLookupNF("FontFile");
+    if (obj3.isRef()) {
       *embID = obj3.getRef();
       if (expectedType != fontType1) {
 	err = gTrue;
       }
     }
-    obj3.free();
-    if (embID->num == -1 &&
-	fontDesc.dictLookupNF("FontFile2", &obj3)->isRef()) {
+    if (embID->num == -1 && (obj3 = fontDesc.dictLookupNF("FontFile2"), obj3.isRef())) {
       *embID = obj3.getRef();
       if (isType0) {
 	expectedType = fontCIDType2;
@@ -359,12 +357,11 @@
 	err = gTrue;
       }
     }
-    obj3.free();
-    if (embID->num == -1 &&
-	fontDesc.dictLookupNF("FontFile3", &obj3)->isRef()) {
+    if (embID->num == -1 && (obj3 = fontDesc.dictLookupNF("FontFile3"), obj3.isRef())) {
       *embID = obj3.getRef();
-      if (obj3.fetch(xref, &obj4)->isStream()) {
-	obj4.streamGetDict()->lookup("Subtype", &subtype);
+      Object obj4 = obj3.fetch(xref);
+      if (obj4.isStream()) {
+	subtype = obj4.streamGetDict()->lookup("Subtype");
 	if (subtype.isName("Type1")) {
 	  if (expectedType != fontType1) {
 	    err = gTrue;
@@ -405,18 +402,14 @@
 	  error(errSyntaxError, -1, "Unknown font type '{0:s}'",
 		subtype.isName() ? subtype.getName() : "???");
 	}
-	subtype.free();
       }
-      obj4.free();
     }
-    obj3.free();
   }
-  fontDesc.free();
 
   t = fontUnknownType;
   if (embID->num >= 0) {
-    obj3.initRef(embID->num, embID->gen);
-    obj3.fetch(xref, &obj4);
+    Object obj3(embID->num, embID->gen);
+    Object obj4 = obj3.fetch(xref);
     if (obj4.isStream()) {
       obj4.streamReset();
       fft = FoFiIdentifier::identifyStream(&readFromStream, obj4.getStream());
@@ -447,8 +440,6 @@
 	break;
       }
     }
-    obj4.free();
-    obj3.free();
   }
 
   if (t == fontUnknownType) {
@@ -464,16 +455,11 @@
 	  "Mismatch between font type and embedded font file");
   }
 
-  obj2.free();
-  obj1.free();
-
   return t;
 }
 
 void GfxFont::readFontDescriptor(XRef *xref, Dict *fontDict) {
-  Object obj1, obj2, obj3, obj4;
   double t;
-  int i;
 
   // assume Times-Roman by default (for substitution purposes)
   flags = fontSerif;
@@ -480,37 +466,35 @@
 
   missingWidth = 0;
 
-  if (fontDict->lookup("FontDescriptor", &obj1)->isDict()) {
+  Object obj1 = fontDict->lookup("FontDescriptor");
+  if (obj1.isDict()) {
 
     // get flags
-    if (obj1.dictLookup("Flags", &obj2)->isInt()) {
+    Object obj2 = obj1.dictLookup("Flags");
+    if (obj2.isInt()) {
       flags = obj2.getInt();
     }
-    obj2.free();
 
     // get name
-    obj1.dictLookup("FontName", &obj2);
+    obj2 = obj1.dictLookup("FontName");
     if (obj2.isName()) {
       embFontName = new GooString(obj2.getName());
     }
-    obj2.free();
     if (embFontName == NULL) {
       // get name with typo
-      obj1.dictLookup("Fontname", &obj2);
+      obj2 = obj1.dictLookup("Fontname");
       if (obj2.isName()) {
         embFontName = new GooString(obj2.getName());
         error(errSyntaxWarning, -1, "The file uses Fontname instead of FontName please notify the creator that the file is broken");
       }
-      obj2.free();
     }
 
     // get family
-    obj1.dictLookup("FontFamily", &obj2);
+    obj2 = obj1.dictLookup("FontFamily");
     if (obj2.isString()) family = new GooString(obj2.getString());
-    obj2.free();
 
     // get stretch
-    obj1.dictLookup("FontStretch", &obj2);
+    obj2 = obj1.dictLookup("FontStretch");
     if (obj2.isName()) {
       if (strcmp(obj2.getName(), "UltraCondensed") == 0) stretch = UltraCondensed;
       else if (strcmp(obj2.getName(), "ExtraCondensed") == 0) stretch = ExtraCondensed;
@@ -523,10 +507,9 @@
       else if (strcmp(obj2.getName(), "UltraExpanded") == 0) stretch = UltraExpanded;
       else error(errSyntaxWarning, -1, "Invalid Font Stretch");
     }
-    obj2.free();
     
     // get weight
-    obj1.dictLookup("FontWeight", &obj2);
+    obj2 = obj1.dictLookup("FontWeight");
     if (obj2.isNum()) {
       if (obj2.getNum() == 100) weight = W100;
       else if (obj2.getNum() == 200) weight = W200;
@@ -539,17 +522,15 @@
       else if (obj2.getNum() == 900) weight = W900;
       else error(errSyntaxWarning, -1, "Invalid Font Weight");
     }
-    obj2.free();
 
     // look for MissingWidth
-    obj1.dictLookup("MissingWidth", &obj2);
+    obj2 = obj1.dictLookup("MissingWidth");
     if (obj2.isNum()) {
       missingWidth = obj2.getNum();
     }
-    obj2.free();
 
     // get Ascent and Descent
-    obj1.dictLookup("Ascent", &obj2);
+    obj2 = obj1.dictLookup("Ascent");
     if (obj2.isNum()) {
       t = 0.001 * obj2.getNum();
       // some broken font descriptors specify a negative ascent
@@ -562,8 +543,7 @@
 	ascent = t;
       }
     }
-    obj2.free();
-    obj1.dictLookup("Descent", &obj2);
+    obj2 = obj1.dictLookup("Descent");
     if (obj2.isNum()) {
       t = 0.001 * obj2.getNum();
       // some broken font descriptors specify a positive descent
@@ -575,36 +555,31 @@
 	descent = t;
       }
     }
-    obj2.free();
 
     // font FontBBox
-    if (obj1.dictLookup("FontBBox", &obj2)->isArray()) {
-      for (i = 0; i < 4 && i < obj2.arrayGetLength(); ++i) {
-	if (obj2.arrayGet(i, &obj3)->isNum()) {
+    obj2 = obj1.dictLookup("FontBBox");
+    if (obj2.isArray()) {
+      for (int i = 0; i < 4 && i < obj2.arrayGetLength(); ++i) {
+	Object obj3 = obj2.arrayGet(i);
+	if (obj3.isNum()) {
 	  fontBBox[i] = 0.001 * obj3.getNum();
 	}
-	obj3.free();
       }
     }
-    obj2.free();
-
   }
-  obj1.free();
 }
 
 CharCodeToUnicode *GfxFont::readToUnicodeCMap(Dict *fontDict, int nBits,
 					      CharCodeToUnicode *ctu) {
   GooString *buf;
-  Object obj1;
 
-  if (!fontDict->lookup("ToUnicode", &obj1)->isStream()) {
-    obj1.free();
+  Object obj1 = fontDict->lookup("ToUnicode");
+  if (!obj1.isStream()) {
     return NULL;
   }
   buf = new GooString();
   obj1.getStream()->fillGooString(buf);
   obj1.streamClose();
-  obj1.free();
   if (ctu) {
     ctu->mergeCMap(buf, nBits);
   } else {
@@ -619,8 +594,6 @@
   GfxFontLoc *fontLoc;
   SysFontType sysFontType;
   GooString *path, *base14Name, *substName;
-  PSFontParam16 *psFont16;
-  Object refObj, embFontObj;
   int substIdx, fontNum;
   GBool embed;
 
@@ -631,14 +604,12 @@
   //----- embedded font
   if (embFontID.num >= 0) {
     embed = gTrue;
-    refObj.initRef(embFontID.num, embFontID.gen);
-    refObj.fetch(xref, &embFontObj);
+    Object refObj(embFontID.num, embFontID.gen);
+    Object embFontObj = refObj.fetch(xref);
     if (!embFontObj.isStream()) {
       error(errSyntaxError, -1, "Embedded font object is wrong type");
       embed = gFalse;
     }
-    embFontObj.free();
-    refObj.free();
     if (embed) {
       if (ps) {
 	switch (type) {
@@ -743,17 +714,6 @@
 
   if (!isCIDFont()) {
 
-    //----- 8-bit PS resident font
-    if (name && ps) {
-      if ((path = globalParams->getPSResidentFont(name))) {
-	fontLoc = new GfxFontLoc();
-	fontLoc->locType = gfxFontLocResident;
-	fontLoc->fontType = fontType1;
-	fontLoc->path = path;
-	return fontLoc;
-      }
-    }
-
     //----- 8-bit font substitution
     if (flags & fontFixedWidth) {
       substIdx = 0;
@@ -796,42 +756,6 @@
     return NULL;
   }
 
-  //----- 16-bit PS resident font
-  if (ps && ((psFont16 = globalParams->getPSResidentFont16(
-					 name,
-					 ((GfxCIDFont *)this)->getWMode())))) {
-    fontLoc = new GfxFontLoc();
-    fontLoc->locType = gfxFontLocResident;
-    fontLoc->fontType = fontCIDType0; // this is not used
-    fontLoc->path = psFont16->psFontName->copy();
-    fontLoc->encoding = psFont16->encoding->copy();
-    fontLoc->wMode = psFont16->wMode;
-    return fontLoc;
-  }
-  if (ps && ((psFont16 = globalParams->getPSResidentFontCC(
-				 ((GfxCIDFont *)this)->getCollection(),
-				 ((GfxCIDFont *)this)->getWMode())))) {
-    error(errSyntaxWarning, -1, "Substituting font '{0:t}' for '{1:t}'",
-	  psFont16->psFontName, name);
-    fontLoc = new GfxFontLoc();
-    fontLoc->locType = gfxFontLocResident;
-    fontLoc->fontType = fontCIDType0; // this is not used
-    fontLoc->path = psFont16->psFontName->copy();
-    fontLoc->encoding = psFont16->encoding->copy();
-    fontLoc->wMode = psFont16->wMode;
-    return fontLoc;
-  }
-
-  //----- CID font substitution
-  if ((path = globalParams->findCCFontFile(
-				((GfxCIDFont *)this)->getCollection()))) {
-    if ((fontLoc = getExternalFont(path, gTrue))) {
-      error(errSyntaxWarning, -1, "Substituting font '{0:t}' for '{1:t}'",
-	    fontLoc->path, name);
-      return fontLoc;
-    }
-  }
-
   // failed to find a substitute font
   return NULL;
 }
@@ -894,15 +818,12 @@
 
 char *GfxFont::readEmbFontFile(XRef *xref, int *len) {
   char *buf;
-  Object obj1, obj2;
   Stream *str;
 
-  obj1.initRef(embFontID.num, embFontID.gen);
-  obj1.fetch(xref, &obj2);
+  Object obj1(embFontID.num, embFontID.gen);
+  Object obj2 = obj1.fetch(xref);
   if (!obj2.isStream()) {
     error(errSyntaxError, -1, "Embedded font file is not a stream");
-    obj2.free();
-    obj1.free();
     embFontID.num = -1;
     *len = 0;
     return NULL;
@@ -912,9 +833,6 @@
   buf = (char*)str->toUnsignedChars(len);
   str->close();
 
-  obj2.free();
-  obj1.free();
-
   return buf;
 }
 
@@ -995,24 +913,20 @@
 // Returns gTrue if the font has character names like xx or Axx which
 // should be parsed for hex or decimal values.
 static GBool testForNumericNames(Dict *fontDict, GBool hex) {
-  Object enc, diff, obj;
   GBool numeric = gTrue;
 
-  fontDict->lookup("Encoding", &enc);
+  Object enc = fontDict->lookup("Encoding");
   if (!enc.isDict()) {
-    enc.free();
     return gFalse;
   }
 
-  enc.dictLookup("Differences", &diff);
-  enc.free();
+  Object diff = enc.dictLookup("Differences");
   if (!diff.isArray()) {
-    diff.free();
     return gFalse;
   }
 
   for (int i = 0; i < diff.arrayGetLength() && numeric; ++i) {
-    diff.arrayGet(i, &obj);
+    Object obj = diff.arrayGet(i);
     if (obj.isInt()) {
       // All sequences must start between character codes 0 and 5.
       if (obj.getInt() > 5)
@@ -1024,10 +938,8 @@
     } else {
       numeric = gFalse;
     }
-    obj.free();
   }
 
-  diff.free();
   return numeric;
 }
 
@@ -1052,7 +964,7 @@
   double mul;
   int firstChar, lastChar;
   Gushort w;
-  Object obj1, obj2, obj3;
+  Object obj1;
   int n, i, a, b, m;
 
   refCnt = 1;
@@ -1130,34 +1042,36 @@
   // get font matrix
   fontMat[0] = fontMat[3] = 1;
   fontMat[1] = fontMat[2] = fontMat[4] = fontMat[5] = 0;
-  if (fontDict->lookup("FontMatrix", &obj1)->isArray()) {
+  obj1 = fontDict->lookup("FontMatrix");
+  if (obj1.isArray()) {
     for (i = 0; i < 6 && i < obj1.arrayGetLength(); ++i) {
-      if (obj1.arrayGet(i, &obj2)->isNum()) {
+      Object obj2 = obj1.arrayGet(i);
+      if (obj2.isNum()) {
 	fontMat[i] = obj2.getNum();
       }
-      obj2.free();
     }
   }
-  obj1.free();
 
   // get Type 3 bounding box, font definition, and resources
   if (type == fontType3) {
-    if (fontDict->lookup("FontBBox", &obj1)->isArray()) {
+    obj1 = fontDict->lookup("FontBBox");
+    if (obj1.isArray()) {
       for (i = 0; i < 4 && i < obj1.arrayGetLength(); ++i) {
-	if (obj1.arrayGet(i, &obj2)->isNum()) {
+	Object obj2 = obj1.arrayGet(i);
+	if (obj2.isNum()) {
 	  fontBBox[i] = obj2.getNum();
 	}
-	obj2.free();
       }
     }
-    obj1.free();
-    if (!fontDict->lookup("CharProcs", &charProcs)->isDict()) {
+    charProcs = fontDict->lookup("CharProcs");
+    if (!charProcs.isDict()) {
       error(errSyntaxError, -1,
 	    "Missing or invalid CharProcs dictionary in Type 3 font");
-      charProcs.free();
+      charProcs.setToNull();
     }
-    if (!fontDict->lookup("Resources", &resources)->isDict()) {
-      resources.free();
+    resources = fontDict->lookup("Resources");
+    if (!resources.isDict()) {
+      resources.setToNull();
     }
   }
 
@@ -1180,9 +1094,9 @@
   usesMacRomanEnc = gFalse;
   baseEnc = NULL;
   baseEncFromFontFile = gFalse;
-  fontDict->lookup("Encoding", &obj1);
+  obj1 = fontDict->lookup("Encoding");
   if (obj1.isDict()) {
-    obj1.dictLookup("BaseEncoding", &obj2);
+    Object obj2 = obj1.dictLookup("BaseEncoding");
     if (obj2.isName("MacRomanEncoding")) {
       hasEncoding = gTrue;
       usesMacRomanEnc = gTrue;
@@ -1194,7 +1108,6 @@
       hasEncoding = gTrue;
       baseEnc = winAnsiEncoding;
     }
-    obj2.free();
   } else if (obj1.isName("MacRomanEncoding")) {
     hasEncoding = gTrue;
     usesMacRomanEnc = gTrue;
@@ -1298,13 +1211,13 @@
 
   // merge differences into encoding
   if (obj1.isDict()) {
-    obj1.dictLookup("Differences", &obj2);
+    Object obj2 = obj1.dictLookup("Differences");
     if (obj2.isArray()) {
       encodingName->Set("Custom");
       hasEncoding = gTrue;
       code = 0;
       for (i = 0; i < obj2.arrayGetLength(); ++i) {
-	obj2.arrayGet(i, &obj3);
+	Object obj3 = obj2.arrayGet(i);
 	if (obj3.isInt()) {
 	  code = obj3.getInt();
 	} else if (obj3.isName()) {
@@ -1321,18 +1234,11 @@
 		"Wrong type in font encoding resource differences ({0:s})",
 		obj3.getTypeName());
 	}
-	obj3.free();
       }
     }
-    obj2.free();
   }
-  obj1.free();
-  if (ffT1) {
-    delete ffT1;
-  }
-  if (ffT1C) {
-    delete ffT1C;
-  }
+  delete ffT1;
+  delete ffT1C;
 
   //----- build the mapping to Unicode -----
 
@@ -1405,12 +1311,10 @@
 	  continue;
 	}
 
-	// if the 'mapUnknownCharNames' flag is set, do a simple pass-through
+	// do a simple pass-through
 	// mapping for unknown character names
-	if (globalParams->getMapUnknownCharNames()) {
-	    uBuf[0] = code;
-	    ctu->setMapping((CharCode)code, uBuf, 1);
-	}
+        uBuf[0] = code;
+        ctu->setMapping((CharCode)code, uBuf, 1);
       }
     }
   }
@@ -1450,20 +1354,18 @@
   }
 
   // use widths from font dict, if present
-  fontDict->lookup("FirstChar", &obj1);
+  obj1 = fontDict->lookup("FirstChar");
   firstChar = obj1.isInt() ? obj1.getInt() : 0;
-  obj1.free();
   if (firstChar < 0 || firstChar > 255) {
     firstChar = 0;
   }
-  fontDict->lookup("LastChar", &obj1);
+  obj1 = fontDict->lookup("LastChar");
   lastChar = obj1.isInt() ? obj1.getInt() : 255;
-  obj1.free();
   if (lastChar < 0 || lastChar > 255) {
     lastChar = 255;
   }
   mul = (type == fontType3) ? fontMat[0] : 0.001;
-  fontDict->lookup("Widths", &obj1);
+  obj1 = fontDict->lookup("Widths");
   if (obj1.isArray()) {
     flags |= fontFixedWidth;
     if (obj1.arrayGetLength() < lastChar - firstChar + 1) {
@@ -1470,7 +1372,7 @@
       lastChar = firstChar + obj1.arrayGetLength() - 1;
     }
     for (code = firstChar; code <= lastChar; ++code) {
-      obj1.arrayGet(code - firstChar, &obj2);
+      Object obj2 = obj1.arrayGet(code - firstChar);
       if (obj2.isNum()) {
 	widths[code] = obj2.getNum() * mul;
 	if (fabs(widths[code] - widths[firstChar]) > 0.00001) {
@@ -1477,7 +1379,6 @@
 	  flags &= ~fontFixedWidth;
 	}
       }
-      obj2.free();
     }
 
   // use widths from built-in font
@@ -1523,7 +1424,6 @@
       }
     }
   }
-  obj1.free();
 
   ok = gTrue;
 }
@@ -1537,12 +1437,6 @@
     }
   }
   ctu->decRefCnt();
-  if (charProcs.isDict()) {
-    charProcs.free();
-  }
-  if (resources.isDict()) {
-    resources.free();
-  }
 }
 
 // This function is in part a derived work of the Adobe Glyph Mapping
@@ -1609,54 +1503,52 @@
   if (names && (uBuf[0] = globalParams->mapNameToUnicodeText(charName))) {
     return 1;
   }
-  if (globalParams->getMapNumericCharNames()) {
-    unsigned int n = strlen(charName);
-    // 3.3. otherwise, if the component is of the form "uni" (U+0075 U+006E
-    // U+0069) followed by a sequence of uppercase hexadecimal digits (0 .. 9,
-    // A .. F, i.e. U+0030 .. U+0039, U+0041 .. U+0046), the length of that
-    // sequence is a multiple of four, and each group of four digits represents
-    // a number in the set {0x0000 .. 0xD7FF, 0xE000 .. 0xFFFF}, then interpret
-    // each such number as a Unicode scalar value and map the component to the
-    // string made of those scalar values. Note that the range and digit length
-    // restrictions mean that the "uni" prefix can be used only with Unicode
-    // values from the Basic Multilingual Plane (BMP).
-    if (n >= 7 && (n % 4) == 3 && !strncmp(charName, "uni", 3)) {
-      int i;
-      unsigned int m;
-      for (i = 0, m = 3; i < uLen && m < n; m += 4) {
-	if (isxdigit(charName[m]) && isxdigit(charName[m + 1]) && 
-	    isxdigit(charName[m + 2]) && isxdigit(charName[m + 3])) {
-	  unsigned int u;
-	  sscanf(charName + m, "%4x", &u);
-	  if (u <= 0xD7FF || (0xE000 <= u && u <= 0xFFFF)) {
-	    uBuf[i++] = u;
-	  }
-	}
+  unsigned int n = strlen(charName);
+  // 3.3. otherwise, if the component is of the form "uni" (U+0075 U+006E
+  // U+0069) followed by a sequence of uppercase hexadecimal digits (0 .. 9,
+  // A .. F, i.e. U+0030 .. U+0039, U+0041 .. U+0046), the length of that
+  // sequence is a multiple of four, and each group of four digits represents
+  // a number in the set {0x0000 .. 0xD7FF, 0xE000 .. 0xFFFF}, then interpret
+  // each such number as a Unicode scalar value and map the component to the
+  // string made of those scalar values. Note that the range and digit length
+  // restrictions mean that the "uni" prefix can be used only with Unicode
+  // values from the Basic Multilingual Plane (BMP).
+  if (n >= 7 && (n % 4) == 3 && !strncmp(charName, "uni", 3)) {
+    int i;
+    unsigned int m;
+    for (i = 0, m = 3; i < uLen && m < n; m += 4) {
+      if (isxdigit(charName[m]) && isxdigit(charName[m + 1]) &&
+          isxdigit(charName[m + 2]) && isxdigit(charName[m + 3])) {
+        unsigned int u;
+        sscanf(charName + m, "%4x", &u);
+        if (u <= 0xD7FF || (0xE000 <= u && u <= 0xFFFF)) {
+          uBuf[i++] = u;
+        }
       }
-      return i;
     }
-    // 3.4. otherwise, if the component is of the form "u" (U+0075) followed by
-    // a sequence of four to six uppercase hexadecimal digits {0 .. 9, A .. F}
-    // (U+0030 .. U+0039, U+0041 .. U+0046), and those digits represent a
-    // number in {0x0000 .. 0xD7FF, 0xE000 .. 0x10FFFF}, then interpret this
-    // number as a Unicode scalar value and map the component to the string
-    // made of this scalar value.
-    if (n >= 5 && n <= 7 && charName[0] == 'u' && isxdigit(charName[1]) &&
-	isxdigit(charName[2]) && isxdigit(charName[3]) && isxdigit(charName[4])
-	&& (n <= 5 || isxdigit(charName[5]))
-	&& (n <= 6 || isxdigit(charName[6]))) {
-      unsigned int u;
-      sscanf(charName + 1, "%x", &u);
-      if (u <= 0xD7FF || (0xE000 <= u && u <= 0x10FFFF)) {
-	uBuf[0] = u;
-	return 1;
-      }
+    return i;
+  }
+  // 3.4. otherwise, if the component is of the form "u" (U+0075) followed by
+  // a sequence of four to six uppercase hexadecimal digits {0 .. 9, A .. F}
+  // (U+0030 .. U+0039, U+0041 .. U+0046), and those digits represent a
+  // number in {0x0000 .. 0xD7FF, 0xE000 .. 0x10FFFF}, then interpret this
+  // number as a Unicode scalar value and map the component to the string
+  // made of this scalar value.
+  if (n >= 5 && n <= 7 && charName[0] == 'u' && isxdigit(charName[1]) &&
+      isxdigit(charName[2]) && isxdigit(charName[3]) && isxdigit(charName[4])
+      && (n <= 5 || isxdigit(charName[5]))
+      && (n <= 6 || isxdigit(charName[6]))) {
+    unsigned int u;
+    sscanf(charName + 1, "%x", &u);
+    if (u <= 0xD7FF || (0xE000 <= u && u <= 0x10FFFF)) {
+      uBuf[0] = u;
+      return 1;
     }
-    // Not in Adobe Glyph Mapping convention: look for names like xx
-    // or Axx and parse for hex or decimal values.
-    if (numeric && parseNumericName(charName, hex, uBuf))
-      return 1;
   }
+  // Not in Adobe Glyph Mapping convention: look for names like xx
+  // or Axx and parse for hex or decimal values.
+  if (numeric && parseNumericName(charName, hex, uBuf))
+    return 1;
   // 3.5. otherwise, map the component to the empty string
   return 0;
 }
@@ -1695,14 +1587,13 @@
   // To match up with the Adobe-defined behaviour, we choose a cmap
   // like this:
   // 1. If the PDF font has an encoding:
-  //    1a. If the PDF font specified MacRomanEncoding and the
+  //    1a. If the TrueType font has a Microsoft Unicode
+  //        cmap or a non-Microsoft Unicode cmap, use it, and use the
+  //        Unicode indexes, not the char codes.
+  //    1b. If the PDF font specified MacRomanEncoding and the
   //        TrueType font has a Macintosh Roman cmap, use it, and
   //        reverse map the char names through MacRomanEncoding to
   //        get char codes.
-  //    1b. If the PDF font is not symbolic or the PDF font is not
-  //        embedded, and the TrueType font has a Microsoft Unicode
-  //        cmap or a non-Microsoft Unicode cmap, use it, and use the
-  //        Unicode indexes, not the char codes.
   //    1c. If the PDF font is symbolic and the TrueType font has a
   //        Microsoft Symbol cmap, use it, and use char codes
   //        directly (possibly with an offset of 0xf000).
@@ -1735,13 +1626,12 @@
   useMacRoman = gFalse;
   useUnicode = gFalse;
   if (hasEncoding || type == fontType1) {
-    if (usesMacRomanEnc && macRomanCmap >= 0) {
+    if (unicodeCmap >= 0) {
+      cmap = unicodeCmap;
+      useUnicode = gTrue;
+    } else if (usesMacRomanEnc && macRomanCmap >= 0) {
       cmap = macRomanCmap;
       useMacRoman = gTrue;
-    } else if ((!(flags & fontSymbolic) || embFontID.num < 0) &&
-	       unicodeCmap >= 0) {
-      cmap = unicodeCmap;
-      useUnicode = gTrue;
     } else if ((flags & fontSymbolic) && msSymbolCmap >= 0) {
       cmap = msSymbolCmap;
     } else if ((flags & fontSymbolic) && macRomanCmap >= 0) {
@@ -1809,15 +1699,22 @@
   return charProcs.isDict() ? charProcs.getDict() : (Dict *)NULL;
 }
 
-Object *Gfx8BitFont::getCharProc(int code, Object *proc) {
+Object Gfx8BitFont::getCharProc(int code) {
   if (enc[code] && charProcs.isDict()) {
-    charProcs.dictLookup(enc[code], proc);
+    return charProcs.dictLookup(enc[code]);
   } else {
-    proc->initNull();
+    return Object(objNull);
   }
-  return proc;
 }
 
+Object Gfx8BitFont::getCharProcNF(int code) {
+  if (enc[code] && charProcs.isDict()) {
+    return charProcs.dictLookupNF(enc[code]);
+  } else {
+    return Object(objNull);
+  }
+}
+
 Dict *Gfx8BitFont::getResources() {
   return resources.isDict() ? resources.getDict() : (Dict *)NULL;
 }
@@ -1872,17 +1769,16 @@
   cidToGIDLen = 0;
 
   // get the descendant font
-  if (!fontDict->lookup("DescendantFonts", &obj1)->isArray() ||
-      obj1.arrayGetLength() == 0) {
+  obj1 = fontDict->lookup("DescendantFonts");
+  if (!obj1.isArray() || obj1.arrayGetLength() == 0) {
     error(errSyntaxError, -1, "Missing or empty DescendantFonts entry in Type 0 font");
-    obj1.free();
-    goto err1;
+    return;
   }
-  if (!obj1.arrayGet(0, &desFontDictObj)->isDict()) {
+  desFontDictObj = obj1.arrayGet(0);
+  if (!desFontDictObj.isDict()) {
     error(errSyntaxError, -1, "Bad descendant font in Type 0 font");
-    goto err3;
+    return;
   }
-  obj1.free();
   desFontDict = desFontDictObj.getDict();
 
   // get info from font descriptor
@@ -1891,20 +1787,18 @@
   //----- encoding info -----
 
   // char collection
-  if (!desFontDict->lookup("CIDSystemInfo", &obj1)->isDict()) {
+  obj1 = desFontDict->lookup("CIDSystemInfo");
+  if (!obj1.isDict()) {
     error(errSyntaxError, -1, "Missing CIDSystemInfo dictionary in Type 0 descendant font");
-    goto err3;
+    return;
   }
-  obj1.dictLookup("Registry", &obj2);
-  obj1.dictLookup("Ordering", &obj3);
+  obj2 = obj1.dictLookup("Registry");
+  obj3 = obj1.dictLookup("Ordering");
   if (!obj2.isString() || !obj3.isString()) {
     error(errSyntaxError, -1, "Invalid CIDSystemInfo dictionary in Type 0 descendant font");
-    goto err3;
+    return;
   }
   collection = obj2.getString()->copy()->append('-')->append(obj3.getString());
-  obj3.free();
-  obj2.free();
-  obj1.free();
 
   // look for a ToUnicode CMap
   if (!(ctu = readToUnicodeCMap(fontDict, 16, NULL))) {
@@ -1933,7 +1827,7 @@
 	for (size_t i = 0; i < sizeof(knownCollections)/sizeof(knownCollections[0]); i++) {
 	  if (collection->cmp(knownCollections[i]) == 0) {
 	    error(errSyntaxError, -1, "Missing language pack for '{0:t}' mapping", collection);
-	    goto err2;
+	    return;
 	  }
 	}
 	error(errSyntaxError, -1, "Unknown character collection '{0:t}'",
@@ -1963,14 +1857,14 @@
   }
 
   // encoding (i.e., CMap)
-  if (fontDict->lookup("Encoding", &obj1)->isNull()) {
+  obj1 = fontDict->lookup("Encoding");
+  if (obj1.isNull()) {
     error(errSyntaxError, -1, "Missing Encoding entry in Type 0 font");
-    goto err2;
+    return;
   }
   if (!(cMap = CMap::parse(NULL, collection, &obj1))) {
-    goto err2;
+    return;
   }
-  obj1.free();
   if (cMap->getCMapName()) {
     encodingName->Set(cMap->getCMapName()->getCString());
   } else {
@@ -1979,7 +1873,7 @@
 
   // CIDToGIDMap (for embedded TrueType fonts)
   if (type == fontCIDType2 || type == fontCIDType2OT) {
-    desFontDict->lookup("CIDToGIDMap", &obj1);
+    obj1 = desFontDict->lookup("CIDToGIDMap");
     if (obj1.isStream()) {
       cidToGIDLen = 0;
       i = 64;
@@ -1996,26 +1890,27 @@
     } else if (!obj1.isName("Identity") && !obj1.isNull()) {
       error(errSyntaxError, -1, "Invalid CIDToGIDMap entry in CID font");
     }
-    obj1.free();
   }
 
   //----- character metrics -----
 
   // default char width
-  if (desFontDict->lookup("DW", &obj1)->isInt()) {
+  obj1 = desFontDict->lookup("DW");
+  if (obj1.isInt()) {
     widths.defWidth = obj1.getInt() * 0.001;
   }
-  obj1.free();
 
   // char width exceptions
-  if (desFontDict->lookup("W", &obj1)->isArray()) {
+  obj1 = desFontDict->lookup("W");
+  if (obj1.isArray()) {
     excepsSize = 0;
     i = 0;
     while (i + 1 < obj1.arrayGetLength()) {
-      obj1.arrayGet(i, &obj2);
-      obj1.arrayGet(i + 1, &obj3);
+      obj2 = obj1.arrayGet(i);
+      obj3 = obj1.arrayGet(i + 1);
       if (obj2.isInt() && obj3.isInt() && i + 2 < obj1.arrayGetLength()) {
-	if (obj1.arrayGet(i + 2, &obj4)->isNum()) {
+	obj4 = obj1.arrayGet(i + 2);
+	if (obj4.isNum()) {
 	  if (widths.nExceps == excepsSize) {
 	    excepsSize += 16;
 	    widths.exceps = (GfxFontCIDWidthExcep *)
@@ -2029,7 +1924,6 @@
 	} else {
 	  error(errSyntaxError, -1, "Bad widths array in Type 0 font");
 	}
-	obj4.free();
 	i += 3;
       } else if (obj2.isInt() && obj3.isArray()) {
 	if (widths.nExceps + obj3.arrayGetLength() > excepsSize) {
@@ -2040,7 +1934,8 @@
 	}
 	j = obj2.getInt();
 	for (k = 0; k < obj3.arrayGetLength(); ++k) {
-	  if (obj3.arrayGet(k, &obj4)->isNum()) {
+	  obj4 = obj3.arrayGet(k);
+	  if (obj4.isNum()) {
 	    widths.exceps[widths.nExceps].first = j;
 	    widths.exceps[widths.nExceps].last = j;
 	    widths.exceps[widths.nExceps].width = obj4.getNum() * 0.001;
@@ -2049,7 +1944,6 @@
 	  } else {
 	    error(errSyntaxError, -1, "Bad widths array in Type 0 font");
 	  }
-	  obj4.free();
 	}
 	i += 2;
       } else {
@@ -2056,39 +1950,37 @@
 	error(errSyntaxError, -1, "Bad widths array in Type 0 font");
 	++i;
       }
-      obj3.free();
-      obj2.free();
     }
     std::sort(widths.exceps, widths.exceps + widths.nExceps,
 	      cmpWidthExcepFunctor());
   }
-  obj1.free();
 
   // default metrics for vertical font
-  if (desFontDict->lookup("DW2", &obj1)->isArray() &&
+  obj1 = desFontDict->lookup("DW2");
+  if (obj1.isArray() &&
       obj1.arrayGetLength() == 2) {
-    if (obj1.arrayGet(0, &obj2)->isNum()) {
+    obj2 = obj1.arrayGet(0);
+    if (obj2.isNum()) {
       widths.defVY = obj2.getNum() * 0.001;
     }
-    obj2.free();
-    if (obj1.arrayGet(1, &obj2)->isNum()) {
+    obj2 = obj1.arrayGet(1);
+    if (obj2.isNum()) {
       widths.defHeight = obj2.getNum() * 0.001;
     }
-    obj2.free();
   }
-  obj1.free();
 
   // char metric exceptions for vertical font
-  if (desFontDict->lookup("W2", &obj1)->isArray()) {
+  obj1 = desFontDict->lookup("W2");
+  if (obj1.isArray()) {
     excepsSize = 0;
     i = 0;
     while (i + 1 < obj1.arrayGetLength()) {
-      obj1.arrayGet(i, &obj2);
-      obj1.arrayGet(i+ 1, &obj3);
+      obj2 = obj1.arrayGet(i);
+      obj3 = obj1.arrayGet(i+ 1);
       if (obj2.isInt() && obj3.isInt() && i + 4 < obj1.arrayGetLength()) {
-	if (obj1.arrayGet(i + 2, &obj4)->isNum() &&
-	    obj1.arrayGet(i + 3, &obj5)->isNum() &&
-	    obj1.arrayGet(i + 4, &obj6)->isNum()) {
+	if ((obj4 = obj1.arrayGet(i + 2), obj4.isNum()) &&
+	    (obj5 = obj1.arrayGet(i + 3), obj5.isNum()) &&
+	    (obj6 = obj1.arrayGet(i + 4), obj6.isNum())) {
 	  if (widths.nExcepsV == excepsSize) {
 	    excepsSize += 16;
 	    widths.excepsV = (GfxFontCIDWidthExcepV *)
@@ -2104,9 +1996,6 @@
 	} else {
 	  error(errSyntaxError, -1, "Bad widths (W2) array in Type 0 font");
 	}
-	obj6.free();
-	obj5.free();
-	obj4.free();
 	i += 5;
       } else if (obj2.isInt() && obj3.isArray()) {
 	if (widths.nExcepsV + obj3.arrayGetLength() / 3 > excepsSize) {
@@ -2118,9 +2007,9 @@
 	}
 	j = obj2.getInt();
 	for (k = 0; k < obj3.arrayGetLength(); k += 3) {
-	  if (obj3.arrayGet(k, &obj4)->isNum() &&
-	      obj3.arrayGet(k+1, &obj5)->isNum() &&
-	      obj3.arrayGet(k+2, &obj6)->isNum()) {
+	  if ((obj4 = obj3.arrayGet(k), obj4.isNum()) &&
+	      (obj5 = obj3.arrayGet(k+1), obj5.isNum()) &&
+	      (obj6 = obj3.arrayGet(k+2), obj6.isNum())) {
 	    widths.excepsV[widths.nExcepsV].first = j;
 	    widths.excepsV[widths.nExcepsV].last = j;
 	    widths.excepsV[widths.nExcepsV].height = obj4.getNum() * 0.001;
@@ -2131,9 +2020,6 @@
 	  } else {
 	    error(errSyntaxError, -1, "Bad widths (W2) array in Type 0 font");
 	  }
-	  obj6.free();
-	  obj5.free();
-	  obj4.free();
 	}
 	i += 2;
       } else {
@@ -2140,25 +2026,12 @@
 	error(errSyntaxError, -1, "Bad widths (W2) array in Type 0 font");
 	++i;
       }
-      obj3.free();
-      obj2.free();
     }
     std::sort(widths.excepsV, widths.excepsV + widths.nExcepsV,
 	      cmpWidthExcepVFunctor());
   }
-  obj1.free();
 
-  desFontDictObj.free();
   ok = gTrue;
-  return;
-
- err3:
-  obj3.free();
-  obj2.free();
- err2:
-  obj1.free();
-  desFontDictObj.free();
- err1:;
 }
 
 GfxCIDFont::~GfxCIDFont() {
@@ -2371,7 +2244,7 @@
   Ref embID;
 
   *mapsizep = 0;
-  if (!ctu) return NULL;
+  if (!ctu || !getCollection()) return NULL;
   if (getCollection()->cmp("Adobe-Identity") == 0) return NULL;
   if (getEmbeddedFontID(&embID)) {
    /* if this font is embedded font, 
@@ -2560,14 +2433,13 @@
 
 GfxFontDict::GfxFontDict(XRef *xref, Ref *fontDictRef, Dict *fontDict) {
   int i;
-  Object obj1, obj2;
   Ref r;
 
   numFonts = fontDict->getLength();
   fonts = (GfxFont **)gmallocn(numFonts, sizeof(GfxFont *));
   for (i = 0; i < numFonts; ++i) {
-    fontDict->getValNF(i, &obj1);
-    obj1.fetch(xref, &obj2);
+    Object obj1 = fontDict->getValNF(i);
+    Object obj2 = obj1.fetch(xref);
     if (obj2.isDict()) {
       if (obj1.isRef()) {
 	r = obj1.getRef();
@@ -2596,8 +2468,6 @@
       error(errSyntaxError, -1, "font resource is not a dictionary");
       fonts[i] = NULL;
     }
-    obj1.free();
-    obj2.free();
   }
 }
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxFont.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxFont.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxFont.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2005, 2008, 2015 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2008, 2015, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2007 Julien Rebetez <julienr at svn.gnome.org>
@@ -322,15 +322,15 @@
   Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA,
 	      GfxFontType typeA, Ref embFontIDA, Dict *fontDict);
 
-  virtual int getNextChar(char *s, int len, CharCode *code,
+  int getNextChar(char *s, int len, CharCode *code,
 			  Unicode **u, int *uLen,
-			  double *dx, double *dy, double *ox, double *oy);
+			  double *dx, double *dy, double *ox, double *oy) override;
 
   // Return the encoding.
   char **getEncoding() { return enc; }
 
   // Return the Unicode map.
-  CharCodeToUnicode *getToUnicode();
+  CharCodeToUnicode *getToUnicode() override;
 
   // Return the character name associated with <code>.
   char *getCharName(int code) { return enc[code]; }
@@ -352,13 +352,14 @@
   Dict *getCharProcs();
 
   // Return the Type 3 CharProc for the character associated with <code>.
-  Object *getCharProc(int code, Object *proc);
+  Object getCharProc(int code);
+  Object getCharProcNF(int code);
 
   // Return the Type 3 Resources dictionary, or NULL if none.
   Dict *getResources();
 
 private:
-  virtual ~Gfx8BitFont();
+  ~Gfx8BitFont();
 
   const Base14FontMapEntry *base14;	// for Base-14 fonts only; NULL otherwise
   char *enc[256];		// char code --> char name
@@ -384,17 +385,17 @@
   GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA,
 	     GfxFontType typeA, Ref embFontIDA, Dict *fontDict);
 
-  virtual GBool isCIDFont() { return gTrue; }
+  GBool isCIDFont() override { return gTrue; }
 
-  virtual int getNextChar(char *s, int len, CharCode *code,
+  int getNextChar(char *s, int len, CharCode *code,
 			  Unicode **u, int *uLen,
-			  double *dx, double *dy, double *ox, double *oy);
+			  double *dx, double *dy, double *ox, double *oy) override;
 
   // Return the writing mode (0=horizontal, 1=vertical).
-  virtual int getWMode();
+  int getWMode() override;
 
   // Return the Unicode map.
-  CharCodeToUnicode *getToUnicode();
+  CharCodeToUnicode *getToUnicode() override;
 
   // Get the collection name (<registry>-<ordering>).
   GooString *getCollection();
@@ -409,7 +410,7 @@
   double getWidth(char* s, int len);
 
 private:
-  virtual ~GfxCIDFont();
+  ~GfxCIDFont();
 
   int mapCodeToGID(FoFiTrueType *ff, int cmapi,
     Unicode unicode, GBool wmode);

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxState.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxState.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxState.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -16,7 +16,7 @@
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc at gnome.org>
-// Copyright (C) 2006-2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006-2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009, 2012 Koji Otani <sho at bbr.jp>
 // Copyright (C) 2009, 2011-2016 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2009 Christian Persch <chpe at gnome.org>
@@ -29,6 +29,7 @@
 // Copyright (C) 2013 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2015 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2016 Marek Kasik <mkasik at redhat.com>
+// Copyright (C) 2017 Oliver Sander <oliver.sander at tu-dresden.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
@@ -178,40 +179,8 @@
 
 static const std::map<unsigned int, unsigned int>::size_type CMSCACHE_LIMIT = 2048;
 
-#ifdef USE_LCMS1
-#include <lcms.h>
-#define cmsColorSpaceSignature icColorSpaceSignature
-#define cmsSetLogErrorHandler cmsSetErrorHandler
-#define cmsSigXYZData icSigXYZData
-#define cmsSigLuvData icSigLuvData
-#define cmsSigLabData icSigLabData
-#define cmsSigYCbCrData icSigYCbCrData
-#define cmsSigYxyData icSigYxyData
-#define cmsSigRgbData icSigRgbData
-#define cmsSigHsvData icSigHsvData
-#define cmsSigHlsData icSigHlsData
-#define cmsSigCmyData icSigCmyData
-#define cmsSig3colorData icSig3colorData
-#define cmsSigGrayData icSigGrayData
-#define cmsSigCmykData icSigCmykData
-#define cmsSig4colorData icSig4colorData
-#define cmsSig2colorData icSig2colorData
-#define cmsSig5colorData icSig5colorData
-#define cmsSig6colorData icSig6colorData
-#define cmsSig7colorData icSig7colorData
-#define cmsSig8colorData icSig8colorData
-#define cmsSig9colorData icSig9colorData
-#define cmsSig10colorData icSig10colorData
-#define cmsSig11colorData icSig11colorData
-#define cmsSig12colorData icSig12colorData
-#define cmsSig13colorData icSig13colorData
-#define cmsSig14colorData icSig14colorData
-#define cmsSig15colorData icSig15colorData
-#define LCMS_FLAGS 0
-#else
 #include <lcms2.h>
 #define LCMS_FLAGS cmsFLAGS_NOOPTIMIZE | cmsFLAGS_BLACKPOINTCOMPENSATION
-#endif
 
 #define COLOR_PROFILE_DIR "/ColorProfiles/"
 #define GLOBAL_COLOR_PROFILE_DIR POPPLER_DATADIR COLOR_PROFILE_DIR
@@ -314,40 +283,34 @@
   if (csObj->isName()) {
     if (csObj->isName("DeviceGray") || csObj->isName("G")) {
       if (res != NULL) {
-        Object objCS;
-        res->lookupColorSpace("DefaultGray", &objCS);
+        Object objCS = res->lookupColorSpace("DefaultGray");
         if (objCS.isNull()) {
           cs = new GfxDeviceGrayColorSpace();
         } else {
           cs = GfxColorSpace::parse(NULL, &objCS, out, state);
         }
-        objCS.free();
       } else {
         cs = new GfxDeviceGrayColorSpace();
       }
     } else if (csObj->isName("DeviceRGB") || csObj->isName("RGB")) {
       if (res != NULL) {
-        Object objCS;
-        res->lookupColorSpace("DefaultRGB", &objCS);
+        Object objCS = res->lookupColorSpace("DefaultRGB");
         if (objCS.isNull()) {
           cs = new GfxDeviceRGBColorSpace();
         } else {
           cs = GfxColorSpace::parse(NULL, &objCS, out, state);
         }
-        objCS.free();
       } else {
         cs = new GfxDeviceRGBColorSpace();
       }
     } else if (csObj->isName("DeviceCMYK") || csObj->isName("CMYK")) {
       if (res != NULL) {
-        Object objCS;
-        res->lookupColorSpace("DefaultCMYK", &objCS);
+        Object objCS = res->lookupColorSpace("DefaultCMYK");
         if (objCS.isNull()) {
           cs = new GfxDeviceCMYKColorSpace();
         } else {
           cs = GfxColorSpace::parse(NULL, &objCS, out, state);
         }
-        objCS.free();
       } else {
         cs = new GfxDeviceCMYKColorSpace();
       }
@@ -357,43 +320,37 @@
       error(errSyntaxWarning, -1, "Bad color space '{0:s}'", csObj->getName());
     }
   } else if (csObj->isArray() && csObj->arrayGetLength() > 0) {
-    csObj->arrayGet(0, &obj1);
+    obj1 = csObj->arrayGet(0);
     if (obj1.isName("DeviceGray") || obj1.isName("G")) {
       if (res != NULL) {
-        Object objCS;
-        res->lookupColorSpace("DefaultGray", &objCS);
+        Object objCS = res->lookupColorSpace("DefaultGray");
         if (objCS.isNull()) {
           cs = new GfxDeviceGrayColorSpace();
         } else {
           cs = GfxColorSpace::parse(NULL, &objCS, out, state);
         }
-        objCS.free();
       } else {
         cs = new GfxDeviceGrayColorSpace();
       }
     } else if (obj1.isName("DeviceRGB") || obj1.isName("RGB")) {
       if (res != NULL) {
-        Object objCS;
-        res->lookupColorSpace("DefaultRGB", &objCS);
+        Object objCS = res->lookupColorSpace("DefaultRGB");
         if (objCS.isNull()) {
           cs = new GfxDeviceRGBColorSpace();
         } else {
           cs = GfxColorSpace::parse(NULL, &objCS, out, state);
         }
-        objCS.free();
       } else {
         cs = new GfxDeviceRGBColorSpace();
       }
     } else if (obj1.isName("DeviceCMYK") || obj1.isName("CMYK")) {
       if (res != NULL) {
-        Object objCS;
-        res->lookupColorSpace("DefaultCMYK", &objCS);
+        Object objCS = res->lookupColorSpace("DefaultCMYK");
         if (objCS.isNull()) {
           cs = new GfxDeviceCMYKColorSpace();
         } else {
           cs = GfxColorSpace::parse(NULL, &objCS, out, state);
         }
-        objCS.free();
       } else {
         cs = new GfxDeviceCMYKColorSpace();
       }
@@ -416,45 +373,38 @@
     } else {
       error(errSyntaxWarning, -1, "Bad color space");
     }
-    obj1.free();
   } else if (csObj->isDict()) {
-    csObj->dictLookup("ColorSpace", &obj1);
+    obj1 = csObj->dictLookup("ColorSpace");
     if (obj1.isName("DeviceGray")) {
       if (res != NULL) {
-        Object objCS;
-        res->lookupColorSpace("DefaultGray", &objCS);
+        Object objCS = res->lookupColorSpace("DefaultGray");
         if (objCS.isNull()) {
           cs = new GfxDeviceGrayColorSpace();
         } else {
           cs = GfxColorSpace::parse(NULL, &objCS, out, state);
         }
-        objCS.free();
       } else {
         cs = new GfxDeviceGrayColorSpace();
       }
     } else if (obj1.isName("DeviceRGB")) {
       if (res != NULL) {
-        Object objCS;
-        res->lookupColorSpace("DefaultRGB", &objCS);
+        Object objCS = res->lookupColorSpace("DefaultRGB");
         if (objCS.isNull()) {
           cs = new GfxDeviceRGBColorSpace();
         } else {
           cs = GfxColorSpace::parse(NULL, &objCS, out, state);
         }
-        objCS.free();
       } else {
         cs = new GfxDeviceRGBColorSpace();
       }
     } else if (obj1.isName("DeviceCMYK")) {
       if (res != NULL) {
-        Object objCS;
-        res->lookupColorSpace("DefaultCMYK", &objCS);
+        Object objCS = res->lookupColorSpace("DefaultCMYK");
         if (objCS.isNull()) {
           cs = new GfxDeviceCMYKColorSpace();
         } else {
           cs = GfxColorSpace::parse(NULL, &objCS, out, state);
         }
-        objCS.free();
       } else {
         cs = new GfxDeviceCMYKColorSpace();
       }
@@ -461,7 +411,6 @@
     } else {
       error(errSyntaxWarning, -1, "Bad color space dict'");
     }
-    obj1.free();
   } else {
     error(errSyntaxWarning, -1, "Bad color space - expected name or array or dict");
   }
@@ -517,18 +466,10 @@
   return hp;
 }
 
-#ifdef USE_LCMS1
-static int CMSError(int ecode, const char *msg)
-{
-    error(errSyntaxWarning, -1, "{0:s}", msg);
-    return 1;
-}
-#else
 static void CMSError(cmsContext /*contextId*/, cmsUInt32Number /*ecode*/, const char *text)
 {
     error(errSyntaxWarning, -1, "{0:s}", text);
 }
-#endif
 
 int GfxColorSpace::setupColorProfiles()
 {
@@ -830,52 +771,42 @@
 
 GfxColorSpace *GfxCalGrayColorSpace::parse(Array *arr, GfxState *state) {
   GfxCalGrayColorSpace *cs;
-  Object obj1, obj2, obj3;
+  Object obj1, obj2;
 
-  arr->get(1, &obj1);
+  obj1 = arr->get(1);
   if (!obj1.isDict()) {
     error(errSyntaxWarning, -1, "Bad CalGray color space");
-    obj1.free();
     return NULL;
   }
   cs = new GfxCalGrayColorSpace();
-  if (obj1.dictLookup("WhitePoint", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 3) {
-    obj2.arrayGet(0, &obj3);
+  obj2 = obj1.dictLookup("WhitePoint");
+  if (obj2.isArray() && obj2.arrayGetLength() == 3) {
+    Object obj3 = obj2.arrayGet(0);
     if (likely(obj3.isNum()))
       cs->whiteX = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(1, &obj3);
+    obj3 = obj2.arrayGet(1);
     if (likely(obj3.isNum()))
       cs->whiteY = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(2, &obj3);
+    obj3 = obj2.arrayGet(2);
     if (likely(obj3.isNum()))
       cs->whiteZ = obj3.getNum();
-    obj3.free();
   }
-  obj2.free();
-  if (obj1.dictLookup("BlackPoint", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 3) {
-    obj2.arrayGet(0, &obj3);
+  obj2 = obj1.dictLookup("BlackPoint");
+  if (obj2.isArray() && obj2.arrayGetLength() == 3) {
+    Object obj3 = obj2.arrayGet(0);
     if (likely(obj3.isNum()))
       cs->blackX = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(1, &obj3);
+    obj3 = obj2.arrayGet(1);
     if (likely(obj3.isNum()))
       cs->blackY = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(2, &obj3);
+    obj3 = obj2.arrayGet(2);
     if (likely(obj3.isNum()))
       cs->blackZ = obj3.getNum();
-    obj3.free();
   }
-  obj2.free();
-  if (obj1.dictLookup("Gamma", &obj2)->isNum()) {
+  obj2 = obj1.dictLookup("Gamma");
+  if (obj2.isNum()) {
     cs->gamma = obj2.getNum();
   }
-  obj2.free();
-  obj1.free();
 
   cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
 		xyzrgb[0][1] * cs->whiteY +
@@ -1209,75 +1140,59 @@
 
 GfxColorSpace *GfxCalRGBColorSpace::parse(Array *arr, GfxState *state) {
   GfxCalRGBColorSpace *cs;
-  Object obj1, obj2, obj3;
+  Object obj1, obj2;
   int i;
 
-  arr->get(1, &obj1);
+  obj1 = arr->get(1);
   if (!obj1.isDict()) {
     error(errSyntaxWarning, -1, "Bad CalRGB color space");
-    obj1.free();
     return NULL;
   }
   cs = new GfxCalRGBColorSpace();
-  if (obj1.dictLookup("WhitePoint", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 3) {
-    obj2.arrayGet(0, &obj3);
+  obj2 = obj1.dictLookup("WhitePoint");
+  if (obj2.isArray() && obj2.arrayGetLength() == 3) {
+    Object obj3 = obj2.arrayGet(0);
     if (likely(obj3.isNum()))
       cs->whiteX = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(1, &obj3);
+    obj3 = obj2.arrayGet(1);
     if (likely(obj3.isNum()))
       cs->whiteY = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(2, &obj3);
+    obj3 = obj2.arrayGet(2);
     if (likely(obj3.isNum()))
       cs->whiteZ = obj3.getNum();
-    obj3.free();
   }
-  obj2.free();
-  if (obj1.dictLookup("BlackPoint", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 3) {
-    obj2.arrayGet(0, &obj3);
+  obj2 = obj1.dictLookup("BlackPoint");
+  if (obj2.isArray() && obj2.arrayGetLength() == 3) {
+    Object obj3 = obj2.arrayGet(0);
     if (likely(obj3.isNum()))
       cs->blackX = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(1, &obj3);
+    obj3 = obj2.arrayGet(1);
     if (likely(obj3.isNum()))
       cs->blackY = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(2, &obj3);
+    obj3 = obj2.arrayGet(2);
     if (likely(obj3.isNum()))
       cs->blackZ = obj3.getNum();
-    obj3.free();
   }
-  obj2.free();
-  if (obj1.dictLookup("Gamma", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 3) {
-    obj2.arrayGet(0, &obj3);
+  obj2 = obj1.dictLookup("Gamma");
+  if (obj2.isArray() && obj2.arrayGetLength() == 3) {
+    Object obj3 = obj2.arrayGet(0);
     if (likely(obj3.isNum()))
       cs->gammaR = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(1, &obj3);
+    obj3 = obj2.arrayGet(1);
     if (likely(obj3.isNum()))
       cs->gammaG = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(2, &obj3);
+    obj3 = obj2.arrayGet(2);
     if (likely(obj3.isNum()))
       cs->gammaB = obj3.getNum();
-    obj3.free();
   }
-  obj2.free();
-  if (obj1.dictLookup("Matrix", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 9) {
+  obj2 = obj1.dictLookup("Matrix");
+  if (obj2.isArray() && obj2.arrayGetLength() == 9) {
     for (i = 0; i < 9; ++i) {
-      obj2.arrayGet(i, &obj3);
+      Object obj3 = obj2.arrayGet(i);
       if (likely(obj3.isNum()))
         cs->mat[i] = obj3.getNum();
-      obj3.free();
     }
   }
-  obj2.free();
-  obj1.free();
 
   cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
 		xyzrgb[0][1] * cs->whiteY +
@@ -1596,59 +1511,54 @@
 
 GfxColorSpace *GfxLabColorSpace::parse(Array *arr, GfxState *state) {
   GfxLabColorSpace *cs;
-  Object obj1, obj2, obj3;
+  Object obj1, obj2;
 
-  arr->get(1, &obj1);
+  obj1 = arr->get(1);
   if (!obj1.isDict()) {
     error(errSyntaxWarning, -1, "Bad Lab color space");
-    obj1.free();
     return NULL;
   }
   cs = new GfxLabColorSpace();
-  if (obj1.dictLookup("WhitePoint", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 3) {
-    obj2.arrayGet(0, &obj3);
-    cs->whiteX = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(1, &obj3);
-    cs->whiteY = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(2, &obj3);
-    cs->whiteZ = obj3.getNum();
-    obj3.free();
+  bool ok = true;
+  obj2 = obj1.dictLookup("WhitePoint");
+  if (obj2.isArray() && obj2.arrayGetLength() == 3) {
+    Object obj3 = obj2.arrayGet(0);
+    cs->whiteX = obj3.getNum(&ok);
+    obj3 = obj2.arrayGet(1);
+    cs->whiteY = obj3.getNum(&ok);
+    obj3 = obj2.arrayGet(2);
+    cs->whiteZ = obj3.getNum(&ok);
   }
-  obj2.free();
-  if (obj1.dictLookup("BlackPoint", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 3) {
-    obj2.arrayGet(0, &obj3);
-    cs->blackX = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(1, &obj3);
-    cs->blackY = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(2, &obj3);
-    cs->blackZ = obj3.getNum();
-    obj3.free();
+  obj2 = obj1.dictLookup("BlackPoint");
+  if (obj2.isArray() && obj2.arrayGetLength() == 3) {
+    Object obj3 = obj2.arrayGet(0);
+    cs->blackX = obj3.getNum(&ok);
+    obj3 = obj2.arrayGet(1);
+    cs->blackY = obj3.getNum(&ok);
+    obj3 = obj2.arrayGet(2);
+    cs->blackZ = obj3.getNum(&ok);
   }
-  obj2.free();
-  if (obj1.dictLookup("Range", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 4) {
-    obj2.arrayGet(0, &obj3);
-    cs->aMin = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(1, &obj3);
-    cs->aMax = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(2, &obj3);
-    cs->bMin = obj3.getNum();
-    obj3.free();
-    obj2.arrayGet(3, &obj3);
-    cs->bMax = obj3.getNum();
-    obj3.free();
+  obj2 = obj1.dictLookup("Range");
+  if (obj2.isArray() && obj2.arrayGetLength() == 4) {
+    Object obj3 = obj2.arrayGet(0);
+    cs->aMin = obj3.getNum(&ok);
+    obj3 = obj2.arrayGet(1);
+    cs->aMax = obj3.getNum(&ok);
+    obj3 = obj2.arrayGet(2);
+    cs->bMin = obj3.getNum(&ok);
+    obj3 = obj2.arrayGet(3);
+    cs->bMax = obj3.getNum(&ok);
   }
-  obj2.free();
-  obj1.free();
 
+  if (!ok) {
+      error(errSyntaxWarning, -1, "Bad Lab color space");
+#ifdef USE_CMS
+      cs->transform = nullptr;
+#endif
+      delete cs;
+      return nullptr;
+  }
+
   cs->kr = 1 / (xyzrgb[0][0] * cs->whiteX +
 		xyzrgb[0][1] * cs->whiteY +
 		xyzrgb[0][2] * cs->whiteZ);
@@ -1855,7 +1765,7 @@
     {
     }
     
-    bool operator==(const PopplerCacheKey &key) const
+    bool operator==(const PopplerCacheKey &key) const override
     {
       const GfxICCBasedColorSpaceKey *k = static_cast<const GfxICCBasedColorSpaceKey*>(&key);
       return k->num == num && k->gen == gen;
@@ -1936,7 +1846,7 @@
     error(errSyntaxError, -1, "Bad ICCBased color space");
     return NULL;
   }
-  arr->getNF(1, &obj1);
+  obj1 = arr->getNF(1);
   if (obj1.isRef()) {
     iccProfileStreamA = obj1.getRef();
   } else {
@@ -1943,7 +1853,6 @@
     iccProfileStreamA.num = 0;
     iccProfileStreamA.gen = 0;
   }
-  obj1.free();
 #ifdef USE_CMS
   // check cache
   if (out && iccProfileStreamA.num > 0) {
@@ -1973,21 +1882,18 @@
     }
   }
 #endif
-  arr->get(1, &obj1);
+  obj1 = arr->get(1);
   if (!obj1.isStream()) {
     error(errSyntaxWarning, -1, "Bad ICCBased color space (stream)");
-    obj1.free();
     return NULL;
   }
   dict = obj1.streamGetDict();
-  if (!dict->lookup("N", &obj2)->isInt()) {
+  obj2 = dict->lookup("N");
+  if (!obj2.isInt()) {
     error(errSyntaxWarning, -1, "Bad ICCBased color space (N)");
-    obj2.free();
-    obj1.free();
-    return NULL;
+    return nullptr;
   }
   nCompsA = obj2.getInt();
-  obj2.free();
   if (nCompsA > 4) {
     error(errSyntaxError, -1,
 	  "ICCBased color space with too many ({0:d} > 4) components",
@@ -1994,7 +1900,8 @@
 	  nCompsA);
     nCompsA = 4;
   }
-  if (dict->lookup("Alternate", &obj2)->isNull() ||
+  obj2 = dict->lookup("Alternate");
+  if (obj2.isNull() ||
       !(altA = GfxColorSpace::parse(NULL, &obj2, out, state, recursion + 1))) {
     switch (nCompsA) {
     case 1:
@@ -2008,38 +1915,30 @@
       break;
     default:
       error(errSyntaxWarning, -1, "Bad ICCBased color space - invalid N");
-      obj2.free();
-      obj1.free();
       return NULL;
     }
   }
-  obj2.free();
   if (altA->getNComps() != nCompsA) {
       error(errSyntaxWarning, -1, "Bad ICCBased color space - N doesn't match alt color space");
       delete altA;
-      obj1.free();
       return NULL;
   }
   cs = new GfxICCBasedColorSpace(nCompsA, altA, &iccProfileStreamA);
-  if (dict->lookup("Range", &obj2)->isArray() &&
-      obj2.arrayGetLength() == 2 * nCompsA) {
+  obj2 = dict->lookup("Range");
+  if (obj2.isArray() && obj2.arrayGetLength() == 2 * nCompsA) {
     Object obj4;
     for (i = 0; i < nCompsA; ++i) {
-      obj2.arrayGet(2*i, &obj3);
-      obj2.arrayGet(2*i+1, &obj4);
+      obj3 = obj2.arrayGet(2*i);
+      obj4 = obj2.arrayGet(2*i+1);
       if (obj3.isNum() && obj4.isNum()) {
         cs->rangeMin[i] = obj3.getNum();
         cs->rangeMax[i] = obj4.getNum();
       }
-      obj3.free();
-      obj4.free();
     }
   }
-  obj2.free();
-  obj1.free();
 
 #ifdef USE_CMS
-  arr->get(1, &obj1);
+  obj1 = arr->get(1);
   Guchar *profBuf;
   Stream *iccStream = obj1.getStream();
   int length = 0;
@@ -2099,7 +1998,6 @@
     }
     cmsCloseProfile(hp);
   }
-  obj1.free();
   // put this colorSpace into cache
   if (out && iccProfileStreamA.num > 0) {
     GfxICCBasedColorSpaceKey *k = new GfxICCBasedColorSpaceKey(iccProfileStreamA.num, iccProfileStreamA.gen);
@@ -2581,27 +2479,26 @@
 }
 
 GfxColorSpace *GfxIndexedColorSpace::parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion) {
-  GfxIndexedColorSpace *cs;
   GfxColorSpace *baseA;
   int indexHighA;
   Object obj1;
   char *s;
-  int n, i, j;
+  int i, j;
 
   if (arr->getLength() != 4) {
     error(errSyntaxWarning, -1, "Bad Indexed color space");
-    goto err1;
+    return nullptr;
   }
-  arr->get(1, &obj1);
+  obj1 = arr->get(1);
   if (!(baseA = GfxColorSpace::parse(res, &obj1, out, state, recursion + 1))) {
     error(errSyntaxWarning, -1, "Bad Indexed color space (base color space)");
-    goto err2;
+    return nullptr;
   }
-  obj1.free();
-  if (!arr->get(2, &obj1)->isInt()) {
+  obj1 = arr->get(2);
+  if (!obj1.isInt()) {
     error(errSyntaxWarning, -1, "Bad Indexed color space (hival)");
     delete baseA;
-    goto err2;
+    return nullptr;
   }
   indexHighA = obj1.getInt();
   if (indexHighA < 0 || indexHighA > 255) {
@@ -2614,10 +2511,9 @@
     else indexHighA = 255;
     error(errSyntaxWarning, -1, "Bad Indexed color space (invalid indexHigh value, was {0:d} using {1:d} to try to recover)", previousValue, indexHighA);
   }
-  obj1.free();
-  cs = new GfxIndexedColorSpace(baseA, indexHighA);
-  arr->get(3, &obj1);
-  n = baseA->getNComps();
+  GfxIndexedColorSpace *cs = new GfxIndexedColorSpace(baseA, indexHighA);
+  obj1 = arr->get(3);
+  const int n = baseA->getNComps();
   if (obj1.isStream()) {
     obj1.streamReset();
     for (i = 0; i <= indexHighA; ++i) {
@@ -2643,15 +2539,11 @@
     error(errSyntaxWarning, -1, "Bad Indexed color space (lookup table)");
     goto err3;
   }
-  obj1.free();
   return cs;
 
  err3:
   delete cs;
- err2:
-  obj1.free();
- err1:
-  return NULL;
+  return nullptr;
 }
 
 GfxColor *GfxIndexedColorSpace::mapColorToBase(GfxColor *color,
@@ -2663,7 +2555,7 @@
   n = base->getNComps();
   base->getDefaultRanges(low, range, indexHigh);
   const int idx = (int)(colToDbl(color->c[0]) + 0.5) * n;
-  if (likely((idx + n < (indexHigh + 1) * base->getNComps()) && idx >= 0)) {
+  if (likely((idx + n - 1 < (indexHigh + 1) * base->getNComps()) && idx >= 0)) {
     p = &lookup[idx];
     for (i = 0; i < n; ++i) {
       baseColor->c[i] = dblToCol(low[i] + (p[i] / 255.0) * range[i]);
@@ -2856,19 +2748,18 @@
     error(errSyntaxWarning, -1, "Bad Separation color space");
     goto err1;
   }
-  if (!arr->get(1, &obj1)->isName()) {
+  obj1 = arr->get(1);
+  if (!obj1.isName()) {
     error(errSyntaxWarning, -1, "Bad Separation color space (name)");
-    goto err2;
+    goto err1;
   }
   nameA = new GooString(obj1.getName());
-  obj1.free();
-  arr->get(2, &obj1);
+  obj1 = arr->get(2);
   if (!(altA = GfxColorSpace::parse(res, &obj1, out, state, recursion + 1))) {
     error(errSyntaxWarning, -1, "Bad Separation color space (alternate color space)");
     goto err3;
   }
-  obj1.free();
-  arr->get(3, &obj1);
+  obj1 = arr->get(3);
   if (!(funcA = Function::parse(&obj1))) {
     goto err4;
   }
@@ -2876,7 +2767,6 @@
     error(errSyntaxWarning, -1, "Bad SeparationColorSpace function");
     goto err5;
   }
-  obj1.free();
   cs = new GfxSeparationColorSpace(nameA, altA, funcA);
   return cs;
 
@@ -2886,10 +2776,8 @@
   delete altA;
  err3:
   delete nameA;
- err2:
-  obj1.free();
  err1:
-  return NULL;
+  return nullptr;
 }
 
 void GfxSeparationColorSpace::getGray(GfxColor *color, GfxGray *gray) {
@@ -3131,12 +3019,11 @@
 
 //~ handle the 'None' colorant
 GfxColorSpace *GfxDeviceNColorSpace::parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion) {
-  GfxDeviceNColorSpace *cs;
   int nCompsA;
   GooString *namesA[gfxColorMaxComps];
   GfxColorSpace *altA;
   Function *funcA;
-  Object obj1, obj2;
+  Object obj1;
   int i;
   GooList *separationList = new GooList();
 
@@ -3144,9 +3031,10 @@
     error(errSyntaxWarning, -1, "Bad DeviceN color space");
     goto err1;
   }
-  if (!arr->get(1, &obj1)->isArray()) {
+  obj1 = arr->get(1);
+  if (!obj1.isArray()) {
     error(errSyntaxWarning, -1, "Bad DeviceN color space (names)");
-    goto err2;
+    goto err1;
   }
   nCompsA = obj1.arrayGetLength();
   if (nCompsA > gfxColorMaxComps) {
@@ -3155,55 +3043,47 @@
     nCompsA = gfxColorMaxComps;
   }
   for (i = 0; i < nCompsA; ++i) {
-    if (!obj1.arrayGet(i, &obj2)->isName()) {
+    Object obj2 = obj1.arrayGet(i);
+    if (!obj2.isName()) {
       error(errSyntaxWarning, -1, "Bad DeviceN color space (names)");
-      obj2.free();
-      goto err2;
+      goto err1;
     }
     namesA[i] = new GooString(obj2.getName());
-    obj2.free();
   }
-  obj1.free();
-  arr->get(2, &obj1);
+  obj1 = arr->get(2);
   if (!(altA = GfxColorSpace::parse(res, &obj1, out, state, recursion + 1))) {
     error(errSyntaxWarning, -1, "Bad DeviceN color space (alternate color space)");
     goto err3;
   }
-  obj1.free();
-  arr->get(3, &obj1);
+  obj1 = arr->get(3);
   if (!(funcA = Function::parse(&obj1))) {
     goto err4;
   }
-  obj1.free();
   if (arr->getLength() == 5) {
-    if (!arr->get(4, &obj1)->isDict()) {
+    obj1 = arr->get(4);
+    if (!obj1.isDict()) {
       error(errSyntaxWarning, -1, "Bad DeviceN color space (attributes)");
-      goto err4;
+      goto err5;
     }
     Dict *attribs = obj1.getDict();
-    attribs->lookup("Colorants", &obj2);
+    Object obj2 = attribs->lookup("Colorants");
     if (obj2.isDict()) {
       Dict *colorants = obj2.getDict();
       for (i = 0; i < colorants->getLength(); i++) {
-        Object obj3;
-        colorants->getVal(i, &obj3);
+        Object obj3 = colorants->getVal(i);
         if (obj3.isArray()) {
           separationList->append(GfxSeparationColorSpace::parse(res, obj3.getArray(), out, state, recursion));
         } else {
-          obj3.free();
-          obj2.free();
           error(errSyntaxWarning, -1, "Bad DeviceN color space (colorant value entry is not an Array)");
-          goto err4;
+          goto err5;
         }
-        obj3.free();
       }
     }
-    obj2.free();
-    obj1.free();
   }
-  cs = new GfxDeviceNColorSpace(nCompsA, namesA, altA, funcA, separationList);
-  return cs;
+  return new GfxDeviceNColorSpace(nCompsA, namesA, altA, funcA, separationList);
 
+ err5:
+  delete funcA;
  err4:
   delete altA;
  err3:
@@ -3210,8 +3090,6 @@
   for (i = 0; i < nCompsA; ++i) {
     delete namesA[i];
   }
- err2:
-  obj1.free();
  err1:
   delete separationList;
   return NULL;
@@ -3407,13 +3285,11 @@
   }
   underA = NULL;
   if (arr->getLength() == 2) {
-    arr->get(1, &obj1);
+    obj1 = arr->get(1);
     if (!(underA = GfxColorSpace::parse(res, &obj1, out, state, recursion + 1))) {
       error(errSyntaxWarning, -1, "Bad Pattern color space (underlying color space)");
-      obj1.free();
       return NULL;
     }
-    obj1.free();
   }
   cs = new GfxPatternColorSpace(underA);
   return cs;
@@ -3446,31 +3322,33 @@
 // Pattern
 //------------------------------------------------------------------------
 
-GfxPattern::GfxPattern(int typeA) {
-  type = typeA;
+GfxPattern::GfxPattern(int typeA, int patternRefNumA)
+ : type(typeA)
+ , patternRefNum(patternRefNumA)
+{
+
 }
 
 GfxPattern::~GfxPattern() {
 }
 
-GfxPattern *GfxPattern::parse(GfxResources *res, Object *obj, OutputDev *out, GfxState *state) {
+GfxPattern *GfxPattern::parse(GfxResources *res, Object *obj, OutputDev *out, GfxState *state, int patternRefNum) {
   GfxPattern *pattern;
   Object obj1;
 
   if (obj->isDict()) {
-    obj->dictLookup("PatternType", &obj1);
+    obj1 = obj->dictLookup("PatternType");
   } else if (obj->isStream()) {
-    obj->streamGetDict()->lookup("PatternType", &obj1);
+    obj1 = obj->streamGetDict()->lookup("PatternType");
   } else {
-    return NULL;
+    return nullptr;
   }
   pattern = NULL;
   if (obj1.isInt() && obj1.getInt() == 1) {
-    pattern = GfxTilingPattern::parse(obj);
+    pattern = GfxTilingPattern::parse(obj, patternRefNum);
   } else if (obj1.isInt() && obj1.getInt() == 2) {
-    pattern = GfxShadingPattern::parse(res, obj, out, state);
+    pattern = GfxShadingPattern::parse(res, obj, out, state, patternRefNum);
   }
-  obj1.free();
   return pattern;
 }
 
@@ -3478,14 +3356,13 @@
 // GfxTilingPattern
 //------------------------------------------------------------------------
 
-GfxTilingPattern *GfxTilingPattern::parse(Object *patObj) {
-  GfxTilingPattern *pat;
+GfxTilingPattern *GfxTilingPattern::parse(Object *patObj, int patternRefNum) {
   Dict *dict;
   int paintTypeA, tilingTypeA;
   double bboxA[4], matrixA[6];
   double xStepA, yStepA;
   Object resDictA;
-  Object obj1, obj2;
+  Object obj1;
   int i;
 
   if (!patObj->isStream()) {
@@ -3493,78 +3370,73 @@
   }
   dict = patObj->streamGetDict();
 
-  if (dict->lookup("PaintType", &obj1)->isInt()) {
+  obj1 = dict->lookup("PaintType");
+  if (obj1.isInt()) {
     paintTypeA = obj1.getInt();
   } else {
     paintTypeA = 1;
     error(errSyntaxWarning, -1, "Invalid or missing PaintType in pattern");
   }
-  obj1.free();
-  if (dict->lookup("TilingType", &obj1)->isInt()) {
+  obj1 = dict->lookup("TilingType");
+  if (obj1.isInt()) {
     tilingTypeA = obj1.getInt();
   } else {
     tilingTypeA = 1;
     error(errSyntaxWarning, -1, "Invalid or missing TilingType in pattern");
   }
-  obj1.free();
   bboxA[0] = bboxA[1] = 0;
   bboxA[2] = bboxA[3] = 1;
-  if (dict->lookup("BBox", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 4) {
+  obj1 = dict->lookup("BBox");
+  if (obj1.isArray() && obj1.arrayGetLength() == 4) {
     for (i = 0; i < 4; ++i) {
-      if (obj1.arrayGet(i, &obj2)->isNum()) {
+      Object obj2 = obj1.arrayGet(i);
+      if (obj2.isNum()) {
 	bboxA[i] = obj2.getNum();
       }
-      obj2.free();
     }
   } else {
     error(errSyntaxWarning, -1, "Invalid or missing BBox in pattern");
   }
-  obj1.free();
-  if (dict->lookup("XStep", &obj1)->isNum()) {
+  obj1 = dict->lookup("XStep");
+  if (obj1.isNum()) {
     xStepA = obj1.getNum();
   } else {
     xStepA = 1;
     error(errSyntaxWarning, -1, "Invalid or missing XStep in pattern");
   }
-  obj1.free();
-  if (dict->lookup("YStep", &obj1)->isNum()) {
+  obj1 = dict->lookup("YStep");
+  if (obj1.isNum()) {
     yStepA = obj1.getNum();
   } else {
     yStepA = 1;
     error(errSyntaxWarning, -1, "Invalid or missing YStep in pattern");
   }
-  obj1.free();
-  if (!dict->lookup("Resources", &resDictA)->isDict()) {
-    resDictA.free();
-    resDictA.initNull();
+  resDictA = dict->lookup("Resources");
+  if (!resDictA.isDict()) {
     error(errSyntaxWarning, -1, "Invalid or missing Resources in pattern");
   }
   matrixA[0] = 1; matrixA[1] = 0;
   matrixA[2] = 0; matrixA[3] = 1;
   matrixA[4] = 0; matrixA[5] = 0;
-  if (dict->lookup("Matrix", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 6) {
+  obj1 = dict->lookup("Matrix");
+  if (obj1.isArray() && obj1.arrayGetLength() == 6) {
     for (i = 0; i < 6; ++i) {
-      if (obj1.arrayGet(i, &obj2)->isNum()) {
+      Object obj2 = obj1.arrayGet(i);
+      if (obj2.isNum()) {
 	matrixA[i] = obj2.getNum();
       }
-      obj2.free();
     }
   }
-  obj1.free();
 
-  pat = new GfxTilingPattern(paintTypeA, tilingTypeA, bboxA, xStepA, yStepA,
-			     &resDictA, matrixA, patObj);
-  resDictA.free();
-  return pat;
+  return new GfxTilingPattern(paintTypeA, tilingTypeA, bboxA, xStepA, yStepA,
+			     &resDictA, matrixA, patObj, patternRefNum);
 }
 
 GfxTilingPattern::GfxTilingPattern(int paintTypeA, int tilingTypeA,
 				   double *bboxA, double xStepA, double yStepA,
 				   Object *resDictA, double *matrixA,
-				   Object *contentStreamA):
-  GfxPattern(1)
+				   Object *contentStreamA, int patternRefNumA) :
+  GfxPattern(1, patternRefNumA)
 {
   int i;
 
@@ -3575,21 +3447,19 @@
   }
   xStep = xStepA;
   yStep = yStepA;
-  resDictA->copy(&resDict);
+  resDict = resDictA->copy();
   for (i = 0; i < 6; ++i) {
     matrix[i] = matrixA[i];
   }
-  contentStreamA->copy(&contentStream);
+  contentStream = contentStreamA->copy();
 }
 
 GfxTilingPattern::~GfxTilingPattern() {
-  resDict.free();
-  contentStream.free();
 }
 
 GfxPattern *GfxTilingPattern::copy() {
   return new GfxTilingPattern(paintType, tilingType, bbox, xStep, yStep,
-			      &resDict, matrix, &contentStream);
+			      &resDict, matrix, &contentStream, getPatternRefNum());
 }
 
 //------------------------------------------------------------------------
@@ -3596,11 +3466,11 @@
 // GfxShadingPattern
 //------------------------------------------------------------------------
 
-GfxShadingPattern *GfxShadingPattern::parse(GfxResources *res, Object *patObj, OutputDev *out, GfxState *state) {
+GfxShadingPattern *GfxShadingPattern::parse(GfxResources *res, Object *patObj, OutputDev *out, GfxState *state, int patternRefNum) {
   Dict *dict;
   GfxShading *shadingA;
   double matrixA[6];
-  Object obj1, obj2;
+  Object obj1;
   int i;
 
   if (!patObj->isDict()) {
@@ -3608,9 +3478,8 @@
   }
   dict = patObj->getDict();
 
-  dict->lookup("Shading", &obj1);
+  obj1 = dict->lookup("Shading");
   shadingA = GfxShading::parse(res, &obj1, out, state);
-  obj1.free();
   if (!shadingA) {
     return NULL;
   }
@@ -3618,22 +3487,21 @@
   matrixA[0] = 1; matrixA[1] = 0;
   matrixA[2] = 0; matrixA[3] = 1;
   matrixA[4] = 0; matrixA[5] = 0;
-  if (dict->lookup("Matrix", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 6) {
+  obj1 = dict->lookup("Matrix");
+  if (obj1.isArray() && obj1.arrayGetLength() == 6) {
     for (i = 0; i < 6; ++i) {
-      if (obj1.arrayGet(i, &obj2)->isNum()) {
+      Object obj2 = obj1.arrayGet(i);
+      if (obj2.isNum()) {
 	matrixA[i] = obj2.getNum();
       }
-      obj2.free();
     }
   }
-  obj1.free();
 
-  return new GfxShadingPattern(shadingA, matrixA);
+  return new GfxShadingPattern(shadingA, matrixA, patternRefNum);
 }
 
-GfxShadingPattern::GfxShadingPattern(GfxShading *shadingA, double *matrixA):
-  GfxPattern(2)
+GfxShadingPattern::GfxShadingPattern(GfxShading *shadingA, double *matrixA, int patternRefNumA):
+  GfxPattern(2, patternRefNumA)
 {
   int i;
 
@@ -3648,7 +3516,7 @@
 }
 
 GfxPattern *GfxShadingPattern::copy() {
-  return new GfxShadingPattern(shading->copy(), matrix);
+  return new GfxShadingPattern(shading->copy(), matrix, getPatternRefNum());
 }
 
 //------------------------------------------------------------------------
@@ -3696,13 +3564,12 @@
     return NULL;
   }
 
-  if (!dict->lookup("ShadingType", &obj1)->isInt()) {
+  obj1 = dict->lookup("ShadingType");
+  if (!obj1.isInt()) {
     error(errSyntaxWarning, -1, "Invalid ShadingType in shading dictionary");
-    obj1.free();
     return NULL;
   }
   typeA = obj1.getInt();
-  obj1.free();
 
   switch (typeA) {
   case 1:
@@ -3758,43 +3625,41 @@
 }
 
 GBool GfxShading::init(GfxResources *res, Dict *dict, OutputDev *out, GfxState *state) {
-  Object obj1, obj2;
+  Object obj1;
   int i;
 
-  dict->lookup("ColorSpace", &obj1);
+  obj1 = dict->lookup("ColorSpace");
   if (!(colorSpace = GfxColorSpace::parse(res, &obj1, out, state))) {
     error(errSyntaxWarning, -1, "Bad color space in shading dictionary");
-    obj1.free();
     return gFalse;
   }
-  obj1.free();
 
   for (i = 0; i < gfxColorMaxComps; ++i) {
     background.c[i] = 0;
   }
   hasBackground = gFalse;
-  if (dict->lookup("Background", &obj1)->isArray()) {
+  obj1 = dict->lookup("Background");
+  if (obj1.isArray()) {
     if (obj1.arrayGetLength() == colorSpace->getNComps()) {
       hasBackground = gTrue;
       for (i = 0; i < colorSpace->getNComps(); ++i) {
-	background.c[i] = dblToCol(obj1.arrayGet(i, &obj2)->getNum());
-	obj2.free();
+	Object obj2 = obj1.arrayGet(i);
+	background.c[i] = dblToCol(obj2.getNum());
       }
     } else {
       error(errSyntaxWarning, -1, "Bad Background in shading dictionary");
     }
   }
-  obj1.free();
 
   xMin = yMin = xMax = yMax = 0;
   hasBBox = gFalse;
-  if (dict->lookup("BBox", &obj1)->isArray()) {
+  obj1 = dict->lookup("BBox");
+  if (obj1.isArray()) {
     if (obj1.arrayGetLength() == 4) {
-      Object obj3, obj4, obj5;
-      obj1.arrayGet(0, &obj2);
-      obj1.arrayGet(1, &obj3);
-      obj1.arrayGet(2, &obj4);
-      obj1.arrayGet(3, &obj5);
+      Object obj2 = obj1.arrayGet(0);
+      Object obj3 = obj1.arrayGet(1);
+      Object obj4 = obj1.arrayGet(2);
+      Object obj5 = obj1.arrayGet(3);
       if (obj2.isNum() && obj3.isNum() && obj4.isNum() && obj5.isNum())
       {
         hasBBox = gTrue;
@@ -3805,15 +3670,10 @@
       } else {
         error(errSyntaxWarning, -1, "Bad BBox in shading dictionary (Values not numbers)");
       }
-      obj2.free();
-      obj3.free();
-      obj4.free();
-      obj5.free();
     } else {
       error(errSyntaxWarning, -1, "Bad BBox in shading dictionary");
     }
   }
-  obj1.free();
 
   return gTrue;
 }
@@ -3875,65 +3735,53 @@
   double matrixA[6];
   Function *funcsA[gfxColorMaxComps];
   int nFuncsA;
-  Object obj1, obj2;
+  Object obj1;
   int i;
 
   x0A = y0A = 0;
   x1A = y1A = 1;
-  if (dict->lookup("Domain", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 4) {
-    x0A = obj1.arrayGet(0, &obj2)->getNum();
-    obj2.free();
-    x1A = obj1.arrayGet(1, &obj2)->getNum();
-    obj2.free();
-    y0A = obj1.arrayGet(2, &obj2)->getNum();
-    obj2.free();
-    y1A = obj1.arrayGet(3, &obj2)->getNum();
-    obj2.free();
+  obj1 = dict->lookup("Domain");
+  if (obj1.isArray() && obj1.arrayGetLength() == 4) {
+    Object obj2;
+    x0A = (obj2 = obj1.arrayGet(0), obj2.getNum());
+    x1A = (obj2 = obj1.arrayGet(1), obj2.getNum());
+    y0A = (obj2 = obj1.arrayGet(2), obj2.getNum());
+    y1A = (obj2 = obj1.arrayGet(3), obj2.getNum());
   }
-  obj1.free();
 
   matrixA[0] = 1; matrixA[1] = 0;
   matrixA[2] = 0; matrixA[3] = 1;
   matrixA[4] = 0; matrixA[5] = 0;
-  if (dict->lookup("Matrix", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 6) {
-    matrixA[0] = obj1.arrayGet(0, &obj2)->getNum();
-    obj2.free();
-    matrixA[1] = obj1.arrayGet(1, &obj2)->getNum();
-    obj2.free();
-    matrixA[2] = obj1.arrayGet(2, &obj2)->getNum();
-    obj2.free();
-    matrixA[3] = obj1.arrayGet(3, &obj2)->getNum();
-    obj2.free();
-    matrixA[4] = obj1.arrayGet(4, &obj2)->getNum();
-    obj2.free();
-    matrixA[5] = obj1.arrayGet(5, &obj2)->getNum();
-    obj2.free();
+  obj1 = dict->lookup("Matrix");
+  if (obj1.isArray() && obj1.arrayGetLength() == 6) {
+    Object obj2;
+    matrixA[0] = (obj2 = obj1.arrayGet(0), obj2.getNum());
+    matrixA[1] = (obj2 = obj1.arrayGet(1), obj2.getNum());
+    matrixA[2] = (obj2 = obj1.arrayGet(2), obj2.getNum());
+    matrixA[3] = (obj2 = obj1.arrayGet(3), obj2.getNum());
+    matrixA[4] = (obj2 = obj1.arrayGet(4), obj2.getNum());
+    matrixA[5] = (obj2 = obj1.arrayGet(5), obj2.getNum());
   }
-  obj1.free();
 
-  dict->lookup("Function", &obj1);
+  obj1 = dict->lookup("Function");
   if (obj1.isArray()) {
     nFuncsA = obj1.arrayGetLength();
     if (nFuncsA > gfxColorMaxComps || nFuncsA <= 0) {
       error(errSyntaxWarning, -1, "Invalid Function array in shading dictionary");
-      goto err1;
+      return nullptr;
     }
     for (i = 0; i < nFuncsA; ++i) {
-      obj1.arrayGet(i, &obj2);
+      Object obj2 = obj1.arrayGet(i);
       if (!(funcsA[i] = Function::parse(&obj2))) {
-	goto err2;
+	return nullptr;
       }
-      obj2.free();
     }
   } else {
     nFuncsA = 1;
     if (!(funcsA[0] = Function::parse(&obj1))) {
-      goto err1;
+      return nullptr;
     }
   }
-  obj1.free();
 
   shading = new GfxFunctionShading(x0A, y0A, x1A, y1A, matrixA,
 				   funcsA, nFuncsA);
@@ -3942,12 +3790,6 @@
     return NULL;
   }
   return shading;
-
- err2:
-  obj2.free();
- err1:
-  obj1.free();
-  return NULL;
 }
 
 GfxShading *GfxFunctionShading::copy() {
@@ -4034,12 +3876,18 @@
 
 void GfxUnivariateShading::getColor(double t, GfxColor *color) {
   double out[gfxColorMaxComps];
-  int i, nComps;
+  int i;
 
   // NB: there can be one function with n outputs or n functions with
   // one output each (where n = number of color components)
-  nComps = nFuncs * funcs[0]->getOutputSize();
+  const int nComps = nFuncs * funcs[0]->getOutputSize();
 
+  if (unlikely(nFuncs < 1 || nComps > gfxColorMaxComps)) {
+    for (int i = 0; i < gfxColorMaxComps; i++)
+        color->c[i] = 0;
+    return;
+  }
+
   if (cacheSize > 0) {
     double x, ix, *l, *u, *upper;
 
@@ -4089,6 +3937,9 @@
   cacheBounds = NULL;
   cacheSize = 0;
 
+  if (unlikely(nFuncs < 1))
+    return;
+
   // NB: there can be one function with n outputs or n functions with
   // one output each (where n = number of color components)
   nComps = nFuncs * funcs[0]->getOutputSize();
@@ -4195,17 +4046,16 @@
   Function *funcsA[gfxColorMaxComps];
   int nFuncsA;
   GBool extend0A, extend1A;
-  Object obj1, obj2;
+  Object obj1;
   int i;
 
   x0A = y0A = x1A = y1A = 0;
-  if (dict->lookup("Coords", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 4) {
-    Object obj3, obj4, obj5;
-    obj1.arrayGet(0, &obj2);
-    obj1.arrayGet(1, &obj3);
-    obj1.arrayGet(2, &obj4);
-    obj1.arrayGet(3, &obj5);
+  obj1 = dict->lookup("Coords");
+  if (obj1.isArray() && obj1.arrayGetLength() == 4) {
+    Object obj2 = obj1.arrayGet(0);
+    Object obj3 = obj1.arrayGet(1);
+    Object obj4 = obj1.arrayGet(2);
+    Object obj5 = obj1.arrayGet(3);
     if (obj2.isNum() && obj3.isNum() && obj4.isNum() && obj5.isNum()) {
       x0A = obj2.getNum();
       y0A = obj3.getNum();
@@ -4212,87 +4062,67 @@
       x1A = obj4.getNum();
       y1A = obj5.getNum();
     }
-    obj2.free();
-    obj3.free();
-    obj4.free();
-    obj5.free();
   } else {
     error(errSyntaxWarning, -1, "Missing or invalid Coords in shading dictionary");
-    goto err1;
+    return nullptr;
   }
-  obj1.free();
 
   t0A = 0;
   t1A = 1;
-  if (dict->lookup("Domain", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 2) {
-    Object obj3;
-    obj1.arrayGet(0, &obj2);
-    obj1.arrayGet(1, &obj3);
+  obj1 = dict->lookup("Domain");
+  if (obj1.isArray() && obj1.arrayGetLength() == 2) {
+    Object obj2 = obj1.arrayGet(0);
+    Object obj3 = obj1.arrayGet(1);
     if (obj2.isNum() && obj3.isNum()) {
       t0A = obj2.getNum();
       t1A = obj3.getNum();
     }
-    obj2.free();
-    obj3.free();
   }
-  obj1.free();
 
-  dict->lookup("Function", &obj1);
+  obj1 = dict->lookup("Function");
   if (obj1.isArray()) {
     nFuncsA = obj1.arrayGetLength();
     if (nFuncsA > gfxColorMaxComps || nFuncsA == 0) {
       error(errSyntaxWarning, -1, "Invalid Function array in shading dictionary");
-      goto err1;
+      return nullptr;
     }
     for (i = 0; i < nFuncsA; ++i) {
-      obj1.arrayGet(i, &obj2);
+      Object obj2 = obj1.arrayGet(i);
       if (!(funcsA[i] = Function::parse(&obj2))) {
-	obj1.free();
-	obj2.free();
-	goto err1;
+	return nullptr;
       }
-      obj2.free();
     }
   } else {
     nFuncsA = 1;
     if (!(funcsA[0] = Function::parse(&obj1))) {
-      obj1.free();
-      goto err1;
+      return nullptr;
     }
   }
-  obj1.free();
 
   extend0A = extend1A = gFalse;
-  if (dict->lookup("Extend", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 2) {
-    obj1.arrayGet(0, &obj2);
+  obj1 = dict->lookup("Extend");
+  if (obj1.isArray() && obj1.arrayGetLength() == 2) {
+    Object obj2 = obj1.arrayGet(0);
     if (obj2.isBool()) {
       extend0A = obj2.getBool();
     } else {
       error(errSyntaxWarning, -1, "Invalid axial shading extend (0)");
     }
-    obj2.free();
-    obj1.arrayGet(1, &obj2);
+    obj2 = obj1.arrayGet(1);
     if (obj2.isBool()) {
       extend1A = obj2.getBool();
     } else {
       error(errSyntaxWarning, -1, "Invalid axial shading extend (1)");
     }
-    obj2.free();
   }
-  obj1.free();
 
   shading = new GfxAxialShading(x0A, y0A, x1A, y1A, t0A, t1A,
 				funcsA, nFuncsA, extend0A, extend1A);
   if (!shading->init(res, dict, out, state)) {
     delete shading;
-    return NULL;
+    shading = nullptr;
   }
   return shading;
-
- err1:
-  return NULL;
 }
 
 GfxShading *GfxAxialShading::copy() {
@@ -4403,75 +4233,60 @@
   Function *funcsA[gfxColorMaxComps];
   int nFuncsA;
   GBool extend0A, extend1A;
-  Object obj1, obj2;
+  Object obj1;
   int i;
 
   x0A = y0A = r0A = x1A = y1A = r1A = 0;
-  if (dict->lookup("Coords", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 6) {
-    x0A = obj1.arrayGet(0, &obj2)->getNum();
-    obj2.free();
-    y0A = obj1.arrayGet(1, &obj2)->getNum();
-    obj2.free();
-    r0A = obj1.arrayGet(2, &obj2)->getNum();
-    obj2.free();
-    x1A = obj1.arrayGet(3, &obj2)->getNum();
-    obj2.free();
-    y1A = obj1.arrayGet(4, &obj2)->getNum();
-    obj2.free();
-    r1A = obj1.arrayGet(5, &obj2)->getNum();
-    obj2.free();
+  obj1 = dict->lookup("Coords");
+  if (obj1.isArray() && obj1.arrayGetLength() == 6) {
+    Object obj2;
+    x0A = (obj2 = obj1.arrayGet(0), obj2.getNum());
+    y0A = (obj2 = obj1.arrayGet(1), obj2.getNum());
+    r0A = (obj2 = obj1.arrayGet(2), obj2.getNum());
+    x1A = (obj2 = obj1.arrayGet(3), obj2.getNum());
+    y1A = (obj2 = obj1.arrayGet(4), obj2.getNum());
+    r1A = (obj2 = obj1.arrayGet(5), obj2.getNum());
   } else {
     error(errSyntaxWarning, -1, "Missing or invalid Coords in shading dictionary");
-    goto err1;
+    return nullptr;
   }
-  obj1.free();
 
   t0A = 0;
   t1A = 1;
-  if (dict->lookup("Domain", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 2) {
-    t0A = obj1.arrayGet(0, &obj2)->getNum();
-    obj2.free();
-    t1A = obj1.arrayGet(1, &obj2)->getNum();
-    obj2.free();
+  obj1 = dict->lookup("Domain");
+  if (obj1.isArray() && obj1.arrayGetLength() == 2) {
+    Object obj2;
+    t0A = (obj2 = obj1.arrayGet(0), obj2.getNum());
+    t1A = (obj2 = obj1.arrayGet(1), obj2.getNum());
   }
-  obj1.free();
 
-  dict->lookup("Function", &obj1);
+  obj1 = dict->lookup("Function");
   if (obj1.isArray()) {
     nFuncsA = obj1.arrayGetLength();
     if (nFuncsA > gfxColorMaxComps) {
       error(errSyntaxWarning, -1, "Invalid Function array in shading dictionary");
-      goto err1;
+      return nullptr;
     }
     for (i = 0; i < nFuncsA; ++i) {
-      obj1.arrayGet(i, &obj2);
+      Object obj2 = obj1.arrayGet(i);
       if (!(funcsA[i] = Function::parse(&obj2))) {
-	obj1.free();
-	obj2.free();
-	goto err1;
+	return nullptr;
       }
-      obj2.free();
     }
   } else {
     nFuncsA = 1;
     if (!(funcsA[0] = Function::parse(&obj1))) {
-      obj1.free();
-      goto err1;
+      return nullptr;
     }
   }
-  obj1.free();
 
   extend0A = extend1A = gFalse;
-  if (dict->lookup("Extend", &obj1)->isArray() &&
-      obj1.arrayGetLength() == 2) {
-    extend0A = obj1.arrayGet(0, &obj2)->getBool();
-    obj2.free();
-    extend1A = obj1.arrayGet(1, &obj2)->getBool();
-    obj2.free();
+  obj1 = dict->lookup("Extend");
+  if (obj1.isArray() && obj1.arrayGetLength() == 2) {
+    Object obj2;
+    extend0A = (obj2 = obj1.arrayGet(0), obj2.getBool());
+    extend1A = (obj2 = obj1.arrayGet(1), obj2.getBool());
   }
-  obj1.free();
 
   shading = new GfxRadialShading(x0A, y0A, r0A, x1A, y1A, r1A, t0A, t1A,
 				 funcsA, nFuncsA, extend0A, extend1A);
@@ -4480,9 +4295,6 @@
     return NULL;
   }
   return shading;
-
- err1:
-  return NULL;
 }
 
 GfxShading *GfxRadialShading::copy() {
@@ -4934,94 +4746,84 @@
   Guint x, y, flag;
   Guint c[gfxColorMaxComps];
   GfxShadingBitBuf *bitBuf;
-  Object obj1, obj2;
+  Object obj1;
   int i, j, k, state;
 
-  if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) {
+  obj1 = dict->lookup("BitsPerCoordinate");
+  if (obj1.isInt()) {
     coordBits = obj1.getInt();
   } else {
     error(errSyntaxWarning, -1, "Missing or invalid BitsPerCoordinate in shading dictionary");
-    goto err2;
+    return nullptr;
   }
-  obj1.free();
-  if (dict->lookup("BitsPerComponent", &obj1)->isInt()) {
+  obj1 = dict->lookup("BitsPerComponent");
+  if (obj1.isInt()) {
     compBits = obj1.getInt();
   } else {
     error(errSyntaxWarning, -1, "Missing or invalid BitsPerComponent in shading dictionary");
-    goto err2;
+    return nullptr;
   }
-  obj1.free();
   flagBits = vertsPerRow = 0; // make gcc happy
   if (typeA == 4) {
-    if (dict->lookup("BitsPerFlag", &obj1)->isInt()) {
+    obj1 = dict->lookup("BitsPerFlag");
+  if (obj1.isInt()) {
       flagBits = obj1.getInt();
     } else {
       error(errSyntaxWarning, -1, "Missing or invalid BitsPerFlag in shading dictionary");
-      goto err2;
+      return nullptr;
     }
-    obj1.free();
   } else {
-    if (dict->lookup("VerticesPerRow", &obj1)->isInt()) {
+    obj1 = dict->lookup("VerticesPerRow");
+  if (obj1.isInt()) {
       vertsPerRow = obj1.getInt();
     } else {
       error(errSyntaxWarning, -1, "Missing or invalid VerticesPerRow in shading dictionary");
-      goto err2;
+      return nullptr;
     }
-    obj1.free();
   }
-  if (dict->lookup("Decode", &obj1)->isArray() &&
-      obj1.arrayGetLength() >= 6) {
-    xMin = obj1.arrayGet(0, &obj2)->getNum();
-    obj2.free();
-    xMax = obj1.arrayGet(1, &obj2)->getNum();
-    obj2.free();
+  obj1 = dict->lookup("Decode");
+  if (obj1.isArray() && obj1.arrayGetLength() >= 6) {
+    Object obj2;
+    xMin = (obj2 = obj1.arrayGet(0), obj2.getNum());
+    xMax = (obj2 = obj1.arrayGet(1), obj2.getNum());
     xMul = (xMax - xMin) / (pow(2.0, coordBits) - 1);
-    yMin = obj1.arrayGet(2, &obj2)->getNum();
-    obj2.free();
-    yMax = obj1.arrayGet(3, &obj2)->getNum();
-    obj2.free();
+    yMin = (obj2 = obj1.arrayGet(2), obj2.getNum());
+    yMax = (obj2 = obj1.arrayGet(3), obj2.getNum());
     yMul = (yMax - yMin) / (pow(2.0, coordBits) - 1);
     for (i = 0; 5 + 2*i < obj1.arrayGetLength() && i < gfxColorMaxComps; ++i) {
-      cMin[i] = obj1.arrayGet(4 + 2*i, &obj2)->getNum();
-      obj2.free();
-      cMax[i] = obj1.arrayGet(5 + 2*i, &obj2)->getNum();
-      obj2.free();
+      cMin[i] = (obj2 = obj1.arrayGet(4 + 2*i), obj2.getNum());
+      cMax[i] = (obj2 = obj1.arrayGet(5 + 2*i), obj2.getNum());
       cMul[i] = (cMax[i] - cMin[i]) / (double)((1 << compBits) - 1);
     }
     nComps = i;
   } else {
     error(errSyntaxWarning, -1, "Missing or invalid Decode array in shading dictionary");
-    goto err2;
+    return nullptr;
   }
-  obj1.free();
 
-  if (!dict->lookup("Function", &obj1)->isNull()) {
+  obj1 = dict->lookup("Function");
+  if (!obj1.isNull()) {
     if (obj1.isArray()) {
       nFuncsA = obj1.arrayGetLength();
       if (nFuncsA > gfxColorMaxComps) {
 	error(errSyntaxWarning, -1, "Invalid Function array in shading dictionary");
-	goto err1;
+	return nullptr;
       }
       for (i = 0; i < nFuncsA; ++i) {
-	obj1.arrayGet(i, &obj2);
+	Object obj2 = obj1.arrayGet(i);
 	if (!(funcsA[i] = Function::parse(&obj2))) {
-	  obj1.free();
-	  obj2.free();
-	  goto err1;
+	  return nullptr;
 	}
-	obj2.free();
       }
     } else {
       nFuncsA = 1;
       if (!(funcsA[0] = Function::parse(&obj1))) {
-	obj1.free();
-	goto err1;
+	return nullptr;
       }
     }
   } else {
     nFuncsA = 0;
   }
-  obj1.free();
 
   nVerticesA = nTrianglesA = 0;
   verticesA = NULL;
@@ -5120,11 +4922,6 @@
     return NULL;
   }
   return shading;
-
- err2:
-  obj1.free();
- err1:
-  return NULL;
 }
 
 GfxShading *GfxGouraudTriangleShading::copy() {
@@ -5285,83 +5082,79 @@
   double c[4][gfxColorMaxComps];
   Guint ci;
   GfxShadingBitBuf *bitBuf;
-  Object obj1, obj2;
+  Object obj1;
   int i, j;
 
-  if (dict->lookup("BitsPerCoordinate", &obj1)->isInt()) {
+  obj1 = dict->lookup("BitsPerCoordinate");
+  if (obj1.isInt()) {
     coordBits = obj1.getInt();
   } else {
     error(errSyntaxWarning, -1, "Missing or invalid BitsPerCoordinate in shading dictionary");
-    goto err2;
+    return nullptr;
   }
-  obj1.free();
-  if (dict->lookup("BitsPerComponent", &obj1)->isInt()) {
+  obj1 = dict->lookup("BitsPerComponent");
+  if (obj1.isInt()) {
     compBits = obj1.getInt();
   } else {
     error(errSyntaxWarning, -1, "Missing or invalid BitsPerComponent in shading dictionary");
-    goto err2;
+    return nullptr;
   }
-  obj1.free();
-  if (dict->lookup("BitsPerFlag", &obj1)->isInt()) {
+  obj1 = dict->lookup("BitsPerFlag");
+  if (obj1.isInt()) {
     flagBits = obj1.getInt();
   } else {
     error(errSyntaxWarning, -1, "Missing or invalid BitsPerFlag in shading dictionary");
-    goto err2;
+    return nullptr;
   }
-  obj1.free();
-  if (dict->lookup("Decode", &obj1)->isArray() &&
-      obj1.arrayGetLength() >= 6) {
-    xMin = obj1.arrayGet(0, &obj2)->getNum();
-    obj2.free();
-    xMax = obj1.arrayGet(1, &obj2)->getNum();
-    obj2.free();
+  obj1 = dict->lookup("Decode");
+  if (obj1.isArray() && obj1.arrayGetLength() >= 6) {
+    bool decodeOk = true;
+    Object obj2;
+    xMin = (obj2 = obj1.arrayGet(0), obj2.getNum(&decodeOk));
+    xMax = (obj2 = obj1.arrayGet(1), obj2.getNum(&decodeOk));
     xMul = (xMax - xMin) / (pow(2.0, coordBits) - 1);
-    yMin = obj1.arrayGet(2, &obj2)->getNum();
-    obj2.free();
-    yMax = obj1.arrayGet(3, &obj2)->getNum();
-    obj2.free();
+    yMin = (obj2 = obj1.arrayGet(2), obj2.getNum(&decodeOk));
+    yMax = (obj2 = obj1.arrayGet(3), obj2.getNum(&decodeOk));
     yMul = (yMax - yMin) / (pow(2.0, coordBits) - 1);
     for (i = 0; 5 + 2*i < obj1.arrayGetLength() && i < gfxColorMaxComps; ++i) {
-      cMin[i] = obj1.arrayGet(4 + 2*i, &obj2)->getNum();
-      obj2.free();
-      cMax[i] = obj1.arrayGet(5 + 2*i, &obj2)->getNum();
-      obj2.free();
+      cMin[i] = (obj2 = obj1.arrayGet(4 + 2*i), obj2.getNum(&decodeOk));
+      cMax[i] = (obj2 = obj1.arrayGet(5 + 2*i), obj2.getNum(&decodeOk));
       cMul[i] = (cMax[i] - cMin[i]) / (double)((1 << compBits) - 1);
     }
     nComps = i;
+
+    if (!decodeOk) {
+      error(errSyntaxWarning, -1, "Missing or invalid Decode array in shading dictionary");
+      return nullptr;
+    }
   } else {
     error(errSyntaxWarning, -1, "Missing or invalid Decode array in shading dictionary");
-    goto err2;
+    return nullptr;
   }
-  obj1.free();
 
-  if (!dict->lookup("Function", &obj1)->isNull()) {
+  obj1 = dict->lookup("Function");
+  if (!obj1.isNull()) {
     if (obj1.isArray()) {
       nFuncsA = obj1.arrayGetLength();
       if (nFuncsA > gfxColorMaxComps) {
 	error(errSyntaxWarning, -1, "Invalid Function array in shading dictionary");
-	goto err1;
+	return nullptr;
       }
       for (i = 0; i < nFuncsA; ++i) {
-	obj1.arrayGet(i, &obj2);
+	Object obj2 = obj1.arrayGet(i);
 	if (!(funcsA[i] = Function::parse(&obj2))) {
-	  obj1.free();
-	  obj2.free();
-	  goto err1;
+	  return nullptr;
 	}
-	obj2.free();
       }
     } else {
       nFuncsA = 1;
       if (!(funcsA[0] = Function::parse(&obj1))) {
-	obj1.free();
-	goto err1;
+	return nullptr;
       }
     }
   } else {
     nFuncsA = 0;
   }
-  obj1.free();
 
   nPatchesA = 0;
   patchesA = NULL;
@@ -5462,7 +5255,7 @@
 	break;
       case 1:
 	if (nPatchesA == 0) {
-	  goto err1;
+	  return nullptr;
 	}
 	p->x[0][0] = patchesA[nPatchesA-1].x[0][3];
 	p->y[0][0] = patchesA[nPatchesA-1].y[0][3];
@@ -5497,7 +5290,7 @@
 	break;
       case 2:
 	if (nPatchesA == 0) {
-	  goto err1;
+	  return nullptr;
 	}
 	p->x[0][0] = patchesA[nPatchesA-1].x[3][3];
 	p->y[0][0] = patchesA[nPatchesA-1].y[3][3];
@@ -5532,7 +5325,7 @@
 	break;
       case 3:
 	if (nPatchesA == 0) {
-	  goto err1;
+	  return nullptr;
 	}
 	p->x[0][0] = patchesA[nPatchesA-1].x[3][0];
 	p->y[0][0] = patchesA[nPatchesA-1].y[3][0];
@@ -5610,7 +5403,7 @@
 	break;
       case 1:
 	if (nPatchesA == 0) {
-	  goto err1;
+	  return nullptr;
 	}
 	p->x[0][0] = patchesA[nPatchesA-1].x[0][3];
 	p->y[0][0] = patchesA[nPatchesA-1].y[0][3];
@@ -5653,7 +5446,7 @@
 	break;
       case 2:
 	if (nPatchesA == 0) {
-	  goto err1;
+	  return nullptr;
 	}
 	p->x[0][0] = patchesA[nPatchesA-1].x[3][3];
 	p->y[0][0] = patchesA[nPatchesA-1].y[3][3];
@@ -5696,7 +5489,7 @@
 	break;
       case 3:
 	if (nPatchesA == 0) {
-	  goto err1;
+	  return nullptr;
 	}
 	p->x[0][0] = patchesA[nPatchesA-1].x[3][0];
 	p->y[0][0] = patchesA[nPatchesA-1].y[3][0];
@@ -5794,14 +5587,9 @@
 				    funcsA, nFuncsA);
   if (!shading->init(res, dict, out, state)) {
     delete shading;
-    return NULL;
+    return nullptr;
   }
   return shading;
-
- err2:
-  obj1.free();
- err1:
-  return NULL;
 }
 
 void GfxPatchMeshShading::getParameterizedColor(double t, GfxColor *color) {
@@ -5830,7 +5618,6 @@
   int maxPixel, indexHigh;
   Guchar *indexedLookup;
   Function *sepFunc;
-  Object obj;
   double x[gfxColorMaxComps];
   double y[gfxColorMaxComps];
   int i, j, k;
@@ -5872,18 +5659,16 @@
       nComps = colorSpace->getNComps();
     }
     for (i = 0; i < nComps; ++i) {
-      decode->arrayGet(2*i, &obj);
+      Object obj = decode->arrayGet(2*i);
       if (!obj.isNum()) {
-	goto err2;
+	goto err1;
       }
       decodeLow[i] = obj.getNum();
-      obj.free();
-      decode->arrayGet(2*i+1, &obj);
+      obj = decode->arrayGet(2*i+1);
       if (!obj.isNum()) {
-	goto err2;
+	goto err1;
       }
       decodeRange[i] = obj.getNum() - decodeLow[i];
-      obj.free();
     }
   } else {
     goto err1;
@@ -5988,8 +5773,6 @@
 
   return;
 
- err2:
-  obj.free();
  err1:
   ok = gFalse;
 }
@@ -7313,7 +7096,6 @@
 }
 
 GBool GfxState::parseBlendMode(Object *obj, GfxBlendMode *mode) {
-  Object obj2;
   int i, j;
 
   if (obj->isName()) {
@@ -7326,19 +7108,16 @@
     return gFalse;
   } else if (obj->isArray()) {
     for (i = 0; i < obj->arrayGetLength(); ++i) {
-      obj->arrayGet(i, &obj2);
+      Object obj2 = obj->arrayGet(i);
       if (!obj2.isName()) {
-	obj2.free();
 	return gFalse;
       }
       for (j = 0; j < nGfxBlendModeNames; ++j) {
 	if (!strcmp(obj2.getName(), gfxBlendModeNames[j].name)) {
-	  obj2.free();
 	  *mode = gfxBlendModeNames[j].mode;
 	  return gTrue;
 	}
       }
-      obj2.free();
     }
     *mode = gfxBlendNormal;
     return gTrue;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxState.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxState.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/GfxState.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -17,12 +17,13 @@
 // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2006 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009 Koji Otani <sho at bbr.jp>
-// Copyright (C) 2009-2011, 2013, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009-2011, 2013, 2016, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
 // Copyright (C) 2011 Andrea Canciani <ranma42 at gmail.com>
 // Copyright (C) 2011-2014, 2016 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2013 Lu Wang <coolwanglu at gmail.com>
-// Copyright (C) 2015 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2015, 2017 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2017 Oliver Sander <oliver.sander at tu-dresden.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
@@ -132,6 +133,10 @@
   return (Guchar)(((x << 8) - x + 0x8000) >> 16);
 }
 
+static inline Gushort colToShort(GfxColorComp x) {
+  return (Gushort)(x);
+}
+
 //------------------------------------------------------------------------
 // GfxColor
 //------------------------------------------------------------------------
@@ -288,28 +293,28 @@
 public:
 
   GfxDeviceGrayColorSpace();
-  virtual ~GfxDeviceGrayColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csDeviceGray; }
+  ~GfxDeviceGrayColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csDeviceGray; }
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
-  virtual void getGrayLine(Guchar *in, Guchar *out, int length);
-  virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
-  virtual void getRGBLine(Guchar *in, Guchar *out, int length);
-  virtual void getRGBXLine(Guchar *in, Guchar *out, int length);
-  virtual void getCMYKLine(Guchar *in, Guchar *out, int length);
-  virtual void getDeviceNLine(Guchar *in, Guchar *out, int length);
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+  void getGrayLine(Guchar *in, Guchar *out, int length) override;
+  void getRGBLine(Guchar *in, unsigned int *out, int length) override;
+  void getRGBLine(Guchar *in, Guchar *out, int length) override;
+  void getRGBXLine(Guchar *in, Guchar *out, int length) override;
+  void getCMYKLine(Guchar *in, Guchar *out, int length) override;
+  void getDeviceNLine(Guchar *in, Guchar *out, int length) override;
 
-  virtual GBool useGetRGBLine() { return gTrue; }
-  virtual GBool useGetGrayLine() { return gTrue; }
-  virtual GBool useGetCMYKLine() { return gTrue; }
-  virtual GBool useGetDeviceNLine() { return gTrue; }
+  GBool useGetRGBLine() override { return gTrue; }
+  GBool useGetGrayLine() override { return gTrue; }
+  GBool useGetCMYKLine() override { return gTrue; }
+  GBool useGetDeviceNLine() override { return gTrue; }
 
-  virtual int getNComps() { return 1; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return 1; }
+  void getDefaultColor(GfxColor *color) override;
 
 private:
 };
@@ -322,20 +327,20 @@
 public:
 
   GfxCalGrayColorSpace();
-  virtual ~GfxCalGrayColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csCalGray; }
+  ~GfxCalGrayColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csCalGray; }
 
   // Construct a CalGray color space.  Returns NULL if unsuccessful.
   static GfxColorSpace *parse(Array *arr, GfxState *state);
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
 
-  virtual int getNComps() { return 1; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return 1; }
+  void getDefaultColor(GfxColor *color) override;
 
   // CalGray-specific access.
   double getWhiteX() { return whiteX; }
@@ -366,28 +371,28 @@
 public:
 
   GfxDeviceRGBColorSpace();
-  virtual ~GfxDeviceRGBColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csDeviceRGB; }
+  ~GfxDeviceRGBColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csDeviceRGB; }
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
-  virtual void getGrayLine(Guchar *in, Guchar *out, int length);
-  virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
-  virtual void getRGBLine(Guchar *in, Guchar *out, int length);
-  virtual void getRGBXLine(Guchar *in, Guchar *out, int length);
-  virtual void getCMYKLine(Guchar *in, Guchar *out, int length);
-  virtual void getDeviceNLine(Guchar *in, Guchar *out, int length);
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+  void getGrayLine(Guchar *in, Guchar *out, int length) override;
+  void getRGBLine(Guchar *in, unsigned int *out, int length) override;
+  void getRGBLine(Guchar *in, Guchar *out, int length) override;
+  void getRGBXLine(Guchar *in, Guchar *out, int length) override;
+  void getCMYKLine(Guchar *in, Guchar *out, int length) override;
+  void getDeviceNLine(Guchar *in, Guchar *out, int length) override;
 
-  virtual GBool useGetRGBLine() { return gTrue; }
-  virtual GBool useGetGrayLine() { return gTrue; }
-  virtual GBool useGetCMYKLine() { return gTrue; }
-  virtual GBool useGetDeviceNLine() { return gTrue; }
+  GBool useGetRGBLine() override { return gTrue; }
+  GBool useGetGrayLine() override { return gTrue; }
+  GBool useGetCMYKLine() override { return gTrue; }
+  GBool useGetDeviceNLine() override { return gTrue; }
 
-  virtual int getNComps() { return 3; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return 3; }
+  void getDefaultColor(GfxColor *color) override;
 
 private:
 };
@@ -400,20 +405,20 @@
 public:
 
   GfxCalRGBColorSpace();
-  virtual ~GfxCalRGBColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csCalRGB; }
+  ~GfxCalRGBColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csCalRGB; }
 
   // Construct a CalRGB color space.  Returns NULL if unsuccessful.
   static GfxColorSpace *parse(Array *arr, GfxState *state);
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
 
-  virtual int getNComps() { return 3; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return 3; }
+  void getDefaultColor(GfxColor *color) override;
 
   // CalRGB-specific access.
   double getWhiteX() { return whiteX; }
@@ -448,25 +453,25 @@
 public:
 
   GfxDeviceCMYKColorSpace();
-  virtual ~GfxDeviceCMYKColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csDeviceCMYK; }
+  ~GfxDeviceCMYKColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csDeviceCMYK; }
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
-  virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
-  virtual void getRGBLine(Guchar *, Guchar *out, int length);
-  virtual void getRGBXLine(Guchar *in, Guchar *out, int length);
-  virtual void getCMYKLine(Guchar *in, Guchar *out, int length);
-  virtual void getDeviceNLine(Guchar *in, Guchar *out, int length);
-  virtual GBool useGetRGBLine() { return gTrue; }
-  virtual GBool useGetCMYKLine() { return gTrue; }
-  virtual GBool useGetDeviceNLine() { return gTrue; }
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+  void getRGBLine(Guchar *in, unsigned int *out, int length) override;
+  void getRGBLine(Guchar *, Guchar *out, int length) override;
+  void getRGBXLine(Guchar *in, Guchar *out, int length) override;
+  void getCMYKLine(Guchar *in, Guchar *out, int length) override;
+  void getDeviceNLine(Guchar *in, Guchar *out, int length) override;
+  GBool useGetRGBLine() override { return gTrue; }
+  GBool useGetCMYKLine() override { return gTrue; }
+  GBool useGetDeviceNLine() override { return gTrue; }
 
-  virtual int getNComps() { return 4; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return 4; }
+  void getDefaultColor(GfxColor *color) override;
 
 private:
 };
@@ -479,23 +484,23 @@
 public:
 
   GfxLabColorSpace();
-  virtual ~GfxLabColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csLab; }
+  ~GfxLabColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csLab; }
 
   // Construct a Lab color space.  Returns NULL if unsuccessful.
   static GfxColorSpace *parse(Array *arr, GfxState *state);
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
 
-  virtual int getNComps() { return 3; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return 3; }
+  void getDefaultColor(GfxColor *color) override;
 
-  virtual void getDefaultRanges(double *decodeLow, double *decodeRange,
-				int maxImgPixel);
+  void getDefaultRanges(double *decodeLow, double *decodeRange,
+				int maxImgPixel) override;
 
   // Lab-specific access.
   double getWhiteX() { return whiteX; }
@@ -530,32 +535,32 @@
 
   GfxICCBasedColorSpace(int nCompsA, GfxColorSpace *altA,
 			Ref *iccProfileStreamA);
-  virtual ~GfxICCBasedColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csICCBased; }
+  ~GfxICCBasedColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csICCBased; }
 
   // Construct an ICCBased color space.  Returns NULL if unsuccessful.
   static GfxColorSpace *parse(Array *arr, OutputDev *out, GfxState *state, int recursion);
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
-  virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
-  virtual void getRGBLine(Guchar *in, Guchar *out, int length);
-  virtual void getRGBXLine(Guchar *in, Guchar *out, int length);
-  virtual void getCMYKLine(Guchar *in, Guchar *out, int length);
-  virtual void getDeviceNLine(Guchar *in, Guchar *out, int length);
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+  void getRGBLine(Guchar *in, unsigned int *out, int length) override;
+  void getRGBLine(Guchar *in, Guchar *out, int length) override;
+  void getRGBXLine(Guchar *in, Guchar *out, int length) override;
+  void getCMYKLine(Guchar *in, Guchar *out, int length) override;
+  void getDeviceNLine(Guchar *in, Guchar *out, int length) override;
 
-  virtual GBool useGetRGBLine();
-  virtual GBool useGetCMYKLine();
-  virtual GBool useGetDeviceNLine();
+  GBool useGetRGBLine() override;
+  GBool useGetCMYKLine() override;
+  GBool useGetDeviceNLine() override;
 
-  virtual int getNComps() { return nComps; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return nComps; }
+  void getDefaultColor(GfxColor *color) override;
 
-  virtual void getDefaultRanges(double *decodeLow, double *decodeRange,
-				int maxImgPixel);
+  void getDefaultRanges(double *decodeLow, double *decodeRange,
+				int maxImgPixel) override;
 
   // ICCBased-specific access.
   GfxColorSpace *getAlt() { return alt; }
@@ -582,32 +587,32 @@
 public:
 
   GfxIndexedColorSpace(GfxColorSpace *baseA, int indexHighA);
-  virtual ~GfxIndexedColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csIndexed; }
+  ~GfxIndexedColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csIndexed; }
 
   // Construct an Indexed color space.  Returns NULL if unsuccessful.
   static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
-  virtual void getRGBLine(Guchar *in, unsigned int *out, int length);
-  virtual void getRGBLine(Guchar *in, Guchar *out, int length);
-  virtual void getRGBXLine(Guchar *in, Guchar *out, int length);
-  virtual void getCMYKLine(Guchar *in, Guchar *out, int length);
-  virtual void getDeviceNLine(Guchar *in, Guchar *out, int length);
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
+  void getRGBLine(Guchar *in, unsigned int *out, int length) override;
+  void getRGBLine(Guchar *in, Guchar *out, int length) override;
+  void getRGBXLine(Guchar *in, Guchar *out, int length) override;
+  void getCMYKLine(Guchar *in, Guchar *out, int length) override;
+  void getDeviceNLine(Guchar *in, Guchar *out, int length) override;
 
-  virtual GBool useGetRGBLine() { return gTrue; }
-  virtual GBool useGetCMYKLine() { return gTrue; }
-  virtual GBool useGetDeviceNLine() { return gTrue; }
+  GBool useGetRGBLine() override { return gTrue; }
+  GBool useGetCMYKLine() override { return gTrue; }
+  GBool useGetDeviceNLine() override { return gTrue; }
 
-  virtual int getNComps() { return 1; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return 1; }
+  void getDefaultColor(GfxColor *color) override;
 
-  virtual void getDefaultRanges(double *decodeLow, double *decodeRange,
-				int maxImgPixel);
+  void getDefaultRanges(double *decodeLow, double *decodeRange,
+				int maxImgPixel) override;
 
   // Indexed-specific access.
   GfxColorSpace *getBase() { return base; }
@@ -615,7 +620,7 @@
   Guchar *getLookup() { return lookup; }
   GfxColor *mapColorToBase(GfxColor *color, GfxColor *baseColor);
   Guint getOverprintMask() { return base->getOverprintMask(); }
-  virtual void createMapping(GooList *separationList, int maxSepComps)
+  void createMapping(GooList *separationList, int maxSepComps) override
     { base->createMapping(separationList, maxSepComps); }
 
 
@@ -635,24 +640,24 @@
 
   GfxSeparationColorSpace(GooString *nameA, GfxColorSpace *altA,
 			  Function *funcA);
-  virtual ~GfxSeparationColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csSeparation; }
+  ~GfxSeparationColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csSeparation; }
 
   // Construct a Separation color space.  Returns NULL if unsuccessful.
   static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
 
-  virtual void createMapping(GooList *separationList, int maxSepComps);
+  void createMapping(GooList *separationList, int maxSepComps) override;
 
-  virtual int getNComps() { return 1; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return 1; }
+  void getDefaultColor(GfxColor *color) override;
 
-  virtual GBool isNonMarking() { return nonMarking; }
+  GBool isNonMarking() override { return nonMarking; }
 
   // Separation-specific access.
   GooString *getName() { return name; }
@@ -680,24 +685,24 @@
 
   GfxDeviceNColorSpace(int nCompsA, GooString **namesA,
 		       GfxColorSpace *alt, Function *func, GooList *sepsCS);
-  virtual ~GfxDeviceNColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csDeviceN; }
+  ~GfxDeviceNColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csDeviceN; }
 
   // Construct a DeviceN color space.  Returns NULL if unsuccessful.
   static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
 
-  virtual void createMapping(GooList *separationList, int maxSepComps);
+  void createMapping(GooList *separationList, int maxSepComps) override;
 
-  virtual int getNComps() { return nComps; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return nComps; }
+  void getDefaultColor(GfxColor *color) override;
 
-  virtual GBool isNonMarking() { return nonMarking; }
+  GBool isNonMarking() override { return nonMarking; }
 
   // DeviceN-specific access.
   GooString *getColorantName(int i) { return names[i]; }
@@ -727,20 +732,20 @@
 public:
 
   GfxPatternColorSpace(GfxColorSpace *underA);
-  virtual ~GfxPatternColorSpace();
-  virtual GfxColorSpace *copy();
-  virtual GfxColorSpaceMode getMode() { return csPattern; }
+  ~GfxPatternColorSpace();
+  GfxColorSpace *copy() override;
+  GfxColorSpaceMode getMode() override { return csPattern; }
 
   // Construct a Pattern color space.  Returns NULL if unsuccessful.
   static GfxColorSpace *parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion);
 
-  virtual void getGray(GfxColor *color, GfxGray *gray);
-  virtual void getRGB(GfxColor *color, GfxRGB *rgb);
-  virtual void getCMYK(GfxColor *color, GfxCMYK *cmyk);
-  virtual void getDeviceN(GfxColor *color, GfxColor *deviceN);
+  void getGray(GfxColor *color, GfxGray *gray) override;
+  void getRGB(GfxColor *color, GfxRGB *rgb) override;
+  void getCMYK(GfxColor *color, GfxCMYK *cmyk) override;
+  void getDeviceN(GfxColor *color, GfxColor *deviceN) override;
 
-  virtual int getNComps() { return 0; }
-  virtual void getDefaultColor(GfxColor *color);
+  int getNComps() override { return 0; }
+  void getDefaultColor(GfxColor *color) override;
 
   // Pattern-specific access.
   GfxColorSpace *getUnder() { return under; }
@@ -758,18 +763,21 @@
 class GfxPattern {
 public:
 
-  GfxPattern(int typeA);
+  GfxPattern(int typeA, int patternRefNumA);
   virtual ~GfxPattern();
 
-  static GfxPattern *parse(GfxResources *res, Object *obj, OutputDev *out, GfxState *state);
+  static GfxPattern *parse(GfxResources *res, Object *obj, OutputDev *out, GfxState *state, int patternRefNum);
 
   virtual GfxPattern *copy() = 0;
 
   int getType() { return type; }
 
+  int getPatternRefNum() const { return patternRefNum; }
+
 private:
 
   int type;
+  int patternRefNum;
 };
 
 //------------------------------------------------------------------------
@@ -779,10 +787,10 @@
 class GfxTilingPattern: public GfxPattern {
 public:
 
-  static GfxTilingPattern *parse(Object *patObj);
-  virtual ~GfxTilingPattern();
+  static GfxTilingPattern *parse(Object *patObj, int patternRefNum);
+  ~GfxTilingPattern();
 
-  virtual GfxPattern *copy();
+  GfxPattern *copy() override;
 
   int getPaintType() { return paintType; }
   int getTilingType() { return tilingType; }
@@ -799,7 +807,7 @@
   GfxTilingPattern(int paintTypeA, int tilingTypeA,
 		   double *bboxA, double xStepA, double yStepA,
 		   Object *resDictA, double *matrixA,
-		   Object *contentStreamA);
+		   Object *contentStreamA, int patternRefNumA);
 
   int paintType;
   int tilingType;
@@ -817,10 +825,10 @@
 class GfxShadingPattern: public GfxPattern {
 public:
 
-  static GfxShadingPattern *parse(GfxResources *res, Object *patObj, OutputDev *out, GfxState *state);
-  virtual ~GfxShadingPattern();
+  static GfxShadingPattern *parse(GfxResources *res, Object *patObj, OutputDev *out, GfxState *state, int patternRefNum);
+  ~GfxShadingPattern();
 
-  virtual GfxPattern *copy();
+  GfxPattern *copy() override;
 
   GfxShading *getShading() { return shading; }
   double *getMatrix() { return matrix; }
@@ -827,7 +835,7 @@
 
 private:
 
-  GfxShadingPattern(GfxShading *shadingA, double *matrixA);
+  GfxShadingPattern(GfxShading *shadingA, double *matrixA, int patternRefNumA);
 
   GfxShading *shading;
   double matrix[6];
@@ -860,6 +868,13 @@
 
   GBool init(GfxResources *res, Dict *dict, OutputDev *out, GfxState *state);
 
+  // 1: Function-based shading
+  // 2: Axial shading
+  // 3: Radial shading
+  // 4: Free-form Gouraud-shaded triangle mesh
+  // 5: Lattice-form Gouraud-shaded triangle mesh
+  // 6: Coons patch mesh
+  // 7: Tensor-product patch mesh
   int type;
   GBool hasBackground;
   GBool hasBBox;
@@ -880,7 +895,7 @@
 		       Function **funcsA, int nFuncsA,
 		       GBool extend0A, GBool extend1A);
   GfxUnivariateShading(GfxUnivariateShading *shading);
-  virtual ~GfxUnivariateShading();
+  ~GfxUnivariateShading();
 
   double getDomain0() { return t0; }
   double getDomain1() { return t1; }
@@ -925,11 +940,11 @@
 		     double *matrixA,
 		     Function **funcsA, int nFuncsA);
   GfxFunctionShading(GfxFunctionShading *shading);
-  virtual ~GfxFunctionShading();
+  ~GfxFunctionShading();
 
   static GfxFunctionShading *parse(GfxResources *res, Dict *dict, OutputDev *out, GfxState *state);
 
-  virtual GfxShading *copy();
+  GfxShading *copy() override;
 
   void getDomain(double *x0A, double *y0A, double *x1A, double *y1A)
     { *x0A = x0; *y0A = y0; *x1A = x1; *y1A = y1; }
@@ -959,20 +974,20 @@
 		  Function **funcsA, int nFuncsA,
 		  GBool extend0A, GBool extend1A);
   GfxAxialShading(GfxAxialShading *shading);
-  virtual ~GfxAxialShading();
+  ~GfxAxialShading();
 
   static GfxAxialShading *parse(GfxResources *res, Dict *dict, OutputDev *out, GfxState *state);
 
-  virtual GfxShading *copy();
+  GfxShading *copy() override;
 
   void getCoords(double *x0A, double *y0A, double *x1A, double *y1A)
     { *x0A = x0; *y0A = y0; *x1A = x1; *y1A = y1; }
 
-  virtual void getParameterRange(double *lower, double *upper,
+  void getParameterRange(double *lower, double *upper,
 				 double xMin, double yMin,
-				 double xMax, double yMax);
+				 double xMax, double yMax) override;
 
-  virtual double getDistance(double tMin, double tMax);
+  double getDistance(double tMin, double tMax) override;
 
 private:
 
@@ -992,21 +1007,21 @@
 		   Function **funcsA, int nFuncsA,
 		   GBool extend0A, GBool extend1A);
   GfxRadialShading(GfxRadialShading *shading);
-  virtual ~GfxRadialShading();
+  ~GfxRadialShading();
 
   static GfxRadialShading *parse(GfxResources *res, Dict *dict, OutputDev *out, GfxState *state);
 
-  virtual GfxShading *copy();
+  GfxShading *copy() override;
 
   void getCoords(double *x0A, double *y0A, double *r0A,
 		 double *x1A, double *y1A, double *r1A)
     { *x0A = x0; *y0A = y0; *r0A = r0; *x1A = x1; *y1A = y1; *r1A = r1; }
 
-  virtual void getParameterRange(double *lower, double *upper,
+  void getParameterRange(double *lower, double *upper,
 				 double xMin, double yMin,
-				 double xMax, double yMax);
+				 double xMax, double yMax) override;
 
-  virtual double getDistance(double tMin, double tMax);
+  double getDistance(double tMin, double tMax) override;
 
 private:
 
@@ -1030,11 +1045,11 @@
 			    int (*trianglesA)[3], int nTrianglesA,
 			    Function **funcsA, int nFuncsA);
   GfxGouraudTriangleShading(GfxGouraudTriangleShading *shading);
-  virtual ~GfxGouraudTriangleShading();
+  ~GfxGouraudTriangleShading();
 
   static GfxGouraudTriangleShading *parse(GfxResources *res, int typeA, Dict *dict, Stream *str, OutputDev *out, GfxState *state);
 
-  virtual GfxShading *copy();
+  GfxShading *copy() override;
 
   int getNTriangles() { return nTriangles; }
 
@@ -1116,11 +1131,11 @@
   GfxPatchMeshShading(int typeA, GfxPatch *patchesA, int nPatchesA,
 		      Function **funcsA, int nFuncsA);
   GfxPatchMeshShading(GfxPatchMeshShading *shading);
-  virtual ~GfxPatchMeshShading();
+  ~GfxPatchMeshShading();
 
   static GfxPatchMeshShading *parse(GfxResources *res, int typeA, Dict *dict, Stream *str, OutputDev *out, GfxState *state);
 
-  virtual GfxShading *copy();
+  GfxShading *copy() override;
 
   int getNPatches() { return nPatches; }
   GfxPatch *getPatch(int i) { return &patches[i]; }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParams.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParams.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParams.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005, 2007-2010, 2012, 2015 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2007-2010, 2012, 2015, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
@@ -31,10 +31,12 @@
 // Copyright (C) 2011 Pino Toscano <pino at kde.org>
 // Copyright (C) 2011 Koji Otani <sho at bbr.jp>
 // Copyright (C) 2012 Yi Yang <ahyangyi at gmail.com>
-// Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2012 Peter Breitenlohner <peb at mppmu.mpg.de>
 // Copyright (C) 2013, 2014 Jason Crain <jason at aquaticape.us>
+// Copyright (C) 2017 Christoph Cullmann <cullmann at kde.org>
+// Copyright (C) 2017 Jean Ghali <jghali at libertysurf.fr>
 //
 // 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
@@ -59,6 +61,7 @@
 #  include <shlobj.h>
 #  include <mbstring.h>
 #endif
+#include "goo/glibc.h"
 #include "goo/gmem.h"
 #include "goo/GooString.h"
 #include "goo/GooList.h"
@@ -77,17 +80,17 @@
 #include "GlobalParams.h"
 #include "GfxFont.h"
 
-#if WITH_FONTCONFIGURATION_FONTCONFIG
+#ifdef WITH_FONTCONFIGURATION_FONTCONFIG
 #include <fontconfig/fontconfig.h>
 #endif
 
-#ifdef _WIN32
+#ifdef _MSC_VER
 #  define strcasecmp stricmp
 #else
 #  include <strings.h>
 #endif
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define lockGlobalParams            gLockMutex(&mutex)
 #  define lockUnicodeMapCache         gLockMutex(&unicodeMapCacheMutex)
 #  define lockCMapCache               gLockMutex(&cMapCacheMutex)
@@ -109,7 +112,7 @@
 
 #include "NameToUnicodeTable.h"
 #include "UnicodeMapTables.h"
-#include "UTF8.h"
+#include "UnicodeMapFuncs.h"
 
 #ifdef ENABLE_PLUGINS
 #  ifdef _WIN32
@@ -126,46 +129,33 @@
 
 GlobalParams *globalParams = NULL;
 
-//------------------------------------------------------------------------
-// PSFontParam16
-//------------------------------------------------------------------------
+#if defined(ENABLE_RELOCATABLE) && defined(_WIN32)
 
-PSFontParam16::PSFontParam16(GooString *nameA, int wModeA,
-			     GooString *psFontNameA, GooString *encodingA) {
-  name = nameA;
-  wMode = wModeA;
-  psFontName = psFontNameA;
-  encoding = encodingA;
-}
-
-PSFontParam16::~PSFontParam16() {
-  delete name;
-  delete psFontName;
-  delete encoding;
-}
-
-#if ENABLE_RELOCATABLE && defined(_WIN32)
-
 /* search for data relative to where we are installed */
 
 static HMODULE hmodule;
 
 extern "C" {
-BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
-	 DWORD     fdwReason,
-	 LPVOID    lpvReserved)
-{
-  switch (fdwReason)
-    {
-    case DLL_PROCESS_ATTACH:
-      hmodule = hinstDLL;
-      break;
+  /* Provide declaration to squelch -Wmissing-declarations warning */
+  BOOL WINAPI
+  DllMain (HINSTANCE hinstDLL,
+	   DWORD     fdwReason,
+	   LPVOID    lpvReserved);
+
+  BOOL WINAPI
+  DllMain (HINSTANCE hinstDLL,
+	   DWORD     fdwReason,
+	   LPVOID    lpvReserved)
+  {
+    switch (fdwReason) {
+      case DLL_PROCESS_ATTACH:
+	hmodule = hinstDLL;
+	break;
     }
 
-  return TRUE;
+    return TRUE;
+  }
 }
-}
 
 static const char *
 get_poppler_datadir (void)
@@ -178,7 +168,7 @@
   if (beenhere)
     return retval;
 
-  if (!GetModuleFileName (hmodule, (CHAR *) retval, sizeof(retval) - 20))
+  if (!GetModuleFileNameA (hmodule, (CHAR *) retval, sizeof(retval) - 20))
     return POPPLER_DATADIR;
 
   p = _mbsrchr ((unsigned char *) retval, '\\');
@@ -270,7 +260,7 @@
   ~SysFontList();
   SysFontInfo *find(GooString *name, GBool isFixedWidth, GBool exact);
 
-#ifdef WIN32
+#ifdef _WIN32
   void scanWindowsFonts(GooString *winFontDir);
 #endif
 #ifdef WITH_FONTCONFIGURATION_FONTCONFIG
@@ -278,7 +268,7 @@
 #endif
 private:
 
-#ifdef WIN32
+#ifdef _WIN32
   SysFontInfo *makeWindowsFont(char *name, int fontNum,
 			       char *path);
 #endif
@@ -557,7 +547,7 @@
   UnicodeMap *map;
   int i;
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
   gInitMutex(&unicodeMapCacheMutex);
   gInitMutex(&cMapCacheMutex);
@@ -586,17 +576,10 @@
   cMapDirs = new GooHash(gTrue);
   toUnicodeDirs = new GooList();
   fontFiles = new GooHash(gTrue);
-  fontDirs = new GooList();
-  ccFontFiles = new GooHash(gTrue);
   sysFonts = new SysFontList();
   psExpandSmaller = gFalse;
   psShrinkLarger = gTrue;
-  psCenter = gTrue;
   psLevel = psLevel2;
-  psFile = NULL;
-  psResidentFonts = new GooHash(gTrue);
-  psResidentFonts16 = new GooList();
-  psResidentFontsCC = new GooList();
   textEncoding = new GooString("UTF-8");
 #if defined(_WIN32)
   textEOL = eolDOS;
@@ -606,19 +589,8 @@
   textEOL = eolUnix;
 #endif
   textPageBreaks = gTrue;
-  textKeepTinyChars = gFalse;
   enableFreeType = gTrue;
-  strokeAdjust = gTrue;
-  screenType = screenUnset;
-  screenSize = -1;
-  screenDotRadius = -1;
-  screenGamma = 1.0;
-  screenBlackThreshold = 0.0;
-  screenWhiteThreshold = 1.0;
-  minLineWidth = 0.0;
   overprintPreview = gFalse;
-  mapNumericCharNames = gTrue;
-  mapUnknownCharNames = gTrue;
   printCommands = gFalse;
   profileCommands = gFalse;
   errQuiet = gFalse;
@@ -659,7 +631,7 @@
   residentUnicodeMaps->add(map->getEncodingName(), map);
   map = new UnicodeMap("UTF-8", gTrue, &mapUTF8);
   residentUnicodeMaps->add(map->getEncodingName(), map);
-  map = new UnicodeMap("UCS-2", gTrue, &mapUCS2);
+  map = new UnicodeMap("UTF-16", gTrue, &mapUTF16);
   residentUnicodeMaps->add(map->getEncodingName(), map);
 
   scanEncodingDirs();
@@ -795,18 +767,10 @@
   deleteGooHash(unicodeMaps, GooString);
   deleteGooList(toUnicodeDirs, GooString);
   deleteGooHash(fontFiles, GooString);
-  deleteGooList(fontDirs, GooString);
-  deleteGooHash(ccFontFiles, GooString);
 #ifdef _WIN32
   deleteGooHash(substFiles, GooString);
 #endif
   delete sysFonts;
-  if (psFile) {
-    delete psFile;
-  }
-  deleteGooHash(psResidentFonts, GooString);
-  deleteGooList(psResidentFonts16, PSFontParam16);
-  deleteGooList(psResidentFontsCC, PSFontParam16);
   delete textEncoding;
 
   GooHashIter *iter;
@@ -829,7 +793,7 @@
   deleteGooList(plugins, Plugin);
 #endif
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
   gDestroyMutex(&unicodeMapCacheMutex);
   gDestroyMutex(&cMapCacheMutex);
@@ -930,7 +894,7 @@
   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;
@@ -1104,14 +1068,7 @@
 #endif
 
 GooString *GlobalParams::findFontFile(GooString *fontName) {
-  static const char *exts[] = { ".pfa", ".pfb", ".ttf", ".ttc", ".otf" };
-  GooString *path, *dir;
-#ifdef WIN32
-  GooString *fontNameU;
-#endif
-  const char *ext;
-  FILE *f;
-  int i, j;
+  GooString *path;
 
   setupBaseFonts(NULL);
   lockGlobalParams;
@@ -1120,26 +1077,6 @@
     unlockGlobalParams;
     return path;
   }
-  for (i = 0; i < fontDirs->getLength(); ++i) {
-    dir = (GooString *)fontDirs->get(i);
-    for (j = 0; j < (int)(sizeof(exts) / sizeof(exts[0])); ++j) {
-      ext = exts[j];
-#ifdef WIN32
-      fontNameU = fileNameToUTF8(fontName->getCString());
-      path = appendToPath(dir->copy(), fontNameU->getCString());
-      delete fontNameU;
-#else
-      path = appendToPath(dir->copy(), fontName->getCString());
-#endif
-      path->append(ext);
-      if ((f = openFile(path->getCString(), "rb"))) {
-	fclose(f);
-	unlockGlobalParams;
-	return path;
-      }
-      delete path;
-    }
-  }
   unlockGlobalParams;
   return NULL;
 }
@@ -1147,7 +1084,7 @@
 /* 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) {
 }
@@ -1424,18 +1361,6 @@
 }
 #endif
 
-GooString *GlobalParams::findCCFontFile(GooString *collection) {
-  GooString *path;
-
-  lockGlobalParams;
-  if ((path = (GooString *)ccFontFiles->lookup(collection))) {
-    path = path->copy();
-  }
-  unlockGlobalParams;
-  return path;
-}
-
-
 GBool GlobalParams::getPSExpandSmaller() {
   GBool f;
 
@@ -1454,15 +1379,6 @@
   return f;
 }
 
-GBool GlobalParams::getPSCenter() {
-  GBool f;
-
-  lockGlobalParams;
-  f = psCenter;
-  unlockGlobalParams;
-  return f;
-}
-
 PSLevel GlobalParams::getPSLevel() {
   PSLevel level;
 
@@ -1472,67 +1388,6 @@
   return level;
 }
 
-GooString *GlobalParams::getPSResidentFont(GooString *fontName) {
-  GooString *psName;
-
-  lockGlobalParams;
-  psName = (GooString *)psResidentFonts->lookup(fontName);
-  unlockGlobalParams;
-  return psName;
-}
-
-GooList *GlobalParams::getPSResidentFonts() {
-  GooList *names;
-  GooHashIter *iter;
-  GooString *name;
-  GooString *psName;
-
-  names = new GooList();
-  lockGlobalParams;
-  psResidentFonts->startIter(&iter);
-  while (psResidentFonts->getNext(&iter, &name, (void **)&psName)) {
-    names->append(psName->copy());
-  }
-  unlockGlobalParams;
-  return names;
-}
-
-PSFontParam16 *GlobalParams::getPSResidentFont16(GooString *fontName,
-						 int wMode) {
-  PSFontParam16 *p;
-  int i;
-
-  lockGlobalParams;
-  p = NULL;
-  for (i = 0; i < psResidentFonts16->getLength(); ++i) {
-    p = (PSFontParam16 *)psResidentFonts16->get(i);
-    if (!(p->name->cmp(fontName)) && p->wMode == wMode) {
-      break;
-    }
-    p = NULL;
-  }
-  unlockGlobalParams;
-  return p;
-}
-
-PSFontParam16 *GlobalParams::getPSResidentFontCC(GooString *collection,
-						 int wMode) {
-  PSFontParam16 *p;
-  int i;
-
-  lockGlobalParams;
-  p = NULL;
-  for (i = 0; i < psResidentFontsCC->getLength(); ++i) {
-    p = (PSFontParam16 *)psResidentFontsCC->get(i);
-    if (!(p->name->cmp(collection)) && p->wMode == wMode) {
-      break;
-    }
-    p = NULL;
-  }
-  unlockGlobalParams;
-  return p;
-}
-
 GooString *GlobalParams::getTextEncodingName() {
   GooString *s;
 
@@ -1560,15 +1415,6 @@
   return pageBreaks;
 }
 
-GBool GlobalParams::getTextKeepTinyChars() {
-  GBool tiny;
-
-  lockGlobalParams;
-  tiny = textKeepTinyChars;
-  unlockGlobalParams;
-  return tiny;
-}
-
 GBool GlobalParams::getEnableFreeType() {
   GBool f;
 
@@ -1578,96 +1424,6 @@
   return f;
 }
 
-GBool GlobalParams::getStrokeAdjust() {
-  GBool f;
-
-  lockGlobalParams;
-  f = strokeAdjust;
-  unlockGlobalParams;
-  return f;
-}
-
-ScreenType GlobalParams::getScreenType() {
-  ScreenType t;
-
-  lockGlobalParams;
-  t = screenType;
-  unlockGlobalParams;
-  return t;
-}
-
-int GlobalParams::getScreenSize() {
-  int size;
-
-  lockGlobalParams;
-  size = screenSize;
-  unlockGlobalParams;
-  return size;
-}
-
-int GlobalParams::getScreenDotRadius() {
-  int r;
-
-  lockGlobalParams;
-  r = screenDotRadius;
-  unlockGlobalParams;
-  return r;
-}
-
-double GlobalParams::getScreenGamma() {
-  double gamma;
-
-  lockGlobalParams;
-  gamma = screenGamma;
-  unlockGlobalParams;
-  return gamma;
-}
-
-double GlobalParams::getScreenBlackThreshold() {
-  double thresh;
-
-  lockGlobalParams;
-  thresh = screenBlackThreshold;
-  unlockGlobalParams;
-  return thresh;
-}
-
-double GlobalParams::getScreenWhiteThreshold() {
-  double thresh;
-
-  lockGlobalParams;
-  thresh = screenWhiteThreshold;
-  unlockGlobalParams;
-  return thresh;
-}
-
-double GlobalParams::getMinLineWidth() {
-  double minLineWidthA;
-
-  lockGlobalParams;
-  minLineWidthA = minLineWidth;
-  unlockGlobalParams;
-  return minLineWidthA;
-}
-
-GBool GlobalParams::getMapNumericCharNames() {
-  GBool map;
-
-  lockGlobalParams;
-  map = mapNumericCharNames;
-  unlockGlobalParams;
-  return map;
-}
-
-GBool GlobalParams::getMapUnknownCharNames() {
-  GBool map;
-
-  lockGlobalParams;
-  map = mapUnknownCharNames;
-  unlockGlobalParams;
-  return map;
-}
-
 GBool GlobalParams::getPrintCommands() {
   GBool p;
 
@@ -1790,15 +1546,6 @@
   unlockGlobalParams;
 }
 
-void GlobalParams::setPSFile(char *file) {
-  lockGlobalParams;
-  if (psFile) {
-    delete psFile;
-  }
-  psFile = new GooString(file);
-  unlockGlobalParams;
-}
-
 void GlobalParams::setPSExpandSmaller(GBool expand) {
   lockGlobalParams;
   psExpandSmaller = expand;
@@ -1811,12 +1558,6 @@
   unlockGlobalParams;
 }
 
-void GlobalParams::setPSCenter(GBool center) {
-  lockGlobalParams;
-  psCenter = center;
-  unlockGlobalParams;
-}
-
 void GlobalParams::setPSLevel(PSLevel level) {
   lockGlobalParams;
   psLevel = level;
@@ -1852,12 +1593,6 @@
   unlockGlobalParams;
 }
 
-void GlobalParams::setTextKeepTinyChars(GBool keep) {
-  lockGlobalParams;
-  textKeepTinyChars = keep;
-  unlockGlobalParams;
-}
-
 GBool GlobalParams::setEnableFreeType(char *s) {
   GBool ok;
 
@@ -1867,71 +1602,6 @@
   return ok;
 }
 
-GBool GlobalParams::setDisableFreeTypeHinting(char *s) {
-  GBool ok;
-
-  lockGlobalParams;
-  ok = parseYesNo2(s, &disableFreeTypeHinting);
-  unlockGlobalParams;
-  return ok;
-}
-
-void GlobalParams::setStrokeAdjust(GBool adjust)
-{
-  lockGlobalParams;
-  strokeAdjust = adjust;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setScreenType(ScreenType st)
-{
-  lockGlobalParams;
-  screenType = st;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setScreenSize(int size)
-{
-  lockGlobalParams;
-  screenSize = size;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setScreenDotRadius(int radius)
-{
-  lockGlobalParams;
-  screenDotRadius = radius;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setScreenGamma(double gamma)
-{
-  lockGlobalParams;
-  screenGamma = gamma;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setScreenBlackThreshold(double blackThreshold)
-{
-  lockGlobalParams;
-  screenBlackThreshold = blackThreshold;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setScreenWhiteThreshold(double whiteThreshold)
-{
-  lockGlobalParams;
-  screenWhiteThreshold = whiteThreshold;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setMinLineWidth(double minLineWidthA)
-{
-  lockGlobalParams;
-  minLineWidth = minLineWidthA;
-  unlockGlobalParams;
-}
-
 void GlobalParams::setOverprintPreview(GBool overprintPreviewA) {
   lockGlobalParams;
   overprintPreview = overprintPreviewA;
@@ -1938,18 +1608,6 @@
   unlockGlobalParams;
 }
 
-void GlobalParams::setMapNumericCharNames(GBool map) {
-  lockGlobalParams;
-  mapNumericCharNames = map;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setMapUnknownCharNames(GBool map) {
-  lockGlobalParams;
-  mapUnknownCharNames = map;
-  unlockGlobalParams;
-}
-
 void GlobalParams::setPrintCommands(GBool printCommandsA) {
   lockGlobalParams;
   printCommands = printCommandsA;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParams.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParams.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParams.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2005, 2007-2010, 2012, 2015 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2007-2010, 2012, 2015, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
@@ -23,7 +23,7 @@
 // Copyright (C) 2009, 2011, 2012, 2014, 2015 William Bader <williambader at hotmail.com>
 // Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
 // Copyright (C) 2011 Pino Toscano <pino at kde.org>
-// Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2013 Jason Crain <jason at aquaticape.us>
 //
@@ -45,7 +45,7 @@
 #include "goo/gtypes.h"
 #include "CharTypes.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #include "goo/GooMutex.h"
 #endif
 
@@ -81,22 +81,6 @@
 
 //------------------------------------------------------------------------
 
-class PSFontParam16 {
-public:
-
-  GooString *name;		// PDF font name for psResidentFont16;
-				//   char collection name for psResidentFontCC
-  int wMode;			// writing mode (0=horiz, 1=vert)
-  GooString *psFontName;		// PostScript font name
-  GooString *encoding;		// encoding
-
-  PSFontParam16(GooString *nameA, int wModeA,
-		GooString *psFontNameA, GooString *encodingA);
-  ~PSFontParam16();
-};
-
-//------------------------------------------------------------------------
-
 enum PSLevel {
   psLevel1,
   psLevel1Sep,
@@ -116,20 +100,10 @@
 
 //------------------------------------------------------------------------
 
-enum ScreenType {
-  screenUnset,
-  screenDispersed,
-  screenClustered,
-  screenStochasticClustered
-};
-
-//------------------------------------------------------------------------
-
 class GlobalParams {
 public:
 
-  // Initialize the global parameters by attempting to read a config
-  // file.
+  // Initialize the global parameters
   GlobalParams(const char *customPopplerDataDir = NULL);
 
   ~GlobalParams();
@@ -157,31 +131,14 @@
   GooString *findSystemFontFile(GfxFont *font, SysFontType *type,
 			      int *fontNum, GooString *substituteFontName = NULL, 
 		              GooString *base14Name = NULL);
-  GooString *findCCFontFile(GooString *collection);
   GBool getPSExpandSmaller();
   GBool getPSShrinkLarger();
-  GBool getPSCenter();
   PSLevel getPSLevel();
-  GooString *getPSResidentFont(GooString *fontName);
-  GooList *getPSResidentFonts();
-  PSFontParam16 *getPSResidentFont16(GooString *fontName, int wMode);
-  PSFontParam16 *getPSResidentFontCC(GooString *collection, int wMode);
   GooString *getTextEncodingName();
   EndOfLineKind getTextEOL();
   GBool getTextPageBreaks();
-  GBool getTextKeepTinyChars();
   GBool getEnableFreeType();
-  GBool getStrokeAdjust();
-  ScreenType getScreenType();
-  int getScreenSize();
-  int getScreenDotRadius();
-  double getScreenGamma();
-  double getScreenBlackThreshold();
-  double getScreenWhiteThreshold();
-  double getMinLineWidth();
   GBool getOverprintPreview() { return overprintPreview; }
-  GBool getMapNumericCharNames();
-  GBool getMapUnknownCharNames();
   GBool getPrintCommands();
   GBool getProfileCommands();
   GBool getErrQuiet();
@@ -199,28 +156,14 @@
 
   //----- functions to set parameters
   void addFontFile(GooString *fontName, GooString *path);
-  void setPSFile(char *file);
   void setPSExpandSmaller(GBool expand);
   void setPSShrinkLarger(GBool shrink);
-  void setPSCenter(GBool center);
   void setPSLevel(PSLevel level);
   void setTextEncoding(char *encodingName);
   GBool setTextEOL(char *s);
   void setTextPageBreaks(GBool pageBreaks);
-  void setTextKeepTinyChars(GBool keep);
   GBool setEnableFreeType(char *s);
-  GBool setDisableFreeTypeHinting(char *s);
-  void setStrokeAdjust(GBool strokeAdjust);
-  void setScreenType(ScreenType st);
-  void setScreenSize(int size);
-  void setScreenDotRadius(int radius);
-  void setScreenGamma(double gamma);
-  void setScreenBlackThreshold(double blackThreshold);
-  void setScreenWhiteThreshold(double whiteThreshold);
-  void setMinLineWidth(double minLineWidth);
   void setOverprintPreview(GBool overprintPreviewA);
-  void setMapNumericCharNames(GBool map);
-  void setMapUnknownCharNames(GBool map);
   void setPrintCommands(GBool printCommandsA);
   void setProfileCommands(GBool profileCommandsA);
   void setErrQuiet(GBool errQuietA);
@@ -271,47 +214,20 @@
 #endif
   GooHash *fontFiles;		// font files: font name mapped to path
 				//   [GString]
-  GooList *fontDirs;		// list of font dirs [GString]
-  GooHash *ccFontFiles;	// character collection font files:
-				//   collection name  mapped to path [GString]
   SysFontList *sysFonts;	// system fonts
-  GooString *psFile;		// PostScript file or command (for xpdf)
   GBool psExpandSmaller;	// expand smaller pages to fill paper
   GBool psShrinkLarger;		// shrink larger pages to fit paper
-  GBool psCenter;		// center pages on the paper
   PSLevel psLevel;		// PostScript level to generate
-  GooHash *psResidentFonts;	// 8-bit fonts resident in printer:
-				//   PDF font name mapped to PS font name
-				//   [GString]
-  GooList *psResidentFonts16;	// 16-bit fonts resident in printer:
-				//   PDF font name mapped to font info
-				//   [PSFontParam16]
-  GooList *psResidentFontsCC;	// 16-bit character collection fonts
-				//   resident in printer: collection name
-				//   mapped to font info [PSFontParam16]
   GooString *textEncoding;	// encoding (unicodeMap) to use for text
 				//   output
   EndOfLineKind textEOL;	// type of EOL marker to use for text
 				//   output
   GBool textPageBreaks;		// insert end-of-page markers?
-  GBool textKeepTinyChars;	// keep all characters in text output
   GBool enableFreeType;		// FreeType enable flag
-  GBool disableFreeTypeHinting;	// FreeType disable hinting flag
-  GBool strokeAdjust;		// stroke adjustment enable flag
-  ScreenType screenType;	// halftone screen type
-  int screenSize;		// screen matrix size
-  int screenDotRadius;		// screen dot radius
-  double screenGamma;		// screen gamma correction
-  double screenBlackThreshold;	// screen black clamping threshold
-  double screenWhiteThreshold;	// screen white clamping threshold
-  double minLineWidth;		// minimum line width
   GBool overprintPreview;	// enable overprint preview
-  GBool mapNumericCharNames;	// map numeric char names (from font subsets)?
-  GBool mapUnknownCharNames;	// map unknown char names?
   GBool printCommands;		// print the drawing commands
   GBool profileCommands;	// profile the drawing commands
   GBool errQuiet;		// suppress error messages?
-  double splashResolution;	// resolution when rasterizing images
 
   CharCodeToUnicodeCache *cidToUnicodeCache;
   CharCodeToUnicodeCache *unicodeToUnicodeCache;
@@ -324,7 +240,7 @@
 				//   [XpdfSecurityHandler]
 #endif
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
   GooMutex mutex;
   GooMutex unicodeMapCacheMutex;
   GooMutex cMapCacheMutex;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/GlobalParamsWin.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -4,10 +4,12 @@
    // Copyright (C) 2010, 2012 Hib Eris <hib at hiberis.nl>
    // Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
    // Copyright (C) 2012 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
-   // Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+   // Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
    // Copyright (C) 2012 Mark Brand <mabrand at mabrand.nl>
    // Copyright (C) 2013 Adam Reichold <adamreichold at myopera.com>
    // Copyright (C) 2013 Dmytro Morgun <lztoad at gmail.com>
+   // Copyright (C) 2017 Christoph Cullmann <cullmann at kde.org>
+   // Copyright (C) 2017 Albert Astals Cid <aacid at kde.org>
 
 TODO: instead of a fixed mapping defined in displayFontTab, it could
 scan the whole fonts directory, parse TTF files and build font
@@ -52,7 +54,7 @@
 #include "Lexer.h"
 #include "Parser.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define lockGlobalParams            gLockMutex(&mutex)
 #  define lockUnicodeMapCache         gLockMutex(&unicodeMapCacheMutex)
 #  define lockCMapCache               gLockMutex(&cMapCacheMutex)
@@ -76,7 +78,7 @@
 #define DEFAULT_CID_FONT_AK1_MSWIN "Batang"    /* Adobe-Korea1 */
 #define DEFAULT_CID_FONT_MSWIN "ArialUnicode"  /* Unknown */
 
-static struct {
+static const struct {
     const char *name;
     const char *t1FileName;
     const char *ttFileName;
@@ -180,7 +182,7 @@
 static void GetWindowsFontDir(char *winFontDir, int cbWinFontDirLen)
 {
     BOOL (__stdcall *SHGetSpecialFolderPathFunc)(HWND  hwndOwner,
-                                                  LPTSTR lpszPath,
+                                                  LPSTR lpszPath,
                                                   int    nFolder,
                                                   BOOL  fCreate);
     HRESULT (__stdcall *SHGetFolderPathFunc)(HWND  hwndOwner,
@@ -187,15 +189,15 @@
                                               int    nFolder,
                                               HANDLE hToken,
                                               DWORD  dwFlags,
-                                              LPTSTR pszPath);
+                                              LPSTR pszPath);
 
     // SHGetSpecialFolderPath isn't available in older versions of shell32.dll (Win95 and
     // WinNT4), so do a dynamic load of ANSI versions.
     winFontDir[0] = '\0';
 
-    HMODULE hLib = LoadLibrary("shell32.dll");
+    HMODULE hLib = LoadLibraryA("shell32.dll");
     if (hLib) {
-        SHGetFolderPathFunc = (HRESULT (__stdcall *)(HWND, int, HANDLE, DWORD, LPTSTR)) 
+        SHGetFolderPathFunc = (HRESULT (__stdcall *)(HWND, int, HANDLE, DWORD, LPSTR))
                               GetProcAddress(hLib, "SHGetFolderPathA");
         if (SHGetFolderPathFunc)
             (*SHGetFolderPathFunc)(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, winFontDir);
@@ -202,7 +204,7 @@
 
         if (!winFontDir[0]) {
             // Try an older function
-            SHGetSpecialFolderPathFunc = (BOOL (__stdcall *)(HWND, LPTSTR, int, BOOL))
+            SHGetSpecialFolderPathFunc = (BOOL (__stdcall *)(HWND, LPSTR, int, BOOL))
                                           GetProcAddress(hLib, "SHGetSpecialFolderPathA");
             if (SHGetSpecialFolderPathFunc)
                 (*SHGetSpecialFolderPathFunc)(NULL, winFontDir, CSIDL_FONTS, FALSE);
@@ -213,9 +215,9 @@
         return;
 
     // Try older DLL
-    hLib = LoadLibrary("SHFolder.dll");
+    hLib = LoadLibraryA("SHFolder.dll");
     if (hLib) {
-        SHGetFolderPathFunc = (HRESULT (__stdcall *)(HWND, int, HANDLE, DWORD, LPTSTR))
+        SHGetFolderPathFunc = (HRESULT (__stdcall *)(HWND, int, HANDLE, DWORD, LPSTR))
                               GetProcAddress(hLib, "SHGetFolderPathA");
         if (SHGetFolderPathFunc)
             (*SHGetFolderPathFunc)(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, winFontDir);
@@ -225,7 +227,7 @@
         return;
 
     // Everything else failed so the standard fonts directory.
-    GetWindowsDirectory(winFontDir, cbWinFontDirLen);                                                       
+    GetWindowsDirectoryA(winFontDir, cbWinFontDirLen);
     if (winFontDir[0]) {
         strncat(winFontDir, FONTS_SUBDIR, cbWinFontDirLen);
         winFontDir[cbWinFontDirLen-1] = 0;
@@ -259,7 +261,7 @@
   } else {
     path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts\\";
   }
-  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, path, 0,
+  if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, path, 0,
 		   KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
 		   &regKey) == ERROR_SUCCESS) {
     idx = 0;
@@ -266,7 +268,7 @@
     while (1) {
       valNameLen = sizeof(valName) - 1;
       dataLen = sizeof(data) - 1;
-      if (RegEnumValue(regKey, idx, valName, &valNameLen, NULL,
+      if (RegEnumValueA(regKey, idx, valName, &valNameLen, NULL,
 		       &type, (LPBYTE)data, &dataLen) != ERROR_SUCCESS) {
 	break;
       }
@@ -462,37 +464,28 @@
 
     if (file != NULL) {
       Parser *parser;
-      Object obj1, obj2;
-
-      obj1.initNull();
       parser = new Parser(NULL,
 	      new Lexer(NULL,
-	      new FileStream(file, 0, gFalse, file->size(), &obj1)),
+	      new FileStream(file, 0, gFalse, file->size(), Object(objNull))),
 	      gTrue);
-      obj1.free();
-      parser->getObj(&obj1);
+      Object obj1 = parser->getObj();
       while (!obj1.isEOF()) {
-	    parser->getObj(&obj2);
+	    Object obj2 = parser->getObj();
 	    if (obj1.isName()) {
 	      // Substitutions
 	      if (obj2.isDict()) {
-	        Object obj3;
-	        obj2.getDict()->lookup("Path", &obj3);
+	        Object obj3 = obj2.getDict()->lookup("Path");
 	        if (obj3.isString())
 	          addFontFile(new GooString(obj1.getName()), obj3.getString()->copy());
-	        obj3.free();
 	      // Aliases
 	      } else if (obj2.isName()) {
 	        substFiles->add(new GooString(obj1.getName()), new GooString(obj2.getName()));
 	      }
 	    }
-	    obj2.free();
-	    obj1.free();
-	    parser->getObj(&obj1);
+	    obj1 = parser->getObj();
 	    // skip trailing ';'
 	    while (obj1.isCmd(";")) {
-	      obj1.free();
-	      parser->getObj(&obj1);
+	      obj1 = parser->getObj();
 	    }
       }
       delete file;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Hints.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Hints.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Hints.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -5,7 +5,7 @@
 // This file is licensed under the GPLv2 or later
 //
 // Copyright 2010, 2012 Hib Eris <hib at hiberis.nl>
-// Copyright 2010, 2011, 2013, 2014, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright 2010, 2011, 2013, 2014, 2016, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright 2010, 2013 Pino Toscano <pino at kde.org>
 // Copyright 2013 Adrian Johnson <ajohnson at redneon.com>
 // Copyright 2014 Fabio D'Urso <fabiodurso at hotmail.it>
@@ -181,7 +181,6 @@
   hintsLength2 = linearization->getHintsLength2();
 
   Parser *parser;
-  Object obj;
 
   int bufLength = hintsLength + hintsLength2;
 
@@ -188,35 +187,32 @@
   std::vector<char> buf(bufLength);
   char *p = &buf[0];
 
-  obj.initNull();
-  Stream *s = str->makeSubStream(hintsOffset, gFalse, hintsLength, &obj);
+  Stream *s = str->makeSubStream(hintsOffset, gFalse, hintsLength, Object(objNull));
   s->reset();
   for (Guint i=0; i < hintsLength; i++) { *p++ = s->getChar(); }
   delete s;
 
   if (hintsOffset2 && hintsLength2) {
-    obj.initNull();
-    s = str->makeSubStream(hintsOffset2, gFalse, hintsLength2, &obj);
+    s = str->makeSubStream(hintsOffset2, gFalse, hintsLength2, Object(objNull));
     s->reset();
     for (Guint i=0; i < hintsLength2; i++) { *p++ = s->getChar(); }
     delete s;
   }
 
-  obj.initNull();
-  MemStream *memStream = new MemStream (&buf[0], 0, bufLength, &obj);
+  MemStream *memStream = new MemStream (&buf[0], 0, bufLength, Object(objNull));
 
-  obj.initNull();
   parser = new Parser(xref, new Lexer(xref, memStream), gTrue);
 
   int num, gen;
-  if (parser->getObj(&obj)->isInt() &&
-     (num = obj.getInt(), obj.free(), parser->getObj(&obj)->isInt()) &&
-     (gen = obj.getInt(), obj.free(), parser->getObj(&obj)->isCmd("obj")) &&
-     (obj.free(), parser->getObj(&obj, gFalse,
+  Object obj;
+  if ((obj = parser->getObj(), obj.isInt()) &&
+     (num = obj.getInt(), obj = parser->getObj(), obj.isInt()) &&
+     (gen = obj.getInt(), obj = parser->getObj(), obj.isCmd("obj")) &&
+     (obj = parser->getObj(gFalse,
          secHdlr ? secHdlr->getFileKey() : (Guchar *)NULL,
          secHdlr ? secHdlr->getEncAlgorithm() : cryptRC4,
          secHdlr ? secHdlr->getFileKeyLength() : 0,
-         num, gen, 0, gTrue)->isStream())) {
+         num, gen, 0, gTrue), obj.isStream())) {
     Stream *hintsStream = obj.getStream();
     Dict *hintsDict = obj.streamGetDict();
 
@@ -238,7 +234,6 @@
   } else {
     error(errSyntaxWarning, -1, "Failed parsing hints table object");
   }
-  obj.free();
 
   delete parser;
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/JBIG2Stream.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/JBIG2Stream.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/JBIG2Stream.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2006 Raj Kumar <rkumar at archive.org>
 // Copyright (C) 2006 Paul Walmsley <paul at booyaka.com>
-// Copyright (C) 2006-2010, 2012, 2014-2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006-2010, 2012, 2014-2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 David Benjamin <davidben at mit.edu>
 // Copyright (C) 2011 Edward Jiang <ejiang at google.com>
 // Copyright (C) 2012 William Bader <williambader at hotmail.com>
@@ -674,8 +674,8 @@
 public:
 
   JBIG2Bitmap(Guint segNumA, int wA, int hA);
-  virtual ~JBIG2Bitmap();
-  virtual JBIG2SegmentType getType() { return jbig2SegBitmap; }
+  ~JBIG2Bitmap();
+  JBIG2SegmentType getType() override { return jbig2SegBitmap; }
   JBIG2Bitmap *copy() { return new JBIG2Bitmap(0, this); }
   JBIG2Bitmap *getSlice(Guint x, Guint y, Guint wA, Guint hA);
   void expand(int newH, Guint pixel);
@@ -760,6 +760,10 @@
   JBIG2Bitmap *slice;
   Guint xx, yy;
 
+  if (!data) {
+      return nullptr;
+  }
+
   slice = new JBIG2Bitmap(0, wA, hA);
   if (slice->isOk()) {
     slice->clearToZero();
@@ -892,7 +896,7 @@
   oneByte = x0 == ((x1 - 1) & ~7);
 
   for (yy = y0; yy < y1; ++yy) {
-    if (unlikely(y + yy) >= h)
+    if (unlikely((y + yy >= h) || (y + yy < 0)))
       continue;
 
     // one byte per line -- need to mask both left and right side
@@ -1046,8 +1050,8 @@
 public:
 
   JBIG2SymbolDict(Guint segNumA, Guint sizeA);
-  virtual ~JBIG2SymbolDict();
-  virtual JBIG2SegmentType getType() { return jbig2SegSymbolDict; }
+  ~JBIG2SymbolDict();
+  JBIG2SegmentType getType() override { return jbig2SegSymbolDict; }
   Guint getSize() { return size; }
   void setBitmap(Guint idx, JBIG2Bitmap *bitmap) { bitmaps[idx] = bitmap; }
   JBIG2Bitmap *getBitmap(Guint idx) { return bitmaps[idx]; }
@@ -1107,8 +1111,8 @@
 public:
 
   JBIG2PatternDict(Guint segNumA, Guint sizeA);
-  virtual ~JBIG2PatternDict();
-  virtual JBIG2SegmentType getType() { return jbig2SegPatternDict; }
+  ~JBIG2PatternDict();
+  JBIG2SegmentType getType() override { return jbig2SegPatternDict; }
   Guint getSize() { return size; }
   void setBitmap(Guint idx, JBIG2Bitmap *bitmap) { if (likely(idx < size)) bitmaps[idx] = bitmap; }
   JBIG2Bitmap *getBitmap(Guint idx) { return (idx < size) ? bitmaps[idx] : NULL; }
@@ -1148,8 +1152,8 @@
 public:
 
   JBIG2CodeTable(Guint segNumA, JBIG2HuffmanTable *tableA);
-  virtual ~JBIG2CodeTable();
-  virtual JBIG2SegmentType getType() { return jbig2SegCodeTable; }
+  ~JBIG2CodeTable();
+  JBIG2SegmentType getType() override { return jbig2SegCodeTable; }
   JBIG2HuffmanTable *getHuffTable() { return table; }
 
 private:
@@ -1197,7 +1201,7 @@
   mmrDecoder = new JBIG2MMRDecoder();
 
   if (globalsStreamA->isStream()) {
-    globalsStreamA->copy(&globalsStream);
+    globalsStream = globalsStreamA->copy();
     if (globalsStreamRefA->isRef())
       globalsStreamRef = globalsStreamRefA->getRef();
   }
@@ -1209,7 +1213,6 @@
 
 JBIG2Stream::~JBIG2Stream() {
   close();
-  globalsStream.free();
   delete arithDecoder;
   delete genericRegionStats;
   delete refinementRegionStats;
@@ -1304,7 +1307,7 @@
 int JBIG2Stream::getChars(int nChars, Guchar *buffer) {
   int n, i;
 
-  if (nChars <= 0) {
+  if (nChars <= 0 || !dataPtr) {
     return 0;
   }
   if (dataEnd - dataPtr < nChars) {
@@ -2961,8 +2964,8 @@
     mmrDecoder->reset();
     if (w > INT_MAX - 2) {
       error(errSyntaxError, curStr->getPos(), "Bad width in JBIG2 generic bitmap");
-      // force a call to gmalloc(-1), which will throw an exception
-      w = -3;
+      delete bitmap;
+      return NULL;
     }
     // 0 <= codingLine[0] < codingLine[1] < ... < codingLine[n] = w
     // ---> max codingLine size = w + 1
@@ -3827,6 +3830,10 @@
   JBIG2BitmapPtr tpgrCXPtr2 = {0};
   int x, y, pix;
 
+  if (!refBitmap) {
+      return nullptr;
+  }
+
   bitmap = new JBIG2Bitmap(0, w, h);
   if (!bitmap->isOk())
   {

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/JBIG2Stream.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/JBIG2Stream.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/JBIG2Stream.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -48,21 +48,21 @@
 public:
 
   JBIG2Stream(Stream *strA, Object *globalsStreamA, Object *globalsStreamRefA);
-  virtual ~JBIG2Stream();
-  virtual StreamKind getKind() { return strJBIG2; }
-  virtual void reset();
-  virtual void close();
-  virtual Goffset getPos();
-  virtual int getChar();
-  virtual int lookChar();
-  virtual GooString *getPSFilter(int psLevel, const char *indent);
-  virtual GBool isBinary(GBool last = gTrue);
+  ~JBIG2Stream();
+  StreamKind getKind() override { return strJBIG2; }
+  void reset() override;
+  void close() override;
+  Goffset getPos() override;
+  int getChar() override;
+  int lookChar() override;
+  GooString *getPSFilter(int psLevel, const char *indent) override;
+  GBool isBinary(GBool last = gTrue) override;
   virtual Object *getGlobalsStream() { return &globalsStream; }
   virtual Ref getGlobalsStreamRef() { return globalsStreamRef; }
 
 private:
-  virtual GBool hasGetChars() { return true; }
-  virtual int getChars(int nChars, Guchar *buffer);
+  GBool hasGetChars() override { return true; }
+  int getChars(int nChars, Guchar *buffer) override;
 
   void readSegments();
   GBool readSymbolDictSeg(Guint segNum, Guint length,

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/JPEG2000Stream.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -4,7 +4,7 @@
 //
 // A JPX stream decoder using OpenJPEG
 //
-// Copyright 2008-2010, 2012 Albert Astals Cid <aacid at kde.org>
+// Copyright 2008-2010, 2012, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright 2011 Daniel Glöckner <daniel-gl at gmx.net>
 // Copyright 2014, 2016 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright 2013, 2014 Adrian Johnson <ajohnson at redneon.com>
@@ -24,7 +24,6 @@
 	+ ((minor) *   100)				\
 	+ ((micro) *     1))
 
-#ifdef USE_OPENJPEG2
 #ifdef OPJ_VERSION_MAJOR
 #define OPENJPEG_VERSION OPENJPEG_VERSION_ENCODE(OPJ_VERSION_MAJOR, OPJ_VERSION_MINOR, OPJ_VERSION_BUILD)
 #else
@@ -33,7 +32,6 @@
 // assume there will be no API changes in 2.0.x.
 #define OPENJPEG_VERSION OPENJPEG_VERSION_ENCODE(2, 0, 0)
 #endif
-#endif
 
 struct JPXStreamPrivate {
   opj_image_t *image;
@@ -44,13 +42,7 @@
   GBool indexed;
   GBool inited;
   int smaskInData;
-#ifdef USE_OPENJPEG1
-  opj_dinfo_t *dinfo;
-  void init2(unsigned char *buf, int bufLen, OPJ_CODEC_FORMAT format, GBool indexed);
-#endif
-#ifdef USE_OPENJPEG2
   void init2(OPJ_CODEC_FORMAT format, unsigned char *data, int length, GBool indexed);
-#endif
 };
 
 static inline Guchar adjustComp(int r, int adjust, int depth, int sgndcorr, GBool indexed) {
@@ -90,9 +82,6 @@
   priv->npixels = 0;
   priv->ncomps = 0;
   priv->indexed = gFalse;
-#ifdef USE_OPENJPEG1
-  priv->dinfo = NULL;
-#endif
 }
 
 JPXStream::~JPXStream() {
@@ -112,13 +101,6 @@
     priv->image = NULL;
     priv->npixels = 0;
   }
-
-#ifdef USE_OPENJPEG1
-  if (priv->dinfo != NULL) {
-    opj_destroy_decompress(priv->dinfo);
-    priv->dinfo = NULL;
-  }
-#endif
 }
 
 Goffset JPXStream::getPos() {
@@ -162,13 +144,8 @@
   *bitsPerComponent = 8;
   int numComps = (priv->image) ? priv->image->numcomps : 1;
   if (priv->image) {
-#ifdef USE_OPENJPEG1
-    if (priv->image->color_space == CLRSPC_SRGB && numComps == 4) { numComps = 3; }
-    else if (priv->image->color_space == CLRSPC_SYCC && numComps == 4) { numComps = 3; }
-#else
     if (priv->image->color_space == OPJ_CLRSPC_SRGB && numComps == 4) { numComps = 3; }
     else if (priv->image->color_space == OPJ_CLRSPC_SYCC && numComps == 4) { numComps = 3; }
-#endif
     else if (numComps == 2) { numComps = 1; }
     else if (numComps > 4) { numComps = 4; }
   }
@@ -189,132 +166,6 @@
   error(errSyntaxWarning, -1, "{0:s}", msg);
 }
 
-#ifdef USE_OPENJPEG1
-
-#define BUFFER_INITIAL_SIZE 4096
-
-void JPXStream::init()
-{
-  Object oLen, cspace, smaskInData;
-  if (getDict()) getDict()->lookup("Length", &oLen);
-  if (getDict()) getDict()->lookup("ColorSpace", &cspace);
-  if (getDict()) getDict()->lookup("SMaskInData", &smaskInData);
-
-  int bufSize = BUFFER_INITIAL_SIZE;
-  if (oLen.isInt()) bufSize = oLen.getInt();
-  oLen.free();
-
-  if (cspace.isArray() && cspace.arrayGetLength() > 0) {
-    Object cstype;
-    cspace.arrayGet(0, &cstype);
-    if (cstype.isName("Indexed")) priv->indexed = gTrue;
-    cstype.free();
-  }
-  cspace.free();
-
-  priv->smaskInData = 0;
-  if (smaskInData.isInt()) priv->smaskInData = smaskInData.getInt();
-  smaskInData.free();
-
-  int length = 0;
-  unsigned char *buf = str->toUnsignedChars(&length, bufSize);
-  priv->init2(buf, length, CODEC_JP2, priv->indexed);
-  free(buf);
-
-  if (priv->image) {
-    int numComps = (priv->image) ? priv->image->numcomps : 1;
-    int alpha = 0;
-    if (priv->image) {
-      if (priv->image->color_space == CLRSPC_SRGB && numComps == 4) { numComps = 3; alpha = 1; }
-      else if (priv->image->color_space == CLRSPC_SYCC && numComps == 4) { numComps = 3; alpha = 1; }
-      else if (numComps == 2) { numComps = 1; alpha = 1; }
-      else if (numComps > 4) { numComps = 4; alpha = 1; }
-      else { alpha = 0; }
-    }
-    priv->npixels = priv->image->comps[0].w * priv->image->comps[0].h;
-    priv->ncomps = priv->image->numcomps;
-    if (alpha == 1 && priv->smaskInData == 0) priv->ncomps--;
-    for (int component = 0; component < priv->ncomps; component++) {
-      if (priv->image->comps[component].data == NULL) {
-        close();
-        break;
-      }
-      unsigned char *cdata = (unsigned char *)priv->image->comps[component].data;
-      int adjust = 0;
-      int depth = priv->image->comps[component].prec;
-      if (priv->image->comps[component].prec > 8)
-	adjust = priv->image->comps[component].prec - 8;
-      int sgndcorr = 0;
-      if (priv->image->comps[component].sgnd)
-	sgndcorr = 1 << (priv->image->comps[0].prec - 1);
-      for (int i = 0; i < priv->npixels; i++) {
-	int r = priv->image->comps[component].data[i];
-	*(cdata++) = adjustComp(r, adjust, depth, sgndcorr, priv->indexed);
-      }
-    }
-  } else
-    priv->npixels = 0;
-
-  priv->counter = 0;
-  priv->ccounter = 0;
-  priv->inited = gTrue;
-}
-
-void JPXStreamPrivate::init2(unsigned char *buf, int bufLen, OPJ_CODEC_FORMAT format, GBool indexed)
-{
-  opj_cio_t *cio = NULL;
-
-  /* Use default decompression parameters */
-  opj_dparameters_t parameters;
-  opj_set_default_decoder_parameters(&parameters);
-#ifdef WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG
-  if (indexed)
-    parameters.flags = OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
-#endif
-
-  /* Configure the event manager to receive errors and warnings */
-  opj_event_mgr_t event_mgr;
-  memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
-  event_mgr.error_handler = libopenjpeg_error_callback;
-  event_mgr.warning_handler = libopenjpeg_warning_callback;
-
-  /* Get the decoder handle of the format */
-  dinfo = opj_create_decompress(format);
-  if (dinfo == NULL) goto error;
-  /* Catch events using our callbacks */
-  opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, NULL);
-
-  /* Setup the decoder decoding parameters */
-  opj_setup_decoder(dinfo, &parameters);
-
-  /* Open a byte stream */
-  cio = opj_cio_open((opj_common_ptr)dinfo, buf, bufLen);
-  if (cio == NULL) goto error;
-
-  /* Decode the stream and fill the image structure */
-  image = opj_decode(dinfo, cio);
-
-  /* Close the byte stream */
-  opj_cio_close(cio);
-
-  if (image == NULL) goto error;
-  else return;
-
-error:
-  if (format == CODEC_JP2) {
-    error(errSyntaxWarning, -1, "Did not succeed opening JPX Stream as JP2, trying as J2K.");
-    init2(buf, bufLen, CODEC_J2K, indexed);
-  } else if (format == CODEC_J2K) {
-    error(errSyntaxWarning, -1, "Did not succeed opening JPX Stream as J2K, trying as JPT.");
-    init2(buf, bufLen, CODEC_JPT, indexed);
-  } else {
-    error(errSyntaxError, -1, "Did not succeed opening JPX Stream.");
-  }
-}
-#endif
-
-
-#ifdef USE_OPENJPEG2
 typedef struct JPXData_s
 {
   unsigned char *data;
@@ -363,25 +214,22 @@
 void JPXStream::init()
 {
   Object oLen, cspace, smaskInData;
-  if (getDict()) getDict()->lookup("Length", &oLen);
-  if (getDict()) getDict()->lookup("ColorSpace", &cspace);
-  if (getDict()) getDict()->lookup("SMaskInData", &smaskInData);
+  if (getDict()) {
+    oLen = getDict()->lookup("Length");
+    cspace = getDict()->lookup("ColorSpace");
+    smaskInData = getDict()->lookup("SMaskInData");
+  }
 
   int bufSize = BUFFER_INITIAL_SIZE;
   if (oLen.isInt()) bufSize = oLen.getInt();
-  oLen.free();
 
   if (cspace.isArray() && cspace.arrayGetLength() > 0) {
-    Object cstype;
-    cspace.arrayGet(0, &cstype);
+    Object cstype = cspace.arrayGet(0);
     if (cstype.isName("Indexed")) priv->indexed = gTrue;
-    cstype.free();
   }
-  cspace.free();
 
   priv->smaskInData = 0;
   if (smaskInData.isInt()) priv->smaskInData = smaskInData.getInt();
-  smaskInData.free();
 
   int length = 0;
   unsigned char *buf = str->toUnsignedChars(&length, bufSize);
@@ -504,6 +352,7 @@
     return;
 
 error:
+  opj_stream_destroy(stream);
   opj_destroy_codec(decoder);
   if (format == OPJ_CODEC_JP2) {
     error(errSyntaxWarning, -1, "Did no succeed opening JPX Stream as JP2, trying as J2K.");
@@ -515,4 +364,3 @@
     error(errSyntaxError, -1, "Did no succeed opening JPX Stream.");
   }
 }
-#endif

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/JPEG2000Stream.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/JPEG2000Stream.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/JPEG2000Stream.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -28,16 +28,16 @@
 public:
 
   JPXStream(Stream *strA);
-  virtual ~JPXStream();
-  virtual StreamKind getKind() { return strJPX; }
-  virtual void reset();
-  virtual void close();
-  virtual Goffset getPos();
-  virtual int getChar();
-  virtual int lookChar();
-  virtual GooString *getPSFilter(int psLevel, const char *indent);
-  virtual GBool isBinary(GBool last = gTrue);
-  virtual void getImageParams(int *bitsPerComponent, StreamColorSpaceMode *csMode);
+  ~JPXStream();
+  StreamKind getKind() override { return strJPX; }
+  void reset() override;
+  void close() override;
+  Goffset getPos() override;
+  int getChar() override;
+  int lookChar() override;
+  GooString *getPSFilter(int psLevel, const char *indent) override;
+  GBool isBinary(GBool last = gTrue) override;
+  void getImageParams(int *bitsPerComponent, StreamColorSpaceMode *csMode) override;
 
   int readStream(int nChars, Guchar *buffer) {
     return str->doGetChars(nChars, buffer);
@@ -48,8 +48,8 @@
   JPXStreamPrivate *priv;
 
   void init();
-  virtual GBool hasGetChars() { return true; }
-  virtual int getChars(int nChars, Guchar *buffer);
+  GBool hasGetChars() override { return true; }
+  int getChars(int nChars, Guchar *buffer) override;
 };
 
 #endif

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/JPXStream.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/JPXStream.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/JPXStream.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -262,15 +262,15 @@
 
   JPXStream(Stream *strA);
   virtual ~JPXStream();
-  virtual StreamKind getKind() { return strJPX; }
-  virtual void reset();
-  virtual void close();
-  virtual int getChar();
-  virtual int lookChar();
-  virtual GooString *getPSFilter(int psLevel, const char *indent);
-  virtual GBool isBinary(GBool last = gTrue);
+  virtual StreamKind getKind() override { return strJPX; }
+  virtual void reset() override;
+  virtual void close() override;
+  virtual int getChar() override;
+  virtual int lookChar() override;
+  virtual GooString *getPSFilter(int psLevel, const char *indent) override;
+  virtual GBool isBinary(GBool last = gTrue) override;
   virtual void getImageParams(int *bitsPerComponent,
-			      StreamColorSpaceMode *csMode);
+			      StreamColorSpaceMode *csMode) override;
 
 private:
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Lexer.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Lexer.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Lexer.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2006-2010, 2012-2014 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006-2010, 2012-2014, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 // Copyright (C) 2010 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2012, 2013 Adrian Johnson <ajohnson at redneon.com>
@@ -70,14 +70,12 @@
 //------------------------------------------------------------------------
 
 Lexer::Lexer(XRef *xrefA, Stream *str) {
-  Object obj;
-
   lookCharLastValueCached = LOOK_VALUE_NOT_CACHED;
   xref = xrefA;
 
-  curStr.initStream(str);
+  curStr = Object(str);
   streams = new Array(xref);
-  streams->add(curStr.copy(&obj));
+  streams->add(curStr.copy());
   strPtr = 0;
   freeArray = gTrue;
   curStr.streamReset();
@@ -84,15 +82,14 @@
 }
 
 Lexer::Lexer(XRef *xrefA, Object *obj) {
-  Object obj2;
-
   lookCharLastValueCached = LOOK_VALUE_NOT_CACHED;
   xref = xrefA;
 
   if (obj->isStream()) {
+    Object obj2;
     streams = new Array(xref);
     freeArray = gTrue;
-    streams->add(obj->copy(&obj2));
+    streams->add(obj->copy());
   } else {
     streams = obj->getArray();
     freeArray = gFalse;
@@ -99,7 +96,7 @@
   }
   strPtr = 0;
   if (streams->getLength() > 0) {
-    streams->get(strPtr, &curStr);
+    curStr = streams->get(strPtr);
     curStr.streamReset();
   }
 }
@@ -107,7 +104,6 @@
 Lexer::~Lexer() {
   if (!curStr.isNone()) {
     curStr.streamClose();
-    curStr.free();
   }
   if (freeArray) {
     delete streams;
@@ -129,10 +125,10 @@
       return EOF;
     } else {
       curStr.streamClose();
-      curStr.free();
+      curStr = Object();
       ++strPtr;
       if (strPtr < streams->getLength()) {
-        streams->get(strPtr, &curStr);
+        curStr = streams->get(strPtr);
         curStr.streamReset();
       }
     }
@@ -154,7 +150,7 @@
   }
 }
 
-Object *Lexer::getObj(Object *obj, int objNum) {
+Object Lexer::getObj(int objNum) {
   char *p;
   int c, c2;
   GBool comment, neg, done, overflownInteger, overflownLongLong;
@@ -169,7 +165,7 @@
   comment = gFalse;
   while (1) {
     if ((c = getChar()) == EOF) {
-      return obj->initEOF();
+      return Object(objEOF);
     }
     if (comment) {
       if (c == '\r' || c == '\n')
@@ -236,16 +232,16 @@
     }
     if (unlikely(overflownInteger)) {
       if (overflownLongLong) {
-        obj->initReal(xf);
+        return Object(xf);
       } else {
         if (unlikely(xll == INT_MIN)) {
-          obj->initInt(INT_MIN);
+          return Object(static_cast<int>(INT_MIN));
         } else {
-          obj->initInt64(xll);
+          return Object(xll);
         }
       }
     } else {
-      obj->initInt(xi);
+      return Object(xi);
     }
     break;
   doReal:
@@ -274,7 +270,7 @@
     if (neg) {
       xf = -xf;
     }
-    obj->initReal(xf);
+    return Object(xf);
     break;
 
   // string
@@ -401,9 +397,9 @@
         s = new GooString(tokBuf, n);
       else
         s->append(tokBuf, n);
-      obj->initString(s);
+      return Object(s);
     } else {
-      obj->initEOF();
+      return Object(objEOF);
     }
     break;
 
@@ -455,10 +451,11 @@
     }
     if (n < tokBufSize) {
       *p = '\0';
-      obj->initName(tokBuf);
+      return Object(objName, tokBuf);
     } else {
-      obj->initName(s->getCString());
+      Object obj(objName, s->getCString());
       delete s;
+      return obj;
     }
     break;
 
@@ -467,7 +464,7 @@
   case ']':
     tokBuf[0] = c;
     tokBuf[1] = '\0';
-    obj->initCmd(tokBuf);
+    return Object(objCmd, tokBuf);
     break;
 
   // hex string or dict punctuation
@@ -479,7 +476,7 @@
       getChar();
       tokBuf[0] = tokBuf[1] = '<';
       tokBuf[2] = '\0';
-      obj->initCmd(tokBuf);
+      return Object(objCmd, tokBuf);
 
     // hex string
     } else {
@@ -526,7 +523,7 @@
 	s->append(tokBuf, n);
       if (m == 1)
 	s->append((char)(c2 << 4));
-      obj->initString(s);
+      return Object(s);
     }
     break;
 
@@ -537,10 +534,10 @@
       getChar();
       tokBuf[0] = tokBuf[1] = '>';
       tokBuf[2] = '\0';
-      obj->initCmd(tokBuf);
+      return Object(objCmd, tokBuf);
     } else {
       error(errSyntaxError, getPos(), "Illegal character '>'");
-      obj->initError();
+      return Object(objError);
     }
     break;
 
@@ -549,7 +546,7 @@
   case '{':
   case '}':
     error(errSyntaxError, getPos(), "Illegal character '{0:c}'", c);
-    obj->initError();
+    return Object(objError);
     break;
 
   // command
@@ -567,21 +564,21 @@
     }
     *p = '\0';
     if (tokBuf[0] == 't' && !strcmp(tokBuf, "true")) {
-      obj->initBool(gTrue);
+      return Object(gTrue);
     } else if (tokBuf[0] == 'f' && !strcmp(tokBuf, "false")) {
-      obj->initBool(gFalse);
+      return Object(gFalse);
     } else if (tokBuf[0] == 'n' && !strcmp(tokBuf, "null")) {
-      obj->initNull();
+      return Object(objNull);
     } else {
-      obj->initCmd(tokBuf);
+      return Object(objCmd, tokBuf);
     }
     break;
   }
 
-  return obj;
+  return Object();
 }
 
-Object *Lexer::getObj(Object *obj, const char *cmdA, int objNum) {
+Object Lexer::getObj(const char *cmdA, int objNum) {
   char *p;
   int c;
   GBool comment;
@@ -594,7 +591,7 @@
   while (strcmp(cmdA, cmd1) && (objNum < 0 || (xref && xref->getNumEntry(getPos()) == objNum))) {
     while (1) {
       if ((c = getChar()) == EOF) {
-        return obj->initEOF();
+        return Object(objEOF);
       }
       if (comment) {
         if (c == '\r' || c == '\n') {
@@ -618,9 +615,8 @@
     }
     *p = '\0';
   }
-  obj->initCmd(tokBuf);
-  
-  return obj;
+
+  return Object(objCmd, tokBuf);
 }
 
 void Lexer::skipToNextLine() {

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Lexer.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Lexer.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Lexer.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2006, 2007, 2010, 2013 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006, 2007, 2010, 2013, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 // Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
@@ -56,8 +56,9 @@
   ~Lexer();
 
   // Get the next object from the input stream.
-  Object *getObj(Object *obj, int objNum = -1);
-  Object *getObj(Object *obj, const char *cmdA, int objNum);
+  Object getObj(int objNum = -1);
+  Object getObj(const char *cmdA, int objNum);
+  template<typename T> Object getObj(T) = delete;
 
   // Skip to the beginning of the next line in the input stream.
   void skipToNextLine();

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Linearization.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Linearization.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Linearization.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -6,6 +6,7 @@
 //
 // Copyright 2010, 2012 Hib Eris <hib at hiberis.nl>
 // Copyright 2015 Jason Crain <jason at aquaticape.us>
+// Copyright 2017 Albert Astals Cid <aacid at kde.org>
 //
 //========================================================================
 
@@ -20,36 +21,26 @@
 Linearization::Linearization (BaseStream *str)
 {
   Parser *parser;
-  Object obj1, obj2, obj3, obj5;
 
-  linDict.initNull();
-
   str->reset();
-  obj1.initNull();
   parser = new Parser(NULL,
-      new Lexer(NULL, str->makeSubStream(str->getStart(), gFalse, 0, &obj1)),
+      new Lexer(NULL, str->makeSubStream(str->getStart(), gFalse, 0, Object(objNull))),
       gFalse);
-  parser->getObj(&obj1);
-  parser->getObj(&obj2);
-  parser->getObj(&obj3);
-  parser->getObj(&linDict);
+  Object obj1 = parser->getObj();
+  Object obj2 = parser->getObj();
+  Object obj3 = parser->getObj();
+  linDict = parser->getObj();
   if (obj1.isInt() && obj2.isInt() && obj3.isCmd("obj") && linDict.isDict()) {
-    linDict.dictLookup("Linearized", &obj5);
+    Object obj5 = linDict.dictLookup("Linearized");
     if (!(obj5.isNum() && obj5.getNum() > 0)) {
-       linDict.free();
-       linDict.initNull();
+       linDict.setToNull();
     }
-    obj5.free();
   }
-  obj3.free();
-  obj2.free();
-  obj1.free();
   delete parser;
 }
 
 Linearization:: ~Linearization()
 {
-  linDict.free();
 }
 
 Guint Linearization::getLength()
@@ -72,9 +63,9 @@
 
   Object obj1, obj2;
   if (linDict.isDict() &&
-      linDict.dictLookup("H", &obj1)->isArray() &&
+      (obj1 = linDict.dictLookup("H"), obj1.isArray()) &&
       obj1.arrayGetLength()>=2 &&
-      obj1.arrayGet(0, &obj2)->isInt() &&
+      (obj2 = obj1.arrayGet(0), obj2.isInt()) &&
       obj2.getInt() > 0) {
     hintsOffset = obj2.getInt();
   } else {
@@ -81,8 +72,6 @@
     error(errSyntaxWarning, -1, "Hints table offset in linearization table is invalid");
     hintsOffset = 0;
   }
-  obj2.free();
-  obj1.free();
 
   return hintsOffset;
 }
@@ -93,9 +82,9 @@
 
   Object obj1, obj2;
   if (linDict.isDict() &&
-      linDict.dictLookup("H", &obj1)->isArray() &&
+      (obj1 = linDict.dictLookup("H"), obj1.isArray()) &&
       obj1.arrayGetLength()>=2 &&
-      obj1.arrayGet(1, &obj2)->isInt() &&
+      (obj2 = obj1.arrayGet(1), obj2.isInt()) &&
       obj2.getInt() > 0) {
     hintsLength = obj2.getInt();
   } else {
@@ -102,8 +91,6 @@
     error(errSyntaxWarning, -1, "Hints table length in linearization table is invalid");
     hintsLength = 0;
   }
-  obj2.free();
-  obj1.free();
 
   return hintsLength;
 }
@@ -112,12 +99,12 @@
 {
   int hintsOffset2 = 0; // default to 0
 
-  Object obj1, obj2;
+  Object obj1;
   if (linDict.isDict() &&
-      linDict.dictLookup("H", &obj1)->isArray() &&
+      (obj1 = linDict.dictLookup("H"), obj1.isArray()) &&
       obj1.arrayGetLength()>=4) {
-    if (obj1.arrayGet(2, &obj2)->isInt() &&
-        obj2.getInt() > 0) {
+    Object obj2 = obj1.arrayGet(2);
+    if (obj2.isInt() && obj2.getInt() > 0) {
       hintsOffset2 = obj2.getInt();
     } else {
       error(errSyntaxWarning, -1, "Second hints table offset in linearization table is invalid");
@@ -124,8 +111,6 @@
       hintsOffset2 = 0;
     }
   }
-  obj2.free();
-  obj1.free();
 
   return hintsOffset2;
 }
@@ -134,12 +119,12 @@
 {
   int hintsLength2 = 0; // default to 0
 
-  Object obj1, obj2;
+  Object obj1;
   if (linDict.isDict() &&
-      linDict.dictLookup("H", &obj1)->isArray() &&
+      (obj1 = linDict.dictLookup("H"), obj1.isArray()) &&
       obj1.arrayGetLength()>=4) {
-    if (obj1.arrayGet(3, &obj2)->isInt() &&
-        obj2.getInt() > 0) {
+    Object obj2 = obj1.arrayGet(3);
+    if (obj2.isInt() && obj2.getInt() > 0) {
       hintsLength2 = obj2.getInt();
     } else {
       error(errSyntaxWarning, -1, "Second hints table length in linearization table is invalid");
@@ -146,8 +131,6 @@
       hintsLength2 = 0;
     }
   }
-  obj2.free();
-  obj1.free();
 
   return hintsLength2;
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Link.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Link.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Link.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -16,7 +16,7 @@
 // Copyright (C) 2006, 2008 Pino Toscano <pino at kde.org>
 // Copyright (C) 2007, 2010, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2008 Hugo Mercier <hmercier31 at gmail.com>
-// Copyright (C) 2008-2010, 2012-2014, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008-2010, 2012-2014, 2016, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
 // Copyright (C) 2009 Ilya Gorenbein <igorenbein at finjan.com>
 // Copyright (C) 2012 Tobias Koening <tobias.koenig at kdab.com>
@@ -64,7 +64,6 @@
 
 LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) {
   LinkAction *action;
-  Object obj2, obj3, obj4;
 
   if (!obj->isDict()) {
       error(errSyntaxWarning, -1, "parseAction: Bad annotation action for URI '{0:s}'",
@@ -72,21 +71,18 @@
       return NULL;
   }
 
-  obj->dictLookup("S", &obj2);
+  Object obj2 = obj->dictLookup("S");
 
   // GoTo action
   if (obj2.isName("GoTo")) {
-    obj->dictLookup("D", &obj3);
+    Object obj3 = obj->dictLookup("D");
     action = new LinkGoTo(&obj3);
-    obj3.free();
 
   // GoToR action
   } else if (obj2.isName("GoToR")) {
-    obj->dictLookup("F", &obj3);
-    obj->dictLookup("D", &obj4);
+    Object obj3 = obj->dictLookup("F");
+    Object obj4 = obj->dictLookup("D");
     action = new LinkGoToR(&obj3, &obj4);
-    obj3.free();
-    obj4.free();
 
   // Launch action
   } else if (obj2.isName("Launch")) {
@@ -94,15 +90,13 @@
 
   // URI action
   } else if (obj2.isName("URI")) {
-    obj->dictLookup("URI", &obj3);
+    Object obj3 = obj->dictLookup("URI");
     action = new LinkURI(&obj3, baseURI);
-    obj3.free();
 
   // Named action
   } else if (obj2.isName("Named")) {
-    obj->dictLookup("N", &obj3);
+    Object obj3 = obj->dictLookup("N");
     action = new LinkNamed(&obj3);
-    obj3.free();
 
   // Movie action
   } else if (obj2.isName("Movie")) {
@@ -118,9 +112,8 @@
 
   // JavaScript action
   } else if (obj2.isName("JavaScript")) {
-    obj->dictLookup("JS", &obj3);
+    Object obj3 = obj->dictLookup("JS");
     action = new LinkJavaScript(&obj3);
-    obj3.free();
 
   // Set-OCG-State action
   } else if (obj2.isName("SetOCGState")) {
@@ -137,8 +130,6 @@
     action = NULL;
   }
 
-  obj2.free();
-
   if (action && !action->isOk()) {
     delete action;
     return NULL;
@@ -151,8 +142,6 @@
 //------------------------------------------------------------------------
 
 LinkDest::LinkDest(Array *a) {
-  Object obj1, obj2;
-
   // initialize fields
   left = bottom = right = top = zoom = 0;
   changeLeft = changeTop = changeZoom = gFalse;
@@ -163,7 +152,7 @@
     error(errSyntaxWarning, -1, "Annotation destination array is too short");
     return;
   }
-  a->getNF(0, &obj1);
+  Object obj1 = a->getNF(0);
   if (obj1.isInt()) {
     pageNum = obj1.getInt() + 1;
     pageIsRef = gFalse;
@@ -173,12 +162,11 @@
     pageIsRef = gTrue;
   } else {
     error(errSyntaxWarning, -1, "Bad annotation destination");
-    goto err2;
+    return;
   }
-  obj1.free();
 
   // get destination type
-  a->get(1, &obj1);
+  obj1 = a->get(1);
 
   // XYZ link
   if (obj1.isName("XYZ")) {
@@ -186,7 +174,7 @@
     if (a->getLength() < 3) {
       changeLeft = gFalse;
     } else {
-      a->get(2, &obj2);
+      Object obj2 = a->get(2);
       if (obj2.isNull()) {
 	changeLeft = gFalse;
       } else if (obj2.isNum()) {
@@ -194,14 +182,13 @@
 	left = obj2.getNum();
       } else {
 	error(errSyntaxWarning, -1, "Bad annotation destination position");
-	goto err1;
+	return;
       }
-      obj2.free();
     }
     if (a->getLength() < 4) {
       changeTop = gFalse;
     } else {
-      a->get(3, &obj2);
+      Object obj2 = a->get(3);
       if (obj2.isNull()) {
 	changeTop = gFalse;
       } else if (obj2.isNum()) {
@@ -209,14 +196,13 @@
 	top = obj2.getNum();
       } else {
 	error(errSyntaxWarning, -1, "Bad annotation destination position");
-	goto err1;
+	return;
       }
-      obj2.free();
     }
     if (a->getLength() < 5) {
       changeZoom = gFalse;
     } else {
-      a->get(4, &obj2);
+      Object obj2 = a->get(4);
       if (obj2.isNull()) {
 	changeZoom = gFalse;
       } else if (obj2.isNum()) {
@@ -224,9 +210,8 @@
 	changeZoom = (zoom == 0) ? gFalse : gTrue;
       } else {
 	error(errSyntaxWarning, -1, "Bad annotation destination position");
-	goto err1;
+	return;
       }
-      obj2.free();
     }
 
   // Fit link
@@ -239,7 +224,7 @@
     if (a->getLength() < 3) {
       changeTop = gFalse;
     } else {
-      a->get(2, &obj2);
+      Object obj2 = a->get(2);
       if (obj2.isNull()) {
 	changeTop = gFalse;
       } else if (obj2.isNum()) {
@@ -249,7 +234,6 @@
 	error(errSyntaxWarning, -1, "Bad annotation destination position");
 	kind = destFit;
       }
-      obj2.free();
     }
 
   // FitV link
@@ -256,10 +240,10 @@
   } else if (obj1.isName("FitV")) {
     if (a->getLength() < 3) {
       error(errSyntaxWarning, -1, "Annotation destination array is too short");
-      goto err2;
+      return;
     }
     kind = destFitV;
-    a->get(2, &obj2);
+    Object obj2 = a->get(2);
     if (obj2.isNull()) {
       changeLeft = gFalse;
     } else if (obj2.isNum()) {
@@ -269,43 +253,42 @@
       error(errSyntaxWarning, -1, "Bad annotation destination position");
       kind = destFit;
     }
-    obj2.free();
 
   // FitR link
   } else if (obj1.isName("FitR")) {
     if (a->getLength() < 6) {
       error(errSyntaxWarning, -1, "Annotation destination array is too short");
-      goto err2;
+      return;
     }
     kind = destFitR;
-    if (a->get(2, &obj2)->isNum()) {
+    Object obj2 = a->get(2);
+    if (obj2.isNum()) {
       left = obj2.getNum();
     } else {
       error(errSyntaxWarning, -1, "Bad annotation destination position");
       kind = destFit;
     }
-    obj2.free();
-    if (a->get(3, &obj2)->isNum()) {
+    obj2 = a->get(3);
+    if (obj2.isNum()) {
       bottom = obj2.getNum();
     } else {
       error(errSyntaxWarning, -1, "Bad annotation destination position");
       kind = destFit;
     }
-    obj2.free();
-    if (a->get(4, &obj2)->isNum()) {
+    obj2 = a->get(4);
+    if (obj2.isNum()) {
       right = obj2.getNum();
     } else {
       error(errSyntaxWarning, -1, "Bad annotation destination position");
       kind = destFit;
     }
-    obj2.free();
-    if (a->get(5, &obj2)->isNum()) {
+    obj2 = a->get(5);
+    if (obj2.isNum()) {
       top = obj2.getNum();
     } else {
       error(errSyntaxWarning, -1, "Bad annotation destination position");
       kind = destFit;
     }
-    obj2.free();
 
   // FitB link
   } else if (obj1.isName("FitB")) {
@@ -315,10 +298,10 @@
   } else if (obj1.isName("FitBH")) {
     if (a->getLength() < 3) {
       error(errSyntaxWarning, -1, "Annotation destination array is too short");
-      goto err2;
+      return;
     }
     kind = destFitBH;
-    a->get(2, &obj2);
+    Object obj2 = a->get(2);
     if (obj2.isNull()) {
       changeTop = gFalse;
     } else if (obj2.isNum()) {
@@ -328,16 +311,15 @@
       error(errSyntaxWarning, -1, "Bad annotation destination position");
       kind = destFit;
     }
-    obj2.free();
 
   // FitBV link
   } else if (obj1.isName("FitBV")) {
     if (a->getLength() < 3) {
       error(errSyntaxWarning, -1, "Annotation destination array is too short");
-      goto err2;
+      return;
     }
     kind = destFitBV;
-    a->get(2, &obj2);
+    Object obj2 = a->get(2);
     if (obj2.isNull()) {
       changeLeft = gFalse;
     } else if (obj2.isNum()) {
@@ -347,22 +329,14 @@
       error(errSyntaxWarning, -1, "Bad annotation destination position");
       kind = destFit;
     }
-    obj2.free();
 
   // unknown link kind
   } else {
     error(errSyntaxWarning, -1, "Unknown annotation destination type");
-    goto err2;
   }
 
-  obj1.free();
   ok = gTrue;
   return;
-
- err1:
-  obj2.free();
- err2:
-  obj1.free();
 }
 
 LinkDest::LinkDest(LinkDest *dest) {
@@ -428,10 +402,9 @@
   namedDest = NULL;
 
   // get file name
-  Object obj1;
-  if (getFileSpecNameForPlatform (fileSpecObj, &obj1)) {
+  Object obj1 = getFileSpecNameForPlatform (fileSpecObj);
+  if (obj1.isString()) {
     fileName = obj1.getString()->copy();
-    obj1.free();
   }
 
   // named destination
@@ -469,54 +442,39 @@
 //------------------------------------------------------------------------
 
 LinkLaunch::LinkLaunch(Object *actionObj) {
-  Object obj1, obj2, obj3;
 
   fileName = NULL;
   params = NULL;
 
   if (actionObj->isDict()) {
-    if (!actionObj->dictLookup("F", &obj1)->isNull()) {
-      if (getFileSpecNameForPlatform (&obj1, &obj3)) {
+    Object obj1 = actionObj->dictLookup("F");
+    if (!obj1.isNull()) {
+      Object obj3 = getFileSpecNameForPlatform (&obj1);
+      if (obj3.isString()) {
 	fileName = obj3.getString()->copy();
-	obj3.free();
       }
     } else {
-      obj1.free();
 #ifdef _WIN32
-      if (actionObj->dictLookup("Win", &obj1)->isDict()) {
-	obj1.dictLookup("F", &obj2);
-	if (getFileSpecNameForPlatform (&obj2, &obj3)) {
-	  fileName = obj3.getString()->copy();
-	  obj3.free();
-	}
-	obj2.free();
-	if (obj1.dictLookup("P", &obj2)->isString()) {
-	  params = obj2.getString()->copy();
-	}
-	obj2.free();
-      } else {
-	error(errSyntaxWarning, -1, "Bad launch-type link action");
-      }
+      obj1 = actionObj->dictLookup("Win");
 #else
       //~ This hasn't been defined by Adobe yet, so assume it looks
       //~ just like the Win dictionary until they say otherwise.
-      if (actionObj->dictLookup("Unix", &obj1)->isDict()) {
-	obj1.dictLookup("F", &obj2);
-	if (getFileSpecNameForPlatform (&obj2, &obj3)) {
+      obj1 = actionObj->dictLookup("Unix");
+#endif
+      if (obj1.isDict()) {
+	Object obj2 = obj1.dictLookup("F");
+	Object obj3 = getFileSpecNameForPlatform (&obj2);
+	if (obj3.isString()) {
 	  fileName = obj3.getString()->copy();
-	  obj3.free();
 	}
-	obj2.free();
-	if (obj1.dictLookup("P", &obj2)->isString()) {
+	obj2 = obj1.dictLookup("P");
+	if (obj2.isString()) {
 	  params = obj2.getString()->copy();
 	}
-	obj2.free();
       } else {
 	error(errSyntaxWarning, -1, "Bad launch-type link action");
       }
-#endif
     }
-    obj1.free();
   }
 }
 
@@ -601,16 +559,15 @@
   annotRef.num = -1;
   annotTitle = NULL;
 
-  Object tmp;
-  if (obj->dictLookupNF("Annotation", &tmp)->isRef()) {
+  Object tmp = obj->dictLookupNF("Annotation");
+  if (tmp.isRef()) {
     annotRef = tmp.getRef();
   }
-  tmp.free();
 
-  if (obj->dictLookup("T", &tmp)->isString()) {
+  tmp = obj->dictLookup("T");
+  if (tmp.isString()) {
     annotTitle = tmp.getString()->copy();
   }
-  tmp.free();
 
   if ((annotTitle == NULL) && (annotRef.num == -1)) {
     error(errSyntaxError, -1,
@@ -617,7 +574,8 @@
 	  "Movie action is missing both the Annot and T keys");
   }
 
-  if (obj->dictLookup("Operation", &tmp)->isName()) {
+  tmp = obj->dictLookup("Operation");
+  if (tmp.isName()) {
     char *name = tmp.getName();
     
     if (!strcmp(name, "Play")) {
@@ -633,7 +591,6 @@
       operation = operationTypeResume;
     }
   }
-  tmp.free();
 }
 
 LinkMovie::~LinkMovie() {
@@ -654,35 +611,29 @@
   sound = NULL;
   if (soundObj->isDict())
   {
-    Object tmp;
     // volume
-    soundObj->dictLookup("Volume", &tmp);
+    Object tmp = soundObj->dictLookup("Volume");
     if (tmp.isNum()) {
       volume = tmp.getNum();
     }
-    tmp.free();
     // sync
-    soundObj->dictLookup("Synchronous", &tmp);
+    tmp = soundObj->dictLookup("Synchronous");
     if (tmp.isBool()) {
       sync = tmp.getBool();
     }
-    tmp.free();
     // repeat
-    soundObj->dictLookup("Repeat", &tmp);
+    tmp = soundObj->dictLookup("Repeat");
     if (tmp.isBool()) {
       repeat = tmp.getBool();
     }
-    tmp.free();
     // mix
-    soundObj->dictLookup("Mix", &tmp);
+    tmp = soundObj->dictLookup("Mix");
     if (tmp.isBool()) {
       mix = tmp.getBool();
     }
-    tmp.free();
     // 'Sound' object
-    soundObj->dictLookup("Sound", &tmp);
+    tmp = soundObj->dictLookup("Sound");
     sound = Sound::parseSound(&tmp);
-    tmp.free();
   }
 }
 
@@ -701,9 +652,8 @@
   int operationCode = -1;
 
   if (obj->isDict()) {
-    Object tmp;
-
-    if (!obj->dictLookup("JS", &tmp)->isNull()) {
+    Object tmp = obj->dictLookup("JS");
+    if (!tmp.isNull()) {
       if (tmp.isString()) {
         js = new GooString(tmp.getString());
       } else if (tmp.isStream()) {
@@ -714,9 +664,9 @@
         error(errSyntaxWarning, -1, "Invalid Rendition Action: JS not string or stream");
       }
     }
-    tmp.free();
 
-    if (obj->dictLookup("OP", &tmp)->isInt()) {
+    tmp = obj->dictLookup("OP");
+    if (tmp.isInt()) {
       operationCode = tmp.getInt();
       if (!js && (operationCode < 0 || operationCode > 4)) {
         error(errSyntaxWarning, -1, "Invalid Rendition Action: unrecognized operation valued: {0:d}", operationCode);
@@ -724,16 +674,18 @@
         Object obj1;
 
         // retrieve rendition object
-        if (obj->dictLookup("R", &renditionObj)->isDict()) {
+        renditionObj = obj->dictLookup("R");
+        if (renditionObj.isDict()) {
           media = new MediaRendition(&renditionObj);
 	} else if (operationCode == 0 || operationCode == 4) {
           error(errSyntaxWarning, -1, "Invalid Rendition Action: no R field with op = {0:d}", operationCode);
-	  renditionObj.free();
+	  renditionObj.setToNull();
 	}
 
-	if (!obj->dictLookupNF("AN", &screenRef)->isRef() && operation >= 0 && operation <= 4) {
+	screenRef = obj->dictLookupNF("AN");
+	if (!screenRef.isRef() && operation >= 0 && operation <= 4) {
 	  error(errSyntaxWarning, -1, "Invalid Rendition Action: no AN field with op = {0:d}", operationCode);
-	  screenRef.free();
+	  screenRef.setToNull();
 	}
       }
 
@@ -757,18 +709,12 @@
     } else if (!js) {
       error(errSyntaxWarning, -1, "Invalid Rendition action: no OP or JS field defined");
     }
-    tmp.free();
   }
 }
 
 LinkRendition::~LinkRendition() {
-  renditionObj.free();
-  screenRef.free();
-
-  if (js)
-    delete js;
-  if (media)
-    delete media;
+  delete js;
+  delete media;
 }
 
 
@@ -799,18 +745,15 @@
 // LinkOCGState
 //------------------------------------------------------------------------
 LinkOCGState::LinkOCGState(Object *obj) {
-  Object obj1;
-
   stateList = new GooList();
   preserveRB = gTrue;
 
-  if (obj->dictLookup("State", &obj1)->isArray()) {
+  Object obj1 = obj->dictLookup("State");
+  if (obj1.isArray()) {
     StateList *stList = NULL;
 
     for (int i = 0; i < obj1.arrayGetLength(); ++i) {
-      Object obj2;
-
-      obj1.arrayGetNF(i, &obj2);
+      Object obj2 = obj1.arrayGetNF(i);
       if (obj2.isName()) {
         if (stList)
 	  stateList->append(stList);
@@ -842,7 +785,6 @@
       } else {
         error(errSyntaxWarning, -1, "Invalid item in OCG Action State array");
       }
-      obj2.free();
     }
     // Add the last group
     if (stList)
@@ -852,12 +794,11 @@
     delete stateList;
     stateList = NULL;
   }
-  obj1.free();
 
-  if (obj->dictLookup("PreserveRB", &obj1)->isBool()) {
+  obj1 = obj->dictLookup("PreserveRB");
+  if (obj1.isBool()) {
     preserveRB = obj1.getBool();
   }
-  obj1.free();
 }
 
 LinkOCGState::~LinkOCGState() {

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Link.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Link.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Link.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -150,13 +150,13 @@
   LinkGoTo(Object *destObj);
 
   // Destructor.
-  virtual ~LinkGoTo();
+  ~LinkGoTo();
 
   // Was the LinkGoTo created successfully?
-  virtual GBool isOk() { return dest || namedDest; }
+  GBool isOk() override { return dest || namedDest; }
 
   // Accessors.
-  virtual LinkActionKind getKind() { return actionGoTo; }
+  LinkActionKind getKind() override { return actionGoTo; }
   LinkDest *getDest() { return dest; }
   GooString *getNamedDest() { return namedDest; }
 
@@ -180,13 +180,13 @@
   LinkGoToR(Object *fileSpecObj, Object *destObj);
 
   // Destructor.
-  virtual ~LinkGoToR();
+  ~LinkGoToR();
 
   // Was the LinkGoToR created successfully?
-  virtual GBool isOk() { return fileName && (dest || namedDest); }
+  GBool isOk() override { return fileName && (dest || namedDest); }
 
   // Accessors.
-  virtual LinkActionKind getKind() { return actionGoToR; }
+  LinkActionKind getKind() override { return actionGoToR; }
   GooString *getFileName() { return fileName; }
   LinkDest *getDest() { return dest; }
   GooString *getNamedDest() { return namedDest; }
@@ -211,13 +211,13 @@
   LinkLaunch(Object *actionObj);
 
   // Destructor.
-  virtual ~LinkLaunch();
+  ~LinkLaunch();
 
   // Was the LinkLaunch created successfully?
-  virtual GBool isOk() { return fileName != NULL; }
+  GBool isOk() override { return fileName != NULL; }
 
   // Accessors.
-  virtual LinkActionKind getKind() { return actionLaunch; }
+  LinkActionKind getKind() override { return actionLaunch; }
   GooString *getFileName() { return fileName; }
   GooString *getParams() { return params; }
 
@@ -238,13 +238,13 @@
   LinkURI(Object *uriObj, GooString *baseURI);
 
   // Destructor.
-  virtual ~LinkURI();
+  ~LinkURI();
 
   // Was the LinkURI created successfully?
-  virtual GBool isOk() { return uri != NULL; }
+  GBool isOk() override { return uri != NULL; }
 
   // Accessors.
-  virtual LinkActionKind getKind() { return actionURI; }
+  LinkActionKind getKind() override { return actionURI; }
   GooString *getURI() { return uri; }
 
 private:
@@ -262,11 +262,11 @@
   // Build a LinkNamed given the action name.
   LinkNamed(Object *nameObj);
 
-  virtual ~LinkNamed();
+  ~LinkNamed();
 
-  virtual GBool isOk() { return name != NULL; }
+  GBool isOk() override { return name != NULL; }
 
-  virtual LinkActionKind getKind() { return actionNamed; }
+  LinkActionKind getKind() override { return actionNamed; }
   GooString *getName() { return name; }
 
 private:
@@ -290,10 +290,10 @@
   };
 
   LinkMovie(Object *obj);
-  virtual ~LinkMovie();
+  ~LinkMovie();
 
-  virtual GBool isOk() { return annotRef.num >= 0 || annotTitle != NULL; }
-  virtual LinkActionKind getKind() { return actionMovie; }
+  GBool isOk() override { return annotRef.num >= 0 || annotTitle != NULL; }
+  LinkActionKind getKind() override { return actionMovie; }
 
   // a movie action stores either an indirect reference to a movie annotation
   // or the movie annotation title
@@ -333,11 +333,11 @@
 
   LinkRendition(Object *Obj);
 
-  virtual ~LinkRendition();
+  ~LinkRendition();
 
-  virtual GBool isOk() { return true; }
+  GBool isOk() override { return true; }
 
-  virtual LinkActionKind getKind() { return actionRendition; }
+  LinkActionKind getKind() override { return actionRendition; }
 
   GBool hasRenditionObject() { return renditionObj.isDict(); }
   Object* getRenditionObject() { return &renditionObj; }
@@ -371,11 +371,11 @@
 
   LinkSound(Object *soundObj);
 
-  virtual ~LinkSound();
+  ~LinkSound();
 
-  virtual GBool isOk() { return sound != NULL; }
+  GBool isOk() override { return sound != NULL; }
 
-  virtual LinkActionKind getKind() { return actionSound; }
+  LinkActionKind getKind() override { return actionSound; }
 
   double getVolume() { return volume; }
   GBool getSynchronous() { return sync; }
@@ -402,11 +402,11 @@
   // Build a LinkJavaScript given the action name.
   LinkJavaScript(Object *jsObj);
 
-  virtual ~LinkJavaScript();
+  ~LinkJavaScript();
 
-  virtual GBool isOk() { return js != NULL; }
+  GBool isOk() override { return js != NULL; }
 
-  virtual LinkActionKind getKind() { return actionJavaScript; }
+  LinkActionKind getKind() override { return actionJavaScript; }
   GooString *getScript() { return js; }
 
 private:
@@ -421,11 +421,11 @@
 public:
   LinkOCGState(Object *obj);
 
-  virtual ~LinkOCGState();
+  ~LinkOCGState();
 
-  virtual GBool isOk() { return stateList != NULL; }
+  GBool isOk() override { return stateList != NULL; }
 
-  virtual LinkActionKind getKind() { return actionOCGState; }
+  LinkActionKind getKind() override { return actionOCGState; }
 
   enum State { On, Off, Toggle};
   struct StateList {
@@ -454,13 +454,13 @@
   LinkUnknown(char *actionA);
 
   // Destructor.
-  virtual ~LinkUnknown();
+  ~LinkUnknown();
 
   // Was the LinkUnknown create successfully?
-  virtual GBool isOk() { return action != NULL; }
+  GBool isOk() override { return action != NULL; }
 
   // Accessors.
-  virtual LinkActionKind getKind() { return actionUnknown; }
+  LinkActionKind getKind() override { return actionUnknown; }
   GooString *getAction() { return action; }
 
 private:

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/LocalPDFDocBuilder.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/LocalPDFDocBuilder.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/LocalPDFDocBuilder.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -23,10 +23,9 @@
 class LocalPDFDocBuilder : public PDFDocBuilder {
 
 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;
 
 };
 

Deleted: branches/stable/source/src/libs/poppler/poppler-src/poppler/Makefile.am
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Makefile.am	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Makefile.am	2018-02-27 23:34:23 UTC (rev 795)
@@ -1,348 +0,0 @@
-CFLAGS+=$(PTHREAD_CFLAGS)
-CXXFLAGS+=$(PTHREAD_CFLAGS)
-
-AM_CPPFLAGS =					\
-	-I$(top_srcdir)				\
-	-I$(top_srcdir)/goo
-
-lib_LTLIBRARIES = libpoppler.la
-
-if BUILD_CAIRO_OUTPUT
-noinst_LTLIBRARIES = libpoppler-cairo.la
-endif
-
-if BUILD_SPLASH_OUTPUT
-
-splash_sources =				\
-	SplashOutputDev.cc
-
-splash_headers =				\
-	SplashOutputDev.h
-
-splash_includes =				\
-	$(SPLASH_CFLAGS)
-
-splash_libs =					\
-	$(SPLASH_LIBS)				\
-	$(top_builddir)/splash/libsplash.la
-
-endif
-
-if BUILD_LIBJPEG
-
-libjpeg_sources =				\
-	DCTStream.h				\
-	DCTStream.cc
-
-libjpeg_libs =					\
-	$(LIBJPEG_LIBS)
-libjpeg_includes =				\
-	$(LIBJPEG_CFLAGS)
-
-endif
-
-if BUILD_LIBPNG
-
-libpng_libs =					\
-	$(LIBPNG_LIBS)
-libpng_includes =				\
-	$(LIBPNG_CFLAGS)
-
-endif
-
-if BUILD_LIBTIFF
-
-libtiff_libs =					\
-	$(LIBTIFF_LIBS)
-libtiff_includes =				\
-	$(LIBTIFF_CFLAGS)
-
-endif
-
-if BUILD_LIBOPENJPEG
-
-libjpeg2000_sources =				\
-	JPEG2000Stream.h			\
-	JPEG2000Stream.cc
-
-libjpeg2000_libs =				\
-	$(LIBOPENJPEG_LIBS)
-libjpeg2000_includes =				\
-	$(LIBOPENJPEG_CFLAGS)
-
-else
-
-libjpeg2000_sources =				\
-	JPXStream.h			\
-	JPXStream.cc
-
-endif
-
-if BUILD_NSS
-
-nss_sources =                   \
-	SignatureHandler.cc
-
-nss_libs =                      \
-	$(NSS3_LIBS)
-
-nss_includes =                  \
-	$(NSS3_CFLAGS)
-
-nss_headers =                   \
-	SignatureHandler.h
-
-endif	
-
-
-if BUILD_ZLIB
-
-zlib_sources =					\
-	FlateEncoder.h				\
-	FlateEncoder.cc
-
-zlib_libs = 					\
-	$(ZLIB_LIBS)
-
-endif
-
-if BUILD_ZLIB_UNCOMPRESS
-
-zlib_uncompress_sources =			\
-	FlateStream.h				\
-	FlateStream.cc
-
-endif
-
-if BUILD_LIBCURL
-
-libcurl_libs =					\
-	$(LIBCURL_LIBS)
-
-libcurl_includes =				\
-	$(LIBCURL_CFLAGS)
-
-curl_headers =					\
-	CurlCachedFile.h			\
-	CurlPDFDocBuilder.h
-
-curl_sources =					\
-	CurlCachedFile.cc			\
-	CurlPDFDocBuilder.cc
-
-endif
-
-if USE_CMS
-cms_includes = $(LCMS_CFLAGS)
-cms_libs = $(LCMS_LIBS)
-endif
-
-if ENABLE_XPDF_HEADERS
-
-poppler_includedir = $(includedir)/poppler
-poppler_include_HEADERS =	\
-	$(splash_headers)	\
-	$(curl_headers)		\
-	$(nss_headers) 		\
-	Annot.h			\
-	Array.h			\
-	BuiltinFont.h		\
-	BuiltinFontTables.h	\
-	CachedFile.h		\
-	Catalog.h		\
-	CharCodeToUnicode.h	\
-	CMap.h			\
-	DateInfo.h		\
-	Decrypt.h		\
-	Dict.h			\
-	Error.h			\
-	FileSpec.h		\
-	FontEncodingTables.h	\
-	FontInfo.h		\
-	Form.h 			\
-	Function.h		\
-	Gfx.h			\
-	GfxFont.h		\
-	GfxState.h		\
-	GfxState_helpers.h	\
-	GlobalParams.h		\
-	Hints.h			\
-	JArithmeticDecoder.h	\
-	JBIG2Stream.h		\
-	Lexer.h			\
-	Linearization.h 	\
-	Link.h			\
-	LocalPDFDocBuilder.h	\
-	Movie.h                 \
-	NameToCharCode.h	\
-	Object.h		\
-	OptionalContent.h	\
-	Outline.h		\
-	OutputDev.h		\
-	Page.h			\
-	PageTransition.h	\
-	Parser.h		\
-	PDFDoc.h		\
-	PDFDocBuilder.h		\
-	PDFDocEncoding.h	\
-	PDFDocFactory.h		\
-	PopplerCache.h		\
-	ProfileData.h		\
-	PreScanOutputDev.h	\
-	PSTokenizer.h		\
-	Rendition.h		\
-	SignatureInfo.h		\
-	StdinCachedFile.h	\
-	StdinPDFDocBuilder.h	\
-	Stream-CCITT.h		\
-	Stream.h		\
-	StructElement.h		\
-	StructTreeRoot.h	\
-	UnicodeMap.h		\
-	UnicodeMapTables.h	\
-	UnicodeTypeTable.h	\
-	UnicodeCClassTables.h	\
-	UnicodeCompTables.h	\
-	UnicodeDecompTables.h	\
-	ViewerPreferences.h	\
-	XRef.h			\
-	CharTypes.h		\
-	CompactFontTables.h	\
-	ErrorCodes.h		\
-	NameToUnicodeTable.h	\
-	PSOutputDev.h		\
-	TextOutputDev.h		\
-	MarkedContentOutputDev.h \
-	SecurityHandler.h	\
-	UTF.h			\
-	UTF8.h			\
-	XpdfPluginAPI.h		\
-	Sound.h
-nodist_poppler_include_HEADERS = poppler-config.h
-
-endif
-
-libpoppler_la_SOURCES =		\
-	$(splash_sources)	\
-	$(libjpeg_sources)	\
-	$(zlib_sources)		\
-	$(zlib_uncompress_sources) \
-	$(nss_sources)      \
-	$(libjpeg2000_sources)	\
-	$(curl_sources)		\
-	Annot.cc		\
-	Array.cc 		\
-	BuiltinFont.cc		\
-	BuiltinFontTables.cc	\
-	CachedFile.cc		\
-	Catalog.cc 		\
-	CharCodeToUnicode.cc	\
-	CMap.cc			\
-	DateInfo.cc		\
-	Decrypt.cc		\
-	Dict.cc 		\
-	Error.cc 		\
-	FileSpec.cc		\
-	FontEncodingTables.cc	\
-	Form.cc 		\
-	FontInfo.cc		\
-	Function.cc		\
-	Gfx.cc 			\
-	GfxFont.cc 		\
-	GfxState.cc		\
-	GlobalParams.cc		\
-	Hints.cc		\
-	JArithmeticDecoder.cc	\
-	JBIG2Stream.cc		\
-	Lexer.cc 		\
-	Linearization.cc 	\
-	Link.cc 		\
-	LocalPDFDocBuilder.cc	\
-	Movie.cc                \
-	NameToCharCode.cc	\
-	Object.cc 		\
-	OptionalContent.cc	\
-	Outline.cc		\
-	OutputDev.cc 		\
-	Page.cc 		\
-	PageTransition.cc	\
-	Parser.cc 		\
-	PDFDoc.cc 		\
-	PDFDocEncoding.cc	\
-	PDFDocFactory.cc	\
-	PopplerCache.cc		\
-	ProfileData.cc		\
-	PreScanOutputDev.cc \
-	PSTokenizer.cc		\
-	Rendition.cc		\
-	SignatureInfo.cc	\
-	StdinCachedFile.cc	\
-	StdinPDFDocBuilder.cc	\
-	Stream.cc 		\
-	StructTreeRoot.cc	\
-	StructElement.cc	\
-	strtok_r.cpp		\
-	UnicodeMap.cc		\
-	UnicodeTypeTable.cc	\
-	UTF.cc                  \
-	ViewerPreferences.cc	\
-	XRef.cc			\
-	PSOutputDev.cc		\
-	TextOutputDev.cc	\
-	MarkedContentOutputDev.cc \
-	PageLabelInfo.h		\
-	PageLabelInfo.cc	\
-	SecurityHandler.cc	\
-	Sound.cc		\
-	XpdfPluginAPI.cc
-
-libpoppler_la_CPPFLAGS =			\
-	$(cms_includes)				\
-	$(splash_includes)			\
-	$(libjpeg_includes)			\
-	$(libtiff_includes)			\
-	$(libjpeg2000_includes)			\
-	$(libpng_includes)			\
-	$(libcurl_includes)			\
-	$(nss_includes)				\
-	$(FREETYPE_CFLAGS)			\
-	$(FONTCONFIG_CFLAGS)			\
-	$(AM_CPPFLAGS)
-
-libpoppler_la_LIBADD =				\
-	$(top_builddir)/goo/libgoo.la		\
-	$(top_builddir)/fofi/libfofi.la		\
-	$(cms_libs)				\
-	$(splash_libs)				\
-	$(libtiff_libs)				\
-	$(libjpeg_libs)				\
-	$(libpng_libs)				\
-	$(zlib_libs)				\
-	$(libcurl_libs)				\
-	$(nss_libs)                 \
-	$(libjpeg2000_libs)			\
-	$(FREETYPE_LIBS)			\
-	$(FONTCONFIG_LIBS)			\
-	$(PTHREAD_LIBS)				\
-	$(win32_libs)
-
-libpoppler_la_LDFLAGS =				\
-	-version-info 66:0:0			\
-	@create_shared_lib@			\
-	@auto_import_flags@
-
-libpoppler_cairo_la_SOURCES =			\
-	CairoFontEngine.cc			\
-	CairoFontEngine.h			\
-	CairoOutputDev.cc			\
-	CairoOutputDev.h			\
-	CairoRescaleBox.cc			\
-	CairoRescaleBox.h
-
-libpoppler_cairo_la_CPPFLAGS =			\
-	$(CAIRO_CFLAGS)				\
-	$(AM_CPPFLAGS)
-
-EXTRA_DIST = gen-unicode-tables.py	\
-             GlobalParamsWin.cc         \
-             PageLabelInfo_p.h

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/MarkedContentOutputDev.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -89,24 +89,24 @@
   virtual ~MarkedContentOutputDev();
 
   virtual GBool isOk() { return gTrue; }
-  virtual GBool upsideDown() { return gTrue; }
-  virtual GBool useDrawChar() { return gTrue; }
-  virtual GBool interpretType3Chars() { return gFalse; }
-  virtual GBool needNonText() { return gFalse; }
-  virtual GBool needCharCount() { return gFalse; }
+  GBool upsideDown() override { return gTrue; }
+  GBool useDrawChar() override { return gTrue; }
+  GBool interpretType3Chars() override { return gFalse; }
+  GBool needNonText() override { return gFalse; }
+  GBool needCharCount() override { return gFalse; }
 
-  virtual void startPage(int pageNum, GfxState *state, XRef *xref);
-  virtual void endPage();
+  void startPage(int pageNum, GfxState *state, XRef *xref) override;
+  void endPage() override;
 
-  virtual void drawChar(GfxState *state,
+  void drawChar(GfxState *state,
                         double xx, double yy,
                         double dx, double dy,
                         double ox, double oy,
                         CharCode c, int nBytes,
-                        Unicode *u, int uLen);
+                        Unicode *u, int uLen) override;
 
-  virtual void beginMarkedContent(char *name, Dict *properties);
-  virtual void endMarkedContent(GfxState *state);
+  void beginMarkedContent(char *name, Dict *properties) override;
+  void endMarkedContent(GfxState *state) override;
 
   const TextSpanArray& getTextSpans() const;
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Movie.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Movie.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Movie.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -6,7 +6,7 @@
 // Hugo Mercier <hmercier31[at]gmail.com> (c) 2008
 // Pino Toscano <pino at kde.org> (c) 2008
 // Carlos Garcia Campos <carlosgc at gnome.org> (c) 2010
-// Albert Astals Cid <aacid at kde.org> (c) 2010
+// Albert Astals Cid <aacid at kde.org> (c) 2010, 2017
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -47,9 +47,8 @@
 }
 
 void MovieActivationParameters::parseMovieActivation(Object* aDict) {
-  Object obj1;
-
-  if (!aDict->dictLookup("Start", &obj1)->isNull()) {
+  Object obj1 = aDict->dictLookup("Start");
+  if (obj1.isNull()) {
     if (obj1.isInt()) {
       // If it is representable as an integer (subject to the implementation limit for
       // integers, as described in Appendix C), it should be specified as such.
@@ -64,8 +63,7 @@
     } else if (obj1.isArray()) {
       Array* a = obj1.getArray();
 
-      Object tmp;
-      a->get(0, &tmp);
+      Object tmp = a->get(0);
       if (tmp.isInt()) {
         start.units = tmp.getInt();
       }
@@ -72,18 +70,16 @@
       if (tmp.isString()) {
         // UNSUPPORTED
       }
-      tmp.free();
 
-      a->get(1, &tmp);
+      tmp = a->get(1);
       if (tmp.isInt()) {
         start.units_per_second = tmp.getInt();
       }
-      tmp.free();
     }
   }
-  obj1.free();
 
-  if (!aDict->dictLookup("Duration", &obj1)->isNull()) {
+  obj1 = aDict->dictLookup("Duration");
+  if (obj1.isNull()) {
     if (obj1.isInt()) {
       duration.units = obj1.getInt();
     } else if (obj1.isString()) {
@@ -91,8 +87,7 @@
     } else if (obj1.isArray()) {
       Array* a = obj1.getArray();
 
-      Object tmp;
-      a->get(0, &tmp);
+      Object tmp = a->get(0);
       if (tmp.isInt()) {
         duration.units = tmp.getInt();
       }
@@ -99,39 +94,37 @@
       if (tmp.isString()) {
         // UNSUPPORTED
       }
-      tmp.free();
 
-      a->get(1, &tmp);
+      tmp = a->get(1);
       if (tmp.isInt()) {
         duration.units_per_second = tmp.getInt();
       }
-      tmp.free();
     }
   }
-  obj1.free();
 
-  if (aDict->dictLookup("Rate", &obj1)->isNum()) {
+  obj1 = aDict->dictLookup("Rate");
+  if (obj1.isNum()) {
     rate = obj1.getNum();
   }
-  obj1.free();
 
-  if (aDict->dictLookup("Volume", &obj1)->isNum()) {
+  obj1 = aDict->dictLookup("Volume");
+  if (obj1.isNum()) {
     // convert volume to [0 100]
     volume = int((obj1.getNum() + 1.0) * 50);
   }
-  obj1.free();
 
-  if (aDict->dictLookup("ShowControls", &obj1)->isBool()) {
+  obj1 = aDict->dictLookup("ShowControls");
+  if (obj1.isBool()) {
     showControls = obj1.getBool();
   }
-  obj1.free();
 
-  if (aDict->dictLookup("Synchronous", &obj1)->isBool()) {
+  obj1 = aDict->dictLookup("Synchronous");
+  if (obj1.isBool()) {
     synchronousPlay = obj1.getBool();
   }
-  obj1.free();
 
-  if (aDict->dictLookup("Mode", &obj1)->isName()) {
+  obj1 = aDict->dictLookup("Mode");
+  if (obj1.isName()) {
     char* name = obj1.getName();
     if (!strcmp(name, "Once")) {
       repeatMode = repeatModeOnce;
@@ -143,9 +136,9 @@
       repeatMode = repeatModePalindrome;
     }
   }
-  obj1.free();
 
-  if (aDict->dictLookup("FWScale", &obj1)->isArray()) {
+  obj1 = aDict->dictLookup("FWScale");
+  if (obj1.isArray()) {
     // the presence of that entry implies that the movie is to be played
     // in a floating window
     floatingWindow = gTrue;
@@ -152,34 +145,31 @@
 
     Array* scale = obj1.getArray();
     if (scale->getLength() >= 2) {
-      Object tmp;
-      if (scale->get(0, &tmp)->isInt()) {
+      Object tmp = scale->get(1);
+      if (tmp.isInt()) {
         znum = tmp.getInt();
       }
-      tmp.free();
-      if (scale->get(1, &tmp)->isInt()) {
+      tmp = scale->get(1);
+      if (tmp.isInt()) {
         zdenum = tmp.getInt();
       }
-      tmp.free();
     }
   }
-  obj1.free();
 
-  if (aDict->dictLookup("FWPosition", &obj1)->isArray()) {
+  obj1 = aDict->dictLookup("FWPosition");
+  if (obj1.isArray()) {
     Array* pos = obj1.getArray();
     if (pos->getLength() >= 2) {
-      Object tmp;
-      if (pos->get(0, &tmp)->isNum()) {
+      Object tmp = pos->get(0);
+      if (tmp.isNum()) {
         xPosition = tmp.getNum();
       }
-      tmp.free();
-      if (pos->get(1, &tmp)->isNum()) {
+      tmp = pos->get(1);
+      if (tmp.isNum()) {
         yPosition = tmp.getNum();
       }
-      tmp.free();
     }
   }
-  obj1.free();
 }
 
 void Movie::parseMovie (Object *movieDict) {
@@ -189,59 +179,55 @@
   height = -1;
   showPoster = gFalse;
 
-  Object obj1, obj2;
-  if (getFileSpecNameForPlatform(movieDict->dictLookup("F", &obj1), &obj2)) {
+  Object obj1 = movieDict->dictLookup("F");
+  Object obj2 = getFileSpecNameForPlatform(&obj1);
+  if (obj2.isString()) {
     fileName = obj2.getString()->copy();
-    obj2.free();
   } else {
     error (errSyntaxError, -1, "Invalid Movie");
     ok = gFalse;
-    obj1.free();
     return;
   }
-  obj1.free();
 
-  if (movieDict->dictLookup("Aspect", &obj1)->isArray()) {
+  obj1 = movieDict->dictLookup("Aspect");
+  if (obj1.isArray()) {
     Array* aspect = obj1.getArray();
     if (aspect->getLength() >= 2) {
-      Object tmp;
-      if( aspect->get(0, &tmp)->isNum() ) {
-        width = (int)floor( aspect->get(0, &tmp)->getNum() + 0.5 );
+      Object tmp = aspect->get(0);
+      if( tmp.isNum() ) {
+        width = (int)floor( tmp.getNum() + 0.5 );
       }
-      tmp.free();
-      if( aspect->get(1, &tmp)->isNum() ) {
-        height = (int)floor( aspect->get(1, &tmp)->getNum() + 0.5 );
+      tmp = aspect->get(1);
+      if( tmp.isNum() ) {
+        height = (int)floor( tmp.getNum() + 0.5 );
       }
-      tmp.free();
     }
   }
-  obj1.free();
 
-  if (movieDict->dictLookup("Rotate", &obj1)->isInt()) {
+  obj1 = movieDict->dictLookup("Rotate");
+  if (obj1.isInt()) {
     // round up to 90°
     rotationAngle = (((obj1.getInt() + 360) % 360) % 90) * 90;
   }
-  obj1.free();
 
   //
   // movie poster
   //
-  if (!movieDict->dictLookupNF("Poster", &poster)->isNull()) {
+  poster = movieDict->dictLookupNF("Poster");
+  if (!poster.isNull()) {
     if (poster.isRef() || poster.isStream()) {
       showPoster = gTrue;
     } else if (poster.isBool()) {
       showPoster = poster.getBool();
-      poster.free();
+      poster.setToNull();
     } else {
-      poster.free();
+      poster.setToNull();
     }
   }
 }
 
 Movie::~Movie() {
-  if (fileName)
-    delete fileName;
-  poster.free();
+  delete fileName;
 }
 
 Movie::Movie(Object *movieDict) {
@@ -265,6 +251,23 @@
   }
 }
 
+Movie::Movie(const Movie &other)
+{
+  ok = other.ok;
+  rotationAngle = other.rotationAngle;
+  width = other.width;
+  height = other.height;
+  showPoster = other.showPoster;
+  MA = other.MA;
+
+  poster = other.poster.copy();
+
+  if (other.fileName)
+    fileName = other.fileName->copy();
+  else
+    fileName = nullptr;
+}
+
 void Movie::getFloatingWindowSize(int *widthA, int *heightA)
 {
   *widthA = int(width * double(MA.znum) / MA.zdenum);
@@ -272,14 +275,5 @@
 }
 
 Movie* Movie::copy() {
-
-  // call default copy constructor
-  Movie* new_movie = new Movie(*this);
-
-  if (fileName)
-    new_movie->fileName = fileName->copy();
-
-  poster.copy(&new_movie->poster);
-
-  return new_movie;
+  return new Movie(*this);
 }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Movie.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Movie.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Movie.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -5,6 +5,7 @@
 //---------------------------------------------------------------------------------
 // Hugo Mercier <hmercier31[at]gmail.com> (c) 2008
 // Carlos Garcia Campos <carlosgc at gnome.org> (c) 2010
+// Albert Astals Cid <aacid at kde.org> (c) 2017
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -71,6 +72,7 @@
  public:
   Movie(Object *objMovie, Object *objAct);
   Movie(Object *objMovie);
+  Movie(const Movie &movie);
   ~Movie();
 
   GBool isOk() { return ok; }
@@ -81,7 +83,7 @@
   Gushort getRotationAngle() { return rotationAngle; }
   void getAspect (int *widthA, int *heightA) { *widthA = width; *heightA = height; }
 
-  Object *getPoster(Object *obj) { return poster.copy(obj); }
+  Object getPoster() { return poster.copy(); }
   GBool getShowPoster() { return showPoster; }
 
   GBool getUseFloatingWindow() { return MA.floatingWindow; }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Object.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Object.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Object.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2008, 2010, 2012 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2010, 2012, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
@@ -54,47 +54,48 @@
   "error",
   "eof",
   "none",
-  "integer64"
+  "integer64",
+  "dead"
 };
 
 #ifdef DEBUG_MEM
 int Object::numAlloc[numObjTypes] =
-  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 #endif
 
-Object *Object::initArray(XRef *xref) {
-  initObj(objArray);
-  array = new Array(xref);
-  return this;
+Object::Object(Object&& other)
+{
+  type = other.type;
+  real = other.real; // this is the biggest of the union so it's enough
+  other.type = objDead;
 }
 
-Object *Object::initDict(XRef *xref) {
-  initObj(objDict);
-  dict = new Dict(xref);
-  return this;
+Object& Object::operator=(Object&& other)
+{
+  free();
+  type = other.type;
+  real = other.real; // this is the biggest of the union so it's enough
+  other.type = objDead;
+  return *this;
 }
 
-Object *Object::initDict(Dict *dictA) {
-  initObj(objDict);
-  dict = dictA;
-  dict->incRef();
-  return this;
+Object::~Object()
+{
+  free();
 }
 
-Object *Object::initStream(Stream *streamA) {
-  initObj(objStream);
-  stream = streamA;
-  return this;
-}
+Object Object::copy() const {
+  CHECK_NOT_DEAD;
 
-Object *Object::copy(Object *obj) {
-  *obj = *this;
+  Object obj;
+  obj.type = type;
+  obj.real = real; // this is the biggest of the union so it's enough
   switch (type) {
   case objString:
-    obj->string = string->copy();
+    obj.string = string->copy();
     break;
   case objName:
-    obj->name = copyString(name);
+    obj.cString = copyString(cString);
     break;
   case objArray:
     array->incRef();
@@ -106,7 +107,7 @@
     stream->incRef();
     break;
   case objCmd:
-    obj->cmd = copyString(cmd);
+    obj.cString = copyString(cString);
     break;
   default:
     break;
@@ -117,9 +118,11 @@
   return obj;
 }
 
-Object *Object::fetch(XRef *xref, Object *obj, int recursion) {
+Object Object::fetch(XRef *xref, int recursion) const {
+  CHECK_NOT_DEAD;
+
   return (type == objRef && xref) ?
-         xref->fetch(ref.num, ref.gen, obj, recursion) : copy(obj);
+         xref->fetch(ref.num, ref.gen, recursion) : copy();
 }
 
 void Object::free() {
@@ -128,7 +131,7 @@
     delete string;
     break;
   case objName:
-    gfree(name);
+    gfree(cString);
     break;
   case objArray:
     if (!array->decRef()) {
@@ -146,7 +149,7 @@
     }
     break;
   case objCmd:
-    gfree(cmd);
+    gfree(cString);
     break;
   default:
     break;
@@ -157,11 +160,11 @@
   type = objNone;
 }
 
-const char *Object::getTypeName() {
+const char *Object::getTypeName() const {
   return objTypeNames[type];
 }
 
-void Object::print(FILE *f) {
+void Object::print(FILE *f) const {
   Object obj;
   int i;
 
@@ -181,7 +184,7 @@
     fprintf(f, ")");
     break;
   case objName:
-    fprintf(f, "/%s", name);
+    fprintf(f, "/%s", cString);
     break;
   case objNull:
     fprintf(f, "null");
@@ -191,9 +194,8 @@
     for (i = 0; i < arrayGetLength(); ++i) {
       if (i > 0)
 	fprintf(f, " ");
-      arrayGetNF(i, &obj);
+      obj = arrayGetNF(i);
       obj.print(f);
-      obj.free();
     }
     fprintf(f, "]");
     break;
@@ -201,9 +203,8 @@
     fprintf(f, "<<");
     for (i = 0; i < dictGetLength(); ++i) {
       fprintf(f, " /%s ", dictGetKey(i));
-      dictGetValNF(i, &obj);
+      obj = dictGetValNF(i);
       obj.print(f);
-      obj.free();
     }
     fprintf(f, " >>");
     break;
@@ -214,7 +215,7 @@
     fprintf(f, "%d %d R", ref.num, ref.gen);
     break;
   case objCmd:
-    fprintf(f, "%s", cmd);
+    fprintf(f, "%s", cString);
     break;
   case objError:
     fprintf(f, "<error>");
@@ -225,6 +226,9 @@
   case objNone:
     fprintf(f, "<none>");
     break;
+    case objDead:
+    fprintf(f, "<dead>");
+    break;
   case objInt64:
     fprintf(f, "%lld", int64g);
     break;

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Object.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Object.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Object.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -15,11 +15,11 @@
 //
 // Copyright (C) 2007 Julien Rebetez <julienr at svn.gnome.org>
 // Copyright (C) 2008 Kees Cook <kees at outflux.net>
-// Copyright (C) 2008, 2010 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2010, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Jakub Wilk <jwilk at jwilk.net>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
-// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 Adrian Perez de Castro <aperez at igalia.com>
 // Copyright (C) 2016 Jakub Alba <jakubalba at gmail.com>
 //
@@ -38,6 +38,7 @@
 #include <set>
 #include <stdio.h>
 #include <string.h>
+#include <limits.h>
 #include "goo/gtypes.h"
 #include "goo/gmem.h"
 #include "goo/GooString.h"
@@ -65,6 +66,12 @@
         abort(); \
     }
 
+#define CHECK_NOT_DEAD \
+  if (unlikely(type == objDead)) { \
+        error(errInternal, 0, "Call to dead object"); \
+        abort(); \
+    }
+
 class XRef;
 class Array;
 class Dict;
@@ -105,10 +112,11 @@
   objNone,			// uninitialized object
 
   // poppler-only objects
-  objInt64			// integer with at least 64-bits
+  objInt64,			// integer with at least 64-bits
+  objDead			// and object after shallowCopy
 };
 
-#define numObjTypes 15		// total number of object types
+#define numObjTypes 16		// total number of object types
 
 //------------------------------------------------------------------------
 // Object
@@ -115,156 +123,177 @@
 //------------------------------------------------------------------------
 
 #ifdef DEBUG_MEM
-#define initObj(t) zeroUnion(); ++numAlloc[type = t]
+#define initObj(t) free(); zeroUnion(); ++numAlloc[type = t]
 #else
-#define initObj(t) zeroUnion(); type = t
+#define initObj(t) free(); zeroUnion(); type = t
 #endif
 
+#ifdef DEBUG_MEM
+#define constructObj(t) ++numAlloc[type = t]
+#else
+#define constructObj(t) type = t
+#endif
+
 class Object {
 public:
   // clear the anonymous union as best we can -- clear at least a pointer
-  void zeroUnion() { this->name = NULL; }
+  void zeroUnion() { this->cString = NULL; }
 
   // Default constructor.
   Object():
     type(objNone) { zeroUnion(); }
+  ~Object();
 
-  // Initialize an object.
-  Object *initBool(GBool boolnA)
-    { initObj(objBool); booln = boolnA; return this; }
-  Object *initInt(int intgA)
-    { initObj(objInt); intg = intgA; return this; }
-  Object *initReal(double realA)
-    { initObj(objReal); real = realA; return this; }
-  Object *initString(GooString *stringA)
-    { initObj(objString); string = stringA; return this; }
-  Object *initName(const char *nameA)
-    { initObj(objName); name = copyString(nameA); return this; }
-  Object *initNull()
-    { initObj(objNull); return this; }
-  Object *initArray(XRef *xref);
-  Object *initDict(XRef *xref);
-  Object *initDict(Dict *dictA);
-  Object *initStream(Stream *streamA);
-  Object *initRef(int numA, int genA)
-    { initObj(objRef); ref.num = numA; ref.gen = genA; return this; }
-  Object *initCmd(const char *cmdA)
-    { initObj(objCmd); cmd = copyString(cmdA); return this; }
-  Object *initError()
-    { initObj(objError); return this; }
-  Object *initEOF()
-    { initObj(objEOF); return this; }
-  Object *initInt64(long long int64gA)
-    { initObj(objInt64); int64g = int64gA; return this; }
+  explicit Object(GBool boolnA)
+    { constructObj(objBool); booln = boolnA; }
+  explicit Object(int intgA)
+    { constructObj(objInt); intg = intgA; }
+  explicit Object(ObjType typeA)
+    { constructObj(typeA); }
+  explicit Object(double realA)
+    { constructObj(objReal); real = realA; }
+  explicit Object(GooString *stringA)
+    { constructObj(objString); string = stringA; }
+  Object(ObjType typeA, const char *stringA)
+    { constructObj(typeA); cString = copyString(stringA); }
+  explicit Object(long long int64gA)
+    { constructObj(objInt64); int64g = int64gA; }
+  explicit Object(Array *arrayA)
+    { constructObj(objArray); array = arrayA; }
+  explicit Object(Dict *dictA)
+    { constructObj(objDict); dict = dictA; }
+  explicit Object(Stream *streamA)
+    { constructObj(objStream); stream = streamA; }
+  Object(int numA, int genA)
+    { constructObj(objRef); ref.num = numA; ref.gen = genA; }
+  template<typename T> Object(T) = delete;
 
-  // Copy an object.
-  Object *copy(Object *obj);
-  Object *shallowCopy(Object *obj) {
-    *obj = *this;
-    return obj;
-  }
+  Object(Object&& other);
+  Object& operator=(Object&& other);
 
+  Object &operator=(const Object &other) = delete;
+  Object(const Object &other) = delete;
+
+  // Set object to null.
+  void setToNull() { initObj(objNull); }
+
+  // Copy this to obj
+  Object copy() const;
+
   // If object is a Ref, fetch and return the referenced object.
   // Otherwise, return a copy of the object.
-  Object *fetch(XRef *xref, Object *obj, int recursion = 0);
+  Object fetch(XRef *xref, int recursion = 0) const;
 
-  // Free object contents.
-  void free();
-
   // Type checking.
-  ObjType getType() { return type; }
-  GBool isBool() { return type == objBool; }
-  GBool isInt() { return type == objInt; }
-  GBool isReal() { return type == objReal; }
-  GBool isNum() { return type == objInt || type == objReal || type == objInt64; }
-  GBool isString() { return type == objString; }
-  GBool isName() { return type == objName; }
-  GBool isNull() { return type == objNull; }
-  GBool isArray() { return type == objArray; }
-  GBool isDict() { return type == objDict; }
-  GBool isStream() { return type == objStream; }
-  GBool isRef() { return type == objRef; }
-  GBool isCmd() { return type == objCmd; }
-  GBool isError() { return type == objError; }
-  GBool isEOF() { return type == objEOF; }
-  GBool isNone() { return type == objNone; }
-  GBool isInt64() { return type == objInt64; }
-  GBool isIntOrInt64() { return type == objInt || type == objInt64; }
+  ObjType getType() const { CHECK_NOT_DEAD; return type; }
+  GBool isBool() const { CHECK_NOT_DEAD; return type == objBool; }
+  GBool isInt() const { CHECK_NOT_DEAD; return type == objInt; }
+  GBool isReal() const { CHECK_NOT_DEAD; return type == objReal; }
+  GBool isNum() const { CHECK_NOT_DEAD; return type == objInt || type == objReal || type == objInt64; }
+  GBool isString() const { CHECK_NOT_DEAD; return type == objString; }
+  GBool isName() const { CHECK_NOT_DEAD; return type == objName; }
+  GBool isNull() const { CHECK_NOT_DEAD; return type == objNull; }
+  GBool isArray() const { CHECK_NOT_DEAD; return type == objArray; }
+  GBool isDict() const { CHECK_NOT_DEAD; return type == objDict; }
+  GBool isStream() const { CHECK_NOT_DEAD; return type == objStream; }
+  GBool isRef() const { CHECK_NOT_DEAD; return type == objRef; }
+  GBool isCmd() const { CHECK_NOT_DEAD; return type == objCmd; }
+  GBool isError() const { CHECK_NOT_DEAD; return type == objError; }
+  GBool isEOF() const { CHECK_NOT_DEAD; return type == objEOF; }
+  GBool isNone() const { CHECK_NOT_DEAD; return type == objNone; }
+  GBool isInt64() const { CHECK_NOT_DEAD; return type == objInt64; }
+  GBool isIntOrInt64() const { CHECK_NOT_DEAD; return type == objInt || type == objInt64; }
 
   // Special type checking.
-  GBool isName(const char *nameA)
-    { return type == objName && !strcmp(name, nameA); }
-  GBool isDict(const char *dictType);
-  GBool isStream(const char *dictType);
-  GBool isCmd(const char *cmdA)
-    { return type == objCmd && !strcmp(cmd, cmdA); }
+  GBool isName(const char *nameA) const
+    { return type == objName && !strcmp(cString, nameA); }
+  GBool isDict(const char *dictType) const;
+  GBool isStream(char *dictType) const;
+  GBool isCmd(const char *cmdA) const
+    { return type == objCmd && !strcmp(cString, cmdA); }
 
   // Accessors.
-  GBool getBool() { OBJECT_TYPE_CHECK(objBool); return booln; }
-  int getInt() { OBJECT_TYPE_CHECK(objInt); return intg; }
-  double getReal() { OBJECT_TYPE_CHECK(objReal); return real; }
+  GBool getBool() const { OBJECT_TYPE_CHECK(objBool); return booln; }
+  int getInt() const { OBJECT_TYPE_CHECK(objInt); return intg; }
+  double getReal() const { OBJECT_TYPE_CHECK(objReal); return real; }
 
   // Note: integers larger than 2^53 can not be exactly represented by a double.
   // Where the exact value of integers up to 2^63 is required, use isInt64()/getInt64().
-  double getNum() { OBJECT_3TYPES_CHECK(objInt, objInt64, objReal);
+  double getNum() const { OBJECT_3TYPES_CHECK(objInt, objInt64, objReal);
     return type == objInt ? (double)intg : type == objInt64 ? (double)int64g : real; }
-  GooString *getString() { OBJECT_TYPE_CHECK(objString); return string; }
+  double getNum(bool *ok) const {
+    if (unlikely(type != objInt && type != objInt64 && type != objReal)) {
+      *ok = false;
+      return 0.;
+    }
+    return type == objInt ? (double)intg : type == objInt64 ? (double)int64g : real;
+  }
+  GooString *getString() const { OBJECT_TYPE_CHECK(objString); return string; }
   // After takeString() the only method that should be called for the object is free()
   // because the object it's not expected to have a NULL string.
   GooString *takeString() {
     OBJECT_TYPE_CHECK(objString); GooString *s = string; string = NULL; return s; }
-  char *getName() { OBJECT_TYPE_CHECK(objName); return name; }
-  Array *getArray() { OBJECT_TYPE_CHECK(objArray); return array; }
-  Dict *getDict() { OBJECT_TYPE_CHECK(objDict); return dict; }
-  Stream *getStream() { OBJECT_TYPE_CHECK(objStream); return stream; }
-  Ref getRef() { OBJECT_TYPE_CHECK(objRef); return ref; }
-  int getRefNum() { OBJECT_TYPE_CHECK(objRef); return ref.num; }
-  int getRefGen() { OBJECT_TYPE_CHECK(objRef); return ref.gen; }
-  char *getCmd() { OBJECT_TYPE_CHECK(objCmd); return cmd; }
-  long long getInt64() { OBJECT_TYPE_CHECK(objInt64); return int64g; }
-  long long getIntOrInt64() { OBJECT_2TYPES_CHECK(objInt, objInt64);
+  char *getName() const { OBJECT_TYPE_CHECK(objName); return cString; }
+  Array *getArray() const { OBJECT_TYPE_CHECK(objArray); return array; }
+  Dict *getDict() const { OBJECT_TYPE_CHECK(objDict); return dict; }
+  Stream *getStream() const { OBJECT_TYPE_CHECK(objStream); return stream; }
+  Ref getRef() const { OBJECT_TYPE_CHECK(objRef); return ref; }
+  int getRefNum() const { OBJECT_TYPE_CHECK(objRef); return ref.num; }
+  int getRefGen() const { OBJECT_TYPE_CHECK(objRef); return ref.gen; }
+  char *getCmd() const { OBJECT_TYPE_CHECK(objCmd); return cString; }
+  long long getInt64() const { OBJECT_TYPE_CHECK(objInt64); return int64g; }
+  long long getIntOrInt64() const { OBJECT_2TYPES_CHECK(objInt, objInt64);
     return type == objInt ? intg : int64g; }
 
   // Array accessors.
-  int arrayGetLength();
-  void arrayAdd(Object *elem);
+  int arrayGetLength() const;
+  void arrayAdd(Object &&elem);
   void arrayRemove(int i);
-  Object *arrayGet(int i, Object *obj, int recursion);
-  Object *arrayGetNF(int i, Object *obj);
+  Object arrayGet(int i, int recursion) const;
+  Object arrayGetNF(int i) const;
 
   // Dict accessors.
-  int dictGetLength();
-  void dictAdd(char *key, Object *val);
-  void dictSet(const char *key, Object *val);
+  int dictGetLength() const;
+  void dictAdd(char *key, Object &&val);
+  void dictSet(const char *key, Object &&val);
   void dictRemove(const char *key);
-  GBool dictIs(const char *dictType);
-  Object *dictLookup(const char *key, Object *obj, int recursion = 0);
-  Object *dictLookupNF(const char *key, Object *obj);
-  char *dictGetKey(int i);
-  Object *dictGetVal(int i, Object *obj);
-  Object *dictGetValNF(int i, Object *obj);
+  GBool dictIs(const char *dictType) const;
+  Object dictLookup(const char *key, int recursion = 0) const;
+  Object dictLookupNF(const char *key) const;
+  char *dictGetKey(int i) const;
+  Object dictGetVal(int i) const;
+  Object dictGetValNF(int i) const;
 
   // Stream accessors.
-  GBool streamIs(const char *dictType);
+  GBool streamIs(char *dictType) const;
   void streamReset();
   void streamClose();
-  int streamGetChar();
-  int streamGetChars(int nChars, Guchar *buffer);
-  int streamLookChar();
-  char *streamGetLine(char *buf, int size);
-  Goffset streamGetPos();
+  int streamGetChar() const;
+  int streamGetChars(int nChars, Guchar *buffer) const;
+  int streamLookChar() const;
+  char *streamGetLine(char *buf, int size) const;
+  Goffset streamGetPos() const;
   void streamSetPos(Goffset pos, int dir = 0);
-  Dict *streamGetDict();
+  Dict *streamGetDict() const;
 
   // Output.
-  const char *getTypeName();
-  void print(FILE *f = stdout);
+  const char *getTypeName() const;
+  void print(FILE *f = stdout) const;
 
   // Memory testing.
   static void memCheck(FILE *f);
 
 private:
+  friend class Array; // Needs free and initNullAfterMalloc
+  friend class Dict; // Needs free and initNullAfterMalloc
+  friend class XRef; // Needs free and initNullAfterMalloc
 
+  // Free object contents.
+  void free();
+
+  // Only use if are mallocing Objects
+  void initNullAfterMalloc() { constructObj(objNull); }
+
   ObjType type;			// object type
   union {			// value for each type:
     GBool booln;		//   boolean
@@ -272,12 +301,11 @@
     long long int64g;           //   64-bit integer
     double real;		//   real
     GooString *string;		//   string
-    char *name;			//   name
+    char *cString;		//   name or command, depending on objType
     Array *array;		//   array
     Dict *dict;			//   dictionary
     Stream *stream;		//   stream
     Ref ref;			//   indirect reference
-    char *cmd;			//   command
   };
 
 #ifdef DEBUG_MEM
@@ -292,20 +320,20 @@
 
 #include "Array.h"
 
-inline int Object::arrayGetLength()
+inline int Object::arrayGetLength() const
   { OBJECT_TYPE_CHECK(objArray); return array->getLength(); }
 
-inline void Object::arrayAdd(Object *elem)
-  { OBJECT_TYPE_CHECK(objArray); array->add(elem); }
+inline void Object::arrayAdd(Object &&elem)
+  { OBJECT_TYPE_CHECK(objArray); array->add(std::move(elem)); }
 
 inline void Object::arrayRemove(int i)
   { OBJECT_TYPE_CHECK(objArray); array->remove(i); }
 
-inline Object *Object::arrayGet(int i, Object *obj, int recursion = 0)
-  { OBJECT_TYPE_CHECK(objArray); return array->get(i, obj, recursion); }
+inline Object Object::arrayGet(int i, int recursion = 0) const
+  { OBJECT_TYPE_CHECK(objArray); return array->get(i, recursion); }
 
-inline Object *Object::arrayGetNF(int i, Object *obj)
-  { OBJECT_TYPE_CHECK(objArray); return array->getNF(i, obj); }
+inline Object Object::arrayGetNF(int i) const
+  { OBJECT_TYPE_CHECK(objArray); return array->getNF(i); }
 
 //------------------------------------------------------------------------
 // Dict accessors.
@@ -313,38 +341,38 @@
 
 #include "Dict.h"
 
-inline int Object::dictGetLength()
+inline int Object::dictGetLength() const
   { OBJECT_TYPE_CHECK(objDict); return dict->getLength(); }
 
-inline void Object::dictAdd(char *key, Object *val)
-  { OBJECT_TYPE_CHECK(objDict); dict->add(key, val); }
+inline void Object::dictAdd(char *key, Object &&val)
+  { OBJECT_TYPE_CHECK(objDict); dict->add(key, std::move(val)); }
 
-inline void Object::dictSet(const char *key, Object *val)
-  { OBJECT_TYPE_CHECK(objDict); dict->set(key, val); }
+inline void Object::dictSet(const char *key, Object &&val)
+  { OBJECT_TYPE_CHECK(objDict); dict->set(key, std::move(val)); }
 
 inline void Object::dictRemove(const char *key)
   { OBJECT_TYPE_CHECK(objDict); dict->remove(key); }
 
-inline GBool Object::dictIs(const char *dictType)
+inline GBool Object::dictIs(const char *dictType) const
   { OBJECT_TYPE_CHECK(objDict); return dict->is(dictType); }
 
-inline GBool Object::isDict(const char *dictType)
+inline GBool Object::isDict(const char *dictType) const
   { return type == objDict && dictIs(dictType); }
 
-inline Object *Object::dictLookup(const char *key, Object *obj, int recursion)
-  { OBJECT_TYPE_CHECK(objDict); return dict->lookup(key, obj, recursion); }
+inline Object Object::dictLookup(const char *key, int recursion) const
+  { OBJECT_TYPE_CHECK(objDict); return dict->lookup(key, recursion); }
 
-inline Object *Object::dictLookupNF(const char *key, Object *obj)
-  { OBJECT_TYPE_CHECK(objDict); return dict->lookupNF(key, obj); }
+inline Object Object::dictLookupNF(const char *key) const
+  { OBJECT_TYPE_CHECK(objDict); return dict->lookupNF(key); }
 
-inline char *Object::dictGetKey(int i)
+inline char *Object::dictGetKey(int i) const
   { OBJECT_TYPE_CHECK(objDict); return dict->getKey(i); }
 
-inline Object *Object::dictGetVal(int i, Object *obj)
-  { OBJECT_TYPE_CHECK(objDict); return dict->getVal(i, obj); }
+inline Object Object::dictGetVal(int i) const
+  { OBJECT_TYPE_CHECK(objDict); return dict->getVal(i); }
 
-inline Object *Object::dictGetValNF(int i, Object *obj)
-  { OBJECT_TYPE_CHECK(objDict); return dict->getValNF(i, obj); }
+inline Object Object::dictGetValNF(int i) const
+  { OBJECT_TYPE_CHECK(objDict); return dict->getValNF(i); }
 
 //------------------------------------------------------------------------
 // Stream accessors.
@@ -352,10 +380,10 @@
 
 #include "Stream.h"
 
-inline GBool Object::streamIs(const char *dictType)
+inline GBool Object::streamIs(char *dictType) const
   { OBJECT_TYPE_CHECK(objStream); return stream->getDict()->is(dictType); }
 
-inline GBool Object::isStream(const char *dictType)
+inline GBool Object::isStream(char *dictType) const
   { return type == objStream && streamIs(dictType); }
 
 inline void Object::streamReset()
@@ -364,25 +392,25 @@
 inline void Object::streamClose()
   { OBJECT_TYPE_CHECK(objStream); stream->close(); }
 
-inline int Object::streamGetChar()
+inline int Object::streamGetChar() const
   { OBJECT_TYPE_CHECK(objStream); return stream->getChar(); }
 
-inline int Object::streamGetChars(int nChars, Guchar *buffer)
+inline int Object::streamGetChars(int nChars, Guchar *buffer) const
   { OBJECT_TYPE_CHECK(objStream); return stream->doGetChars(nChars, buffer); }
 
-inline int Object::streamLookChar()
+inline int Object::streamLookChar() const
   { OBJECT_TYPE_CHECK(objStream); return stream->lookChar(); }
 
-inline char *Object::streamGetLine(char *buf, int size)
+inline char *Object::streamGetLine(char *buf, int size) const
   { OBJECT_TYPE_CHECK(objStream); return stream->getLine(buf, size); }
 
-inline Goffset Object::streamGetPos()
+inline Goffset Object::streamGetPos() const
   { OBJECT_TYPE_CHECK(objStream); return stream->getPos(); }
 
 inline void Object::streamSetPos(Goffset pos, int dir)
   { OBJECT_TYPE_CHECK(objStream); stream->setPos(pos, dir); }
 
-inline Dict *Object::streamGetDict()
+inline Dict *Object::streamGetDict() const
   { OBJECT_TYPE_CHECK(objStream); return stream->getDict(); }
 
 #endif

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/OptionalContent.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/OptionalContent.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/OptionalContent.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -43,11 +43,9 @@
   optionalContentGroups = new GooList();
   display = NULL;
 
-  Object ocgList;
-  ocgObject->dictLookup("OCGs", &ocgList);
+  Object ocgList = ocgObject->dictLookup("OCGs");
   if (!ocgList.isArray()) {
     error(errSyntaxError, -1, "Expected the optional content group list, but wasn't able to find it, or it isn't an Array");
-    ocgList.free();
     ok = gFalse;
     return;
   }
@@ -54,39 +52,31 @@
 
   // we now enumerate over the ocgList, and build up the optionalContentGroups list.
   for(int i = 0; i < ocgList.arrayGetLength(); ++i) {
-    Object ocg;
-    ocgList.arrayGet(i, &ocg);
+    Object ocg = ocgList.arrayGet(i);
     if (!ocg.isDict()) {
-      ocg.free();
       break;
     }
     OptionalContentGroup *thisOptionalContentGroup = new OptionalContentGroup(ocg.getDict());
-    ocg.free();
-    ocgList.arrayGetNF(i, &ocg);
+    ocg = ocgList.arrayGetNF(i);
     if (!ocg.isRef()) {
-      ocg.free();
+      delete thisOptionalContentGroup;
       break;
     }
     // TODO: we should create a lookup map from Ref to the OptionalContentGroup
     thisOptionalContentGroup->setRef( ocg.getRef() );
-    ocg.free();
     // the default is ON - we change state later, depending on BaseState, ON and OFF
     thisOptionalContentGroup->setState(OptionalContentGroup::On);
     optionalContentGroups->append(thisOptionalContentGroup);
   }
 
-  Object defaultOcgConfig;
-  ocgObject->dictLookup("D", &defaultOcgConfig);
+  Object defaultOcgConfig = ocgObject->dictLookup("D");
   if (!defaultOcgConfig.isDict()) {
     error(errSyntaxError, -1, "Expected the default config, but wasn't able to find it, or it isn't a Dictionary");
-    defaultOcgConfig.free();
-    ocgList.free();
     ok = gFalse;
     return;
   }
 
-  Object baseState;
-  defaultOcgConfig.dictLookup("BaseState", &baseState);
+  Object baseState = defaultOcgConfig.dictLookup("BaseState");
   if (baseState.isName("OFF")) {
     for (int i = 0; i < optionalContentGroups->getLength(); ++i) {
       OptionalContentGroup *group;
@@ -95,22 +85,17 @@
       group->setState(OptionalContentGroup::Off);
     }
   }
-  baseState.free();
 
-  Object on;
-  defaultOcgConfig.dictLookup("ON", &on);
+  Object on = defaultOcgConfig.dictLookup("ON");
   if (on.isArray()) {
     // ON is an optional element
     for (int i = 0; i < on.arrayGetLength(); ++i) {
-      Object reference;
-      on.arrayGetNF(i, &reference);
+      Object reference = on.arrayGetNF(i);
       if (!reference.isRef()) {
 	// there can be null entries
-	reference.free();
 	break;
       }
       OptionalContentGroup *group = findOcgByRef( reference.getRef() );
-      reference.free();
       if (!group) {
 	error(errSyntaxWarning, -1, "Couldn't find group for reference");
 	break;
@@ -118,22 +103,17 @@
       group->setState(OptionalContentGroup::On);
     }
   }
-  on.free();
 
-  Object off;
-  defaultOcgConfig.dictLookup("OFF", &off);
+  Object off = defaultOcgConfig.dictLookup("OFF");
   if (off.isArray()) {
     // OFF is an optional element
     for (int i = 0; i < off.arrayGetLength(); ++i) {
-      Object reference;
-      off.arrayGetNF(i, &reference);
+      Object reference = off.arrayGetNF(i);
       if (!reference.isRef()) {
 	// there can be null entries
-	reference.free();
 	break;
       }
       OptionalContentGroup *group = findOcgByRef( reference.getRef() );
-      reference.free();
       if (!group) {
 	error(errSyntaxWarning, -1, "Couldn't find group for reference to set OFF");
 	break;
@@ -141,22 +121,15 @@
       group->setState(OptionalContentGroup::Off);
     }
   }
-  off.free();
 
-  defaultOcgConfig.dictLookup("Order", &order);
-  defaultOcgConfig.dictLookup("RBGroups", &rbgroups);
-
-  ocgList.free();
-  defaultOcgConfig.free();
+  order = defaultOcgConfig.dictLookup("Order");
+  rbgroups = defaultOcgConfig.dictLookup("RBGroups");
 }
 
 OCGs::~OCGs()
 {
   deleteGooList(optionalContentGroups, OptionalContentGroup);
-  order.free();
-  if (display)
-    delete display;
-  rbgroups.free();
+  delete display;
 }
 
 
@@ -193,12 +166,7 @@
 
 bool OCGs::optContentIsVisible( Object *dictRef )
 {
-  Object dictObj;
   Dict *dict;
-  Object dictType;
-  Object ocg;
-  Object policy;
-  Object ve;
   bool result = true;
 
   if (dictRef->isNull())
@@ -210,22 +178,22 @@
       return oc->getState() == OptionalContentGroup::On;
   }
 
-  dictRef->fetch( m_xref, &dictObj );
+  Object dictObj = dictRef->fetch( m_xref);
   if ( ! dictObj.isDict() ) {
     error(errSyntaxWarning, -1, "Unexpected oc reference target: {0:d}", dictObj.getType() );
-    dictObj.free();
     return result;
   }
   dict = dictObj.getDict();
   // printf("checking if optContent is visible\n");
-  dict->lookup("Type", &dictType);
+  Object dictType = dict->lookup("Type");
   if (dictType.isName("OCMD")) {
-    if (dict->lookup("VE", &ve)->isArray()) {
+    Object ve = dict->lookup("VE");
+    if (ve.isArray()) {
       result = evalOCVisibilityExpr(&ve, 0);
     } else {
-      dict->lookupNF("OCGs", &ocg);
+      Object ocg = dict->lookupNF("OCGs");
       if (ocg.isArray()) {
-        dict->lookup("P", &policy);
+        Object policy = dict->lookup("P");
         if (policy.isName("AllOn")) {
           result = allOn( ocg.getArray() );
         } else if (policy.isName("AllOff")) {
@@ -236,7 +204,6 @@
           // this is the default
           result = anyOn( ocg.getArray() );
         }
-        policy.free();
       } else if (ocg.isRef()) {
         OptionalContentGroup *oc = findOcgByRef( ocg.getRef() );
         if ( oc && oc->getState() == OptionalContentGroup::Off ) {
@@ -245,9 +212,7 @@
           result = true ;
         }
       }
-      ocg.free();
     }
-    ve.free();
   } else if ( dictType.isName("OCG") ) {
     OptionalContentGroup* oc = findOcgByRef( dictRef->getRef() );
     if ( oc && oc->getState() == OptionalContentGroup::Off ) {
@@ -254,8 +219,6 @@
       result=false;
     }
   }
-  dictType.free();
-  dictObj.free();
   // printf("visibility: %s\n", result? "on" : "off");
   return result;
 }
@@ -262,9 +225,7 @@
 
 GBool OCGs::evalOCVisibilityExpr(Object *expr, int recursion) {
   OptionalContentGroup *ocg;
-  Object expr2, op, obj;
   GBool ret;
-  int i;
 
   if (recursion > visibilityExprRecursionLimit) {
     error(errSyntaxError, -1,
@@ -276,19 +237,17 @@
       return ocg->getState() == OptionalContentGroup::On;
     }
   }
-  expr->fetch(m_xref, &expr2);
+  Object expr2 = expr->fetch(m_xref);
   if (!expr2.isArray() || expr2.arrayGetLength() < 1) {
     error(errSyntaxError, -1,
 	  "Invalid optional content visibility expression");
-    expr2.free();
     return gTrue;
   }
-  expr2.arrayGet(0, &op);
+  Object op = expr2.arrayGet(0);
   if (op.isName("Not")) {
     if (expr2.arrayGetLength() == 2) {
-      expr2.arrayGetNF(1, &obj);
+      Object obj = expr2.arrayGetNF(1);
       ret = !evalOCVisibilityExpr(&obj, recursion + 1);
-      obj.free();
     } else {
       error(errSyntaxError, -1,
 	    "Invalid optional content visibility expression");
@@ -296,17 +255,15 @@
     }
   } else if (op.isName("And")) {
     ret = gTrue;
-    for (i = 1; i < expr2.arrayGetLength() && ret; ++i) {
-      expr2.arrayGetNF(i, &obj);
+    for (int i = 1; i < expr2.arrayGetLength() && ret; ++i) {
+      Object obj = expr2.arrayGetNF(i);
       ret = evalOCVisibilityExpr(&obj, recursion + 1);
-      obj.free();
     }
   } else if (op.isName("Or")) {
     ret = gFalse;
-    for (i = 1; i < expr2.arrayGetLength() && !ret; ++i) {
-      expr2.arrayGetNF(i, &obj);
+    for (int i = 1; i < expr2.arrayGetLength() && !ret; ++i) {
+      Object obj = expr2.arrayGetNF(i);
       ret = evalOCVisibilityExpr(&obj, recursion + 1);
-      obj.free();
     }
   } else {
     error(errSyntaxError, -1,
@@ -313,8 +270,6 @@
 	  "Invalid optional content visibility expression");
     ret = gTrue;
   }
-  op.free();
-  expr2.free();
   return ret;
 }
 
@@ -321,8 +276,7 @@
 bool OCGs::allOn( Array *ocgArray )
 {
   for (int i = 0; i < ocgArray->getLength(); ++i) {
-    Object ocgItem;
-    ocgArray->getNF(i, &ocgItem);
+    Object ocgItem = ocgArray->getNF(i);
     if (ocgItem.isRef()) {
       OptionalContentGroup* oc = findOcgByRef( ocgItem.getRef() );      
       if ( oc && oc->getState() == OptionalContentGroup::Off ) {
@@ -336,8 +290,7 @@
 bool OCGs::allOff( Array *ocgArray )
 {
   for (int i = 0; i < ocgArray->getLength(); ++i) {
-    Object ocgItem;
-    ocgArray->getNF(i, &ocgItem);
+    Object ocgItem = ocgArray->getNF(i);
     if (ocgItem.isRef()) {
       OptionalContentGroup* oc = findOcgByRef( ocgItem.getRef() );      
       if ( oc && oc->getState() == OptionalContentGroup::On ) {
@@ -351,8 +304,7 @@
 bool OCGs::anyOn( Array *ocgArray )
 {
   for (int i = 0; i < ocgArray->getLength(); ++i) {
-    Object ocgItem;
-    ocgArray->getNF(i, &ocgItem);
+    Object ocgItem = ocgArray->getNF(i);
     if (ocgItem.isRef()) {
       OptionalContentGroup* oc = findOcgByRef( ocgItem.getRef() );      
       if ( oc && oc->getState() == OptionalContentGroup::On ) {
@@ -366,8 +318,7 @@
 bool OCGs::anyOff( Array *ocgArray )
 {
   for (int i = 0; i < ocgArray->getLength(); ++i) {
-    Object ocgItem;
-    ocgArray->getNF(i, &ocgItem);
+    Object ocgItem = ocgArray->getNF(i);
     if (ocgItem.isRef()) {
       OptionalContentGroup* oc = findOcgByRef( ocgItem.getRef() );      
       if ( oc && oc->getState() == OptionalContentGroup::Off ) {
@@ -382,20 +333,20 @@
 
 OptionalContentGroup::OptionalContentGroup(Dict *ocgDict) : m_name(NULL)
 {
-  Object obj1, obj2, obj3;
-  Object ocgName;
-  ocgDict->lookup("Name", &ocgName);
+  Object ocgName = ocgDict->lookup("Name");
   if (!ocgName.isString()) {
     error(errSyntaxWarning, -1, "Expected the name of the OCG, but wasn't able to find it, or it isn't a String");
   } else {
     m_name = new GooString( ocgName.getString() );
   }
-  ocgName.free();
 
   viewState = printState = ocUsageUnset;
-  if (ocgDict->lookup("Usage", &obj1)->isDict()) {
-    if (obj1.dictLookup("View", &obj2)->isDict()) {
-      if (obj2.dictLookup("ViewState", &obj3)->isName()) {
+  Object obj1 = ocgDict->lookup("Usage");
+  if (obj1.isDict()) {
+    Object obj2 = obj1.dictLookup("View");
+    if (obj2.isDict()) {
+      Object obj3 = obj2.dictLookup("ViewState");
+      if (obj3.isName()) {
 	if (obj3.isName("ON")) {
 	  viewState = ocUsageOn;
 	} else {
@@ -402,11 +353,11 @@
 	  viewState = ocUsageOff;
 	}
       }
-      obj3.free();
     }
-    obj2.free();
-    if (obj1.dictLookup("Print", &obj2)->isDict()) {
-      if (obj2.dictLookup("PrintState", &obj3)->isName()) {
+    obj2 = obj1.dictLookup("Print");
+    if (obj2.isDict()) {
+      Object obj3 = obj2.dictLookup("PrintState");
+      if (obj3.isName()) {
 	if (obj3.isName("ON")) {
 	  printState = ocUsageOn;
 	} else {
@@ -413,11 +364,8 @@
 	  printState = ocUsageOff;
 	}
       }
-      obj3.free();
     }
-    obj2.free();
   }
-  obj1.free();
 }
 
 OptionalContentGroup::OptionalContentGroup(GooString *label)
@@ -450,7 +398,6 @@
 
 OCDisplayNode *OCDisplayNode::parse(Object *obj, OCGs *oc,
 				    XRef *xref, int recursion) {
-  Object obj2, obj3;
   OptionalContentGroup *ocgA;
   OCDisplayNode *node, *child;
   int i;
@@ -464,25 +411,24 @@
       return new OCDisplayNode(ocgA);
     }
   }
-  obj->fetch(xref, &obj2);
+  Object obj2 = obj->fetch(xref);
   if (!obj2.isArray()) {
-    obj2.free();
     return NULL;
   }
   i = 0;
   if (obj2.arrayGetLength() >= 1) {
-    if (obj2.arrayGet(0, &obj3)->isString()) {
+    Object obj3 = obj2.arrayGet(0);
+    if (obj3.isString()) {
       node = new OCDisplayNode(obj3.getString());
       i = 1;
     } else {
       node = new OCDisplayNode();
     }
-    obj3.free();
   } else {
     node = new OCDisplayNode();
   }
   for (; i < obj2.arrayGetLength(); ++i) {
-    obj2.arrayGetNF(i, &obj3);
+    Object obj3 = obj2.arrayGetNF(i);
     if ((child = OCDisplayNode::parse(&obj3, oc, xref, recursion + 1))) {
       if (!child->ocg && !child->name && node->getNumChildren() > 0) {
 	node->getChild(node->getNumChildren() - 1)->addChildren(child->takeChildren());
@@ -491,9 +437,7 @@
 	node->addChild(child);
       }
     }
-    obj3.free();
   }
-  obj2.free();
   return node;
 }
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/Outline.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/Outline.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/Outline.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -14,9 +14,10 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Marco Pesenti Gritti <mpg at redhat.com>
-// Copyright (C) 2008, 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2016, 2017 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Nick Jones <nick.jones at network-box.com>
 // Copyright (C) 2016 Jason Crain <jason at aquaticape.us>
+// Copyright (C) 2017 Adrian Johnson <ajohnson at redneon.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -41,15 +42,12 @@
 //------------------------------------------------------------------------
 
 Outline::Outline(Object *outlineObj, XRef *xref) {
-  Object first, last;
-
-  items = NULL;
+  items = nullptr;
   if (!outlineObj->isDict()) {
     return;
   }
-  items = OutlineItem::readItemList(outlineObj->dictLookupNF("First", &first), xref);
-  first.free();
-  last.free();
+  Object first = outlineObj->dictLookupNF("First");
+  items = OutlineItem::readItemList(&first, xref);
 }
 
 Outline::~Outline() {
@@ -62,7 +60,6 @@
 
 OutlineItem::OutlineItem(Dict *dict, XRef *xrefA) {
   Object obj1;
-  GooString *s;
 
   xref = xrefA;
   title = NULL;
@@ -69,35 +66,36 @@
   action = NULL;
   kids = NULL;
 
-  if (dict->lookup("Title", &obj1)->isString()) {
-    s = obj1.getString();
+
+  obj1 = dict->lookup("Title");
+  if (obj1.isString()) {
+    GooString *s = obj1.getString();
     titleLen = TextStringToUCS4(s, &title);
   } else {
     titleLen = 0;
   }
-  obj1.free();
 
-  if (!dict->lookup("Dest", &obj1)->isNull()) {
+  obj1 = dict->lookup("Dest");
+  if (!obj1.isNull()) {
     action = LinkAction::parseDest(&obj1);
   } else {
-      obj1.free();
-    if (!dict->lookup("A", &obj1)->isNull()) {
-        action = LinkAction::parseAction(&obj1);
+    obj1 = dict->lookup("A");
+    if (!obj1.isNull()) {
+      action = LinkAction::parseAction(&obj1);
+    }
   }
-  }
-  obj1.free();
 
-  dict->lookupNF("First", &firstRef);
-  dict->lookupNF("Last", &lastRef);
-  dict->lookupNF("Next", &nextRef);
+  firstRef = dict->lookupNF("First");
+  lastRef = dict->lookupNF("Last");
+  nextRef = dict->lookupNF("Next");
 
   startsOpen = gFalse;
-  if (dict->lookup("Count", &obj1)->isInt()) {
+  obj1 = dict->lookup("Count");
+  if (obj1.isInt()) {
     if (obj1.getInt() > 0) {
       startsOpen = gTrue;
     }
   }
-  obj1.free();
 }
 
 OutlineItem::~OutlineItem() {
@@ -108,9 +106,6 @@
   if (action) {
     delete action;
   }
-  firstRef.free();
-  lastRef.free();
-  nextRef.free();
 }
 
 GooList *OutlineItem::readItemList(Object *firstItemRef, XRef *xrefA) {
@@ -117,7 +112,6 @@
   GooList *items;
   char* alreadyRead;
   OutlineItem *item;
-  Object obj;
   Object *p;
 
   items = new GooList();
@@ -130,13 +124,12 @@
 	 (p->getRefNum() >= 0) && 
          (p->getRefNum() < xrefA->getNumObjects()) && 
          !alreadyRead[p->getRefNum()]) {
-    if (!p->fetch(xrefA, &obj)->isDict()) {
-      obj.free();
+    Object obj = p->fetch(xrefA);
+    if (!obj.isDict()) {
       break;
     }
     alreadyRead[p->getRefNum()] = 1;
     item = new OutlineItem(obj.getDict(), xrefA);
-    obj.free();
     items->append(item);
     p = &item->nextRef;
   }

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/OutputDev.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/OutputDev.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/OutputDev.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2006 Thorkild Stray <thorkild at ifi.uio.no>
-// Copyright (C) 2007 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2007, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2009 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009, 2012, 2013 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
@@ -170,7 +170,7 @@
 }
 
 
-#if OPI_SUPPORT
+#ifdef OPI_SUPPORT
 void OutputDev::opiBegin(GfxState *state, Dict *opiDict) {
 }
 

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/OutputDev.h
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/OutputDev.h	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/OutputDev.h	2018-02-27 23:34:23 UTC (rev 795)
@@ -16,7 +16,7 @@
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2006 Thorkild Stray <thorkild at ifi.uio.no>
 // Copyright (C) 2007 Jeff Muizelaar <jeff at infidigm.net>
-// Copyright (C) 2007, 2011 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2007, 2011, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2009-2013, 2015 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009, 2012, 2013 Albert Astals Cid <aacid at kde.org>
@@ -23,6 +23,7 @@
 // Copyright (C) 2010 Christian Feuers\xE4nger <cfeuersaenger at googlemail.com>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2012 William Bader <williambader at hotmail.com>
+// Copyright (C) 2017 Oliver Sander <oliver.sander at tu-dresden.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
@@ -167,6 +168,12 @@
 
   //----- update graphics state
   virtual void updateAll(GfxState *state);
+
+  // Update the Current Transformation Matrix (CTM), i.e., the new matrix
+  // given in m11, ..., m32 is combined with the current value of the CTM.
+  // At the same time, when this method is called, state->getCTM() already
+  // contains the correct new CTM, so one may as well replace the
+  // CTM of the renderer with that.
   virtual void updateCTM(GfxState * /*state*/, double /*m11*/, double /*m12*/,
 			 double /*m21*/, double /*m22*/, double /*m31*/, double /*m32*/) {}
   virtual void updateLineDash(GfxState * /*state*/) {}
@@ -242,6 +249,16 @@
   virtual void endStringOp(GfxState * /*state*/) {}
   virtual void beginString(GfxState * /*state*/, GooString * /*s*/) {}
   virtual void endString(GfxState * /*state*/) {}
+
+  // Draw one glyph at a specified position
+  //
+  // Arguments are:
+  // CharCode code: This is the character code in the content stream. It needs to be mapped back to a glyph index.
+  // int nBytes: The text strings in the content stream can consists of either 8-bit or 16-bit
+  //             character codes depending on the font. nBytes is the number of bytes in the character code.
+  // Unicode *u: The UCS-4 mapping used for text extraction (TextOutputDev).
+  // int uLen: The number of unicode entries in u.  Usually '1', for a single character,
+  //           but it may also have larger values, for example for ligatures.
   virtual void drawChar(GfxState * /*state*/, double /*x*/, double /*y*/,
 			double /*dx*/, double /*dy*/,
 			double /*originX*/, double /*originY*/,
@@ -292,7 +309,7 @@
 
 
 
-#if OPI_SUPPORT
+#ifdef OPI_SUPPORT
   //----- OPI functions
   virtual void opiBegin(GfxState *state, Dict *opiDict);
   virtual void opiEnd(GfxState *state, Dict *opiDict);

Modified: branches/stable/source/src/libs/poppler/poppler-src/poppler/PDFDoc.cc
===================================================================
--- branches/stable/source/src/libs/poppler/poppler-src/poppler/PDFDoc.cc	2018-02-27 23:14:41 UTC (rev 794)
+++ branches/stable/source/src/libs/poppler/poppler-src/poppler/PDFDoc.cc	2018-02-27 23:34:23 UTC (rev 795)
@@ -28,7 +28,7 @@
 // Copyright (C) 2010 Philip Lorenz <lorenzph+freedesktop at gmail.com>
 // Copyright (C) 2011-2016 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso at hotmail.it>
-// Copyright (C) 2013, 2014 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013, 2014, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 Adam Reichold <adamreichold at myopera.com>
 // Copyright (C) 2014 Bogdan Cristea <cristeab at gmail.com>
 // Copyright (C) 2015 Li Junling <lijunling at sina.com>
@@ -35,6 +35,7 @@
 // Copyright (C) 2015 André Guerreiro <aguerreiro1985 at gmail.com>
 // Copyright (C) 2015 André Esser <bepandre at hotmail.com>
 // Copyright (C) 2016 Jakub Alba <jakubalba at gmail.com>
+// Copyright (C) 2017 Jean Ghali <jghali at libertysurf.fr>
 //
 // 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
@@ -42,6 +43,7 @@
 //========================================================================
 
 #include <config.h>
+#include <poppler-config.h>
 
 #ifdef USE_GCC_PRAGMAS
 #pragma implementation
@@ -51,11 +53,13 @@
 #include <locale.h>
 #include <stdio.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
 #include <time.h>
 #include <sys/stat.h>
+#include "goo/glibc.h"
 #include "goo/gstrtod.h"
 #include "goo/GooString.h"
 #include "goo/gfile.h"
@@ -79,8 +83,9 @@
 #endif
 #include "PDFDoc.h"
 #include "Hints.h"
+#include "UTF.h"
 
-#if MULTITHREADED
+#ifdef MULTITHREADED
 #  define pdfdocLocker()   MutexLocker locker(&mutex)
 #else
 #  define pdfdocLocker()
@@ -105,7 +110,7 @@
 
 void PDFDoc::init()
 {
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gInitMutex(&mutex);
 #endif
   ok = gFalse;
@@ -132,7 +137,6 @@
 
 PDFDoc::PDFDoc(GooString *fileNameA, GooString *ownerPassword,
 	       GooString *userPassword, void *guiDataA) {
-  Object obj;
 #ifdef _WIN32
   int n, i;
 #endif
@@ -151,7 +155,13 @@
 #endif
 
   // try to open file
-  file = GooFile::open(fileName);
+#ifdef _WIN32
+  wchar_t *wFileName = (wchar_t*)utf8ToUtf16(fileName->getCString());
+  file = GooFile::open(wFileName);
+  gfree(wFileName);
+#else
+   file = GooFile::open(fileName);
+#endif
   if (file == NULL) {
     // fopen() has failed.
     // Keep a copy of the errno returned by fopen so that it can be 
@@ -163,8 +173,7 @@
   }
 
   // create stream
-  obj.initNull();
-  str = new FileStream(file, 0, gFalse, file->size(), &obj);
+  str = new FileStream(file, 0, gFalse, file->size(), Object(objNull));
 
   ok = setup(ownerPassword, userPassword);
 }
@@ -173,7 +182,6 @@
 PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword,
 	       GooString *userPassword, void *guiDataA) {
   OSVERSIONINFO version;
-  Object obj;
   int i;
 
   init();
@@ -205,8 +213,7 @@
   }
 
   // create stream
-  obj.initNull();
-  str = new FileStream(file, 0, gFalse, file->size(), &obj);
+  str = new FileStream(file, 0, gFalse, file->size(), Object(objNull));
 
   ok = setup(ownerPassword, userPassword);
 }
@@ -345,7 +352,7 @@
     gfree(fileNameU);
   }
 #endif
-#if MULTITHREADED
+#ifdef MULTITHREADED
   gDestroyMutex(&mutex);
 #endif
 }
@@ -419,11 +426,10 @@
 }
 
 GBool PDFDoc::checkEncryption(GooString *ownerPassword, GooString *userPassword) {
-  Object encrypt;
   GBool encrypted;
   GBool ret;
 
-  xref->getTrailerDict()->dictLookup("Encrypt", &encrypt);
+  Object encrypt = xref->getTrailerDict()->dictLookup("Encrypt");
   if ((encrypted = encrypt.isDict())) {
     if ((secHdlr = SecurityHandler::make(this, &encrypt))) {
       if (secHdlr->isUnencrypted()) {
@@ -451,7 +457,6 @@
     // document is not encrypted
     ret = gTrue;
   }
-  encrypt.free();
   return ret;
 }
 
@@ -565,7 +570,6 @@
     return gFalse;
   }
   for (int page = 1; page <= linearization->getNumPages(); page++) {
-    Object obj;
     Ref pageRef;
 
     pageRef.num = hints->getPageObjectNum(page);
@@ -581,13 +585,11 @@
     }
 
     pageRef.gen = xref->getEntry(pageRef.num)->gen;
-    xref->fetch(pageRef.num, pageRef.gen, &obj);
+    Object obj = xref->fetch(pageRef.num, pageRef.gen);
     if (!obj.isDict("Page")) {
-      obj.free();
       linearizationState = 2;
       return gFalse;
     }
-    obj.free();
   }
   linearizationState = 1;
   return gTrue;
@@ -607,10 +609,8 @@
 
 void PDFDoc::setDocInfoModified(Object *infoObj)
 {
-  Object infoObjRef;
-  getDocInfoNF(&infoObjRef);
+  Object infoObjRef = getDocInfoNF();
   xref->setModifiedObject(infoObj, infoObjRef.getRef());
-  infoObjRef.free();
 }
 
 void PDFDoc::setDocInfoStringEntry(const char *key, GooString *value)
@@ -620,25 +620,19 @@
     delete value;
   }
 
-  Object infoObj;
-  getDocInfo(&infoObj);
-
+  Object infoObj = getDocInfo();
   if (infoObj.isNull() && removeEntry) {
     // No info dictionary, so no entry to remove.
     return;
   }
 
-  createDocInfoIfNoneExists(&infoObj);
-
-  Object gooStrObj;
+  infoObj = createDocInfoIfNoneExists();
   if (removeEntry) {
-    gooStrObj.initNull();
+    infoObj.dictSet(key, Object(objNull));
   } else {
-    gooStrObj.initString(value);
+    infoObj.dictSet(key, Object(value));
   }
 
-  // gooStrObj is set to value or null by now. The latter will cause a removal.
-  infoObj.dictSet(key, &gooStrObj);
 
   if (infoObj.dictGetLength() == 0) {
     // Info dictionary is empty. Remove it altogether.
@@ -646,19 +640,15 @@
   } else {
     setDocInfoModified(&infoObj);
   }
-
-  infoObj.free();
 }
 
 GooString *PDFDoc::getDocInfoStringEntry(const char *key) {
-  Object infoObj;
-  getDocInfo(&infoObj);
+  Object infoObj = getDocInfo();
   if (!infoObj.isDict()) {
       return NULL;
   }
 
-  Object entryObj;
-  infoObj.dictLookup(key, &entryObj);
+  Object entryObj = infoObj.dictLookup(key);
 
   GooString *result;
 
@@ -668,9 +658,6 @@
     result = NULL;
   }
 
-  entryObj.free();
-  infoObj.free();
-
   return result;
 }
 
@@ -696,45 +683,35 @@
 }
 
 GBool PDFDoc::getID(GooString *permanent_id, GooString *update_id) {
-  Object obj;
-  xref->getTrailerDict()->dictLookup ("ID", &obj);
+  Object obj = xref->getTrailerDict()->dictLookup ("ID");
 
   if (obj.isArray() && obj.arrayGetLength() == 2) {
-    Object obj2;
-
     if (permanent_id) {
-      if (obj.arrayGet(0, &obj2)->isString()) {
+      Object obj2 = obj.arrayGet(0);
+      if (obj2.isString()) {
         if (!get_id (obj2.getString(), permanent_id)) {
-	  obj2.free();
 	  return gFalse;
 	}
       } else {
         error(errSyntaxError, -1, "Invalid permanent ID");
-	obj2.free();
 	return gFalse;
       }
-      obj2.free();
     }
 
     if (update_id) {
-      if (obj.arrayGet(1, &obj2)->isString()) {
+      Object obj2 = obj.arrayGet(1);
+      if (obj2.isString()) {
         if (!get_id (obj2.getString(), update_id)) {
-	  obj2.free();
 	  return gFalse;
 	}
       } else {
         error(errSyntaxError, -1, "Invalid update ID");
-	obj2.free();
 	return gFalse;
       }
-      obj2.free();
     }
 
-    obj.free();
-
     return gTrue;
   }
-  obj.free();
 
   return gFalse;
 }
@@ -777,8 +754,7 @@
     getCatalog()->getPage(pageNo)->getMediaBox(),
     cropBox);
   Ref *refPage = getCatalog()->getPageRef(pageNo);
-  Object page;
-  getXRef()->fetch(refPage->num, refPage->gen, &page);
+  Object page = getXRef()->fetch(refPage->num, refPage->gen);
 
   if (!(f = fopen(name->getCString(), "wb"))) {
     error(errIO, -1, "Couldn't open file '{0:t}'", name);
@@ -801,15 +777,13 @@
   writeHeader(outStr, getPDFMajorVersion(), getPDFMinorVersion());
 
   // get and mark info dict
-  Object infoObj;
-  getXRef()->getDocInfo(&infoObj);
+  Object infoObj = getXRef()->getDocInfo();
   if (infoObj.isDict()) {
     Dict *infoDict = infoObj.getDict();
     markPageObjects(infoDict, yRef, countRef, 0, refPage->num, rootNum + 2);
     if (trailerObj->isDict()) {
       Dict *trailerDict = trailerObj->getDict();
-      Object ref;
-      trailerDict->lookupNF("Info", &ref);
+      Object ref = trailerDict->lookupNF("Info");
       if (ref.isRef()) {
         yRef->add(ref.getRef().num, ref.getRef().gen, 0, gTrue);
         if (getXRef()->getEntry(ref.getRef().num)->type == xrefEntryCompressed) {
@@ -816,23 +790,19 @@
           yRef->getEntry(ref.getRef().num)->type = xrefEntryCompressed;
         }
       }
-      ref.free();
     }
   }
-  infoObj.free();
   
   // get and mark output intents etc.
-  Object catObj, pagesObj, resourcesObj, annotsObj, afObj;
-  getXRef()->getCatalog(&catObj);
+  Object catObj = getXRef()->getCatalog();
   Dict *catDict = catObj.getDict();
-  catDict->lookup("Pages", &pagesObj);
-  catDict->lookupNF("AcroForm", &afObj);
+  Object pagesObj = catDict->lookup("Pages");
+  Object afObj = catDict->lookupNF("AcroForm");
   if (!afObj.isNull()) {
     markAcroForm(&afObj, yRef, countRef, 0, refPage->num, rootNum + 2);
-    afObj.free();
   }
   Dict *pagesDict = pagesObj.getDict();
-  pagesDict->lookup("Resources", &resourcesObj);
+  Object resourcesObj = pagesDict->lookup("Resources");
   if (resourcesObj.isDict())
     markPageObjects(resourcesObj.getDict(), yRef, countRef, 0, refPage->num, rootNum + 2);
   markPageObjects(catDict, yRef, countRef, 0, refPage->num, rootNum + 2);
@@ -839,17 +809,16 @@
 
   Dict *pageDict = page.getDict();
   if (resourcesObj.isNull() && !pageDict->hasKey("Resources")) {
-    Dict *resourceDict = getCatalog()->getPage(pageNo)->getResourceDict();
-    if (resourceDict != NULL) {
-      resourcesObj.initDict(resourceDict);
+    Object *resourceDictObject = getCatalog()->getPage(pageNo)->getResourceDictObject();
+    if (resourceDictObject->isDict()) {
+      resourcesObj = resourceDictObject->copy();
       markPageObjects(resourcesObj.getDict(), yRef, countRef, 0, refPage->num, rootNum + 2);
     }
   }
   markPageObjects(pageDict, yRef, countRef, 0, refPage->num, rootNum + 2);
-  pageDict->lookupNF("Annots", &annotsObj);
+  Object annotsObj = pageDict->lookupNF("Annots");
   if (!annotsObj.isNull()) {
     markAnnotations(&annotsObj, yRef, countRef, 0, refPage->num, rootNum + 2);
-    annotsObj.free();
   }
   yRef->markUnencrypted();
   writePageObjects(outStr, yRef, 0);
@@ -864,14 +833,11 @@
       strcmp(key, "Pages") != 0) 
     {
       if (j > 0) outStr->printf(" ");
-      Object value; catDict->getValNF(j, &value);
+      Object value = catDict->getValNF(j);
       outStr->printf("/%s ", key);
       writeObject(&value, outStr, getXRef(), 0, NULL, cryptRC4, 0, 0, 0);
-      value.free();
     }
   }
-  catObj.free();
-  pagesObj.free();
   outStr->printf(">>\nendobj\n");
 
   yRef->add(rootNum + 1,0,outStr->getPos(),gTrue);
@@ -880,7 +846,6 @@
   if (resourcesObj.isDict()) {
     outStr->printf("/Resources ");
     writeObject(&resourcesObj, outStr, getXRef(), 0, NULL, cryptRC4, 0, 0, 0);
-    resourcesObj.free();
   }
   outStr->printf(">>\n");
   outStr->printf("endobj\n");
@@ -891,7 +856,7 @@
   for (int n = 0; n < pageDict->getLength(); n++) {
     if (n > 0) outStr->printf(" ");
     const char *key = pageDict->getKey(n);
-    Object value; pageDict->getValNF(n, &value);
+    Object value = pageDict->getValNF(n);
     if (strcmp(key, "Parent") == 0) {
       outStr->printf("/Parent %d 0 R", rootNum + 1);
     } else {
@@ -898,20 +863,17 @@
       outStr->printf("/%s ", key);
       writeObject(&value, outStr, getXRef(), 0, NULL, cryptRC4, 0, 0, 0);
     }
-    value.free();
   }
   outStr->printf(" >>\nendobj\n");
-  page.free();
 
   Goffset uxrefOffset = outStr->getPos();
   Ref ref;
   ref.num = rootNum;
   ref.gen = 0;
-  Dict *trailerDict = createTrailerDict(rootNum + 3, gFalse, 0, &ref, getXRef(),
+  Object trailerDict = createTrailerDict(rootNum + 3, gFalse, 0, &ref, getXRef(),
                                         name->getCString(), uxrefOffset);
-  writeXRefTableTrailer(trailerDict, yRef, gFalse /* do not write unnecessary entries */,
+  writeXRefTableTrailer(std::move(trailerDict), yRef, gFalse /* do not write unnecessary entries */,
                         uxrefOffset, outStr, getXRef());
-  delete trailerDict;
 
   outStr->close();
   fclose(f);
@@ -1015,13 +977,11 @@
       ref.num = i;
       ref.gen = xref->getEntry(i)->type == xrefEntryCompressed ? 0 : xref->getEntry(i)->gen;
       if (xref->getEntry(i)->type != xrefEntryFree) {
-        Object obj1;
-        xref->fetch(ref.num, ref.gen, &obj1, 1);
+        Object obj1 = xref->fetch(ref.num, ref.gen, 1);
         Goffset offset = writeObjectHeader(&ref, outStr);
         writeObject(&obj1, outStr, fileKey, encAlgorithm, keyLength, ref.num, ref.gen);
         writeObjectFooter(outStr);
         uxref->add(ref.num, ref.gen, offset, gTrue);
-        obj1.free();
       } else {
         uxref->add(ref.num, ref.gen, 0, gFalse);
       }
@@ -1052,14 +1012,13 @@
     uxref->add(uxrefStreamRef.num, uxrefStreamRef.gen, uxrefOffset, gTrue);
   }
 
-  Dict *trailerDict = createTrailerDict(numobjects, gTrue, getStartXRef(), &rootRef, getXRef(), fileNameA, uxrefOffset);
+  Object trailerDict = createTrailerDict(numobjects, gTrue, getStartXRef(), &rootRef, getXRef(), fileNameA, uxrefOffset);
   if (xRefStream) {
-    writeXRefStreamTrailer(trailerDict, uxref, &uxrefStreamRef, uxrefOffset, outStr, getXRef());
+    writeXRefStreamTrailer(std::move(trailerDict), uxref, &uxrefStreamRef, uxrefOffset, outStr, getXRef());
   } else {
-    writeXRefTableTrailer(trailerDict, uxref, gFalse, uxrefOffset, outStr, getXRef());
+    writeXRefTableTrailer(std::move(trailerDict), uxref, gFalse, uxrefOffset, outStr, getXRef());
   }
 
-  delete trailerDict;
   delete uxref;
 }
 
@@ -1079,7 +1038,6 @@
   uxref->add(0, 65535, 0, gFalse);
   xref->lock();
   for(int i=0; i<xref->getNumObjects(); i++) {
-    Object obj1;
     Ref ref;
     XRefEntryType type = xref->getEntry(i)->type;
     if (type == xrefEntryFree) {
@@ -1097,7 +1055,7 @@
     } else if (type == xrefEntryUncompressed){ 
       ref.num = i;
       ref.gen = xref->getEntry(i)->gen;
-      xref->fetch(ref.num, ref.gen, &obj1, 1);
+      Object obj1 = xref->fetch(ref.num, ref.gen, 1);
       Goffset offset = writeObjectHeader(&ref, outStr);
       // Write unencrypted objects in unencrypted form
       if (xref->getEntry(i)->getFlag(XRefEntry::Unencrypted)) {
@@ -1107,16 +1065,14 @@
       }
       writeObjectFooter(outStr);
       uxref->add(ref.num, ref.gen, offset, gTrue);
-      obj1.free();
     } else if (type == xrefEntryCompressed) {
       ref.num = i;
       ref.gen = 0; //compressed entries have gen == 0
-      xref->fetch(ref.num, ref.gen, &obj1, 1);
+      Object obj1 = xref->fetch(ref.num, ref.gen, 1);
       Goffset offset = writeObjectHeader(&ref, outStr);
       writeObject(&obj1, outStr, fileKey, encAlgorithm, keyLength, ref.num, ref.gen);
       writeObjectFooter(outStr);
       uxref->add(ref.num, ref.gen, offset, gTrue);
-      obj1.free();
     }
   }
   xref->unlock();
@@ -1127,9 +1083,22 @@
 }
 
 void PDFDoc::writeDictionnary (Dict* dict, OutStream* outStr, XRef *xRef, Guint numOffset, Guchar *fileKey,
-                               CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen)

@@ Diff output truncated at 1234567 characters. @@


More information about the pdftex-commits mailing list