summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-05-04 10:12:24 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-05-04 10:12:24 +0000
commitf7af31e336714c75f6472757f24d0c99a7b5e7cf (patch)
treeac78cd023a822f8ed47752c16b62fe0210f18366 /Build
parentd12182ae92e0bf23fd4c233931b8b8dbd5c741dc (diff)
reorganize libs/xpdf patches
git-svn-id: svn://tug.org/texlive/trunk@12919 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/libs/Makefile.am2
-rw-r--r--Build/source/libs/Makefile.in1
-rw-r--r--Build/source/libs/README272
-rw-r--r--Build/source/libs/README.orig250
-rw-r--r--Build/source/libs/xpdf/ChangeLog48
-rw-r--r--Build/source/libs/xpdf/Makefile.am32
-rw-r--r--Build/source/libs/xpdf/Makefile.in4
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-01-pl150
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-02-pl2 (renamed from Build/source/libs/xpdf/xpdf-3.02-pl2.patch)101
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-03-pl3919
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-10-PDF_PARSER_ONLY28
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-11-time_h23
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-12-mingw3222
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-20-pdftex632
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-PDF_PARSER_ONLY.patch16
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl1.patch33
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl2.patch823
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl3.patch (renamed from Build/source/libs/xpdf/xpdf-3.02pl3.patch)0
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-mingw32.patch14
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-pdftex.patch1043
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02-time_h.patch11
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/aclocal.m4274
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/goo/GString.cc44
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/goo/gfile.cc39
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/xpdf/Decrypt.h39
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/xpdf/GlobalParams.cc39
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/xpdf/GlobalParams.h39
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/xpdf/PDFDoc.h3
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/xpdf/Page.cc3
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/xpdf/Page.h39
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/xpdf/Stream.h55
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/xpdf/XRef.cc54
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/xpdf/XRef.h42
-rw-r--r--Build/source/libs/xpdf/xpdf-3.02/xpdf/config.h55
34 files changed, 3160 insertions, 1889 deletions
diff --git a/Build/source/libs/Makefile.am b/Build/source/libs/Makefile.am
index 276e411fa66..cb0416e8c1a 100644
--- a/Build/source/libs/Makefile.am
+++ b/Build/source/libs/Makefile.am
@@ -8,8 +8,6 @@ ACLOCAL_AMFLAGS = -I ../m4
SUBDIRS = dummy . $(SUBLIBS)
DIST_SUBDIRS = dummy $(DIST_SUBLIBS)
-EXTRA_DIST = README.orig
-
## just in case a subdirectory has added directories
dist-hook:
rm -rf `find $(distdir) -name .svn`
diff --git a/Build/source/libs/Makefile.in b/Build/source/libs/Makefile.in
index 55f962d335a..762a58dafb5 100644
--- a/Build/source/libs/Makefile.in
+++ b/Build/source/libs/Makefile.in
@@ -235,7 +235,6 @@ top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I ../m4
SUBDIRS = dummy . $(SUBLIBS)
DIST_SUBDIRS = dummy $(DIST_SUBLIBS)
-EXTRA_DIST = README.orig
SUBLIBS_AUX = sublibsdir-configure sublibsdir-conf.args
noinst_DATA = $(SUBLIBS_AUX)
DISTCLEANFILES = $(noinst_DATA)
diff --git a/Build/source/libs/README b/Build/source/libs/README
index 6dbed304843..53dbfd1525d 100644
--- a/Build/source/libs/README
+++ b/Build/source/libs/README
@@ -3,43 +3,235 @@ Public domain. Originally created by Karl Berry, 2005.
Libraries we compile for TeX Live.
-freetype2:
- http://savannah.nongnu.org/download/freetype/freetype-2.3.9.tar.bz2
-
-gd:
- http://www.libgd.org/releases/gd-2.0.35.tar.bz2
-
-libpng:
- ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.35.tar.bz2
-
-t1lib:
- ftp://sunsite.unc.edu/pub/Linux/libs/graphics/t1lib-5.1.2.tar.gz
-
-xpdf:
- Original sources from:
- http://www.foolabs.com/xpdf/xpdf-3.02.tar.gz
- ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.02.tar.gz
- Applied two patches:
- xpdf-3.02pl1.patch
- xpdf-3.02pl2.patch
- Applied patch for PDF_PARSER_ONLY:
- xpdf/xpdf-3.02-PDF_PARSER_ONLY.patch
- Applied patch for pdftex:
- xpdf/xpdf-3.02-pdftex.patch
- Applied patch for djgpp:
- xpdf/xpdf-3.02-time_h.patch
- Applied patch for mingw32:
- xpdf/xpdf-3.02-mingw32.patch
-
-zlib:
- http://www.zlib.net/zlib-1.2.3.tar.bz2
-
-====================
-
-Apart from descending into the various subdirectories, this sub-package
-'libs' creates two files ../subdir-configure and ../subdir-conf.args. They
-allow the top-level Makefile to properly configure ../utils and ../texk
-without the need to adjust the absolute or relative paths to the respective
-source directories (as already done by configure for this directory).
-
-2009-01-20 Peter Breitenlohner <peb@mppmu.mpg.de>
+See comments in ../texk/README.
+
+expat - ?
+
+freetype 1.5 - ?
+
+freetype2 2.3.9 - http://savannah.nongnu.org/download/freetype/
+
+gd 2.0.35 - http://www.libgd.org/releases/
+
+graphite-engine - used by xetex, maintained here+upstream by Jonathan Kew
+
+icu - as with graphite-engine, modified for xetex
+
+jpeg - ?
+
+libpng 1.2.35 - http://www.libpng.org/ - used by many
+
+md5 - used by pdftex, provenance unknown
+
+obsdcompat - used by pdftex
+
+t1lib 5.1.2 - ftp://sunsite.unc.edu/pub/Linux/libs/graphics/
+
+teckit - as with graphite-engine
+
+unzip - ?
+
+xpdf 3.02pl3 - http://www.foolabs.com/xpdf/
+
+zlib 1.2.3 - http://www.zlib.net/ - used by many
+
+
+
+This info used to be in a howto/ subdirectory; it was written a long
+time ago, by Sebastian Rahtz and/or Thomas Esser, maybe?
+
+==> freetype <==
+The following files have been added:
+ freeetype.ac withenable.ac
+
+Modifications:
+ configure.in:
+ disable AM_DISABLE_STATIC
+ add AM_DISABLE_SHARED
+
+==> freetype2 <==
+The freetype2 directory contains Freetype 2.3.7 sources from:
+
+ http://download.savannah.gnu.org/releases/freetype/freetype-2.3.7.tar.bz2
+
+The following files have been added:
+
+ freetype2.ac
+ withenable.ac
+
+Modifications:
+
+ freetype2/builds/unix/configure
+ - edited to ignore the --srcdir argument, as this doesn't work properly
+ in the tex-live build
+
+
+==> icu-xetex <==
+The icu-xetex directory contains a *MODIFIED* copy of ICU release 3.8.1,
+used in building xetex.
+
+The following files have been added:
+
+ icu-xetex.ac
+ withenable.ac
+
+See libs/icu-xetex/README for more information.
+
+==> libpng <==
+Downloading:
+ http://www.libpng.org/
+ http://libpng.sourceforge.net/
+
+libpng is the original distribution, but with added
+ Makefile.in libpng.ac withenable.ac
+
+The directories
+ contrib projects scripts
+are not needed for teTeX and can be removed.
+
+libpng is configured by libs/configure, so the (original)
+libs/libpng/configure is not used by teTeX.
+
+==> libtiff <==
+Downloading:
+ http://www.libtiff.org/
+ http://freshmeat.net/projects/libtiff/
+
+Which files are in libtiff:
+ from the original distribution:
+ COPYRIGHT RELEASE-DATE VERSION libtiff/* dist/tiff.alpha
+
+ added for teTeX:
+ acconfig.h aclocal.m4 configure.in libtiff.ac withenable.ac port.h
+ Makefile.in (replacing the original file)
+ added for fpTeX:
+ win32 win32.mak
+
+Generated files:
+ the commands
+ autoheader -m ../../texk/etc/autoconf
+ autoconf -m ../../texk/etc/autoconf
+ have generated
+ c-auto.in configure
+
+ by make depend:
+ depend.mak
+
+==> ncurses <==
+Downloading:
+ http://www.gnu.org/software/ncurses/ncurses.html
+ ftp://ftp.gnu.org/pub/gnu/ncurses/
+ ftp://dickey.his.com/ncurses/
+
+The ncurses directory contains the original distribution except:
+ Ada95 c++ doc form menu misc panel progs tack test
+
+The following files have been added:
+ ncurses.ac withenable.ac
+
+Modifications:
+ Makefile.in:
+ remove install from the list in the end. Create an empty install::
+ target somewhere earlier in the file.
+
+ protect "test ... || ..." in Makefile.in with -
+
+ aclocal.m4, remove the following lines (thus disabling misc test
+ c++ subdirs):
+ SRC_SUBDIRS="$SRC_SUBDIRS test"
+ test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
+ test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
+
+ include/Makefile.in
+ add symlink to AUTO_SRC variable
+ add a rule
+ symlink:
+ @test -d ncurses || ln -s . ncurses
+ add the line
+ -rm -f ncurses
+ to the clean:: target
+
+ configure.in:
+ remove that ldconfig stuff
+ remove that cxx stuff
+ remove that ada stuff
+ cf_with_progs=no (instead of yes)
+ remove the line
+ modules_to_build="$modules_to_build panel menu form"
+ with_debug=no (instead of yes)
+ move one line below (after CF_DIRS_TO_MAKE):
+ CF_SRC_MODULES($modules_to_build)
+ remove the line
+ test "$use_database" = yes && SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in"
+
+Run autoconf with version 2.52.20011227. Patch available at
+ http://invisible-island.net/autoconf/
+
+==> ncurses-fix <==
+#!/bin/sh
+
+mv aclocal.m4 aclocal.m4-$$
+sed \
+ -e "s/: .{BUILD_\(.*\):='\(.*\)'}/: \${BUILD_\1=\`echo '\2'\`}/" \
+ -e "s/\`echo ''\`//" < aclocal.m4-$$ > aclocal.m4
+rm -f aclocal.m4-$$
+
+==> t1lib <==
+Downloading:
+ ftp://sunsite.unc.edu/pub/Linux/libs/graphics/t1lib-5.0.2.tar.gz
+
+==> teckit <==
+The teckit directory contains the source of the TECkit (Text Encoding Conversion
+toolkit) library and tools. See http://scripts.sil.org/teckit.
+
+The TECkit library is needed to build xetex.
+
+The subtrees teckit/source/teckitjni and teckit/perl_binaries have been removed
+as these are not relevant to building xetex or using the basic TECkit library.
+The copy of zlib source code found in the teckit tree has also been removed.
+
+The following files have been added:
+
+ teckit.ac
+ withenable.ac (currently empty)
+
+==> xpdf <==
+Downloading:
+ http://www.foolabs.com/xpdf/download.html
+
+Files in xpdf directory:
+ the files of the xpdf distribution, except
+ ltk misc/hello.pdf
+
+Replaced files:
+ Makefile.in
+ configure.in
+ xpdf/Makefile.in
+ goo/Makefile.in
+
+Added files:
+ libxpdf.ac
+
+==> zlib <==
+Downloading:
+ http://www.gzip.org/zlib/
+
+Files in zlib:
+ From the distribution:
+ everything, except:
+ INDEX Make_vms.com Makefile Makefile.riscos algorithm.txt amiga
+ configure descrip.mms msdos nt os2 zlib.html
+
+ Replaced file:
+ Makefile.in
+
+ Added for teTeX:
+ withenable.ac zlib.ac
+
+ Added for fpTeX:
+ win32.mak
+ contrib/minizip/win32.mak
+ contrib/untgz/win32.mak
+
+ Automatically generated:
+ depend.mak
diff --git a/Build/source/libs/README.orig b/Build/source/libs/README.orig
deleted file mode 100644
index e1e509b7b7b..00000000000
--- a/Build/source/libs/README.orig
+++ /dev/null
@@ -1,250 +0,0 @@
-$Id$
-Public domain. Originally created by Karl Berry, 2005.
-
-Libraries we compile for TeX Live.
-See comments in ../texk/README.
-
-expat - ?
-
-freetype - ?
-
-freetype2 - ?
-
-gd - ?
-
-graphite-engine - used by xetex, maintained here+upstream by Jonathan Kew
-
-icu-xetex - as with graphite-engine
-
-jpeg - ?
-
-libpng 1.2.8 - http://www.libpng.org - used by many
-
-libttf - ?
-
-lua* - used by luatex, maintained upstream+here by Taco Hoekwater
-
-md5 - used by pdftex, provenance unknown
-
-ncurses - used only by dialog. So if dialog were changed to use a system
- ncurses (surely universally available now), we could remove ncurses
- from our sources, which would be very nice.
-
-obsdcompat - used by pdftex
-
-slnunicode - ?
-
-t1lib - ?
-
-teckit - as with graphite-engine
-
-type1 - ?
-
-unzip - ?
-
-xpdf - used by pdftex
-
-zlib 1.2.3 - http://www.zlib.net/ - used by many
-
-zziplib - used by luatex
-
-
-
-This info used to be in a howto/ subdirectory; it was written a long
-time ago, by Sebastian Rahtz and/or Thomas Esser, maybe?
-
-==> freetype <==
-The following files have been added:
- freeetype.ac withenable.ac
-
-Modifications:
- configure.in:
- disable AM_DISABLE_STATIC
- add AM_DISABLE_SHARED
-
-==> freetype2 <==
-The freetype2 directory contains Freetype 2.3.7 sources from:
-
- http://download.savannah.gnu.org/releases/freetype/freetype-2.3.7.tar.bz2
-
-The following files have been added:
-
- freetype2.ac
- withenable.ac
-
-Modifications:
-
- freetype2/builds/unix/configure
- - edited to ignore the --srcdir argument, as this doesn't work properly
- in the tex-live build
-
-
-==> icu-xetex <==
-The icu-xetex directory contains a *MODIFIED* copy of ICU release 3.8.1,
-used in building xetex.
-
-The following files have been added:
-
- icu-xetex.ac
- withenable.ac
-
-See libs/icu-xetex/README for more information.
-
-==> libpng <==
-Downloading:
- http://www.libpng.org/
- http://libpng.sourceforge.net/
-
-libpng is the original distribution, but with added
- Makefile.in libpng.ac withenable.ac
-
-The directories
- contrib projects scripts
-are not needed for teTeX and can be removed.
-
-libpng is configured by libs/configure, so the (original)
-libs/libpng/configure is not used by teTeX.
-
-==> libtiff <==
-Downloading:
- http://www.libtiff.org/
- http://freshmeat.net/projects/libtiff/
-
-Which files are in libtiff:
- from the original distribution:
- COPYRIGHT RELEASE-DATE VERSION libtiff/* dist/tiff.alpha
-
- added for teTeX:
- acconfig.h aclocal.m4 configure.in libtiff.ac withenable.ac port.h
- Makefile.in (replacing the original file)
- added for fpTeX:
- win32 win32.mak
-
-Generated files:
- the commands
- autoheader -m ../../texk/etc/autoconf
- autoconf -m ../../texk/etc/autoconf
- have generated
- c-auto.in configure
-
- by make depend:
- depend.mak
-
-==> ncurses <==
-Downloading:
- http://www.gnu.org/software/ncurses/ncurses.html
- ftp://ftp.gnu.org/pub/gnu/ncurses/
- ftp://dickey.his.com/ncurses/
-
-The ncurses directory contains the original distribution except:
- Ada95 c++ doc form menu misc panel progs tack test
-
-The following files have been added:
- ncurses.ac withenable.ac
-
-Modifications:
- Makefile.in:
- remove install from the list in the end. Create an empty install::
- target somewhere earlier in the file.
-
- protect "test ... || ..." in Makefile.in with -
-
- aclocal.m4, remove the following lines (thus disabling misc test
- c++ subdirs):
- SRC_SUBDIRS="$SRC_SUBDIRS test"
- test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
- test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
-
- include/Makefile.in
- add symlink to AUTO_SRC variable
- add a rule
- symlink:
- @test -d ncurses || ln -s . ncurses
- add the line
- -rm -f ncurses
- to the clean:: target
-
- configure.in:
- remove that ldconfig stuff
- remove that cxx stuff
- remove that ada stuff
- cf_with_progs=no (instead of yes)
- remove the line
- modules_to_build="$modules_to_build panel menu form"
- with_debug=no (instead of yes)
- move one line below (after CF_DIRS_TO_MAKE):
- CF_SRC_MODULES($modules_to_build)
- remove the line
- test "$use_database" = yes && SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in"
-
-Run autoconf with version 2.52.20011227. Patch available at
- http://invisible-island.net/autoconf/
-
-==> ncurses-fix <==
-#!/bin/sh
-
-mv aclocal.m4 aclocal.m4-$$
-sed \
- -e "s/: .{BUILD_\(.*\):='\(.*\)'}/: \${BUILD_\1=\`echo '\2'\`}/" \
- -e "s/\`echo ''\`//" < aclocal.m4-$$ > aclocal.m4
-rm -f aclocal.m4-$$
-
-==> t1lib <==
-Downloading:
- ftp://sunsite.unc.edu/pub/Linux/libs/graphics/t1lib-5.0.2.tar.gz
-
-==> teckit <==
-The teckit directory contains the source of the TECkit (Text Encoding Conversion
-toolkit) library and tools. See http://scripts.sil.org/teckit.
-
-The TECkit library is needed to build xetex.
-
-The subtrees teckit/source/teckitjni and teckit/perl_binaries have been removed
-as these are not relevant to building xetex or using the basic TECkit library.
-The copy of zlib source code found in the teckit tree has also been removed.
-
-The following files have been added:
-
- teckit.ac
- withenable.ac (currently empty)
-
-==> xpdf <==
-Downloading:
- http://www.foolabs.com/xpdf/download.html
-
-Files in xpdf directory:
- the files of the xpdf distribution, except
- ltk misc/hello.pdf
-
-Replaced files:
- Makefile.in
- configure.in
- xpdf/Makefile.in
- goo/Makefile.in
-
-Added files:
- libxpdf.ac
-
-==> zlib <==
-Downloading:
- http://www.gzip.org/zlib/
-
-Files in zlib:
- From the distribution:
- everything, except:
- INDEX Make_vms.com Makefile Makefile.riscos algorithm.txt amiga
- configure descrip.mms msdos nt os2 zlib.html
-
- Replaced file:
- Makefile.in
-
- Added for teTeX:
- withenable.ac zlib.ac
-
- Added for fpTeX:
- win32.mak
- contrib/minizip/win32.mak
- contrib/untgz/win32.mak
-
- Automatically generated:
- depend.mak
diff --git a/Build/source/libs/xpdf/ChangeLog b/Build/source/libs/xpdf/ChangeLog
index 0b3f809f2b2..014120ee846 100644
--- a/Build/source/libs/xpdf/ChangeLog
+++ b/Build/source/libs/xpdf/ChangeLog
@@ -1,3 +1,33 @@
+2009-04-30 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Applied official 3.02pl3 patch
+ adapted xpdf-3.02-PATCHES/patch-[12]?-*
+
+ * xpdf/config.h (xpdfVersion): "3.02pl2" -> "3.02pl3"
+
+2009-04-02 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * xpdf/GlobalParams.cc: '#undef WIN32' for mingw32 as patch
+ xpdf-3.02-PATCHES/patch-12-mingw32
+
+2009-03-05 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * goo/gfile.cc: '#include <time.h>' as patch
+ xpdf-3.02-PATCHES/patch-11-time_h
+
+2009-02-14 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * configure.ac: for the new TeX Live build system.
+ * Makefile.am, fofi/Makefile.am, goo/Makefile.am,
+ xpdf/Makefile.am: proxy Makefiles for the patched original
+ sources in xpdf-3.02/
+
+2008-05-08 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Imported/updated changes for pdfTeX as patches
+ xpdf-3.02-PATCHES/patch-10-PDF_PARSER_ONLY
+ xpdf-3.02-PATCHES/patch-20-pdftex
+
2008-01-31 Peter Breitenlohner <peb@mppmu.mpg.de>
Convert from autoconf-2.13 to autoconf-2.59+:
@@ -8,3 +38,21 @@
* aclocal.m4 (new): Generated (aclocal -I ../../texk/m4).
* configure: Regenerated (autoconf).
+2007-11-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Applied official 3.02pl2 patch
+
+ * xpdf/config.h (xpdfVersion): "3.02pl1" -> "3.02pl2"
+
+2007-08-01 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Applied official 3.02pl1 patch
+
+ * xpdf/config.h (xpdfVersion): "3.02" -> "3.02pl1"
+
+2007-02-29 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Imported xpdf-3.02 source tree:
+ ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.02.tar.gz
+ http://www.foolabs.com/xpdf/xpdf-3.02.tar.gz
+
diff --git a/Build/source/libs/xpdf/Makefile.am b/Build/source/libs/xpdf/Makefile.am
index 1f552fd1905..7374496dcbf 100644
--- a/Build/source/libs/xpdf/Makefile.am
+++ b/Build/source/libs/xpdf/Makefile.am
@@ -26,6 +26,14 @@ ACLOCAL_AMFLAGS = -I ../../m4
## Thus nodist_* for all files in $(XPDF_TREE).
EXTRA_DIST = $(XPDF_TREE)
+## Official patches as obtained from ftp://ftp.foolabs.com/pub/xpdf
+##
+EXTRA_DIST += $(XPDF_TREE)-foolabs
+
+## Actual patches applied to the original source tree
+##
+EXTRA_DIST += $(XPDF_TREE)-PATCHES
+
## in case of an SVN repository
dist-hook:
rm -rf `find $(distdir)/$(XPDF_TREE) -name .svn`
@@ -98,27 +106,3 @@ xpdf_libxpdf_a_sources = \
$(XPDF_SRC)/UnicodeMap.cc \
$(XPDF_SRC)/XRef.cc
-## Patch for xpdf-3.02pl2
-##
-EXTRA_DIST += xpdf-3.02-pl2.patch
-
-## Patch for xpdf-3.02pl3
-##
-EXTRA_DIST += xpdf-3.02-pl3.patch
-
-## Patch required to build with -DPDF_PARSER_ONLY
-##
-EXTRA_DIST += xpdf-3.02-PDF_PARSER_ONLY.patch
-
-## Patch required for pdftex
-##
-EXTRA_DIST += xpdf-3.02-pdftex.patch
-
-## Patch required for some systems
-##
-EXTRA_DIST += xpdf-3.02-time_h.patch
-
-## Patch required for mingw32
-##
-EXTRA_DIST += xpdf-3.02-mingw32.patch
-
diff --git a/Build/source/libs/xpdf/Makefile.in b/Build/source/libs/xpdf/Makefile.in
index f70265973bd..c6aa37dcb8b 100644
--- a/Build/source/libs/xpdf/Makefile.in
+++ b/Build/source/libs/xpdf/Makefile.in
@@ -210,9 +210,7 @@ top_srcdir = @top_srcdir@
#========================================================================
#========================================================================
ACLOCAL_AMFLAGS = -I ../../m4
-EXTRA_DIST = $(XPDF_TREE) xpdf-3.02-pl2.patch \
- xpdf-3.02-PDF_PARSER_ONLY.patch xpdf-3.02-pdftex.patch \
- xpdf-3.02-time_h.patch xpdf-3.02-mingw32.patch
+EXTRA_DIST = $(XPDF_TREE) $(XPDF_TREE)-foolabs $(XPDF_TREE)-PATCHES
SUBDIRS = goo fofi xpdf
GOO_SRC = $(top_srcdir)/$(XPDF_TREE)/goo
FOFI_SRC = $(top_srcdir)/$(XPDF_TREE)/fofi
diff --git a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-01-pl1 b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-01-pl1
new file mode 100644
index 00000000000..f203821db36
--- /dev/null
+++ b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-01-pl1
@@ -0,0 +1,50 @@
+ Official patch http://www.foolabs.com/xpdf/xpdf-3.02pl1.patch
+
+ Update of xpdfVersion in xpdf-3.02/xpdf/config.h
+
+diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
+--- xpdf-3.02.orig/xpdf/Stream.cc 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/Stream.cc 2007-08-01 10:34:31.000000000 +0200
+@@ -410,15 +410,13 @@
+ ok = gFalse;
+
+ nVals = width * nComps;
+- if (width <= 0 || nComps <= 0 || nBits <= 0 ||
+- nComps >= INT_MAX / nBits ||
+- width >= INT_MAX / nComps / nBits ||
+- nVals * nBits + 7 < 0) {
+- return;
+- }
+ pixBytes = (nComps * nBits + 7) >> 3;
+ rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes;
+- if (rowBytes <= 0) {
++ if (width <= 0 || nComps <= 0 || nBits <= 0 ||
++ nComps > gfxColorMaxComps ||
++ nBits > 16 ||
++ width >= INT_MAX / nComps || // check for overflow in nVals
++ nVals >= (INT_MAX - 7) / nBits) { // check for overflow in rowBytes
+ return;
+ }
+ predLine = (Guchar *)gmalloc(rowBytes);
+diff -ur -N xpdf-3.02.orig/xpdf/config.h xpdf-3.02/xpdf/config.h
+--- xpdf-3.02.orig/xpdf/config.h 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/config.h 2007-08-01 10:34:31.000000000 +0200
+@@ -5,6 +5,9 @@
+ // Copyright 1996-2007 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #ifndef CONFIG_H
+ #define CONFIG_H
+@@ -14,7 +17,7 @@
+ //------------------------------------------------------------------------
+
+ // xpdf version
+-#define xpdfVersion "3.02"
++#define xpdfVersion "3.02pl1"
+ #define xpdfVersionNum 3.02
+ #define xpdfMajorVersion 3
+ #define xpdfMinorVersion 2
diff --git a/Build/source/libs/xpdf/xpdf-3.02-pl2.patch b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-02-pl2
index b6ee9dbb8cf..00dc4ed6a49 100644
--- a/Build/source/libs/xpdf/xpdf-3.02-pl2.patch
+++ b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-02-pl2
@@ -1,28 +1,11 @@
+ Official patch http://www.foolabs.com/xpdf/xpdf-3.02pl2.patch
+
+ Update of xpdfVersion in xpdf-3.02/xpdf/config.h
+
diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
---- xpdf-3.02.orig/xpdf/Stream.cc 2007-02-27 23:05:52.000000000 +0100
+--- xpdf-3.02.orig/xpdf/Stream.cc 2007-08-01 10:34:31.000000000 +0200
+++ xpdf-3.02/xpdf/Stream.cc 2007-11-12 13:27:21.000000000 +0100
-@@ -410,15 +410,13 @@
- ok = gFalse;
-
- nVals = width * nComps;
-- if (width <= 0 || nComps <= 0 || nBits <= 0 ||
-- nComps >= INT_MAX / nBits ||
-- width >= INT_MAX / nComps / nBits ||
-- nVals * nBits + 7 < 0) {
-- return;
-- }
- pixBytes = (nComps * nBits + 7) >> 3;
- rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes;
-- if (rowBytes <= 0) {
-+ if (width <= 0 || nComps <= 0 || nBits <= 0 ||
-+ nComps > gfxColorMaxComps ||
-+ nBits > 16 ||
-+ width >= INT_MAX / nComps || // check for overflow in nVals
-+ nVals >= (INT_MAX - 7) / nBits) { // check for overflow in rowBytes
- return;
- }
- predLine = (Guchar *)gmalloc(rowBytes);
-@@ -1245,23 +1243,26 @@
+@@ -1243,23 +1243,26 @@
columns = columnsA;
if (columns < 1) {
columns = 1;
@@ -57,7 +40,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
buf = EOF;
}
-@@ -1280,9 +1281,9 @@
+@@ -1278,9 +1281,9 @@
row = 0;
nextLine2D = encoding < 0;
inputBits = 0;
@@ -70,7 +53,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
buf = EOF;
// skip any initial zero bits and end-of-line marker, and get the 2D
-@@ -1299,211 +1300,230 @@
+@@ -1297,211 +1300,230 @@
}
}
@@ -439,7 +422,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
// byte-align the row
if (byteAlign) {
inputBits &= ~7;
-@@ -1562,14 +1582,17 @@
+@@ -1560,14 +1582,17 @@
// this if we know the stream contains end-of-line markers because
// the "just plow on" technique tends to work better otherwise
} else if (err && endOfLine) {
@@ -460,7 +443,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
eatBits(12);
if (encoding > 0) {
eatBits(1);
-@@ -1577,11 +1600,11 @@
+@@ -1575,11 +1600,11 @@
}
}
@@ -477,7 +460,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
}
++row;
-@@ -1589,39 +1612,43 @@
+@@ -1587,39 +1612,43 @@
// get a byte
if (outputBits >= 8) {
@@ -542,7 +525,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
return buf;
}
-@@ -1663,6 +1690,9 @@
+@@ -1661,6 +1690,9 @@
code = 0; // make gcc happy
if (endOfBlock) {
code = lookBits(12);
@@ -552,7 +535,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
if ((code >> 5) == 0) {
p = &whiteTab1[code];
} else {
-@@ -1675,6 +1705,9 @@
+@@ -1673,6 +1705,9 @@
} else {
for (n = 1; n <= 9; ++n) {
code = lookBits(n);
@@ -562,7 +545,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
if (n < 9) {
code <<= 9 - n;
}
-@@ -1686,6 +1719,9 @@
+@@ -1684,6 +1719,9 @@
}
for (n = 11; n <= 12; ++n) {
code = lookBits(n);
@@ -572,7 +555,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
if (n < 12) {
code <<= 12 - n;
}
-@@ -1711,9 +1747,12 @@
+@@ -1709,9 +1747,12 @@
code = 0; // make gcc happy
if (endOfBlock) {
code = lookBits(13);
@@ -586,7 +569,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
p = &blackTab2[(code >> 1) - 64];
} else {
p = &blackTab3[code >> 7];
-@@ -1725,6 +1764,9 @@
+@@ -1723,6 +1764,9 @@
} else {
for (n = 2; n <= 6; ++n) {
code = lookBits(n);
@@ -596,7 +579,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
if (n < 6) {
code <<= 6 - n;
}
-@@ -1736,6 +1778,9 @@
+@@ -1734,6 +1778,9 @@
}
for (n = 7; n <= 12; ++n) {
code = lookBits(n);
@@ -606,7 +589,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
if (n < 12) {
code <<= 12 - n;
}
-@@ -1749,6 +1794,9 @@
+@@ -1747,6 +1794,9 @@
}
for (n = 10; n <= 13; ++n) {
code = lookBits(n);
@@ -616,7 +599,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
if (n < 13) {
code <<= 13 - n;
}
-@@ -1963,6 +2011,12 @@
+@@ -1961,6 +2011,12 @@
// allocate a buffer for the whole image
bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth;
bufHeight = ((height + mcuHeight - 1) / mcuHeight) * mcuHeight;
@@ -629,7 +612,7 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
for (i = 0; i < numComps; ++i) {
frameBuf[i] = (int *)gmallocn(bufWidth * bufHeight, sizeof(int));
memset(frameBuf[i], 0, bufWidth * bufHeight * sizeof(int));
-@@ -3038,6 +3092,11 @@
+@@ -3036,6 +3092,11 @@
}
scanInfo.firstCoeff = str->getChar();
scanInfo.lastCoeff = str->getChar();
@@ -664,37 +647,15 @@ diff -ur -N xpdf-3.02.orig/xpdf/Stream.h xpdf-3.02/xpdf/Stream.h
short getTwoDimCode();
short getWhiteCode();
short getBlackCode();
-diff -ur -N xpdf-3.02.orig/xpdf/XPDFViewer.cc xpdf-3.02/xpdf/XPDFViewer.cc
---- xpdf-3.02.orig/xpdf/XPDFViewer.cc 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/XPDFViewer.cc 2007-06-25 16:21:28.000000000 +0200
-@@ -3406,10 +3406,12 @@
- PSOutputDev *psOut;
-
- doc = viewer->core->getDoc();
-+#if 0
- if (!doc->okToPrint()) {
- error(-1, "Printing this document is not allowed.");
- return;
- }
-+#endif
-
- viewer->core->setBusyCursor(gTrue);
-
-diff -ur -N xpdf-3.02.orig/xpdf/pdftops.cc xpdf-3.02/xpdf/pdftops.cc
---- xpdf-3.02.orig/xpdf/pdftops.cc 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/pdftops.cc 2007-06-25 16:21:33.000000000 +0200
-@@ -278,12 +278,14 @@
- goto err1;
- }
-
-+#if 0
- // check for print permission
- if (!doc->okToPrint()) {
- error(-1, "Printing this document is not allowed.");
- exitCode = 3;
- goto err1;
- }
-+#endif
+diff -ur -N xpdf-3.02.orig/xpdf/config.h xpdf-3.02/xpdf/config.h
+--- xpdf-3.02.orig/xpdf/config.h 2007-08-01 10:34:31.000000000 +0200
++++ xpdf-3.02/xpdf/config.h 2007-11-12 13:27:21.000000000 +0100
+@@ -17,7 +17,7 @@
+ //------------------------------------------------------------------------
- // construct PostScript file name
- if (argc == 3) {
+ // xpdf version
+-#define xpdfVersion "3.02pl1"
++#define xpdfVersion "3.02pl2"
+ #define xpdfVersionNum 3.02
+ #define xpdfMajorVersion 3
+ #define xpdfMinorVersion 2
diff --git a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-03-pl3 b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-03-pl3
new file mode 100644
index 00000000000..dcfa15f46c6
--- /dev/null
+++ b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-03-pl3
@@ -0,0 +1,919 @@
+ Official patch http://www.foolabs.com/xpdf/xpdf-3.02pl3.patch
+
+ Update of xpdfVersion in xpdf-3.02/xpdf/config.h
+
+diff -ur -N xpdf-3.02.orig/goo/gmem.cc xpdf-3.02/goo/gmem.cc
+--- xpdf-3.02.orig/goo/gmem.cc 2007-02-27 23:05:51.000000000 +0100
++++ xpdf-3.02/goo/gmem.cc 2009-03-20 00:47:25.000000000 +0100
+@@ -55,7 +55,15 @@
+ void *data;
+ unsigned long *trl, *p;
+
+- if (size <= 0) {
++ if (size < 0) {
++#if USE_EXCEPTIONS
++ throw GMemException();
++#else
++ fprintf(stderr, "Invalid memory allocation size\n");
++ exit(1);
++#endif
++ }
++ if (size == 0) {
+ return NULL;
+ }
+ size1 = gMemDataSize(size);
+@@ -91,7 +99,15 @@
+ #else
+ void *p;
+
+- if (size <= 0) {
++ if (size < 0) {
++#if USE_EXCEPTIONS
++ throw GMemException();
++#else
++ fprintf(stderr, "Invalid memory allocation size\n");
++ exit(1);
++#endif
++ }
++ if (size == 0) {
+ return NULL;
+ }
+ if (!(p = malloc(size))) {
+@@ -112,7 +128,15 @@
+ void *q;
+ int oldSize;
+
+- if (size <= 0) {
++ if (size < 0) {
++#if USE_EXCEPTIONS
++ throw GMemException();
++#else
++ fprintf(stderr, "Invalid memory allocation size\n");
++ exit(1);
++#endif
++ }
++ if (size == 0) {
+ if (p) {
+ gfree(p);
+ }
+@@ -131,7 +155,15 @@
+ #else
+ void *q;
+
+- if (size <= 0) {
++ if (size < 0) {
++#if USE_EXCEPTIONS
++ throw GMemException();
++#else
++ fprintf(stderr, "Invalid memory allocation size\n");
++ exit(1);
++#endif
++ }
++ if (size == 0) {
+ if (p) {
+ free(p);
+ }
+diff -ur -N xpdf-3.02.orig/xpdf/JBIG2Stream.cc xpdf-3.02/xpdf/JBIG2Stream.cc
+--- xpdf-3.02.orig/xpdf/JBIG2Stream.cc 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/JBIG2Stream.cc 2009-03-31 19:55:23.000000000 +0200
+@@ -422,12 +422,14 @@
+ table[i] = table[len];
+
+ // assign prefixes
+- i = 0;
+- prefix = 0;
+- table[i++].prefix = prefix++;
+- for (; table[i].rangeLen != jbig2HuffmanEOT; ++i) {
+- prefix <<= table[i].prefixLen - table[i-1].prefixLen;
+- table[i].prefix = prefix++;
++ if (table[0].rangeLen != jbig2HuffmanEOT) {
++ i = 0;
++ prefix = 0;
++ table[i++].prefix = prefix++;
++ for (; table[i].rangeLen != jbig2HuffmanEOT; ++i) {
++ prefix <<= table[i].prefixLen - table[i-1].prefixLen;
++ table[i].prefix = prefix++;
++ }
+ }
+ }
+
+@@ -491,7 +493,7 @@
+ }
+ if (p->bits < 0) {
+ error(str->getPos(), "Bad two dim code in JBIG2 MMR stream");
+- return 0;
++ return EOF;
+ }
+ bufLen -= p->bits;
+ return p->n;
+@@ -507,7 +509,7 @@
+ ++nBytesRead;
+ }
+ while (1) {
+- if (bufLen >= 7 && ((buf >> (bufLen - 7)) & 0x7f) == 0) {
++ if (bufLen >= 11 && ((buf >> (bufLen - 7)) & 0x7f) == 0) {
+ if (bufLen <= 12) {
+ code = buf << (12 - bufLen);
+ } else {
+@@ -550,14 +552,15 @@
+ ++nBytesRead;
+ }
+ while (1) {
+- if (bufLen >= 6 && ((buf >> (bufLen - 6)) & 0x3f) == 0) {
++ if (bufLen >= 10 && ((buf >> (bufLen - 6)) & 0x3f) == 0) {
+ if (bufLen <= 13) {
+ code = buf << (13 - bufLen);
+ } else {
+ code = buf >> (bufLen - 13);
+ }
+ p = &blackTab1[code & 0x7f];
+- } else if (bufLen >= 4 && ((buf >> (bufLen - 4)) & 0x0f) == 0) {
++ } else if (bufLen >= 7 && ((buf >> (bufLen - 4)) & 0x0f) == 0 &&
++ ((buf >> (bufLen - 6)) & 0x03) != 0) {
+ if (bufLen <= 12) {
+ code = buf << (12 - bufLen);
+ } else {
+@@ -683,8 +686,9 @@
+ h = hA;
+ line = (wA + 7) >> 3;
+ if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) {
+- data = NULL;
+- return;
++ // force a call to gmalloc(-1), which will throw an exception
++ h = -1;
++ line = 2;
+ }
+ // need to allocate one extra guard byte for use in combine()
+ data = (Guchar *)gmalloc(h * line + 1);
+@@ -698,8 +702,9 @@
+ h = bitmap->h;
+ line = bitmap->line;
+ if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) {
+- data = NULL;
+- return;
++ // force a call to gmalloc(-1), which will throw an exception
++ h = -1;
++ line = 2;
+ }
+ // need to allocate one extra guard byte for use in combine()
+ data = (Guchar *)gmalloc(h * line + 1);
+@@ -754,6 +759,8 @@
+ inline void JBIG2Bitmap::getPixelPtr(int x, int y, JBIG2BitmapPtr *ptr) {
+ if (y < 0 || y >= h || x >= w) {
+ ptr->p = NULL;
++ ptr->shift = 0; // make gcc happy
++ ptr->x = 0; // make gcc happy
+ } else if (x < 0) {
+ ptr->p = &data[y * line];
+ ptr->shift = 7;
+@@ -798,6 +805,10 @@
+ Guint src0, src1, src, dest, s1, s2, m1, m2, m3;
+ GBool oneByte;
+
++ // check for the pathological case where y = -2^31
++ if (y < -0x7fffffff) {
++ return;
++ }
+ if (y < 0) {
+ y0 = -y;
+ } else {
+@@ -1011,8 +1022,13 @@
+ JBIG2SymbolDict::JBIG2SymbolDict(Guint segNumA, Guint sizeA):
+ JBIG2Segment(segNumA)
+ {
++ Guint i;
++
+ size = sizeA;
+ bitmaps = (JBIG2Bitmap **)gmallocn(size, sizeof(JBIG2Bitmap *));
++ for (i = 0; i < size; ++i) {
++ bitmaps[i] = NULL;
++ }
+ genericRegionStats = NULL;
+ refinementRegionStats = NULL;
+ }
+@@ -1021,7 +1037,9 @@
+ Guint i;
+
+ for (i = 0; i < size; ++i) {
+- delete bitmaps[i];
++ if (bitmaps[i]) {
++ delete bitmaps[i];
++ }
+ }
+ gfree(bitmaps);
+ if (genericRegionStats) {
+@@ -1296,6 +1314,13 @@
+ goto eofError2;
+ }
+
++ // check for missing page information segment
++ if (!pageBitmap && ((segType >= 4 && segType <= 7) ||
++ (segType >= 20 && segType <= 43))) {
++ error(getPos(), "First JBIG2 segment associated with a page must be a page information segment");
++ goto syntaxError;
++ }
++
+ // read the segment data
+ switch (segType) {
+ case 0:
+@@ -1411,6 +1436,8 @@
+ Guint i, j, k;
+ Guchar *p;
+
++ symWidths = NULL;
++
+ // symbol dictionary flags
+ if (!readUWord(&flags)) {
+ goto eofError;
+@@ -1466,20 +1493,32 @@
+ codeTables = new GList();
+ numInputSyms = 0;
+ for (i = 0; i < nRefSegs; ++i) {
+- seg = findSegment(refSegs[i]);
+- if (seg->getType() == jbig2SegSymbolDict) {
+- numInputSyms += ((JBIG2SymbolDict *)seg)->getSize();
+- } else if (seg->getType() == jbig2SegCodeTable) {
+- codeTables->append(seg);
++ if ((seg = findSegment(refSegs[i]))) {
++ if (seg->getType() == jbig2SegSymbolDict) {
++ j = ((JBIG2SymbolDict *)seg)->getSize();
++ if (numInputSyms > UINT_MAX - j) {
++ error(getPos(), "Too many input symbols in JBIG2 symbol dictionary");
++ delete codeTables;
++ goto eofError;
++ }
++ numInputSyms += j;
++ } else if (seg->getType() == jbig2SegCodeTable) {
++ codeTables->append(seg);
++ }
+ }
+ }
++ if (numInputSyms > UINT_MAX - numNewSyms) {
++ error(getPos(), "Too many input symbols in JBIG2 symbol dictionary");
++ delete codeTables;
++ goto eofError;
++ }
+
+ // compute symbol code length
+- symCodeLen = 0;
+- i = 1;
+- while (i < numInputSyms + numNewSyms) {
++ symCodeLen = 1;
++ i = (numInputSyms + numNewSyms) >> 1;
++ while (i) {
+ ++symCodeLen;
+- i <<= 1;
++ i >>= 1;
+ }
+
+ // get the input symbol bitmaps
+@@ -1491,11 +1530,12 @@
+ k = 0;
+ inputSymbolDict = NULL;
+ for (i = 0; i < nRefSegs; ++i) {
+- seg = findSegment(refSegs[i]);
+- if (seg->getType() == jbig2SegSymbolDict) {
+- inputSymbolDict = (JBIG2SymbolDict *)seg;
+- for (j = 0; j < inputSymbolDict->getSize(); ++j) {
+- bitmaps[k++] = inputSymbolDict->getBitmap(j);
++ if ((seg = findSegment(refSegs[i]))) {
++ if (seg->getType() == jbig2SegSymbolDict) {
++ inputSymbolDict = (JBIG2SymbolDict *)seg;
++ for (j = 0; j < inputSymbolDict->getSize(); ++j) {
++ bitmaps[k++] = inputSymbolDict->getBitmap(j);
++ }
+ }
+ }
+ }
+@@ -1510,6 +1550,9 @@
+ } else if (huffDH == 1) {
+ huffDHTable = huffTableE;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffDHTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+ if (huffDW == 0) {
+@@ -1517,17 +1560,26 @@
+ } else if (huffDW == 1) {
+ huffDWTable = huffTableC;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffDWTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+ if (huffBMSize == 0) {
+ huffBMSizeTable = huffTableA;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffBMSizeTable =
+ ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+ if (huffAggInst == 0) {
+ huffAggInstTable = huffTableA;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffAggInstTable =
+ ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+@@ -1560,7 +1612,6 @@
+ }
+
+ // allocate symbol widths storage
+- symWidths = NULL;
+ if (huff && !refAgg) {
+ symWidths = (Guint *)gmallocn(numNewSyms, sizeof(Guint));
+ }
+@@ -1602,6 +1653,10 @@
+ goto syntaxError;
+ }
+ symWidth += dw;
++ if (i >= numNewSyms) {
++ error(getPos(), "Too many symbols in JBIG2 symbol dictionary");
++ goto syntaxError;
++ }
+
+ // using a collective bitmap, so don't read a bitmap here
+ if (huff && !refAgg) {
+@@ -1638,6 +1693,10 @@
+ arithDecoder->decodeInt(&refDX, iardxStats);
+ arithDecoder->decodeInt(&refDY, iardyStats);
+ }
++ if (symID >= numInputSyms + i) {
++ error(getPos(), "Invalid symbol ID in JBIG2 symbol dictionary");
++ goto syntaxError;
++ }
+ refBitmap = bitmaps[symID];
+ bitmaps[numInputSyms + i] =
+ readGenericRefinementRegion(symWidth, symHeight,
+@@ -1704,6 +1763,12 @@
+ } else {
+ arithDecoder->decodeInt(&run, iaexStats);
+ }
++ if (i + run > numInputSyms + numNewSyms ||
++ (ex && j + run > numExSyms)) {
++ error(getPos(), "Too many exported symbols in JBIG2 symbol dictionary");
++ delete symbolDict;
++ goto syntaxError;
++ }
+ if (ex) {
+ for (cnt = 0; cnt < run; ++cnt) {
+ symbolDict->setBitmap(j++, bitmaps[i++]->copy());
+@@ -1713,6 +1778,11 @@
+ }
+ ex = !ex;
+ }
++ if (j != numExSyms) {
++ error(getPos(), "Too few symbols in JBIG2 symbol dictionary");
++ delete symbolDict;
++ goto syntaxError;
++ }
+
+ for (i = 0; i < numNewSyms; ++i) {
+ delete bitmaps[numInputSyms + i];
+@@ -1735,6 +1805,10 @@
+
+ return gTrue;
+
++ codeTableError:
++ error(getPos(), "Missing code table in JBIG2 symbol dictionary");
++ delete codeTables;
++
+ syntaxError:
+ for (i = 0; i < numNewSyms; ++i) {
+ if (bitmaps[numInputSyms + i]) {
+@@ -1837,6 +1911,8 @@
+ }
+ } else {
+ error(getPos(), "Invalid segment reference in JBIG2 text region");
++ delete codeTables;
++ return;
+ }
+ }
+ symCodeLen = 0;
+@@ -1871,6 +1947,9 @@
+ } else if (huffFS == 1) {
+ huffFSTable = huffTableG;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffFSTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+ if (huffDS == 0) {
+@@ -1880,6 +1959,9 @@
+ } else if (huffDS == 2) {
+ huffDSTable = huffTableJ;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffDSTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+ if (huffDT == 0) {
+@@ -1889,6 +1971,9 @@
+ } else if (huffDT == 2) {
+ huffDTTable = huffTableM;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffDTTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+ if (huffRDW == 0) {
+@@ -1896,6 +1981,9 @@
+ } else if (huffRDW == 1) {
+ huffRDWTable = huffTableO;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffRDWTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+ if (huffRDH == 0) {
+@@ -1903,6 +1991,9 @@
+ } else if (huffRDH == 1) {
+ huffRDHTable = huffTableO;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffRDHTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+ if (huffRDX == 0) {
+@@ -1910,6 +2001,9 @@
+ } else if (huffRDX == 1) {
+ huffRDXTable = huffTableO;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffRDXTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+ if (huffRDY == 0) {
+@@ -1917,11 +2011,17 @@
+ } else if (huffRDY == 1) {
+ huffRDYTable = huffTableO;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffRDYTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+ if (huffRSize == 0) {
+ huffRSizeTable = huffTableA;
+ } else {
++ if (i >= (Guint)codeTables->getLength()) {
++ goto codeTableError;
++ }
+ huffRSizeTable =
+ ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
+ }
+@@ -2016,8 +2116,15 @@
+
+ return;
+
++ codeTableError:
++ error(getPos(), "Missing code table in JBIG2 text region");
++ gfree(codeTables);
++ delete syms;
++ return;
++
+ eofError:
+ error(getPos(), "Unexpected EOF in JBIG2 stream");
++ return;
+ }
+
+ JBIG2Bitmap *JBIG2Stream::readTextRegion(GBool huff, GBool refine,
+@@ -2324,8 +2431,8 @@
+ error(getPos(), "Bad symbol dictionary reference in JBIG2 halftone segment");
+ return;
+ }
+- seg = findSegment(refSegs[0]);
+- if (seg->getType() != jbig2SegPatternDict) {
++ if (!(seg = findSegment(refSegs[0])) ||
++ seg->getType() != jbig2SegPatternDict) {
+ error(getPos(), "Bad symbol dictionary reference in JBIG2 halftone segment");
+ return;
+ }
+@@ -2483,7 +2590,7 @@
+
+ // read the bitmap
+ bitmap = readGenericBitmap(mmr, w, h, templ, tpgdOn, gFalse,
+- NULL, atx, aty, mmr ? 0 : length - 18);
++ NULL, atx, aty, mmr ? length - 18 : 0);
+
+ // combine the region bitmap into the page bitmap
+ if (imm) {
+@@ -2505,6 +2612,43 @@
+ error(getPos(), "Unexpected EOF in JBIG2 stream");
+ }
+
++inline void JBIG2Stream::mmrAddPixels(int a1, int blackPixels,
++ int *codingLine, int *a0i, int w) {
++ if (a1 > codingLine[*a0i]) {
++ if (a1 > w) {
++ error(getPos(), "JBIG2 MMR row is wrong length ({0:d})", a1);
++ a1 = w;
++ }
++ if ((*a0i & 1) ^ blackPixels) {
++ ++*a0i;
++ }
++ codingLine[*a0i] = a1;
++ }
++}
++
++inline void JBIG2Stream::mmrAddPixelsNeg(int a1, int blackPixels,
++ int *codingLine, int *a0i, int w) {
++ if (a1 > codingLine[*a0i]) {
++ if (a1 > w) {
++ error(getPos(), "JBIG2 MMR row is wrong length ({0:d})", a1);
++ a1 = w;
++ }
++ if ((*a0i & 1) ^ blackPixels) {
++ ++*a0i;
++ }
++ codingLine[*a0i] = a1;
++ } else if (a1 < codingLine[*a0i]) {
++ if (a1 < 0) {
++ error(getPos(), "Invalid JBIG2 MMR code");
++ a1 = 0;
++ }
++ while (*a0i > 0 && a1 <= codingLine[*a0i - 1]) {
++ --*a0i;
++ }
++ codingLine[*a0i] = a1;
++ }
++}
++
+ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h,
+ int templ, GBool tpgdOn,
+ GBool useSkip, JBIG2Bitmap *skip,
+@@ -2517,7 +2661,7 @@
+ JBIG2BitmapPtr atPtr0, atPtr1, atPtr2, atPtr3;
+ int *refLine, *codingLine;
+ int code1, code2, code3;
+- int x, y, a0, pix, i, refI, codingI;
++ int x, y, a0i, b1i, blackPixels, pix, i;
+
+ bitmap = new JBIG2Bitmap(0, w, h);
+ bitmap->clearToZero();
+@@ -2527,9 +2671,18 @@
+ if (mmr) {
+
+ mmrDecoder->reset();
++ if (w > INT_MAX - 2) {
++ error(getPos(), "Bad width in JBIG2 generic bitmap");
++ // force a call to gmalloc(-1), which will throw an exception
++ w = -3;
++ }
++ // 0 <= codingLine[0] < codingLine[1] < ... < codingLine[n] = w
++ // ---> max codingLine size = w + 1
++ // refLine has one extra guard entry at the end
++ // ---> max refLine size = w + 2
++ codingLine = (int *)gmallocn(w + 1, sizeof(int));
+ refLine = (int *)gmallocn(w + 2, sizeof(int));
+- codingLine = (int *)gmallocn(w + 2, sizeof(int));
+- codingLine[0] = codingLine[1] = w;
++ codingLine[0] = w;
+
+ for (y = 0; y < h; ++y) {
+
+@@ -2537,128 +2690,157 @@
+ for (i = 0; codingLine[i] < w; ++i) {
+ refLine[i] = codingLine[i];
+ }
+- refLine[i] = refLine[i + 1] = w;
++ refLine[i++] = w;
++ refLine[i] = w;
+
+ // decode a line
+- refI = 0; // b1 = refLine[refI]
+- codingI = 0; // a1 = codingLine[codingI]
+- a0 = 0;
+- do {
++ codingLine[0] = 0;
++ a0i = 0;
++ b1i = 0;
++ blackPixels = 0;
++ // invariant:
++ // refLine[b1i-1] <= codingLine[a0i] < refLine[b1i] < refLine[b1i+1] <= w
++ // exception at left edge:
++ // codingLine[a0i = 0] = refLine[b1i = 0] = 0 is possible
++ // exception at right edge:
++ // refLine[b1i] = refLine[b1i+1] = w is possible
++ while (codingLine[a0i] < w) {
+ code1 = mmrDecoder->get2DCode();
+ switch (code1) {
+ case twoDimPass:
+- if (refLine[refI] < w) {
+- a0 = refLine[refI + 1];
+- refI += 2;
+- }
+- break;
++ mmrAddPixels(refLine[b1i + 1], blackPixels, codingLine, &a0i, w);
++ if (refLine[b1i + 1] < w) {
++ b1i += 2;
++ }
++ break;
+ case twoDimHoriz:
+- if (codingI & 1) {
+- code1 = 0;
+- do {
+- code1 += code3 = mmrDecoder->getBlackCode();
+- } while (code3 >= 64);
+- code2 = 0;
+- do {
+- code2 += code3 = mmrDecoder->getWhiteCode();
+- } while (code3 >= 64);
+- } else {
+- code1 = 0;
+- do {
+- code1 += code3 = mmrDecoder->getWhiteCode();
+- } while (code3 >= 64);
+- code2 = 0;
+- do {
+- code2 += code3 = mmrDecoder->getBlackCode();
+- } while (code3 >= 64);
+- }
+- if (code1 > 0 || code2 > 0) {
+- a0 = codingLine[codingI++] = a0 + code1;
+- a0 = codingLine[codingI++] = a0 + code2;
+- while (refLine[refI] <= a0 && refLine[refI] < w) {
+- refI += 2;
+- }
+- }
+- break;
+- case twoDimVert0:
+- a0 = codingLine[codingI++] = refLine[refI];
+- if (refLine[refI] < w) {
+- ++refI;
+- }
+- break;
+- case twoDimVertR1:
+- a0 = codingLine[codingI++] = refLine[refI] + 1;
+- if (refLine[refI] < w) {
+- ++refI;
+- while (refLine[refI] <= a0 && refLine[refI] < w) {
+- refI += 2;
+- }
+- }
+- break;
+- case twoDimVertR2:
+- a0 = codingLine[codingI++] = refLine[refI] + 2;
+- if (refLine[refI] < w) {
+- ++refI;
+- while (refLine[refI] <= a0 && refLine[refI] < w) {
+- refI += 2;
+- }
+- }
+- break;
++ code1 = code2 = 0;
++ if (blackPixels) {
++ do {
++ code1 += code3 = mmrDecoder->getBlackCode();
++ } while (code3 >= 64);
++ do {
++ code2 += code3 = mmrDecoder->getWhiteCode();
++ } while (code3 >= 64);
++ } else {
++ do {
++ code1 += code3 = mmrDecoder->getWhiteCode();
++ } while (code3 >= 64);
++ do {
++ code2 += code3 = mmrDecoder->getBlackCode();
++ } while (code3 >= 64);
++ }
++ mmrAddPixels(codingLine[a0i] + code1, blackPixels,
++ codingLine, &a0i, w);
++ if (codingLine[a0i] < w) {
++ mmrAddPixels(codingLine[a0i] + code2, blackPixels ^ 1,
++ codingLine, &a0i, w);
++ }
++ while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
++ b1i += 2;
++ }
++ break;
+ case twoDimVertR3:
+- a0 = codingLine[codingI++] = refLine[refI] + 3;
+- if (refLine[refI] < w) {
+- ++refI;
+- while (refLine[refI] <= a0 && refLine[refI] < w) {
+- refI += 2;
+- }
+- }
+- break;
+- case twoDimVertL1:
+- a0 = codingLine[codingI++] = refLine[refI] - 1;
+- if (refI > 0) {
+- --refI;
+- } else {
+- ++refI;
+- }
+- while (refLine[refI] <= a0 && refLine[refI] < w) {
+- refI += 2;
+- }
+- break;
+- case twoDimVertL2:
+- a0 = codingLine[codingI++] = refLine[refI] - 2;
+- if (refI > 0) {
+- --refI;
+- } else {
+- ++refI;
+- }
+- while (refLine[refI] <= a0 && refLine[refI] < w) {
+- refI += 2;
+- }
+- break;
++ mmrAddPixels(refLine[b1i] + 3, blackPixels, codingLine, &a0i, w);
++ blackPixels ^= 1;
++ if (codingLine[a0i] < w) {
++ ++b1i;
++ while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
++ b1i += 2;
++ }
++ }
++ break;
++ case twoDimVertR2:
++ mmrAddPixels(refLine[b1i] + 2, blackPixels, codingLine, &a0i, w);
++ blackPixels ^= 1;
++ if (codingLine[a0i] < w) {
++ ++b1i;
++ while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
++ b1i += 2;
++ }
++ }
++ break;
++ case twoDimVertR1:
++ mmrAddPixels(refLine[b1i] + 1, blackPixels, codingLine, &a0i, w);
++ blackPixels ^= 1;
++ if (codingLine[a0i] < w) {
++ ++b1i;
++ while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
++ b1i += 2;
++ }
++ }
++ break;
++ case twoDimVert0:
++ mmrAddPixels(refLine[b1i], blackPixels, codingLine, &a0i, w);
++ blackPixels ^= 1;
++ if (codingLine[a0i] < w) {
++ ++b1i;
++ while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
++ b1i += 2;
++ }
++ }
++ break;
+ case twoDimVertL3:
+- a0 = codingLine[codingI++] = refLine[refI] - 3;
+- if (refI > 0) {
+- --refI;
+- } else {
+- ++refI;
+- }
+- while (refLine[refI] <= a0 && refLine[refI] < w) {
+- refI += 2;
+- }
+- break;
++ mmrAddPixelsNeg(refLine[b1i] - 3, blackPixels, codingLine, &a0i, w);
++ blackPixels ^= 1;
++ if (codingLine[a0i] < w) {
++ if (b1i > 0) {
++ --b1i;
++ } else {
++ ++b1i;
++ }
++ while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
++ b1i += 2;
++ }
++ }
++ break;
++ case twoDimVertL2:
++ mmrAddPixelsNeg(refLine[b1i] - 2, blackPixels, codingLine, &a0i, w);
++ blackPixels ^= 1;
++ if (codingLine[a0i] < w) {
++ if (b1i > 0) {
++ --b1i;
++ } else {
++ ++b1i;
++ }
++ while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
++ b1i += 2;
++ }
++ }
++ break;
++ case twoDimVertL1:
++ mmrAddPixelsNeg(refLine[b1i] - 1, blackPixels, codingLine, &a0i, w);
++ blackPixels ^= 1;
++ if (codingLine[a0i] < w) {
++ if (b1i > 0) {
++ --b1i;
++ } else {
++ ++b1i;
++ }
++ while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
++ b1i += 2;
++ }
++ }
++ break;
++ case EOF:
++ mmrAddPixels(w, 0, codingLine, &a0i, w);
++ break;
+ default:
+ error(getPos(), "Illegal code in JBIG2 MMR bitmap data");
++ mmrAddPixels(w, 0, codingLine, &a0i, w);
+ break;
+ }
+- } while (a0 < w);
+- codingLine[codingI++] = w;
++ }
+
+ // convert the run lengths to a bitmap line
+ i = 0;
+- while (codingLine[i] < w) {
++ while (1) {
+ for (x = codingLine[i]; x < codingLine[i+1]; ++x) {
+ bitmap->setPixel(x, y);
+ }
++ if (codingLine[i+1] >= w || codingLine[i+2] >= w) {
++ break;
++ }
+ i += 2;
+ }
+ }
+@@ -2706,7 +2888,9 @@
+ ltp = !ltp;
+ }
+ if (ltp) {
+- bitmap->duplicateRow(y, y-1);
++ if (y > 0) {
++ bitmap->duplicateRow(y, y-1);
++ }
+ continue;
+ }
+ }
+@@ -2909,8 +3093,8 @@
+ return;
+ }
+ if (nRefSegs == 1) {
+- seg = findSegment(refSegs[0]);
+- if (seg->getType() != jbig2SegBitmap) {
++ if (!(seg = findSegment(refSegs[0])) ||
++ seg->getType() != jbig2SegBitmap) {
+ error(getPos(), "Bad bitmap reference in JBIG2 generic refinement segment");
+ return;
+ }
+@@ -3004,6 +3188,10 @@
+ tpgrCX2 = refBitmap->nextPixel(&tpgrCXPtr2);
+ tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2);
+ tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2);
++ } else {
++ tpgrCXPtr0.p = tpgrCXPtr1.p = tpgrCXPtr2.p = NULL; // make gcc happy
++ tpgrCXPtr0.shift = tpgrCXPtr1.shift = tpgrCXPtr2.shift = 0;
++ tpgrCXPtr0.x = tpgrCXPtr1.x = tpgrCXPtr2.x = 0;
+ }
+
+ for (x = 0; x < w; ++x) {
+@@ -3075,6 +3263,10 @@
+ tpgrCX2 = refBitmap->nextPixel(&tpgrCXPtr2);
+ tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2);
+ tpgrCX2 = (tpgrCX2 << 1) | refBitmap->nextPixel(&tpgrCXPtr2);
++ } else {
++ tpgrCXPtr0.p = tpgrCXPtr1.p = tpgrCXPtr2.p = NULL; // make gcc happy
++ tpgrCXPtr0.shift = tpgrCXPtr1.shift = tpgrCXPtr2.shift = 0;
++ tpgrCXPtr0.x = tpgrCXPtr1.x = tpgrCXPtr2.x = 0;
+ }
+
+ for (x = 0; x < w; ++x) {
+diff -ur -N xpdf-3.02.orig/xpdf/JBIG2Stream.h xpdf-3.02/xpdf/JBIG2Stream.h
+--- xpdf-3.02.orig/xpdf/JBIG2Stream.h 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/JBIG2Stream.h 2009-03-31 19:50:07.000000000 +0200
+@@ -78,6 +78,10 @@
+ Guint *refSegs, Guint nRefSegs);
+ void readGenericRegionSeg(Guint segNum, GBool imm,
+ GBool lossless, Guint length);
++ void mmrAddPixels(int a1, int blackPixels,
++ int *codingLine, int *a0i, int w);
++ void mmrAddPixelsNeg(int a1, int blackPixels,
++ int *codingLine, int *a0i, int w);
+ JBIG2Bitmap *readGenericBitmap(GBool mmr, int w, int h,
+ int templ, GBool tpgdOn,
+ GBool useSkip, JBIG2Bitmap *skip,
+diff -ur -N xpdf-3.02.orig/xpdf/config.h xpdf-3.02/xpdf/config.h
+--- xpdf-3.02.orig/xpdf/config.h 2007-11-12 13:27:21.000000000 +0100
++++ xpdf-3.02/xpdf/config.h 2009-03-31 19:55:23.000000000 +0200
+@@ -17,7 +17,7 @@
+ //------------------------------------------------------------------------
+
+ // xpdf version
+-#define xpdfVersion "3.02pl2"
++#define xpdfVersion "3.02pl3"
+ #define xpdfVersionNum 3.02
+ #define xpdfMajorVersion 3
+ #define xpdfMinorVersion 2
diff --git a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-10-PDF_PARSER_ONLY b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-10-PDF_PARSER_ONLY
new file mode 100644
index 00000000000..55e16622d93
--- /dev/null
+++ b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-10-PDF_PARSER_ONLY
@@ -0,0 +1,28 @@
+ Enable compilation with -DPDF_PARSER_ONLY
+
+diff -ur -N xpdf-3.02.orig/xpdf/Page.cc xpdf-3.02/xpdf/Page.cc
+--- xpdf-3.02.orig/xpdf/Page.cc 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/Page.cc 2009-02-08 03:15:12.000000000 +0100
+@@ -5,6 +5,9 @@
+ // Copyright 1996-2007 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #include <aconf.h>
+
+@@ -420,6 +423,7 @@
+ delete links;
+ }
+
++#ifndef PDF_PARSER_ONLY
+ void Page::getDefaultCTM(double *ctm, double hDPI, double vDPI,
+ int rotate, GBool useMediaBox, GBool upsideDown) {
+ GfxState *state;
+@@ -439,3 +443,4 @@
+ }
+ delete state;
+ }
++#endif
diff --git a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-11-time_h b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-11-time_h
new file mode 100644
index 00000000000..56bc0705130
--- /dev/null
+++ b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-11-time_h
@@ -0,0 +1,23 @@
+ Build fix for djgpp
+
+diff -ur -N xpdf-3.02.orig/goo/gfile.cc xpdf-3.02/goo/gfile.cc
+--- xpdf-3.02.orig/goo/gfile.cc 2007-02-27 23:05:51.000000000 +0100
++++ xpdf-3.02/goo/gfile.cc 2009-03-05 23:36:46.000000000 +0100
+@@ -7,6 +7,9 @@
+ // Copyright 1996-2003 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #include <aconf.h>
+
+@@ -20,6 +23,7 @@
+ # include <sys/stat.h>
+ # include <fcntl.h>
+ # endif
++# include <time.h>
+ # include <limits.h>
+ # include <string.h>
+ # if !defined(VMS) && !defined(ACORN) && !defined(MACOS)
diff --git a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-12-mingw32 b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-12-mingw32
new file mode 100644
index 00000000000..aa8956e98f0
--- /dev/null
+++ b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-12-mingw32
@@ -0,0 +1,22 @@
+ Build fix for mingw32
+
+diff -ur -N xpdf-3.02.orig/xpdf/GlobalParams.cc xpdf-3.02/xpdf/GlobalParams.cc
+--- xpdf-3.02.orig/xpdf/GlobalParams.cc 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/GlobalParams.cc 2009-04-02 10:22:18.000000000 +0200
+@@ -5,9 +5,16 @@
+ // Copyright 2001-2003 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #include <aconf.h>
+
++#ifdef __MINGW32__
++#undef WIN32
++#endif
++
+ #ifdef USE_GCC_PRAGMAS
+ #pragma implementation
+ #endif
diff --git a/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-20-pdftex b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-20-pdftex
new file mode 100644
index 00000000000..dccc4f6bb04
--- /dev/null
+++ b/Build/source/libs/xpdf/xpdf-3.02-PATCHES/patch-20-pdftex
@@ -0,0 +1,632 @@
+ Patches for pdfTeX / luaTeX / XeTeX
+
+ from:
+ Han The Thanh <thanh@pdftex.org>
+ Martin Schroeder <martin@pdftex.org>
+
+diff -ur -N xpdf-3.02.orig/goo/GString.cc xpdf-3.02/goo/GString.cc
+--- xpdf-3.02.orig/goo/GString.cc 2007-02-27 23:05:51.000000000 +0100
++++ xpdf-3.02/goo/GString.cc 2008-05-08 15:40:41.000000000 +0200
+@@ -7,6 +7,9 @@
+ // Copyright 1996-2003 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #include <aconf.h>
+
+@@ -528,7 +531,7 @@
+ if ((neg = x < 0)) {
+ x = -x;
+ }
+- x = floor(x * pow(10, prec) + 0.5);
++ x = floor(x * pow(10.0, prec) + 0.5);
+ i = bufSize;
+ started = !trim;
+ for (j = 0; j < prec && i > 1; ++j) {
+diff -ur -N xpdf-3.02.orig/goo/gfile.cc xpdf-3.02/goo/gfile.cc
+--- xpdf-3.02.orig/goo/gfile.cc 2009-03-05 23:36:46.000000000 +0100
++++ xpdf-3.02/goo/gfile.cc 2009-04-30 21:29:39.000000000 +0200
+@@ -443,6 +443,7 @@
+ #endif
+ }
+
++#ifndef PDF_PARSER_ONLY
+ GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
+ #if defined(WIN32)
+ //---------- Win32 ----------
+@@ -551,6 +552,7 @@
+ return gTrue;
+ #endif
+ }
++#endif
+
+ GBool executeCommand(char *cmd) {
+ #ifdef VMS
+diff -ur -N xpdf-3.02.orig/xpdf/Decrypt.h xpdf-3.02/xpdf/Decrypt.h
+--- xpdf-3.02.orig/xpdf/Decrypt.h 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/Decrypt.h 2008-05-08 15:40:41.000000000 +0200
+@@ -5,6 +5,9 @@
+ // Copyright 1996-2003 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #ifndef DECRYPT_H
+ #define DECRYPT_H
+@@ -73,7 +76,7 @@
+ CryptAlgorithm algoA, int keyLength,
+ int objNum, int objGen);
+ virtual ~DecryptStream();
+- virtual StreamKind getKind() { return strWeird; }
++ virtual StreamKind getKind() { return strCrypt; }
+ virtual void reset();
+ virtual int getChar();
+ virtual int lookChar();
+diff -ur -N xpdf-3.02.orig/xpdf/GlobalParams.cc xpdf-3.02/xpdf/GlobalParams.cc
+--- xpdf-3.02.orig/xpdf/GlobalParams.cc 2009-04-02 10:22:18.000000000 +0200
++++ xpdf-3.02/xpdf/GlobalParams.cc 2009-04-30 21:35:00.000000000 +0200
+@@ -429,6 +429,7 @@
+ }
+ }
+
++#ifndef PDF_PARSER_ONLY
+ //------------------------------------------------------------------------
+ // KeyBinding
+ //------------------------------------------------------------------------
+@@ -461,6 +462,7 @@
+ KeyBinding::~KeyBinding() {
+ deleteGList(cmds, GString);
+ }
++#endif
+
+ #ifdef ENABLE_PLUGINS
+ //------------------------------------------------------------------------
+@@ -608,6 +610,138 @@
+ // parsing
+ //------------------------------------------------------------------------
+
++GlobalParams::GlobalParams() {
++ UnicodeMap *map;
++ int i;
++
++#if MULTITHREADED
++ gInitMutex(&mutex);
++ gInitMutex(&unicodeMapCacheMutex);
++ gInitMutex(&cMapCacheMutex);
++#endif
++
++ initBuiltinFontTables();
++
++ // scan the encoding in reverse because we want the lowest-numbered
++ // index for each char name ('space' is encoded twice)
++ macRomanReverseMap = new NameToCharCode();
++ for (i = 255; i >= 0; --i) {
++ if (macRomanEncoding[i]) {
++ macRomanReverseMap->add(macRomanEncoding[i], (CharCode)i);
++ }
++ }
++
++#ifdef WIN32
++ // baseDir will be set by a call to setBaseDir
++ baseDir = new GString();
++#else
++ baseDir = appendToPath(getHomeDir(), ".xpdf");
++#endif
++ nameToUnicode = new NameToCharCode();
++ cidToUnicodes = new GHash(gTrue);
++ unicodeToUnicodes = new GHash(gTrue);
++ residentUnicodeMaps = new GHash();
++ unicodeMaps = new GHash(gTrue);
++ cMapDirs = new GHash(gTrue);
++ toUnicodeDirs = new GList();
++ displayFonts = new GHash();
++ displayCIDFonts = new GHash();
++ displayNamedCIDFonts = new GHash();
++#if HAVE_PAPER_H
++ char *paperName;
++ const struct paper *paperType;
++ paperinit();
++ if ((paperName = systempapername())) {
++ paperType = paperinfo(paperName);
++ psPaperWidth = (int)paperpswidth(paperType);
++ psPaperHeight = (int)paperpsheight(paperType);
++ } else {
++ error(-1, "No paper information available - using defaults");
++ psPaperWidth = defPaperWidth;
++ psPaperHeight = defPaperHeight;
++ }
++ paperdone();
++#else
++ psPaperWidth = defPaperWidth;
++ psPaperHeight = defPaperHeight;
++#endif
++ psImageableLLX = psImageableLLY = 0;
++ psImageableURX = psPaperWidth;
++ psImageableURY = psPaperHeight;
++ psCrop = gTrue;
++ psExpandSmaller = gFalse;
++ psShrinkLarger = gTrue;
++ psCenter = gTrue;
++ psDuplex = gFalse;
++ psLevel = psLevel2;
++ psFile = NULL;
++ psFonts = new GHash();
++ psNamedFonts16 = new GList();
++ psFonts16 = new GList();
++ psEmbedType1 = gTrue;
++ psEmbedTrueType = gTrue;
++ psEmbedCIDPostScript = gTrue;
++ psEmbedCIDTrueType = gTrue;
++ psOPI = gFalse;
++ psASCIIHex = gFalse;
++ textEncoding = new GString("Latin1");
++#if defined(WIN32)
++ textEOL = eolDOS;
++#elif defined(MACOS)
++ textEOL = eolMac;
++#else
++ textEOL = eolUnix;
++#endif
++ textPageBreaks = gTrue;
++ textKeepTinyChars = gFalse;
++ fontDirs = new GList();
++ initialZoom = new GString("125");
++ continuousView = gFalse;
++ enableT1lib = gTrue;
++ enableFreeType = gTrue;
++ antialias = gTrue;
++ urlCommand = NULL;
++ movieCommand = NULL;
++ mapNumericCharNames = gTrue;
++ printCommands = gFalse;
++ errQuiet = gFalse;
++
++ cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize);
++ unicodeToUnicodeCache =
++ new CharCodeToUnicodeCache(unicodeToUnicodeCacheSize);
++ unicodeMapCache = new UnicodeMapCache();
++ cMapCache = new CMapCache();
++
++#ifdef ENABLE_PLUGINS
++ plugins = new GList();
++ securityHandlers = new GList();
++#endif
++
++ // set up the initial nameToUnicode table
++ for (i = 0; nameToUnicodeTab[i].name; ++i) {
++ nameToUnicode->add(nameToUnicodeTab[i].name, nameToUnicodeTab[i].u);
++ }
++
++ // set up the residentUnicodeMaps table
++ map = new UnicodeMap("Latin1", gFalse,
++ latin1UnicodeMapRanges, latin1UnicodeMapLen);
++ residentUnicodeMaps->add(map->getEncodingName(), map);
++ map = new UnicodeMap("ASCII7", gFalse,
++ ascii7UnicodeMapRanges, ascii7UnicodeMapLen);
++ residentUnicodeMaps->add(map->getEncodingName(), map);
++ map = new UnicodeMap("Symbol", gFalse,
++ symbolUnicodeMapRanges, symbolUnicodeMapLen);
++ residentUnicodeMaps->add(map->getEncodingName(), map);
++ map = new UnicodeMap("ZapfDingbats", gFalse, zapfDingbatsUnicodeMapRanges,
++ zapfDingbatsUnicodeMapLen);
++ residentUnicodeMaps->add(map->getEncodingName(), map);
++ map = new UnicodeMap("UTF-8", gTrue, &mapUTF8);
++ residentUnicodeMaps->add(map->getEncodingName(), map);
++ map = new UnicodeMap("UCS-2", gTrue, &mapUCS2);
++ residentUnicodeMaps->add(map->getEncodingName(), map);
++
++}
++
+ GlobalParams::GlobalParams(char *cfgFileName) {
+ UnicodeMap *map;
+ GString *fileName;
+@@ -713,7 +847,9 @@
+ movieCommand = NULL;
+ mapNumericCharNames = gTrue;
+ mapUnknownCharNames = gFalse;
++#ifndef PDF_PARSER_ONLY
+ createDefaultKeyBindings();
++#endif
+ printCommands = gFalse;
+ errQuiet = gFalse;
+
+@@ -788,12 +924,15 @@
+ }
+ }
+ if (f) {
++#ifndef PDF_PARSER_ONLY
+ parseFile(fileName, f);
++#endif
+ delete fileName;
+ fclose(f);
+ }
+ }
+
++#ifndef PDF_PARSER_ONLY
+ void GlobalParams::createDefaultKeyBindings() {
+ keyBindings = new GList();
+
+@@ -1120,6 +1259,7 @@
+
+ deleteGList(tokens, GString);
+ }
++#endif
+
+ void GlobalParams::parseNameToUnicode(GList *tokens, GString *fileName,
+ int line) {
+@@ -1464,6 +1604,7 @@
+ }
+ }
+
++#ifndef PDF_PARSER_ONLY
+ void GlobalParams::parseBind(GList *tokens, GString *fileName, int line) {
+ KeyBinding *binding;
+ GList *cmds;
+@@ -1649,6 +1790,7 @@
+
+ return gTrue;
+ }
++#endif
+
+ void GlobalParams::parseCommand(char *cmdName, GString **val,
+ GList *tokens, GString *fileName, int line) {
+@@ -1792,7 +1934,9 @@
+ if (movieCommand) {
+ delete movieCommand;
+ }
++#ifndef PDF_PARSER_ONLY
+ deleteGList(keyBindings, KeyBinding);
++#endif
+
+ cMapDirs->startIter(&iter);
+ while (cMapDirs->getNext(&iter, &key, (void **)&list)) {
+@@ -2443,6 +2587,7 @@
+ return map;
+ }
+
++#ifndef PDF_PARSER_ONLY
+ GList *GlobalParams::getKeyBinding(int code, int mods, int context) {
+ KeyBinding *binding;
+ GList *cmds;
+@@ -2468,6 +2613,7 @@
+ unlockGlobalParams;
+ return cmds;
+ }
++#endif
+
+ GBool GlobalParams::getPrintCommands() {
+ GBool p;
+diff -ur -N xpdf-3.02.orig/xpdf/GlobalParams.h xpdf-3.02/xpdf/GlobalParams.h
+--- xpdf-3.02.orig/xpdf/GlobalParams.h 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/GlobalParams.h 2008-05-08 15:40:41.000000000 +0200
+@@ -5,6 +5,9 @@
+ // Copyright 2001-2003 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #ifndef GLOBALPARAMS_H
+ #define GLOBALPARAMS_H
+@@ -123,6 +126,7 @@
+
+ //------------------------------------------------------------------------
+
++#ifndef PDF_PARSER_ONLY
+ class KeyBinding {
+ public:
+
+@@ -186,6 +190,7 @@
+ #define xpdfKeyContextMainWin (2 << 6)
+ #define xpdfKeyContextScrLockOn (1 << 8)
+ #define xpdfKeyContextScrLockOff (2 << 8)
++#endif
+
+ //------------------------------------------------------------------------
+
+@@ -196,12 +201,17 @@
+ // file.
+ GlobalParams(char *cfgFileName);
+
++ // Initialize it without reading the config
++ GlobalParams();
++
+ ~GlobalParams();
+
+ void setBaseDir(char *dir);
+ void setupBaseFonts(char *dir);
+
++#ifndef PDF_PARSER_ONLY
+ void parseLine(char *buf, GString *fileName, int line);
++#endif
+
+ //----- accessors
+
+@@ -256,7 +266,9 @@
+ GString *getMovieCommand() { return movieCommand; }
+ GBool getMapNumericCharNames();
+ GBool getMapUnknownCharNames();
++#ifndef PDF_PARSER_ONLY
+ GList *getKeyBinding(int code, int mods, int context);
++#endif
+ GBool getPrintCommands();
+ GBool getErrQuiet();
+
+@@ -315,7 +327,9 @@
+
+ private:
+
++#ifndef PDF_PARSER_ONLY
+ void createDefaultKeyBindings();
++#endif
+ void parseFile(GString *fileName, FILE *f);
+ void parseNameToUnicode(GList *tokens, GString *fileName, int line);
+ void parseCIDToUnicode(GList *tokens, GString *fileName, int line);
+@@ -338,12 +352,14 @@
+ void parseFontDir(GList *tokens, GString *fileName, int line);
+ void parseInitialZoom(GList *tokens, GString *fileName, int line);
+ void parseScreenType(GList *tokens, GString *fileName, int line);
++#ifndef PDF_PARSER_ONLY
+ void parseBind(GList *tokens, GString *fileName, int line);
+ void parseUnbind(GList *tokens, GString *fileName, int line);
+ GBool parseKey(GString *modKeyStr, GString *contextStr,
+ int *code, int *mods, int *context,
+ char *cmdName,
+ GList *tokens, GString *fileName, int line);
++#endif
+ void parseCommand(char *cmdName, GString **val,
+ GList *tokens, GString *fileName, int line);
+ void parseYesNo(char *cmdName, GBool *flag,
+@@ -438,7 +454,9 @@
+ GString *movieCommand; // command executed for movie annotations
+ GBool mapNumericCharNames; // map numeric char names (from font subsets)?
+ GBool mapUnknownCharNames; // map unknown char names?
++#ifndef PDF_PARSER_ONLY
+ GList *keyBindings; // key & mouse button bindings [KeyBinding]
++#endif
+ GBool printCommands; // print the drawing commands
+ GBool errQuiet; // suppress error messages?
+
+diff -ur -N xpdf-3.02.orig/xpdf/PDFDoc.h xpdf-3.02/xpdf/PDFDoc.h
+--- xpdf-3.02.orig/xpdf/PDFDoc.h 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/PDFDoc.h 2008-07-17 02:29:04.000000000 +0200
+@@ -5,6 +5,9 @@
+ // Copyright 1996-2003 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #ifndef PDFDOC_H
+ #define PDFDOC_H
+@@ -171,13 +174,15 @@
+ double pdfVersion;
+ XRef *xref;
+ Catalog *catalog;
++ GBool ok;
++ int errCode;
++/* Keep the size of the structure the same whether DISABLE_OUTLINE or
++ not, and put it last to try to find errors more quickly. */
+ #ifndef DISABLE_OUTLINE
+ Outline *outline;
++#else
++ void *dummy;
+ #endif
+-
+-
+- GBool ok;
+- int errCode;
+ };
+
+ #endif
+diff -ur -N xpdf-3.02.orig/xpdf/Page.h xpdf-3.02/xpdf/Page.h
+--- xpdf-3.02.orig/xpdf/Page.h 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/Page.h 2008-05-08 15:40:41.000000000 +0200
+@@ -5,6 +5,9 @@
+ // Copyright 1996-2003 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #ifndef PAGE_H
+ #define PAGE_H
+@@ -170,9 +173,11 @@
+
+ void processLinks(OutputDev *out, Catalog *catalog);
+
++#ifndef PDF_PARSER_ONLY
+ // Get the page's default CTM.
+ void getDefaultCTM(double *ctm, double hDPI, double vDPI,
+ int rotate, GBool useMediaBox, GBool upsideDown);
++#endif
+
+ private:
+
+diff -ur -N xpdf-3.02.orig/xpdf/Stream.h xpdf-3.02/xpdf/Stream.h
+--- xpdf-3.02.orig/xpdf/Stream.h 2007-11-12 13:27:21.000000000 +0100
++++ xpdf-3.02/xpdf/Stream.h 2008-05-08 15:40:41.000000000 +0200
+@@ -5,6 +5,9 @@
+ // Copyright 1996-2003 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #ifndef STREAM_H
+ #define STREAM_H
+@@ -34,6 +37,7 @@
+ strFlate,
+ strJBIG2,
+ strJPX,
++ strCrypt,
+ strWeird // internal-use stream types
+ };
+
+diff -ur -N xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc
+--- xpdf-3.02.orig/xpdf/XRef.cc 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/XRef.cc 2008-05-08 15:40:41.000000000 +0200
+@@ -5,6 +5,9 @@
+ // Copyright 1996-2003 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #include <aconf.h>
+
+@@ -45,34 +48,9 @@
+ // ObjectStream
+ //------------------------------------------------------------------------
+
+-class ObjectStream {
+-public:
+-
+- // Create an object stream, using object number <objStrNum>,
+- // generation 0.
+- ObjectStream(XRef *xref, int objStrNumA);
+-
+- ~ObjectStream();
+-
+- // Return the object number of this object stream.
+- int getObjStrNum() { return objStrNum; }
+-
+- // Get the <objIdx>th object from this stream, which should be
+- // object number <objNum>, generation 0.
+- Object *getObject(int objIdx, int objNum, Object *obj);
+-
+-private:
+-
+- int objStrNum; // object number of the object stream
+- int nObjects; // number of objects in the stream
+- Object *objs; // the objects (length = nObjects)
+- int *objNums; // the object numbers (length = nObjects)
+-};
+-
+ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
+ Stream *str;
+ Parser *parser;
+- int *offsets;
+ Object objStr, obj1, obj2;
+ int first, i;
+
+@@ -80,6 +58,7 @@
+ nObjects = 0;
+ objs = NULL;
+ objNums = NULL;
++ offsets = NULL;
+
+ if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) {
+ goto err1;
+@@ -100,6 +79,7 @@
+ goto err1;
+ }
+ first = obj1.getInt();
++ firstOffset = objStr.getStream()->getBaseStream()->getStart() + first;
+ obj1.free();
+ if (first < 0) {
+ goto err1;
+@@ -121,7 +101,7 @@
+ obj1.free();
+ obj2.free();
+ delete parser;
+- gfree(offsets);
++// gfree(offsets);
+ goto err1;
+ }
+ objNums[i] = obj1.getInt();
+@@ -131,7 +111,7 @@
+ if (objNums[i] < 0 || offsets[i] < 0 ||
+ (i > 0 && offsets[i] < offsets[i-1])) {
+ delete parser;
+- gfree(offsets);
++// gfree(offsets);
+ goto err1;
+ }
+ }
+@@ -160,7 +140,7 @@
+ delete parser;
+ }
+
+- gfree(offsets);
++// gfree(offsets);
+
+ err1:
+ objStr.free();
+@@ -177,6 +157,7 @@
+ delete[] objs;
+ }
+ gfree(objNums);
++ gfree(offsets);
+ }
+
+ Object *ObjectStream::getObject(int objIdx, int objNum, Object *obj) {
+diff -ur -N xpdf-3.02.orig/xpdf/XRef.h xpdf-3.02/xpdf/XRef.h
+--- xpdf-3.02.orig/xpdf/XRef.h 2007-02-27 23:05:52.000000000 +0100
++++ xpdf-3.02/xpdf/XRef.h 2008-05-08 15:40:41.000000000 +0200
+@@ -5,6 +5,9 @@
+ // Copyright 1996-2003 Glyph & Cog, LLC
+ //
+ //========================================================================
++// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
++// See top-level ChangeLog for a list of all modifications
++//========================================================================
+
+ #ifndef XREF_H
+ #define XREF_H
+@@ -21,7 +24,36 @@
+ class Dict;
+ class Stream;
+ class Parser;
+-class ObjectStream;
++
++class ObjectStream {
++public:
++
++ // Create an object stream, using object number <objStrNum>,
++ // generation 0.
++ ObjectStream(XRef *xref, int objStrNumA);
++
++ ~ObjectStream();
++
++ // Return the object number of this object stream.
++ int getObjStrNum() { return objStrNum; }
++
++ // Get the <objIdx>th object from this stream, which should be
++ // object number <objNum>, generation 0.
++ Object *getObject(int objIdx, int objNum, Object *obj);
++
++ int *getOffsets() { return offsets; }
++ Guint getFirstOffset() { return firstOffset; }
++
++private:
++
++ int objStrNum; // object number of the object stream
++ int nObjects; // number of objects in the stream
++ Object *objs; // the objects (length = nObjects)
++ int *objNums; // the object numbers (length = nObjects)
++ int *offsets; // the object offsets (length = nObjects)
++ Guint firstOffset;
++};
++
+
+ //------------------------------------------------------------------------
+ // XRef
+@@ -96,6 +128,7 @@
+ int getSize() { return size; }
+ XRefEntry *getEntry(int i) { return &entries[i]; }
+ Object *getTrailerDict() { return &trailerDict; }
++ ObjectStream *getObjStr() { return objStr; }
+
+ private:
+
diff --git a/Build/source/libs/xpdf/xpdf-3.02-PDF_PARSER_ONLY.patch b/Build/source/libs/xpdf/xpdf-3.02-PDF_PARSER_ONLY.patch
deleted file mode 100644
index 6a91d078fb4..00000000000
--- a/Build/source/libs/xpdf/xpdf-3.02-PDF_PARSER_ONLY.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff -ur xpdf-3.02.orig/xpdf/Page.cc xpdf-3.02/xpdf/Page.cc
---- xpdf-3.02.orig/xpdf/Page.cc 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/Page.cc 2009-02-08 03:15:12.000000000 +0100
-@@ -420,6 +420,7 @@
- delete links;
- }
-
-+#ifndef PDF_PARSER_ONLY
- void Page::getDefaultCTM(double *ctm, double hDPI, double vDPI,
- int rotate, GBool useMediaBox, GBool upsideDown) {
- GfxState *state;
-@@ -439,3 +440,4 @@
- }
- delete state;
- }
-+#endif
diff --git a/Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl1.patch b/Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl1.patch
new file mode 100644
index 00000000000..cd42fb962d3
--- /dev/null
+++ b/Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl1.patch
@@ -0,0 +1,33 @@
+*** xpdf-3.02.orig/xpdf/Stream.cc Tue Feb 27 14:05:52 2007
+--- xpdf-3.02/xpdf/Stream.cc Thu Jul 26 14:44:43 2007
+***************
+*** 410,424 ****
+ ok = gFalse;
+
+ nVals = width * nComps;
+- if (width <= 0 || nComps <= 0 || nBits <= 0 ||
+- nComps >= INT_MAX / nBits ||
+- width >= INT_MAX / nComps / nBits ||
+- nVals * nBits + 7 < 0) {
+- return;
+- }
+ pixBytes = (nComps * nBits + 7) >> 3;
+ rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes;
+! if (rowBytes <= 0) {
+ return;
+ }
+ predLine = (Guchar *)gmalloc(rowBytes);
+--- 410,422 ----
+ ok = gFalse;
+
+ nVals = width * nComps;
+ pixBytes = (nComps * nBits + 7) >> 3;
+ rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes;
+! if (width <= 0 || nComps <= 0 || nBits <= 0 ||
+! nComps > gfxColorMaxComps ||
+! nBits > 16 ||
+! width >= INT_MAX / nComps || // check for overflow in nVals
+! nVals >= (INT_MAX - 7) / nBits) { // check for overflow in rowBytes
+ return;
+ }
+ predLine = (Guchar *)gmalloc(rowBytes);
diff --git a/Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl2.patch b/Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl2.patch
new file mode 100644
index 00000000000..ab9e3c671c7
--- /dev/null
+++ b/Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl2.patch
@@ -0,0 +1,823 @@
+diff -c -r xpdf-3.02pl1.orig/xpdf/Stream.cc xpdf-3.02/xpdf/Stream.cc
+*** xpdf-3.02pl1.orig/xpdf/Stream.cc Thu Oct 25 15:47:38 2007
+--- xpdf-3.02/xpdf/Stream.cc Thu Oct 25 15:48:19 2007
+***************
+*** 1243,1265 ****
+ columns = columnsA;
+ if (columns < 1) {
+ columns = 1;
+! }
+! if (columns + 4 <= 0) {
+! columns = INT_MAX - 4;
+ }
+ rows = rowsA;
+ endOfBlock = endOfBlockA;
+ black = blackA;
+! refLine = (short *)gmallocn(columns + 3, sizeof(short));
+! codingLine = (short *)gmallocn(columns + 2, sizeof(short));
+
+ eof = gFalse;
+ row = 0;
+ nextLine2D = encoding < 0;
+ inputBits = 0;
+! codingLine[0] = 0;
+! codingLine[1] = refLine[2] = columns;
+! a0 = 1;
+
+ buf = EOF;
+ }
+--- 1243,1268 ----
+ columns = columnsA;
+ if (columns < 1) {
+ columns = 1;
+! } else if (columns > INT_MAX - 2) {
+! columns = INT_MAX - 2;
+ }
+ rows = rowsA;
+ endOfBlock = endOfBlockA;
+ black = blackA;
+! // 0 <= codingLine[0] < codingLine[1] < ... < codingLine[n] = columns
+! // ---> max codingLine size = columns + 1
+! // refLine has one extra guard entry at the end
+! // ---> max refLine size = columns + 2
+! codingLine = (int *)gmallocn(columns + 1, sizeof(int));
+! refLine = (int *)gmallocn(columns + 2, sizeof(int));
+
+ eof = gFalse;
+ row = 0;
+ nextLine2D = encoding < 0;
+ inputBits = 0;
+! codingLine[0] = columns;
+! a0i = 0;
+! outputBits = 0;
+
+ buf = EOF;
+ }
+***************
+*** 1278,1286 ****
+ row = 0;
+ nextLine2D = encoding < 0;
+ inputBits = 0;
+! codingLine[0] = 0;
+! codingLine[1] = columns;
+! a0 = 1;
+ buf = EOF;
+
+ // skip any initial zero bits and end-of-line marker, and get the 2D
+--- 1281,1289 ----
+ row = 0;
+ nextLine2D = encoding < 0;
+ inputBits = 0;
+! codingLine[0] = columns;
+! a0i = 0;
+! outputBits = 0;
+ buf = EOF;
+
+ // skip any initial zero bits and end-of-line marker, and get the 2D
+***************
+*** 1297,1507 ****
+ }
+ }
+
+ int CCITTFaxStream::lookChar() {
+ short code1, code2, code3;
+! int a0New;
+! GBool err, gotEOL;
+! int ret;
+! int bits, i;
+
+! // if at eof just return EOF
+! if (eof && codingLine[a0] >= columns) {
+! return EOF;
+ }
+
+ // read the next row
+! err = gFalse;
+! if (codingLine[a0] >= columns) {
+
+ // 2-D encoding
+ if (nextLine2D) {
+- // state:
+- // a0New = current position in coding line (0 <= a0New <= columns)
+- // codingLine[a0] = last change in coding line
+- // (black-to-white if a0 is even,
+- // white-to-black if a0 is odd)
+- // refLine[b1] = next change in reference line of opposite color
+- // to a0
+- // invariants:
+- // 0 <= codingLine[a0] <= a0New
+- // <= refLine[b1] <= refLine[b1+1] <= columns
+- // 0 <= a0 <= columns+1
+- // refLine[0] = 0
+- // refLine[n] = refLine[n+1] = columns
+- // -- for some 1 <= n <= columns+1
+- // end condition:
+- // 0 = codingLine[0] <= codingLine[1] < codingLine[2] < ...
+- // < codingLine[n-1] < codingLine[n] = columns
+- // -- where 1 <= n <= columns+1
+ for (i = 0; codingLine[i] < columns; ++i) {
+ refLine[i] = codingLine[i];
+ }
+! refLine[i] = refLine[i + 1] = columns;
+! b1 = 1;
+! a0New = codingLine[a0 = 0] = 0;
+! do {
+ code1 = getTwoDimCode();
+ switch (code1) {
+ case twoDimPass:
+! if (refLine[b1] < columns) {
+! a0New = refLine[b1 + 1];
+! b1 += 2;
+ }
+ break;
+ case twoDimHoriz:
+! if ((a0 & 1) == 0) {
+! code1 = code2 = 0;
+ do {
+! code1 += code3 = getWhiteCode();
+ } while (code3 >= 64);
+ do {
+! code2 += code3 = getBlackCode();
+ } while (code3 >= 64);
+ } else {
+- code1 = code2 = 0;
+ do {
+! code1 += code3 = getBlackCode();
+ } while (code3 >= 64);
+ do {
+! code2 += code3 = getWhiteCode();
+ } while (code3 >= 64);
+ }
+! if (code1 > 0 || code2 > 0) {
+! if (a0New + code1 <= columns) {
+! codingLine[a0 + 1] = a0New + code1;
+! } else {
+! codingLine[a0 + 1] = columns;
+! }
+! ++a0;
+! if (codingLine[a0] + code2 <= columns) {
+! codingLine[a0 + 1] = codingLine[a0] + code2;
+! } else {
+! codingLine[a0 + 1] = columns;
+! }
+! ++a0;
+! a0New = codingLine[a0];
+! while (refLine[b1] <= a0New && refLine[b1] < columns) {
+! b1 += 2;
+ }
+ }
+ break;
+! case twoDimVert0:
+! if (refLine[b1] < columns) {
+! a0New = codingLine[++a0] = refLine[b1];
+! ++b1;
+! while (refLine[b1] <= a0New && refLine[b1] < columns) {
+! b1 += 2;
+ }
+- } else {
+- a0New = codingLine[++a0] = columns;
+ }
+ break;
+ case twoDimVertR1:
+! if (refLine[b1] + 1 < columns) {
+! a0New = codingLine[++a0] = refLine[b1] + 1;
+! ++b1;
+! while (refLine[b1] <= a0New && refLine[b1] < columns) {
+! b1 += 2;
+ }
+- } else {
+- a0New = codingLine[++a0] = columns;
+ }
+ break;
+! case twoDimVertL1:
+! if (refLine[b1] - 1 > a0New || (a0 == 0 && refLine[b1] == 1)) {
+! a0New = codingLine[++a0] = refLine[b1] - 1;
+! --b1;
+! while (refLine[b1] <= a0New && refLine[b1] < columns) {
+! b1 += 2;
+ }
+ }
+ break;
+! case twoDimVertR2:
+! if (refLine[b1] + 2 < columns) {
+! a0New = codingLine[++a0] = refLine[b1] + 2;
+! ++b1;
+! while (refLine[b1] <= a0New && refLine[b1] < columns) {
+! b1 += 2;
+ }
+- } else {
+- a0New = codingLine[++a0] = columns;
+ }
+ break;
+ case twoDimVertL2:
+! if (refLine[b1] - 2 > a0New || (a0 == 0 && refLine[b1] == 2)) {
+! a0New = codingLine[++a0] = refLine[b1] - 2;
+! --b1;
+! while (refLine[b1] <= a0New && refLine[b1] < columns) {
+! b1 += 2;
+ }
+! }
+! break;
+! case twoDimVertR3:
+! if (refLine[b1] + 3 < columns) {
+! a0New = codingLine[++a0] = refLine[b1] + 3;
+! ++b1;
+! while (refLine[b1] <= a0New && refLine[b1] < columns) {
+! b1 += 2;
+ }
+- } else {
+- a0New = codingLine[++a0] = columns;
+ }
+ break;
+! case twoDimVertL3:
+! if (refLine[b1] - 3 > a0New || (a0 == 0 && refLine[b1] == 3)) {
+! a0New = codingLine[++a0] = refLine[b1] - 3;
+! --b1;
+! while (refLine[b1] <= a0New && refLine[b1] < columns) {
+! b1 += 2;
+ }
+ }
+ break;
+ case EOF:
+ eof = gTrue;
+! codingLine[a0 = 0] = columns;
+! return EOF;
+ default:
+ error(getPos(), "Bad 2D code %04x in CCITTFax stream", code1);
+ err = gTrue;
+ break;
+ }
+! } while (codingLine[a0] < columns);
+
+ // 1-D encoding
+ } else {
+! codingLine[a0 = 0] = 0;
+! while (1) {
+ code1 = 0;
+! do {
+! code1 += code3 = getWhiteCode();
+! } while (code3 >= 64);
+! codingLine[a0+1] = codingLine[a0] + code1;
+! ++a0;
+! if (codingLine[a0] >= columns) {
+! break;
+! }
+! code2 = 0;
+! do {
+! code2 += code3 = getBlackCode();
+! } while (code3 >= 64);
+! codingLine[a0+1] = codingLine[a0] + code2;
+! ++a0;
+! if (codingLine[a0] >= columns) {
+! break;
+ }
+ }
+ }
+
+- if (codingLine[a0] != columns) {
+- error(getPos(), "CCITTFax row is wrong length (%d)", codingLine[a0]);
+- // force the row to be the correct length
+- while (codingLine[a0] > columns) {
+- --a0;
+- }
+- codingLine[++a0] = columns;
+- err = gTrue;
+- }
+-
+ // byte-align the row
+ if (byteAlign) {
+ inputBits &= ~7;
+--- 1300,1529 ----
+ }
+ }
+
++ inline void CCITTFaxStream::addPixels(int a1, int blackPixels) {
++ if (a1 > codingLine[a0i]) {
++ if (a1 > columns) {
++ error(getPos(), "CCITTFax row is wrong length (%d)", a1);
++ err = gTrue;
++ a1 = columns;
++ }
++ if ((a0i & 1) ^ blackPixels) {
++ ++a0i;
++ }
++ codingLine[a0i] = a1;
++ }
++ }
++
++ inline void CCITTFaxStream::addPixelsNeg(int a1, int blackPixels) {
++ if (a1 > codingLine[a0i]) {
++ if (a1 > columns) {
++ error(getPos(), "CCITTFax row is wrong length (%d)", a1);
++ err = gTrue;
++ a1 = columns;
++ }
++ if ((a0i & 1) ^ blackPixels) {
++ ++a0i;
++ }
++ codingLine[a0i] = a1;
++ } else if (a1 < codingLine[a0i]) {
++ if (a1 < 0) {
++ error(getPos(), "Invalid CCITTFax code");
++ err = gTrue;
++ a1 = 0;
++ }
++ while (a0i > 0 && a1 <= codingLine[a0i - 1]) {
++ --a0i;
++ }
++ codingLine[a0i] = a1;
++ }
++ }
++
+ int CCITTFaxStream::lookChar() {
+ short code1, code2, code3;
+! int b1i, blackPixels, i, bits;
+! GBool gotEOL;
+
+! if (buf != EOF) {
+! return buf;
+ }
+
+ // read the next row
+! if (outputBits == 0) {
+!
+! // if at eof just return EOF
+! if (eof) {
+! return EOF;
+! }
+!
+! err = gFalse;
+
+ // 2-D encoding
+ if (nextLine2D) {
+ for (i = 0; codingLine[i] < columns; ++i) {
+ refLine[i] = codingLine[i];
+ }
+! refLine[i++] = columns;
+! refLine[i] = columns;
+! codingLine[0] = 0;
+! a0i = 0;
+! b1i = 0;
+! blackPixels = 0;
+! // invariant:
+! // refLine[b1i-1] <= codingLine[a0i] < refLine[b1i] < refLine[b1i+1]
+! // <= columns
+! // exception at left edge:
+! // codingLine[a0i = 0] = refLine[b1i = 0] = 0 is possible
+! // exception at right edge:
+! // refLine[b1i] = refLine[b1i+1] = columns is possible
+! while (codingLine[a0i] < columns) {
+ code1 = getTwoDimCode();
+ switch (code1) {
+ case twoDimPass:
+! addPixels(refLine[b1i + 1], blackPixels);
+! if (refLine[b1i + 1] < columns) {
+! b1i += 2;
+ }
+ break;
+ case twoDimHoriz:
+! code1 = code2 = 0;
+! if (blackPixels) {
+ do {
+! code1 += code3 = getBlackCode();
+ } while (code3 >= 64);
+ do {
+! code2 += code3 = getWhiteCode();
+ } while (code3 >= 64);
+ } else {
+ do {
+! code1 += code3 = getWhiteCode();
+ } while (code3 >= 64);
+ do {
+! code2 += code3 = getBlackCode();
+ } while (code3 >= 64);
+ }
+! addPixels(codingLine[a0i] + code1, blackPixels);
+! if (codingLine[a0i] < columns) {
+! addPixels(codingLine[a0i] + code2, blackPixels ^ 1);
+! }
+! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
+! b1i += 2;
+! }
+! break;
+! case twoDimVertR3:
+! addPixels(refLine[b1i] + 3, blackPixels);
+! blackPixels ^= 1;
+! if (codingLine[a0i] < columns) {
+! ++b1i;
+! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
+! b1i += 2;
+ }
+ }
+ break;
+! case twoDimVertR2:
+! addPixels(refLine[b1i] + 2, blackPixels);
+! blackPixels ^= 1;
+! if (codingLine[a0i] < columns) {
+! ++b1i;
+! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
+! b1i += 2;
+ }
+ }
+ break;
+ case twoDimVertR1:
+! addPixels(refLine[b1i] + 1, blackPixels);
+! blackPixels ^= 1;
+! if (codingLine[a0i] < columns) {
+! ++b1i;
+! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
+! b1i += 2;
+ }
+ }
+ break;
+! case twoDimVert0:
+! addPixels(refLine[b1i], blackPixels);
+! blackPixels ^= 1;
+! if (codingLine[a0i] < columns) {
+! ++b1i;
+! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
+! b1i += 2;
+ }
+ }
+ break;
+! case twoDimVertL3:
+! addPixelsNeg(refLine[b1i] - 3, blackPixels);
+! blackPixels ^= 1;
+! if (codingLine[a0i] < columns) {
+! if (b1i > 0) {
+! --b1i;
+! } else {
+! ++b1i;
+! }
+! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
+! b1i += 2;
+ }
+ }
+ break;
+ case twoDimVertL2:
+! addPixelsNeg(refLine[b1i] - 2, blackPixels);
+! blackPixels ^= 1;
+! if (codingLine[a0i] < columns) {
+! if (b1i > 0) {
+! --b1i;
+! } else {
+! ++b1i;
+ }
+! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
+! b1i += 2;
+ }
+ }
+ break;
+! case twoDimVertL1:
+! addPixelsNeg(refLine[b1i] - 1, blackPixels);
+! blackPixels ^= 1;
+! if (codingLine[a0i] < columns) {
+! if (b1i > 0) {
+! --b1i;
+! } else {
+! ++b1i;
+! }
+! while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) {
+! b1i += 2;
+ }
+ }
+ break;
+ case EOF:
++ addPixels(columns, 0);
+ eof = gTrue;
+! break;
+ default:
+ error(getPos(), "Bad 2D code %04x in CCITTFax stream", code1);
++ addPixels(columns, 0);
+ err = gTrue;
+ break;
+ }
+! }
+
+ // 1-D encoding
+ } else {
+! codingLine[0] = 0;
+! a0i = 0;
+! blackPixels = 0;
+! while (codingLine[a0i] < columns) {
+ code1 = 0;
+! if (blackPixels) {
+! do {
+! code1 += code3 = getBlackCode();
+! } while (code3 >= 64);
+! } else {
+! do {
+! code1 += code3 = getWhiteCode();
+! } while (code3 >= 64);
+ }
++ addPixels(codingLine[a0i] + code1, blackPixels);
++ blackPixels ^= 1;
+ }
+ }
+
+ // byte-align the row
+ if (byteAlign) {
+ inputBits &= ~7;
+***************
+*** 1560,1573 ****
+ // this if we know the stream contains end-of-line markers because
+ // the "just plow on" technique tends to work better otherwise
+ } else if (err && endOfLine) {
+! do {
+ if (code1 == EOF) {
+ eof = gTrue;
+ return EOF;
+ }
+ eatBits(1);
+! code1 = lookBits(13);
+! } while ((code1 >> 1) != 0x001);
+ eatBits(12);
+ if (encoding > 0) {
+ eatBits(1);
+--- 1582,1598 ----
+ // this if we know the stream contains end-of-line markers because
+ // the "just plow on" technique tends to work better otherwise
+ } else if (err && endOfLine) {
+! while (1) {
+! code1 = lookBits(13);
+ if (code1 == EOF) {
+ eof = gTrue;
+ return EOF;
+ }
++ if ((code1 >> 1) == 0x001) {
++ break;
++ }
+ eatBits(1);
+! }
+ eatBits(12);
+ if (encoding > 0) {
+ eatBits(1);
+***************
+*** 1575,1585 ****
+ }
+ }
+
+! a0 = 0;
+! outputBits = codingLine[1] - codingLine[0];
+! if (outputBits == 0) {
+! a0 = 1;
+! outputBits = codingLine[2] - codingLine[1];
+ }
+
+ ++row;
+--- 1600,1610 ----
+ }
+ }
+
+! // set up for output
+! if (codingLine[0] > 0) {
+! outputBits = codingLine[a0i = 0];
+! } else {
+! outputBits = codingLine[a0i = 1];
+ }
+
+ ++row;
+***************
+*** 1587,1625 ****
+
+ // get a byte
+ if (outputBits >= 8) {
+! ret = ((a0 & 1) == 0) ? 0xff : 0x00;
+! if ((outputBits -= 8) == 0) {
+! ++a0;
+! if (codingLine[a0] < columns) {
+! outputBits = codingLine[a0 + 1] - codingLine[a0];
+! }
+ }
+ } else {
+ bits = 8;
+! ret = 0;
+ do {
+ if (outputBits > bits) {
+! i = bits;
+! bits = 0;
+! if ((a0 & 1) == 0) {
+! ret |= 0xff >> (8 - i);
+ }
+! outputBits -= i;
+ } else {
+! i = outputBits;
+! bits -= outputBits;
+! if ((a0 & 1) == 0) {
+! ret |= (0xff >> (8 - i)) << bits;
+ }
+ outputBits = 0;
+! ++a0;
+! if (codingLine[a0] < columns) {
+! outputBits = codingLine[a0 + 1] - codingLine[a0];
+ }
+ }
+! } while (bits > 0 && codingLine[a0] < columns);
+ }
+- buf = black ? (ret ^ 0xff) : ret;
+ return buf;
+ }
+
+--- 1612,1654 ----
+
+ // get a byte
+ if (outputBits >= 8) {
+! buf = (a0i & 1) ? 0x00 : 0xff;
+! outputBits -= 8;
+! if (outputBits == 0 && codingLine[a0i] < columns) {
+! ++a0i;
+! outputBits = codingLine[a0i] - codingLine[a0i - 1];
+ }
+ } else {
+ bits = 8;
+! buf = 0;
+ do {
+ if (outputBits > bits) {
+! buf <<= bits;
+! if (!(a0i & 1)) {
+! buf |= 0xff >> (8 - bits);
+ }
+! outputBits -= bits;
+! bits = 0;
+ } else {
+! buf <<= outputBits;
+! if (!(a0i & 1)) {
+! buf |= 0xff >> (8 - outputBits);
+ }
++ bits -= outputBits;
+ outputBits = 0;
+! if (codingLine[a0i] < columns) {
+! ++a0i;
+! outputBits = codingLine[a0i] - codingLine[a0i - 1];
+! } else if (bits > 0) {
+! buf <<= bits;
+! bits = 0;
+ }
+ }
+! } while (bits);
+! }
+! if (black) {
+! buf ^= 0xff;
+ }
+ return buf;
+ }
+
+***************
+*** 1661,1666 ****
+--- 1690,1698 ----
+ code = 0; // make gcc happy
+ if (endOfBlock) {
+ code = lookBits(12);
++ if (code == EOF) {
++ return 1;
++ }
+ if ((code >> 5) == 0) {
+ p = &whiteTab1[code];
+ } else {
+***************
+*** 1673,1678 ****
+--- 1705,1713 ----
+ } else {
+ for (n = 1; n <= 9; ++n) {
+ code = lookBits(n);
++ if (code == EOF) {
++ return 1;
++ }
+ if (n < 9) {
+ code <<= 9 - n;
+ }
+***************
+*** 1684,1689 ****
+--- 1719,1727 ----
+ }
+ for (n = 11; n <= 12; ++n) {
+ code = lookBits(n);
++ if (code == EOF) {
++ return 1;
++ }
+ if (n < 12) {
+ code <<= 12 - n;
+ }
+***************
+*** 1709,1717 ****
+ code = 0; // make gcc happy
+ if (endOfBlock) {
+ code = lookBits(13);
+ if ((code >> 7) == 0) {
+ p = &blackTab1[code];
+! } else if ((code >> 9) == 0) {
+ p = &blackTab2[(code >> 1) - 64];
+ } else {
+ p = &blackTab3[code >> 7];
+--- 1747,1758 ----
+ code = 0; // make gcc happy
+ if (endOfBlock) {
+ code = lookBits(13);
++ if (code == EOF) {
++ return 1;
++ }
+ if ((code >> 7) == 0) {
+ p = &blackTab1[code];
+! } else if ((code >> 9) == 0 && (code >> 7) != 0) {
+ p = &blackTab2[(code >> 1) - 64];
+ } else {
+ p = &blackTab3[code >> 7];
+***************
+*** 1723,1728 ****
+--- 1764,1772 ----
+ } else {
+ for (n = 2; n <= 6; ++n) {
+ code = lookBits(n);
++ if (code == EOF) {
++ return 1;
++ }
+ if (n < 6) {
+ code <<= 6 - n;
+ }
+***************
+*** 1734,1739 ****
+--- 1778,1786 ----
+ }
+ for (n = 7; n <= 12; ++n) {
+ code = lookBits(n);
++ if (code == EOF) {
++ return 1;
++ }
+ if (n < 12) {
+ code <<= 12 - n;
+ }
+***************
+*** 1747,1752 ****
+--- 1794,1802 ----
+ }
+ for (n = 10; n <= 13; ++n) {
+ code = lookBits(n);
++ if (code == EOF) {
++ return 1;
++ }
+ if (n < 13) {
+ code <<= 13 - n;
+ }
+***************
+*** 1961,1966 ****
+--- 2011,2022 ----
+ // allocate a buffer for the whole image
+ bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth;
+ bufHeight = ((height + mcuHeight - 1) / mcuHeight) * mcuHeight;
++ if (bufWidth <= 0 || bufHeight <= 0 ||
++ bufWidth > INT_MAX / bufWidth / (int)sizeof(int)) {
++ error(getPos(), "Invalid image size in DCT stream");
++ y = height;
++ return;
++ }
+ for (i = 0; i < numComps; ++i) {
+ frameBuf[i] = (int *)gmallocn(bufWidth * bufHeight, sizeof(int));
+ memset(frameBuf[i], 0, bufWidth * bufHeight * sizeof(int));
+***************
+*** 3036,3041 ****
+--- 3092,3102 ----
+ }
+ scanInfo.firstCoeff = str->getChar();
+ scanInfo.lastCoeff = str->getChar();
++ if (scanInfo.firstCoeff < 0 || scanInfo.lastCoeff > 63 ||
++ scanInfo.firstCoeff > scanInfo.lastCoeff) {
++ error(getPos(), "Bad DCT coefficient numbers in scan info block");
++ return gFalse;
++ }
+ c = str->getChar();
+ scanInfo.ah = (c >> 4) & 0x0f;
+ scanInfo.al = c & 0x0f;
+diff -c -r xpdf-3.02pl1.orig/xpdf/Stream.h xpdf-3.02/xpdf/Stream.h
+*** xpdf-3.02pl1.orig/xpdf/Stream.h Tue Feb 27 14:05:52 2007
+--- xpdf-3.02/xpdf/Stream.h Thu Oct 25 15:48:15 2007
+***************
+*** 528,540 ****
+ int row; // current row
+ int inputBuf; // input buffer
+ int inputBits; // number of bits in input buffer
+! short *refLine; // reference line changing elements
+! int b1; // index into refLine
+! short *codingLine; // coding line changing elements
+! int a0; // index into codingLine
+ int outputBits; // remaining ouput bits
+ int buf; // character buffer
+
+ short getTwoDimCode();
+ short getWhiteCode();
+ short getBlackCode();
+--- 528,542 ----
+ int row; // current row
+ int inputBuf; // input buffer
+ int inputBits; // number of bits in input buffer
+! int *codingLine; // coding line changing elements
+! int *refLine; // reference line changing elements
+! int a0i; // index into codingLine
+! GBool err; // error on current line
+ int outputBits; // remaining ouput bits
+ int buf; // character buffer
+
++ void addPixels(int a1, int black);
++ void addPixelsNeg(int a1, int black);
+ short getTwoDimCode();
+ short getWhiteCode();
+ short getBlackCode();
diff --git a/Build/source/libs/xpdf/xpdf-3.02pl3.patch b/Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl3.patch
index b5988805f42..b5988805f42 100644
--- a/Build/source/libs/xpdf/xpdf-3.02pl3.patch
+++ b/Build/source/libs/xpdf/xpdf-3.02-foolabs/xpdf-3.02pl3.patch
diff --git a/Build/source/libs/xpdf/xpdf-3.02-mingw32.patch b/Build/source/libs/xpdf/xpdf-3.02-mingw32.patch
deleted file mode 100644
index ce4921e0372..00000000000
--- a/Build/source/libs/xpdf/xpdf-3.02-mingw32.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -ur xpdf-3.02.orig/xpdf/GlobalParams.cc xpdf-3.02/xpdf/GlobalParams.cc
---- xpdf-3.02.orig/xpdf/GlobalParams.cc 2009-03-20 08:45:16.000000000 +0100
-+++ xpdf-3.02/xpdf/GlobalParams.cc 2009-04-02 10:22:18.000000000 +0200
-@@ -44,6 +44,10 @@
-
- #include <aconf.h>
-
-+#ifdef __MINGW32__
-+#undef WIN32
-+#endif
-+
- #ifdef USE_GCC_PRAGMAS
- #pragma implementation
- #endif
diff --git a/Build/source/libs/xpdf/xpdf-3.02-pdftex.patch b/Build/source/libs/xpdf/xpdf-3.02-pdftex.patch
deleted file mode 100644
index b9206a18937..00000000000
--- a/Build/source/libs/xpdf/xpdf-3.02-pdftex.patch
+++ /dev/null
@@ -1,1043 +0,0 @@
-diff -ur xpdf-3.02.orig/goo/GString.cc xpdf-3.02/goo/GString.cc
---- xpdf-3.02.orig/goo/GString.cc 2007-02-27 23:05:51.000000000 +0100
-+++ xpdf-3.02/goo/GString.cc 2008-05-08 15:40:41.000000000 +0200
-@@ -8,6 +8,47 @@
- //
- //========================================================================
-
-+/* ------------------------------------------------------------------------
-+* Changed by Martin Schröder <martin@pdftex.org>
-+* $Id: GString.cc 421 2008-04-26 21:59:55Z oneiros $
-+* Changelog:
-+* ------------------------------------------------------------------------
-+* r196 | oneiros | 2007-07-11 13:56:21 +0200 (Mi, 11 Jul 2007) | 2 lines
-+*
-+* Merge r195 (compilation problems on IRIX) into stable
-+*
-+* ------------------------------------------------------------------------
-+* r194 | oneiros | 2007-07-10 19:47:01 +0200 (Di, 10 Jul 2007) | 2 lines
-+*
-+* Merge r193 (compilation problems on IRIX) into stable
-+*
-+* ------------------------------------------------------------------------
-+* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-+*
-+* Merging xpdf 3.02 from HEAD into stable
-+* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-+*
-+* ------------------------------------------------------------------------
-+* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-+*
-+* 1.30.1
-+*
-+* ------------------------------------------------------------------------
-+* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-+*
-+* released v1.11b
-+*
-+* ------------------------------------------------------------------------
-+* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-+*
-+* Moved sources to src
-+*
-+* ------------------------------------------------------------------------
-+* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-+*
-+* 1.11a
-+*------------------------------------------------------------------------ */
-+
- #include <aconf.h>
-
- #ifdef USE_GCC_PRAGMAS
-@@ -528,7 +569,7 @@
- if ((neg = x < 0)) {
- x = -x;
- }
-- x = floor(x * pow(10, prec) + 0.5);
-+ x = floor(x * pow(10.0, prec) + 0.5);
- i = bufSize;
- started = !trim;
- for (j = 0; j < prec && i > 1; ++j) {
-diff -ur xpdf-3.02.orig/goo/gfile.cc xpdf-3.02/goo/gfile.cc
---- xpdf-3.02.orig/goo/gfile.cc 2009-03-06 11:40:39.000000000 +0100
-+++ xpdf-3.02/goo/gfile.cc 2009-03-06 11:54:23.000000000 +0100
-@@ -8,6 +8,42 @@
- //
- //========================================================================
-
-+/* ------------------------------------------------------------------------
-+* Changed by Martin Schröder <martin@pdftex.org>
-+* $Id: gfile.cc 421 2008-04-26 21:59:55Z oneiros $
-+* Changelog:
-+* ------------------------------------------------------------------------
-+* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-+*
-+* Merging xpdf 3.02 from HEAD into stable
-+* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-+*
-+* ------------------------------------------------------------------------
-+* r50 | ms | 2006-02-16 13:00:00 +0100 (Do, 16 Feb 2006) | 2 lines
-+*
-+* 1.30.6
-+*
-+* ------------------------------------------------------------------------
-+* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-+*
-+* 1.20a
-+*
-+* ------------------------------------------------------------------------
-+* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-+*
-+* released v1.11b
-+*
-+* ------------------------------------------------------------------------
-+* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-+*
-+* Moved sources to src
-+*
-+* ------------------------------------------------------------------------
-+* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-+*
-+* 1.11a
-+* ------------------------------------------------------------------------ */
-+
- #include <aconf.h>
-
- #ifdef WIN32
-@@ -440,6 +476,7 @@
- #endif
- }
-
-+#ifndef PDF_PARSER_ONLY
- GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
- #if defined(WIN32)
- //---------- Win32 ----------
-@@ -548,6 +585,7 @@
- return gTrue;
- #endif
- }
-+#endif
-
- GBool executeCommand(char *cmd) {
- #ifdef VMS
-diff -ur xpdf-3.02.orig/xpdf/Decrypt.h xpdf-3.02/xpdf/Decrypt.h
---- xpdf-3.02.orig/xpdf/Decrypt.h 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/Decrypt.h 2008-05-08 15:40:41.000000000 +0200
-@@ -6,6 +6,42 @@
- //
- //========================================================================
-
-+/* ------------------------------------------------------------------------
-+* Changed by Martin Schröder <martin@pdftex.org>
-+* $Id: Decrypt.h 421 2008-04-26 21:59:55Z oneiros $
-+* Changelog:
-+* ------------------------------------------------------------------------
-+* r320 | oneiros | 2007-12-18 13:40:01 +0100 (Di, 18 Dez 2007) | 2 lines
-+*
-+* Import libpng 1.2.24 into stable
-+*
-+* ------------------------------------------------------------------------
-+* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-+*
-+* Merging xpdf 3.02 from HEAD into stable
-+* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-+*
-+* ------------------------------------------------------------------------
-+* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-+*
-+* 1.30.1
-+*
-+* ------------------------------------------------------------------------
-+* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-+*
-+* released v1.11b
-+*
-+* ------------------------------------------------------------------------
-+* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-+*
-+* Moved sources to src
-+*
-+* ------------------------------------------------------------------------
-+* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-+*
-+* 1.11a
-+* ------------------------------------------------------------------------ */
-+
- #ifndef DECRYPT_H
- #define DECRYPT_H
-
-@@ -73,7 +109,7 @@
- CryptAlgorithm algoA, int keyLength,
- int objNum, int objGen);
- virtual ~DecryptStream();
-- virtual StreamKind getKind() { return strWeird; }
-+ virtual StreamKind getKind() { return strCrypt; }
- virtual void reset();
- virtual int getChar();
- virtual int lookChar();
-diff -ur xpdf-3.02.orig/xpdf/GlobalParams.cc xpdf-3.02/xpdf/GlobalParams.cc
---- xpdf-3.02.orig/xpdf/GlobalParams.cc 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/GlobalParams.cc 2008-05-08 15:40:41.000000000 +0200
-@@ -6,6 +6,42 @@
- //
- //========================================================================
-
-+/* ------------------------------------------------------------------------
-+* Changed by Martin Schröder <martin@pdftex.org>
-+* $Id: GlobalParams.cc 421 2008-04-26 21:59:55Z oneiros $
-+* Changelog:
-+* ------------------------------------------------------------------------
-+* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-+*
-+* Merging xpdf 3.02 from HEAD into stable
-+* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-+*
-+* ------------------------------------------------------------------------
-+* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-+*
-+* 1.30.1
-+*
-+* ------------------------------------------------------------------------
-+* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-+*
-+* 1.20a
-+*
-+* ------------------------------------------------------------------------
-+* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-+*
-+* released v1.11b
-+*
-+* ------------------------------------------------------------------------
-+* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-+*
-+* Moved sources to src
-+*
-+* ------------------------------------------------------------------------
-+* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-+*
-+* 1.11a
-+* ------------------------------------------------------------------------ */
-+
- #include <aconf.h>
-
- #ifdef USE_GCC_PRAGMAS
-@@ -422,6 +458,7 @@
- }
- }
-
-+#ifndef PDF_PARSER_ONLY
- //------------------------------------------------------------------------
- // KeyBinding
- //------------------------------------------------------------------------
-@@ -454,6 +491,7 @@
- KeyBinding::~KeyBinding() {
- deleteGList(cmds, GString);
- }
-+#endif
-
- #ifdef ENABLE_PLUGINS
- //------------------------------------------------------------------------
-@@ -601,6 +639,138 @@
- // parsing
- //------------------------------------------------------------------------
-
-+GlobalParams::GlobalParams() {
-+ UnicodeMap *map;
-+ int i;
-+
-+#if MULTITHREADED
-+ gInitMutex(&mutex);
-+ gInitMutex(&unicodeMapCacheMutex);
-+ gInitMutex(&cMapCacheMutex);
-+#endif
-+
-+ initBuiltinFontTables();
-+
-+ // scan the encoding in reverse because we want the lowest-numbered
-+ // index for each char name ('space' is encoded twice)
-+ macRomanReverseMap = new NameToCharCode();
-+ for (i = 255; i >= 0; --i) {
-+ if (macRomanEncoding[i]) {
-+ macRomanReverseMap->add(macRomanEncoding[i], (CharCode)i);
-+ }
-+ }
-+
-+#ifdef WIN32
-+ // baseDir will be set by a call to setBaseDir
-+ baseDir = new GString();
-+#else
-+ baseDir = appendToPath(getHomeDir(), ".xpdf");
-+#endif
-+ nameToUnicode = new NameToCharCode();
-+ cidToUnicodes = new GHash(gTrue);
-+ unicodeToUnicodes = new GHash(gTrue);
-+ residentUnicodeMaps = new GHash();
-+ unicodeMaps = new GHash(gTrue);
-+ cMapDirs = new GHash(gTrue);
-+ toUnicodeDirs = new GList();
-+ displayFonts = new GHash();
-+ displayCIDFonts = new GHash();
-+ displayNamedCIDFonts = new GHash();
-+#if HAVE_PAPER_H
-+ char *paperName;
-+ const struct paper *paperType;
-+ paperinit();
-+ if ((paperName = systempapername())) {
-+ paperType = paperinfo(paperName);
-+ psPaperWidth = (int)paperpswidth(paperType);
-+ psPaperHeight = (int)paperpsheight(paperType);
-+ } else {
-+ error(-1, "No paper information available - using defaults");
-+ psPaperWidth = defPaperWidth;
-+ psPaperHeight = defPaperHeight;
-+ }
-+ paperdone();
-+#else
-+ psPaperWidth = defPaperWidth;
-+ psPaperHeight = defPaperHeight;
-+#endif
-+ psImageableLLX = psImageableLLY = 0;
-+ psImageableURX = psPaperWidth;
-+ psImageableURY = psPaperHeight;
-+ psCrop = gTrue;
-+ psExpandSmaller = gFalse;
-+ psShrinkLarger = gTrue;
-+ psCenter = gTrue;
-+ psDuplex = gFalse;
-+ psLevel = psLevel2;
-+ psFile = NULL;
-+ psFonts = new GHash();
-+ psNamedFonts16 = new GList();
-+ psFonts16 = new GList();
-+ psEmbedType1 = gTrue;
-+ psEmbedTrueType = gTrue;
-+ psEmbedCIDPostScript = gTrue;
-+ psEmbedCIDTrueType = gTrue;
-+ psOPI = gFalse;
-+ psASCIIHex = gFalse;
-+ textEncoding = new GString("Latin1");
-+#if defined(WIN32)
-+ textEOL = eolDOS;
-+#elif defined(MACOS)
-+ textEOL = eolMac;
-+#else
-+ textEOL = eolUnix;
-+#endif
-+ textPageBreaks = gTrue;
-+ textKeepTinyChars = gFalse;
-+ fontDirs = new GList();
-+ initialZoom = new GString("125");
-+ continuousView = gFalse;
-+ enableT1lib = gTrue;
-+ enableFreeType = gTrue;
-+ antialias = gTrue;
-+ urlCommand = NULL;
-+ movieCommand = NULL;
-+ mapNumericCharNames = gTrue;
-+ printCommands = gFalse;
-+ errQuiet = gFalse;
-+
-+ cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize);
-+ unicodeToUnicodeCache =
-+ new CharCodeToUnicodeCache(unicodeToUnicodeCacheSize);
-+ unicodeMapCache = new UnicodeMapCache();
-+ cMapCache = new CMapCache();
-+
-+#ifdef ENABLE_PLUGINS
-+ plugins = new GList();
-+ securityHandlers = new GList();
-+#endif
-+
-+ // set up the initial nameToUnicode table
-+ for (i = 0; nameToUnicodeTab[i].name; ++i) {
-+ nameToUnicode->add(nameToUnicodeTab[i].name, nameToUnicodeTab[i].u);
-+ }
-+
-+ // set up the residentUnicodeMaps table
-+ map = new UnicodeMap("Latin1", gFalse,
-+ latin1UnicodeMapRanges, latin1UnicodeMapLen);
-+ residentUnicodeMaps->add(map->getEncodingName(), map);
-+ map = new UnicodeMap("ASCII7", gFalse,
-+ ascii7UnicodeMapRanges, ascii7UnicodeMapLen);
-+ residentUnicodeMaps->add(map->getEncodingName(), map);
-+ map = new UnicodeMap("Symbol", gFalse,
-+ symbolUnicodeMapRanges, symbolUnicodeMapLen);
-+ residentUnicodeMaps->add(map->getEncodingName(), map);
-+ map = new UnicodeMap("ZapfDingbats", gFalse, zapfDingbatsUnicodeMapRanges,
-+ zapfDingbatsUnicodeMapLen);
-+ residentUnicodeMaps->add(map->getEncodingName(), map);
-+ map = new UnicodeMap("UTF-8", gTrue, &mapUTF8);
-+ residentUnicodeMaps->add(map->getEncodingName(), map);
-+ map = new UnicodeMap("UCS-2", gTrue, &mapUCS2);
-+ residentUnicodeMaps->add(map->getEncodingName(), map);
-+
-+}
-+
- GlobalParams::GlobalParams(char *cfgFileName) {
- UnicodeMap *map;
- GString *fileName;
-@@ -706,7 +876,9 @@
- movieCommand = NULL;
- mapNumericCharNames = gTrue;
- mapUnknownCharNames = gFalse;
-+#ifndef PDF_PARSER_ONLY
- createDefaultKeyBindings();
-+#endif
- printCommands = gFalse;
- errQuiet = gFalse;
-
-@@ -781,12 +953,15 @@
- }
- }
- if (f) {
-+#ifndef PDF_PARSER_ONLY
- parseFile(fileName, f);
-+#endif
- delete fileName;
- fclose(f);
- }
- }
-
-+#ifndef PDF_PARSER_ONLY
- void GlobalParams::createDefaultKeyBindings() {
- keyBindings = new GList();
-
-@@ -1113,6 +1288,7 @@
-
- deleteGList(tokens, GString);
- }
-+#endif
-
- void GlobalParams::parseNameToUnicode(GList *tokens, GString *fileName,
- int line) {
-@@ -1457,6 +1633,7 @@
- }
- }
-
-+#ifndef PDF_PARSER_ONLY
- void GlobalParams::parseBind(GList *tokens, GString *fileName, int line) {
- KeyBinding *binding;
- GList *cmds;
-@@ -1642,6 +1819,7 @@
-
- return gTrue;
- }
-+#endif
-
- void GlobalParams::parseCommand(char *cmdName, GString **val,
- GList *tokens, GString *fileName, int line) {
-@@ -1785,7 +1963,9 @@
- if (movieCommand) {
- delete movieCommand;
- }
-+#ifndef PDF_PARSER_ONLY
- deleteGList(keyBindings, KeyBinding);
-+#endif
-
- cMapDirs->startIter(&iter);
- while (cMapDirs->getNext(&iter, &key, (void **)&list)) {
-@@ -2436,6 +2616,7 @@
- return map;
- }
-
-+#ifndef PDF_PARSER_ONLY
- GList *GlobalParams::getKeyBinding(int code, int mods, int context) {
- KeyBinding *binding;
- GList *cmds;
-@@ -2461,6 +2642,7 @@
- unlockGlobalParams;
- return cmds;
- }
-+#endif
-
- GBool GlobalParams::getPrintCommands() {
- GBool p;
-diff -ur xpdf-3.02.orig/xpdf/GlobalParams.h xpdf-3.02/xpdf/GlobalParams.h
---- xpdf-3.02.orig/xpdf/GlobalParams.h 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/GlobalParams.h 2008-05-08 15:40:41.000000000 +0200
-@@ -6,6 +6,42 @@
- //
- //========================================================================
-
-+/* ------------------------------------------------------------------------
-+* Changed by Martin Schröder <martin@pdftex.org>
-+* $Id: GlobalParams.h 421 2008-04-26 21:59:55Z oneiros $
-+* Changelog:
-+* ------------------------------------------------------------------------
-+* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-+*
-+* Merging xpdf 3.02 from HEAD into stable
-+* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-+*
-+* ------------------------------------------------------------------------
-+* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-+*
-+* 1.30.1
-+*
-+* ------------------------------------------------------------------------
-+* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-+*
-+* 1.20a
-+*
-+* ------------------------------------------------------------------------
-+* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-+*
-+* released v1.11b
-+*
-+* ------------------------------------------------------------------------
-+* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-+*
-+* Moved sources to src
-+*
-+* ------------------------------------------------------------------------
-+* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-+*
-+* 1.11a
-+* ------------------------------------------------------------------------ */
-+
- #ifndef GLOBALPARAMS_H
- #define GLOBALPARAMS_H
-
-@@ -123,6 +159,7 @@
-
- //------------------------------------------------------------------------
-
-+#ifndef PDF_PARSER_ONLY
- class KeyBinding {
- public:
-
-@@ -186,6 +223,7 @@
- #define xpdfKeyContextMainWin (2 << 6)
- #define xpdfKeyContextScrLockOn (1 << 8)
- #define xpdfKeyContextScrLockOff (2 << 8)
-+#endif
-
- //------------------------------------------------------------------------
-
-@@ -196,12 +234,17 @@
- // file.
- GlobalParams(char *cfgFileName);
-
-+ // Initialize it without reading the config
-+ GlobalParams();
-+
- ~GlobalParams();
-
- void setBaseDir(char *dir);
- void setupBaseFonts(char *dir);
-
-+#ifndef PDF_PARSER_ONLY
- void parseLine(char *buf, GString *fileName, int line);
-+#endif
-
- //----- accessors
-
-@@ -256,7 +299,9 @@
- GString *getMovieCommand() { return movieCommand; }
- GBool getMapNumericCharNames();
- GBool getMapUnknownCharNames();
-+#ifndef PDF_PARSER_ONLY
- GList *getKeyBinding(int code, int mods, int context);
-+#endif
- GBool getPrintCommands();
- GBool getErrQuiet();
-
-@@ -315,7 +360,9 @@
-
- private:
-
-+#ifndef PDF_PARSER_ONLY
- void createDefaultKeyBindings();
-+#endif
- void parseFile(GString *fileName, FILE *f);
- void parseNameToUnicode(GList *tokens, GString *fileName, int line);
- void parseCIDToUnicode(GList *tokens, GString *fileName, int line);
-@@ -338,12 +385,14 @@
- void parseFontDir(GList *tokens, GString *fileName, int line);
- void parseInitialZoom(GList *tokens, GString *fileName, int line);
- void parseScreenType(GList *tokens, GString *fileName, int line);
-+#ifndef PDF_PARSER_ONLY
- void parseBind(GList *tokens, GString *fileName, int line);
- void parseUnbind(GList *tokens, GString *fileName, int line);
- GBool parseKey(GString *modKeyStr, GString *contextStr,
- int *code, int *mods, int *context,
- char *cmdName,
- GList *tokens, GString *fileName, int line);
-+#endif
- void parseCommand(char *cmdName, GString **val,
- GList *tokens, GString *fileName, int line);
- void parseYesNo(char *cmdName, GBool *flag,
-@@ -438,7 +487,9 @@
- GString *movieCommand; // command executed for movie annotations
- GBool mapNumericCharNames; // map numeric char names (from font subsets)?
- GBool mapUnknownCharNames; // map unknown char names?
-+#ifndef PDF_PARSER_ONLY
- GList *keyBindings; // key & mouse button bindings [KeyBinding]
-+#endif
- GBool printCommands; // print the drawing commands
- GBool errQuiet; // suppress error messages?
-
-diff -ur xpdf-3.02.orig/xpdf/PDFDoc.h xpdf-3.02/xpdf/PDFDoc.h
---- xpdf-3.02.orig/xpdf/PDFDoc.h 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/PDFDoc.h 2008-07-17 02:29:04.000000000 +0200
-@@ -171,13 +171,15 @@
- double pdfVersion;
- XRef *xref;
- Catalog *catalog;
-+ GBool ok;
-+ int errCode;
-+/* Keep the size of the structure the same whether DISABLE_OUTLINE or
-+ not, and put it last to try to find errors more quickly. */
- #ifndef DISABLE_OUTLINE
- Outline *outline;
-+#else
-+ void *dummy;
- #endif
--
--
-- GBool ok;
-- int errCode;
- };
-
- #endif
-diff -ur xpdf-3.02.orig/xpdf/Page.h xpdf-3.02/xpdf/Page.h
---- xpdf-3.02.orig/xpdf/Page.h 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/Page.h 2008-05-08 15:40:41.000000000 +0200
-@@ -6,6 +6,42 @@
- //
- //========================================================================
-
-+/* ------------------------------------------------------------------------
-+* Changed by Martin Schröder <martin@pdftex.org>
-+* $Id: Page.h 421 2008-04-26 21:59:55Z oneiros $
-+* Changelog:
-+* ------------------------------------------------------------------------
-+* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-+*
-+* Merging xpdf 3.02 from HEAD into stable
-+* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-+*
-+* ------------------------------------------------------------------------
-+* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-+*
-+* 1.30.1
-+*
-+* ------------------------------------------------------------------------
-+* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-+*
-+* 1.20a
-+*
-+* ------------------------------------------------------------------------
-+* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-+*
-+* released v1.11b
-+*
-+* ------------------------------------------------------------------------
-+* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-+*
-+* Moved sources to src
-+*
-+* ------------------------------------------------------------------------
-+* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-+*
-+* 1.11a
-+* ------------------------------------------------------------------------ */
-+
- #ifndef PAGE_H
- #define PAGE_H
-
-@@ -170,9 +206,11 @@
-
- void processLinks(OutputDev *out, Catalog *catalog);
-
-+#ifndef PDF_PARSER_ONLY
- // Get the page's default CTM.
- void getDefaultCTM(double *ctm, double hDPI, double vDPI,
- int rotate, GBool useMediaBox, GBool upsideDown);
-+#endif
-
- private:
-
-diff -ur xpdf-3.02.orig/xpdf/Stream.h xpdf-3.02/xpdf/Stream.h
---- xpdf-3.02.orig/xpdf/Stream.h 2009-03-06 11:40:18.000000000 +0100
-+++ xpdf-3.02/xpdf/Stream.h 2008-05-08 15:40:41.000000000 +0200
-@@ -6,6 +6,58 @@
- //
- //========================================================================
-
-+/* ------------------------------------------------------------------------
-+* Changed by Martin Schröder <martin@pdftex.org>
-+* $Id: Stream.h 421 2008-04-26 21:59:55Z oneiros $
-+* Changelog:
-+* ------------------------------------------------------------------------
-+* r320 | oneiros | 2007-12-18 13:40:01 +0100 (Di, 18 Dez 2007) | 2 lines
-+*
-+* Import libpng 1.2.24 into stable
-+*
-+* ------------------------------------------------------------------------
-+* r268 | oneiros | 2007-11-11 22:45:02 +0100 (So, 11 Nov 2007) | 3 lines
-+*
-+* Merge xpdf 3.02pl2
-+* svn merge -r215:266 http://scm.foundry.supelec.fr/svn/pdftex/vendor/xpdf/current .
-+*
-+* ------------------------------------------------------------------------
-+* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-+*
-+* Merging xpdf 3.02 from HEAD into stable
-+* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-+*
-+* ------------------------------------------------------------------------
-+* r48 | ms | 2005-12-04 13:00:00 +0100 (So, 04 Dez 2005) | 2 lines
-+*
-+* 1.30.5
-+*
-+* ------------------------------------------------------------------------
-+* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-+*
-+* 1.30.1
-+*
-+* ------------------------------------------------------------------------
-+* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-+*
-+* 1.20a
-+*
-+* ------------------------------------------------------------------------
-+* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-+*
-+* released v1.11b
-+*
-+* ------------------------------------------------------------------------
-+* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-+*
-+* Moved sources to src
-+*
-+* ------------------------------------------------------------------------
-+* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-+*
-+* 1.11a
-+* ------------------------------------------------------------------------ */
-+
- #ifndef STREAM_H
- #define STREAM_H
-
-@@ -34,6 +86,7 @@
- strFlate,
- strJBIG2,
- strJPX,
-+ strCrypt,
- strWeird // internal-use stream types
- };
-
-diff -ur xpdf-3.02.orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc
---- xpdf-3.02.orig/xpdf/XRef.cc 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/XRef.cc 2008-05-08 15:40:41.000000000 +0200
-@@ -6,6 +6,57 @@
- //
- //========================================================================
-
-+/* ------------------------------------------------------------------------
-+* Changed by Martin Schröder <martin@pdftex.org>
-+* $Id: XRef.cc 421 2008-04-26 21:59:55Z oneiros $
-+* Changelog:
-+* ------------------------------------------------------------------------
-+* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-+*
-+* Merging xpdf 3.02 from HEAD into stable
-+* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-+*
-+* ------------------------------------------------------------------------
-+* r77 | ms | 2007-01-01 13:01:00 +0100 (Mo, 01 Jan 2007) | 2 lines
-+*
-+* 1.40.0
-+*
-+* ------------------------------------------------------------------------
-+* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-+*
-+* 1.30.1
-+*
-+* ------------------------------------------------------------------------
-+* r24 | ms | 2005-02-04 13:01:00 +0100 (Fr, 04 Feb 2005) | 2 lines
-+*
-+* 1.21a
-+*
-+* ------------------------------------------------------------------------
-+* r21 | ms | 2004-12-22 13:01:00 +0100 (Mi, 22 Dez 2004) | 2 lines
-+*
-+* 1.20b
-+*
-+* ------------------------------------------------------------------------
-+* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-+*
-+* 1.20a
-+*
-+* ------------------------------------------------------------------------
-+* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-+*
-+* released v1.11b
-+*
-+* ------------------------------------------------------------------------
-+* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-+*
-+* Moved sources to src
-+*
-+* ------------------------------------------------------------------------
-+* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-+*
-+* 1.11a
-+* ------------------------------------------------------------------------ */
-+
- #include <aconf.h>
-
- #ifdef USE_GCC_PRAGMAS
-@@ -45,34 +96,9 @@
- // ObjectStream
- //------------------------------------------------------------------------
-
--class ObjectStream {
--public:
--
-- // Create an object stream, using object number <objStrNum>,
-- // generation 0.
-- ObjectStream(XRef *xref, int objStrNumA);
--
-- ~ObjectStream();
--
-- // Return the object number of this object stream.
-- int getObjStrNum() { return objStrNum; }
--
-- // Get the <objIdx>th object from this stream, which should be
-- // object number <objNum>, generation 0.
-- Object *getObject(int objIdx, int objNum, Object *obj);
--
--private:
--
-- int objStrNum; // object number of the object stream
-- int nObjects; // number of objects in the stream
-- Object *objs; // the objects (length = nObjects)
-- int *objNums; // the object numbers (length = nObjects)
--};
--
- ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
- Stream *str;
- Parser *parser;
-- int *offsets;
- Object objStr, obj1, obj2;
- int first, i;
-
-@@ -80,6 +106,7 @@
- nObjects = 0;
- objs = NULL;
- objNums = NULL;
-+ offsets = NULL;
-
- if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) {
- goto err1;
-@@ -100,6 +127,7 @@
- goto err1;
- }
- first = obj1.getInt();
-+ firstOffset = objStr.getStream()->getBaseStream()->getStart() + first;
- obj1.free();
- if (first < 0) {
- goto err1;
-@@ -121,7 +149,7 @@
- obj1.free();
- obj2.free();
- delete parser;
-- gfree(offsets);
-+// gfree(offsets);
- goto err1;
- }
- objNums[i] = obj1.getInt();
-@@ -131,7 +159,7 @@
- if (objNums[i] < 0 || offsets[i] < 0 ||
- (i > 0 && offsets[i] < offsets[i-1])) {
- delete parser;
-- gfree(offsets);
-+// gfree(offsets);
- goto err1;
- }
- }
-@@ -160,7 +188,7 @@
- delete parser;
- }
-
-- gfree(offsets);
-+// gfree(offsets);
-
- err1:
- objStr.free();
-@@ -177,6 +205,7 @@
- delete[] objs;
- }
- gfree(objNums);
-+ gfree(offsets);
- }
-
- Object *ObjectStream::getObject(int objIdx, int objNum, Object *obj) {
-diff -ur xpdf-3.02.orig/xpdf/XRef.h xpdf-3.02/xpdf/XRef.h
---- xpdf-3.02.orig/xpdf/XRef.h 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/XRef.h 2008-05-08 15:40:41.000000000 +0200
-@@ -6,6 +6,45 @@
- //
- //========================================================================
-
-+/* ------------------------------------------------------------------------
-+* Changed by Martin Schröder <martin@pdftex.org>
-+* $Id: XRef.h 421 2008-04-26 21:59:55Z oneiros $
-+* Changelog:
-+* ------------------------------------------------------------------------
-+* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-+*
-+* Merging xpdf 3.02 from HEAD into stable
-+* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-+*
-+* ------------------------------------------------------------------------
-+* r77 | ms | 2007-01-01 13:01:00 +0100 (Mo, 01 Jan 2007) | 2 lines
-+*
-+* 1.40.0
-+*
-+* ------------------------------------------------------------------------
-+* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-+*
-+* 1.30.1
-+* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-+*
-+* 1.20a
-+*
-+* ------------------------------------------------------------------------
-+* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-+*
-+* released v1.11b
-+*
-+* ------------------------------------------------------------------------
-+* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-+*
-+* Moved sources to src
-+*
-+* ------------------------------------------------------------------------
-+* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-+*
-+* 1.11a
-+* ------------------------------------------------------------------------ */
-+
- #ifndef XREF_H
- #define XREF_H
-
-@@ -21,7 +60,36 @@
- class Dict;
- class Stream;
- class Parser;
--class ObjectStream;
-+
-+class ObjectStream {
-+public:
-+
-+ // Create an object stream, using object number <objStrNum>,
-+ // generation 0.
-+ ObjectStream(XRef *xref, int objStrNumA);
-+
-+ ~ObjectStream();
-+
-+ // Return the object number of this object stream.
-+ int getObjStrNum() { return objStrNum; }
-+
-+ // Get the <objIdx>th object from this stream, which should be
-+ // object number <objNum>, generation 0.
-+ Object *getObject(int objIdx, int objNum, Object *obj);
-+
-+ int *getOffsets() { return offsets; }
-+ Guint getFirstOffset() { return firstOffset; }
-+
-+private:
-+
-+ int objStrNum; // object number of the object stream
-+ int nObjects; // number of objects in the stream
-+ Object *objs; // the objects (length = nObjects)
-+ int *objNums; // the object numbers (length = nObjects)
-+ int *offsets; // the object offsets (length = nObjects)
-+ Guint firstOffset;
-+};
-+
-
- //------------------------------------------------------------------------
- // XRef
-@@ -96,6 +164,7 @@
- int getSize() { return size; }
- XRefEntry *getEntry(int i) { return &entries[i]; }
- Object *getTrailerDict() { return &trailerDict; }
-+ ObjectStream *getObjStr() { return objStr; }
-
- private:
-
-diff -ur xpdf-3.02.orig/xpdf/config.h xpdf-3.02/xpdf/config.h
---- xpdf-3.02.orig/xpdf/config.h 2007-02-27 23:05:52.000000000 +0100
-+++ xpdf-3.02/xpdf/config.h 2008-05-08 15:40:41.000000000 +0200
-@@ -6,6 +6,58 @@
- //
- //========================================================================
-
-+/* ------------------------------------------------------------------------
-+* Changed by Martin Schröder <martin@pdftex.org>
-+* $Id: config.h 421 2008-04-26 21:59:55Z oneiros $
-+* Changelog:
-+* ------------------------------------------------------------------------
-+* r268 | oneiros | 2007-11-11 22:45:02 +0100 (So, 11 Nov 2007) | 3 lines
-+*
-+* Merge xpdf 3.02pl2
-+* svn merge -r215:266 http://scm.foundry.supelec.fr/svn/pdftex/vendor/xpdf/current .
-+*
-+* ------------------------------------------------------------------------
-+* r215 | oneiros | 2007-07-31 18:32:04 +0200 (Di, 31 Jul 2007) | 2 lines
-+*
-+* Merge changes from trunk into stable: 203-207,213-214
-+*
-+* ------------------------------------------------------------------------
-+* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-+*
-+* Merging xpdf 3.02 from HEAD into stable
-+* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-+*
-+* ------------------------------------------------------------------------
-+* r86 | ms | 2007-01-31 13:01:00 +0100 (Mi, 31 Jan 2007) | 2 lines
-+*
-+* 1.40.2
-+*
-+* ------------------------------------------------------------------------
-+* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-+*
-+* 1.30.1
-+*
-+* ------------------------------------------------------------------------
-+* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-+*
-+* 1.20a
-+*
-+* ------------------------------------------------------------------------
-+* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-+*
-+* released v1.11b
-+*
-+* ------------------------------------------------------------------------
-+* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-+*
-+* Moved sources to src
-+*
-+* ------------------------------------------------------------------------
-+* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-+*
-+* 1.11a
-+* ------------------------------------------------------------------------ */
-+
- #ifndef CONFIG_H
- #define CONFIG_H
-
-@@ -14,7 +66,7 @@
- //------------------------------------------------------------------------
-
- // xpdf version
--#define xpdfVersion "3.02"
-+#define xpdfVersion "3.02pl3"
- #define xpdfVersionNum 3.02
- #define xpdfMajorVersion 3
- #define xpdfMinorVersion 2
diff --git a/Build/source/libs/xpdf/xpdf-3.02-time_h.patch b/Build/source/libs/xpdf/xpdf-3.02-time_h.patch
deleted file mode 100644
index b467a4e4deb..00000000000
--- a/Build/source/libs/xpdf/xpdf-3.02-time_h.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -ur xpdf-3.02.orig/goo/gfile.cc xpdf-3.02/goo/gfile.cc
---- xpdf-3.02.orig/goo/gfile.cc 2007-02-27 23:05:51.000000000 +0100
-+++ xpdf-3.02/goo/gfile.cc 2009-03-05 23:36:46.000000000 +0100
-@@ -20,6 +20,7 @@
- # include <sys/stat.h>
- # include <fcntl.h>
- # endif
-+# include <time.h>
- # include <limits.h>
- # include <string.h>
- # if !defined(VMS) && !defined(ACORN) && !defined(MACOS)
diff --git a/Build/source/libs/xpdf/xpdf-3.02/aclocal.m4 b/Build/source/libs/xpdf/xpdf-3.02/aclocal.m4
new file mode 100644
index 00000000000..b3aeea2fda6
--- /dev/null
+++ b/Build/source/libs/xpdf/xpdf-3.02/aclocal.m4
@@ -0,0 +1,274 @@
+# <<< smr.m4 from smr_macros 0.2.4 >>>
+
+dnl ####################### -*- Mode: M4 -*- ###########################
+dnl smr.m4 --
+dnl
+dnl Copyright (C) 1999 Matthew D. Langston <langston@SLAC.Stanford.EDU>
+dnl Copyright (C) 1998 Steve Robbins <stever@cs.mcgill.ca>
+dnl
+dnl This file is free software; you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This file is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this file; if not, write to:
+dnl
+dnl Free Software Foundation, Inc.
+dnl Suite 330
+dnl 59 Temple Place
+dnl Boston, MA 02111-1307, USA.
+dnl ####################################################################
+
+
+dnl NOTE: The macros in this file are extensively documented in the
+dnl accompanying `smr_macros.texi' Texinfo file. Please see the
+dnl Texinfo documentation for the definitive specification of how
+dnl these macros are supposed to work. If the macros work
+dnl differently than the Texinfo documentation says they should,
+dnl then the macros (and not the Texinfo documentation) has the
+dnl bug(s).
+
+dnl This is a convenient macro which translates illegal characters for
+dnl bourne shell variables into legal characters. It has the same
+dnl functionality as sed 'y%./+-:%__p__%'.
+AC_DEFUN([smr_safe_translation], [patsubst(patsubst([$1], [+], [p]), [./-:], [_])])
+
+AC_DEFUN(smr_SWITCH,
+[
+ dnl Define convenient aliases for the arguments since there are so
+ dnl many of them and I keep confusing myself whenever I have to edit
+ dnl this macro.
+ pushdef([smr_name], $1)
+ pushdef([smr_help_string], $2)
+ pushdef([smr_default], $3)
+ pushdef([smr_yes_define], $4)
+ pushdef([smr_no_define], $5)
+
+ dnl Do some sanity checking of the arguments.
+ ifelse([regexp(smr_default, [^\(yes\|no\)$])], -1, [AC_MSG_ERROR($0: third arg must be either yes or no)])
+
+ dnl Create the help string
+ pushdef([smr_lhs], [--ifelse(smr_default, yes, disable, enable)-smr_name])dnl
+ pushdef([smr_rhs], [ifelse(smr_default, yes, disable, enable) smr_help_string (default is smr_default)])dnl
+
+ dnl Add the option to `configure --help'. We don't need to supply the
+ dnl 4th argument to AC_ARG_ENABLE (i.e. the code to set the default
+ dnl value) because that is done below by AC_CACHE_CHECK.
+ AC_ARG_ENABLE([smr_name],
+ AC_HELP_STRING([smr_lhs], [smr_rhs]),
+ smr_cv_enable_[]smr_name=$enableval)
+
+ dnl We cache the result so that the user doesn't have to remember
+ dnl which flags they passed to `configure'.
+ AC_CACHE_CHECK([whether to enable smr_help_string],
+ smr_cv_enable_[]smr_name,
+ smr_cv_enable_[]smr_name=smr_default)
+
+ ifelse(smr_yes_define, , , test x"[$]smr_cv_enable_[]smr_name" = xyes && AC_DEFINE(smr_yes_define))
+ ifelse(smr_no_define, , , test x"[$]smr_cv_enable_[]smr_name" = xno && AC_DEFINE(smr_no_define))
+
+ dnl Sanity check the value assigned to smr_cv_enable_$1 to force it to
+ dnl be either `yes' or `no'.
+ if test ! x"[$]smr_cv_enable_[]smr_name" = xyes; then
+ if test ! x"[$]smr_cv_enable_[]smr_name" = xno; then
+ AC_MSG_ERROR([smr_lhs must be either yes or no])
+ fi
+ fi
+
+ popdef([smr_name])
+ popdef([smr_help_string])
+ popdef([smr_default])
+ popdef([smr_yes_define])
+ popdef([smr_no_define])
+ popdef([smr_lhs])
+ popdef([smr_rhs])
+])
+
+
+AC_DEFUN(smr_ARG_WITHLIB,
+[
+ dnl Define convenient aliases for the arguments since there are so
+ dnl many of them and I keep confusing myself whenever I have to edit
+ dnl this macro.
+ pushdef([smr_name], $1)
+ pushdef([smr_libname], ifelse($2, , smr_name, $2))
+ pushdef([smr_help_string], $3)
+ pushdef([smr_safe_name], smr_safe_translation(smr_name))
+
+ dnl Add the option to `configure --help'. We don't need to supply the
+ dnl 4th argument to AC_ARG_WITH (i.e. the code to set the default
+ dnl value) because that is done below by AC_CACHE_CHECK.
+ AC_ARG_WITH(smr_safe_name-library,
+ AC_HELP_STRING([--with-smr_safe_name-library[[=PATH]]],
+ [use smr_name library ifelse(smr_help_string, , , (smr_help_string))]),
+ smr_cv_with_[]smr_safe_name[]_library=$withval)
+
+ dnl We cache the result so that the user doesn't have to remember
+ dnl which flags they passed to `configure'.
+ AC_CACHE_CHECK([whether to use smr_name library],
+ smr_cv_with_[]smr_safe_name[]_library,
+ smr_cv_with_[]smr_safe_name[]_library=maybe)
+
+
+ case x"[$]smr_cv_with_[]smr_safe_name[]_library" in
+ xyes | xmaybe)
+ smr_safe_name[]_LIBS="-l[]smr_libname"
+ with_[]smr_safe_name=[$]smr_cv_with_[]smr_safe_name[]_library
+ ;;
+ xno)
+ smr_safe_name[]_LIBS=
+ with_[]smr_safe_name=no
+ ;;
+ *)
+ if test -f "[$]smr_cv_with_[]smr_safe_name[]_library"; then
+ smr_safe_name[]_LIBS=[$]smr_cv_with_[]smr_safe_name[]_library
+ elif test -d "[$]smr_cv_with_[]smr_safe_name[]_library"; then
+ smr_safe_name[]_LIBS="-L[$]smr_cv_with_[]smr_safe_name[]_library -l[]smr_libname"
+ else
+ AC_MSG_ERROR([argument must be boolean, file, or directory])
+ fi
+ with_[]smr_safe_name=yes
+ ;;
+ esac
+
+ popdef([smr_name])
+ popdef([smr_libname])
+ popdef([smr_help_string])
+ popdef([smr_safe_name])
+])
+
+
+AC_DEFUN(smr_ARG_WITHINCLUDES,
+[
+ dnl Define convenient aliases for the arguments since there are so
+ dnl many of them and I keep confusing myself whenever I have to edit
+ dnl this macro.
+ pushdef([smr_name], $1)
+ pushdef([smr_header], $2)
+ pushdef([smr_extra_flags], $3)
+ pushdef([smr_safe_name], smr_safe_translation(smr_name))
+
+ dnl Add the option to `configure --help'. We don't need to supply the
+ dnl 4th argument to AC_ARG_WITH (i.e. the code to set the default
+ dnl value) because that is done below by AC_CACHE_CHECK.
+ AC_ARG_WITH(smr_safe_name-includes,
+ AC_HELP_STRING([--with-smr_safe_name-includes[[=DIR]]],
+ [set directory for smr_name headers]),
+ smr_cv_with_[]smr_safe_name[]_includes=$withval)
+
+ dnl We cache the result so that the user doesn't have to remember
+ dnl which flags they passed to `configure'.
+ AC_CACHE_CHECK([where to find the smr_name header files],
+ smr_cv_with_[]smr_safe_name[]_includes,
+ smr_cv_with_[]smr_safe_name[]_includes=)
+
+ if test ! x"[$]smr_cv_with_[]smr_safe_name[]_includes" = x; then
+ if test -d "[$]smr_cv_with_[]smr_safe_name[]_includes"; then
+ smr_safe_name[]_CFLAGS="-I[$]smr_cv_with_[]smr_safe_name[]_includes"
+ else
+ AC_MSG_ERROR([argument must be a directory])
+ fi
+ else
+ smr_safe_name[]_CFLAGS=
+ fi
+
+ dnl This bit of logic comes from the autoconf AC_PROG_CC macro. We
+ dnl need to put the given include directory into CPPFLAGS temporarily,
+ dnl but then restore CPPFLAGS to its old value.
+ smr_test_CPPFLAGS="${CPPFLAGS+set}"
+ smr_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS [$]smr_safe_name[]_CFLAGS smr_extra_flags"
+
+ dnl If the header file smr_header exists, then define
+ dnl HAVE_[]smr_header (in all capitals).
+ AC_CHECK_HEADERS([smr_header],
+ smr_have_[]smr_safe_name[]_header=yes,
+ smr_have_[]smr_safe_name[]_header=no)
+
+ if test x"$smr_test_CPPFLAGS" = xset; then
+ CPPFLAGS=$smr_save_CPPFLAGS
+ else
+ unset CPPFLAGS
+ fi
+
+ popdef([smr_name])
+ popdef([smr_header])
+ popdef([smr_extra_flags])
+ popdef([smr_safe_name])
+])
+
+
+AC_DEFUN(smr_CHECK_LIB,
+[
+ dnl Define convenient aliases for the arguments since there are so
+ dnl many of them and I keep confusing myself whenever I have to edit
+ dnl this macro.
+ pushdef([smr_name], $1)
+ pushdef([smr_libname], ifelse($2, , smr_name, $2))
+ pushdef([smr_help_string], $3)
+ pushdef([smr_function], $4)
+ pushdef([smr_header], $5)
+ pushdef([smr_extra_libs], $6)
+ pushdef([smr_extra_flags], $7)
+ pushdef([smr_prototype], $8)
+ pushdef([smr_safe_name], smr_safe_translation(smr_name))
+
+ dnl Give the user (via "configure --help") an interface to specify
+ dnl whether we should use the library or not, and possibly where we
+ dnl should find it.
+ smr_ARG_WITHLIB([smr_name], [smr_libname], [smr_help_string])
+
+ if test ! x"$with_[]smr_safe_name" = xno; then
+
+ # If we got this far, then the user didn't explicitly ask not to use
+ # the library.
+
+ dnl If the caller of smr_CHECK_LIB specified a header file for this
+ dnl library, then give the user (via "configure --help") an
+ dnl interface to specify where this header file can be found (if it
+ dnl isn't found by the compiler by default).
+ ifelse(smr_header, , , [smr_ARG_WITHINCLUDES(smr_name, smr_header, smr_extra_flags)])
+
+ # We need only look for the library if the header has been found
+ # (or no header is needed).
+ if test [$]smr_have_[]smr_safe_name[]_header != no; then
+
+ AC_CHECK_LIB(smr_libname,
+ smr_function,
+ smr_have_[]smr_safe_name[]_library=yes,
+ smr_have_[]smr_safe_name[]_library=no,
+ [$]smr_safe_name[]_CFLAGS [smr_extra_flags] [$]smr_safe_name[]_LIBS [smr_extra_libs],
+ [ifelse(smr_prototype, , , [[#]include <smr_header>])],
+ smr_prototype)
+ fi
+
+ if test x"[$]smr_have_[]smr_safe_name[]_library" = xyes; then
+ AC_MSG_RESULT([using smr_name library])
+ else
+ smr_safe_name[]_LIBS=
+ smr_safe_name[]_CFLAGS=
+
+ if test x"$with_[]smr_safe_name" = xmaybe; then
+ AC_MSG_RESULT([not using smr_name library])
+ else
+ AC_MSG_WARN([requested smr_name library not found!])
+ fi
+ fi
+ fi
+
+ popdef([smr_name])
+ popdef([smr_libname])
+ popdef([smr_help_string])
+ popdef([smr_function])
+ popdef([smr_header])
+ popdef([smr_extra_libs])
+ popdef([smr_extra_flags])
+ popdef([smr_prototype])
+ popdef([smr_safe_name])
+])
diff --git a/Build/source/libs/xpdf/xpdf-3.02/goo/GString.cc b/Build/source/libs/xpdf/xpdf-3.02/goo/GString.cc
index b397cd5736e..4404985f64b 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/goo/GString.cc
+++ b/Build/source/libs/xpdf/xpdf-3.02/goo/GString.cc
@@ -7,47 +7,9 @@
// Copyright 1996-2003 Glyph & Cog, LLC
//
//========================================================================
-
-/* ------------------------------------------------------------------------
-* Changed by Martin Schröder <martin@pdftex.org>
-* $Id: GString.cc 421 2008-04-26 21:59:55Z oneiros $
-* Changelog:
-* ------------------------------------------------------------------------
-* r196 | oneiros | 2007-07-11 13:56:21 +0200 (Mi, 11 Jul 2007) | 2 lines
-*
-* Merge r195 (compilation problems on IRIX) into stable
-*
-* ------------------------------------------------------------------------
-* r194 | oneiros | 2007-07-10 19:47:01 +0200 (Di, 10 Jul 2007) | 2 lines
-*
-* Merge r193 (compilation problems on IRIX) into stable
-*
-* ------------------------------------------------------------------------
-* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-*
-* Merging xpdf 3.02 from HEAD into stable
-* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-*
-* ------------------------------------------------------------------------
-* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-*
-* 1.30.1
-*
-* ------------------------------------------------------------------------
-* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-*
-* released v1.11b
-*
-* ------------------------------------------------------------------------
-* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-*
-* Moved sources to src
-*
-* ------------------------------------------------------------------------
-* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-*
-* 1.11a
-*------------------------------------------------------------------------ */
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#include <aconf.h>
diff --git a/Build/source/libs/xpdf/xpdf-3.02/goo/gfile.cc b/Build/source/libs/xpdf/xpdf-3.02/goo/gfile.cc
index 7f59bcdc0d1..6b092a155b8 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/goo/gfile.cc
+++ b/Build/source/libs/xpdf/xpdf-3.02/goo/gfile.cc
@@ -7,42 +7,9 @@
// Copyright 1996-2003 Glyph & Cog, LLC
//
//========================================================================
-
-/* ------------------------------------------------------------------------
-* Changed by Martin Schröder <martin@pdftex.org>
-* $Id: gfile.cc 421 2008-04-26 21:59:55Z oneiros $
-* Changelog:
-* ------------------------------------------------------------------------
-* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-*
-* Merging xpdf 3.02 from HEAD into stable
-* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-*
-* ------------------------------------------------------------------------
-* r50 | ms | 2006-02-16 13:00:00 +0100 (Do, 16 Feb 2006) | 2 lines
-*
-* 1.30.6
-*
-* ------------------------------------------------------------------------
-* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-*
-* 1.20a
-*
-* ------------------------------------------------------------------------
-* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-*
-* released v1.11b
-*
-* ------------------------------------------------------------------------
-* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-*
-* Moved sources to src
-*
-* ------------------------------------------------------------------------
-* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-*
-* 1.11a
-* ------------------------------------------------------------------------ */
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#include <aconf.h>
diff --git a/Build/source/libs/xpdf/xpdf-3.02/xpdf/Decrypt.h b/Build/source/libs/xpdf/xpdf-3.02/xpdf/Decrypt.h
index c3ad5a5b6e7..14cdaacca7b 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/xpdf/Decrypt.h
+++ b/Build/source/libs/xpdf/xpdf-3.02/xpdf/Decrypt.h
@@ -5,42 +5,9 @@
// Copyright 1996-2003 Glyph & Cog, LLC
//
//========================================================================
-
-/* ------------------------------------------------------------------------
-* Changed by Martin Schröder <martin@pdftex.org>
-* $Id: Decrypt.h 421 2008-04-26 21:59:55Z oneiros $
-* Changelog:
-* ------------------------------------------------------------------------
-* r320 | oneiros | 2007-12-18 13:40:01 +0100 (Di, 18 Dez 2007) | 2 lines
-*
-* Import libpng 1.2.24 into stable
-*
-* ------------------------------------------------------------------------
-* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-*
-* Merging xpdf 3.02 from HEAD into stable
-* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-*
-* ------------------------------------------------------------------------
-* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-*
-* 1.30.1
-*
-* ------------------------------------------------------------------------
-* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-*
-* released v1.11b
-*
-* ------------------------------------------------------------------------
-* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-*
-* Moved sources to src
-*
-* ------------------------------------------------------------------------
-* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-*
-* 1.11a
-* ------------------------------------------------------------------------ */
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#ifndef DECRYPT_H
#define DECRYPT_H
diff --git a/Build/source/libs/xpdf/xpdf-3.02/xpdf/GlobalParams.cc b/Build/source/libs/xpdf/xpdf-3.02/xpdf/GlobalParams.cc
index c4ecd967806..ad63b7d69d0 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/xpdf/GlobalParams.cc
+++ b/Build/source/libs/xpdf/xpdf-3.02/xpdf/GlobalParams.cc
@@ -5,42 +5,9 @@
// Copyright 2001-2003 Glyph & Cog, LLC
//
//========================================================================
-
-/* ------------------------------------------------------------------------
-* Changed by Martin Schröder <martin@pdftex.org>
-* $Id: GlobalParams.cc 421 2008-04-26 21:59:55Z oneiros $
-* Changelog:
-* ------------------------------------------------------------------------
-* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-*
-* Merging xpdf 3.02 from HEAD into stable
-* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-*
-* ------------------------------------------------------------------------
-* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-*
-* 1.30.1
-*
-* ------------------------------------------------------------------------
-* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-*
-* 1.20a
-*
-* ------------------------------------------------------------------------
-* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-*
-* released v1.11b
-*
-* ------------------------------------------------------------------------
-* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-*
-* Moved sources to src
-*
-* ------------------------------------------------------------------------
-* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-*
-* 1.11a
-* ------------------------------------------------------------------------ */
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#include <aconf.h>
diff --git a/Build/source/libs/xpdf/xpdf-3.02/xpdf/GlobalParams.h b/Build/source/libs/xpdf/xpdf-3.02/xpdf/GlobalParams.h
index cd10e76b04c..3d19e4f4f4c 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/xpdf/GlobalParams.h
+++ b/Build/source/libs/xpdf/xpdf-3.02/xpdf/GlobalParams.h
@@ -5,42 +5,9 @@
// Copyright 2001-2003 Glyph & Cog, LLC
//
//========================================================================
-
-/* ------------------------------------------------------------------------
-* Changed by Martin Schröder <martin@pdftex.org>
-* $Id: GlobalParams.h 421 2008-04-26 21:59:55Z oneiros $
-* Changelog:
-* ------------------------------------------------------------------------
-* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-*
-* Merging xpdf 3.02 from HEAD into stable
-* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-*
-* ------------------------------------------------------------------------
-* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-*
-* 1.30.1
-*
-* ------------------------------------------------------------------------
-* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-*
-* 1.20a
-*
-* ------------------------------------------------------------------------
-* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-*
-* released v1.11b
-*
-* ------------------------------------------------------------------------
-* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-*
-* Moved sources to src
-*
-* ------------------------------------------------------------------------
-* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-*
-* 1.11a
-* ------------------------------------------------------------------------ */
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#ifndef GLOBALPARAMS_H
#define GLOBALPARAMS_H
diff --git a/Build/source/libs/xpdf/xpdf-3.02/xpdf/PDFDoc.h b/Build/source/libs/xpdf/xpdf-3.02/xpdf/PDFDoc.h
index b3b44e7306f..792d37ab18c 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/xpdf/PDFDoc.h
+++ b/Build/source/libs/xpdf/xpdf-3.02/xpdf/PDFDoc.h
@@ -5,6 +5,9 @@
// Copyright 1996-2003 Glyph & Cog, LLC
//
//========================================================================
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#ifndef PDFDOC_H
#define PDFDOC_H
diff --git a/Build/source/libs/xpdf/xpdf-3.02/xpdf/Page.cc b/Build/source/libs/xpdf/xpdf-3.02/xpdf/Page.cc
index 2a7540b06c0..376edf04f1f 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/xpdf/Page.cc
+++ b/Build/source/libs/xpdf/xpdf-3.02/xpdf/Page.cc
@@ -5,6 +5,9 @@
// Copyright 1996-2007 Glyph & Cog, LLC
//
//========================================================================
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#include <aconf.h>
diff --git a/Build/source/libs/xpdf/xpdf-3.02/xpdf/Page.h b/Build/source/libs/xpdf/xpdf-3.02/xpdf/Page.h
index 1ed0431d5d7..ab2d296d424 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/xpdf/Page.h
+++ b/Build/source/libs/xpdf/xpdf-3.02/xpdf/Page.h
@@ -5,42 +5,9 @@
// Copyright 1996-2003 Glyph & Cog, LLC
//
//========================================================================
-
-/* ------------------------------------------------------------------------
-* Changed by Martin Schröder <martin@pdftex.org>
-* $Id: Page.h 421 2008-04-26 21:59:55Z oneiros $
-* Changelog:
-* ------------------------------------------------------------------------
-* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-*
-* Merging xpdf 3.02 from HEAD into stable
-* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-*
-* ------------------------------------------------------------------------
-* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-*
-* 1.30.1
-*
-* ------------------------------------------------------------------------
-* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-*
-* 1.20a
-*
-* ------------------------------------------------------------------------
-* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-*
-* released v1.11b
-*
-* ------------------------------------------------------------------------
-* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-*
-* Moved sources to src
-*
-* ------------------------------------------------------------------------
-* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-*
-* 1.11a
-* ------------------------------------------------------------------------ */
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#ifndef PAGE_H
#define PAGE_H
diff --git a/Build/source/libs/xpdf/xpdf-3.02/xpdf/Stream.h b/Build/source/libs/xpdf/xpdf-3.02/xpdf/Stream.h
index 18f06362fe7..ef592eb0927 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/xpdf/Stream.h
+++ b/Build/source/libs/xpdf/xpdf-3.02/xpdf/Stream.h
@@ -5,58 +5,9 @@
// Copyright 1996-2003 Glyph & Cog, LLC
//
//========================================================================
-
-/* ------------------------------------------------------------------------
-* Changed by Martin Schröder <martin@pdftex.org>
-* $Id: Stream.h 421 2008-04-26 21:59:55Z oneiros $
-* Changelog:
-* ------------------------------------------------------------------------
-* r320 | oneiros | 2007-12-18 13:40:01 +0100 (Di, 18 Dez 2007) | 2 lines
-*
-* Import libpng 1.2.24 into stable
-*
-* ------------------------------------------------------------------------
-* r268 | oneiros | 2007-11-11 22:45:02 +0100 (So, 11 Nov 2007) | 3 lines
-*
-* Merge xpdf 3.02pl2
-* svn merge -r215:266 http://scm.foundry.supelec.fr/svn/pdftex/vendor/xpdf/current .
-*
-* ------------------------------------------------------------------------
-* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-*
-* Merging xpdf 3.02 from HEAD into stable
-* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-*
-* ------------------------------------------------------------------------
-* r48 | ms | 2005-12-04 13:00:00 +0100 (So, 04 Dez 2005) | 2 lines
-*
-* 1.30.5
-*
-* ------------------------------------------------------------------------
-* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-*
-* 1.30.1
-*
-* ------------------------------------------------------------------------
-* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-*
-* 1.20a
-*
-* ------------------------------------------------------------------------
-* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-*
-* released v1.11b
-*
-* ------------------------------------------------------------------------
-* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-*
-* Moved sources to src
-*
-* ------------------------------------------------------------------------
-* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-*
-* 1.11a
-* ------------------------------------------------------------------------ */
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#ifndef STREAM_H
#define STREAM_H
diff --git a/Build/source/libs/xpdf/xpdf-3.02/xpdf/XRef.cc b/Build/source/libs/xpdf/xpdf-3.02/xpdf/XRef.cc
index e9b3b0274f8..6fbf8b5d032 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/xpdf/XRef.cc
+++ b/Build/source/libs/xpdf/xpdf-3.02/xpdf/XRef.cc
@@ -5,57 +5,9 @@
// Copyright 1996-2003 Glyph & Cog, LLC
//
//========================================================================
-
-/* ------------------------------------------------------------------------
-* Changed by Martin Schröder <martin@pdftex.org>
-* $Id: XRef.cc 421 2008-04-26 21:59:55Z oneiros $
-* Changelog:
-* ------------------------------------------------------------------------
-* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-*
-* Merging xpdf 3.02 from HEAD into stable
-* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-*
-* ------------------------------------------------------------------------
-* r77 | ms | 2007-01-01 13:01:00 +0100 (Mo, 01 Jan 2007) | 2 lines
-*
-* 1.40.0
-*
-* ------------------------------------------------------------------------
-* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-*
-* 1.30.1
-*
-* ------------------------------------------------------------------------
-* r24 | ms | 2005-02-04 13:01:00 +0100 (Fr, 04 Feb 2005) | 2 lines
-*
-* 1.21a
-*
-* ------------------------------------------------------------------------
-* r21 | ms | 2004-12-22 13:01:00 +0100 (Mi, 22 Dez 2004) | 2 lines
-*
-* 1.20b
-*
-* ------------------------------------------------------------------------
-* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-*
-* 1.20a
-*
-* ------------------------------------------------------------------------
-* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-*
-* released v1.11b
-*
-* ------------------------------------------------------------------------
-* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-*
-* Moved sources to src
-*
-* ------------------------------------------------------------------------
-* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-*
-* 1.11a
-* ------------------------------------------------------------------------ */
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#include <aconf.h>
diff --git a/Build/source/libs/xpdf/xpdf-3.02/xpdf/XRef.h b/Build/source/libs/xpdf/xpdf-3.02/xpdf/XRef.h
index 0db6cee36df..c8ecaaec436 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/xpdf/XRef.h
+++ b/Build/source/libs/xpdf/xpdf-3.02/xpdf/XRef.h
@@ -5,45 +5,9 @@
// Copyright 1996-2003 Glyph & Cog, LLC
//
//========================================================================
-
-/* ------------------------------------------------------------------------
-* Changed by Martin Schröder <martin@pdftex.org>
-* $Id: XRef.h 421 2008-04-26 21:59:55Z oneiros $
-* Changelog:
-* ------------------------------------------------------------------------
-* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-*
-* Merging xpdf 3.02 from HEAD into stable
-* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-*
-* ------------------------------------------------------------------------
-* r77 | ms | 2007-01-01 13:01:00 +0100 (Mo, 01 Jan 2007) | 2 lines
-*
-* 1.40.0
-*
-* ------------------------------------------------------------------------
-* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-*
-* 1.30.1
-* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-*
-* 1.20a
-*
-* ------------------------------------------------------------------------
-* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-*
-* released v1.11b
-*
-* ------------------------------------------------------------------------
-* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-*
-* Moved sources to src
-*
-* ------------------------------------------------------------------------
-* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-*
-* 1.11a
-* ------------------------------------------------------------------------ */
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#ifndef XREF_H
#define XREF_H
diff --git a/Build/source/libs/xpdf/xpdf-3.02/xpdf/config.h b/Build/source/libs/xpdf/xpdf-3.02/xpdf/config.h
index c81f7983546..49e72ad0eb3 100644
--- a/Build/source/libs/xpdf/xpdf-3.02/xpdf/config.h
+++ b/Build/source/libs/xpdf/xpdf-3.02/xpdf/config.h
@@ -5,58 +5,9 @@
// Copyright 1996-2007 Glyph & Cog, LLC
//
//========================================================================
-
-/* ------------------------------------------------------------------------
-* Changed by Martin Schröder <martin@pdftex.org>
-* $Id: config.h 421 2008-04-26 21:59:55Z oneiros $
-* Changelog:
-* ------------------------------------------------------------------------
-* r268 | oneiros | 2007-11-11 22:45:02 +0100 (So, 11 Nov 2007) | 3 lines
-*
-* Merge xpdf 3.02pl2
-* svn merge -r215:266 http://scm.foundry.supelec.fr/svn/pdftex/vendor/xpdf/current .
-*
-* ------------------------------------------------------------------------
-* r215 | oneiros | 2007-07-31 18:32:04 +0200 (Di, 31 Jul 2007) | 2 lines
-*
-* Merge changes from trunk into stable: 203-207,213-214
-*
-* ------------------------------------------------------------------------
-* r151 | ms | 2007-06-25 18:53:17 +0200 (Mo, 25 Jun 2007) | 3 lines
-*
-* Merging xpdf 3.02 from HEAD into stable
-* svn merge -r149:150 --dry-run svn+ssh://svn/srv/svn/repos/pdftex/trunk/source/src/libs/xpdf .
-*
-* ------------------------------------------------------------------------
-* r86 | ms | 2007-01-31 13:01:00 +0100 (Mi, 31 Jan 2007) | 2 lines
-*
-* 1.40.2
-*
-* ------------------------------------------------------------------------
-* r38 | ms | 2005-08-21 14:00:00 +0200 (So, 21 Aug 2005) | 2 lines
-*
-* 1.30.1
-*
-* ------------------------------------------------------------------------
-* r11 | ms | 2004-09-06 14:01:00 +0200 (Mo, 06 Sep 2004) | 2 lines
-*
-* 1.20a
-*
-* ------------------------------------------------------------------------
-* r6 | ms | 2003-10-06 14:01:00 +0200 (Mo, 06 Okt 2003) | 2 lines
-*
-* released v1.11b
-*
-* ------------------------------------------------------------------------
-* r4 | ms | 2003-10-05 14:00:00 +0200 (So, 05 Okt 2003) | 2 lines
-*
-* Moved sources to src
-*
-* ------------------------------------------------------------------------
-* r1 | ms | 2003-08-02 14:00:00 +0200 (Sa, 02 Aug 2003) | 1 line
-*
-* 1.11a
-* ------------------------------------------------------------------------ */
+// Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+// See top-level ChangeLog for a list of all modifications
+//========================================================================
#ifndef CONFIG_H
#define CONFIG_H