summaryrefslogtreecommitdiff
path: root/extra/djvulibre
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2011-11-29 23:14:46 +0000
committerroot <root@rshg054.dnsready.net>2011-11-29 23:14:46 +0000
commit946f0c9fe48dfb648a8a0be065e92f237ce210fd (patch)
tree13387ae15c5ab9a50acdaa6ab02a076319c19047 /extra/djvulibre
parent83c3c42a38bda36bdc56d594318958bc4cfd9b32 (diff)
Tue Nov 29 23:14:46 UTC 2011
Diffstat (limited to 'extra/djvulibre')
-rw-r--r--extra/djvulibre/PKGBUILD15
-rw-r--r--extra/djvulibre/git-fixes.patch1607
2 files changed, 1618 insertions, 4 deletions
diff --git a/extra/djvulibre/PKGBUILD b/extra/djvulibre/PKGBUILD
index 6db90e526..6544542f1 100644
--- a/extra/djvulibre/PKGBUILD
+++ b/extra/djvulibre/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 116498 2011-03-24 09:12:50Z jgc $
+# $Id: PKGBUILD 143707 2011-11-28 13:56:50Z jgc $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: mgushee
pkgname=djvulibre
pkgver=3.5.24
-pkgrel=1
+pkgrel=2
pkgdesc="Suite to create, manipulate and view DjVu ('déjà vu') documents"
arch=("i686" "x86_64")
license=('GPL')
@@ -17,13 +17,20 @@ conflicts=('libdjvu')
optdepends=('djview4: Viewer application')
options=('!libtool')
install=djvulibre.install
-source=(http://downloads.sourceforge.net/djvu/${pkgname}-${pkgver}.tar.gz)
-md5sums=('af83d27af5083198432a178d22b259c5')
+source=(http://downloads.sourceforge.net/djvu/${pkgname}-${pkgver}.tar.gz
+ git-fixes.patch)
+md5sums=('af83d27af5083198432a178d22b259c5'
+ 'ff3798e383e9c3fae407455d8a51deec')
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/git-fixes.patch"
./configure --prefix=/usr --disable-desktopfiles
make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install
#Install icons for mime-types.
diff --git a/extra/djvulibre/git-fixes.patch b/extra/djvulibre/git-fixes.patch
new file mode 100644
index 000000000..3077cf0b4
--- /dev/null
+++ b/extra/djvulibre/git-fixes.patch
@@ -0,0 +1,1607 @@
+From 3341545edba359b292a8ef6db1b7d342caf3dcf1 Mon Sep 17 00:00:00 2001
+From: Leon Bottou <leon@bottou.org>
+Date: Wed, 4 May 2011 21:25:35 -0700
+Subject: [PATCH] Added include <stddef.h> for gcc-4.6
+
+---
+ libdjvu/BSByteStream.cpp | 1 +
+ libdjvu/BSEncodeByteStream.cpp | 1 +
+ libdjvu/ByteStream.cpp | 1 +
+ libdjvu/DjVuFileCache.cpp | 1 +
+ libdjvu/DjVuGlobal.cpp | 2 ++
+ libdjvu/DjVuGlobalMemory.cpp | 2 ++
+ libdjvu/DjVuMessage.cpp | 1 +
+ libdjvu/DjVuMessageLite.cpp | 2 +-
+ libdjvu/DjVuPalette.cpp | 2 ++
+ libdjvu/DjVuPort.h | 1 +
+ libdjvu/DjVuToPS.cpp | 1 +
+ libdjvu/GBitmap.cpp | 2 ++
+ libdjvu/GException.cpp | 1 +
+ libdjvu/GOS.cpp | 1 +
+ libdjvu/GPixmap.cpp | 2 ++
+ libdjvu/GSmartPointer.cpp | 1 +
+ libdjvu/GSmartPointer.h | 2 ++
+ libdjvu/GString.cpp | 1 +
+ libdjvu/GString.h | 1 +
+ libdjvu/GThreads.cpp | 2 ++
+ libdjvu/GURL.cpp | 1 +
+ libdjvu/GUnicode.cpp | 2 ++
+ libdjvu/IFFByteStream.h | 1 +
+ libdjvu/IW44EncodeCodec.cpp | 1 +
+ libdjvu/IW44Image.cpp | 1 +
+ libdjvu/JPEGDecoder.h | 1 +
+ libdjvu/MMX.cpp | 1 +
+ libdjvu/UnicodeByteStream.h | 1 +
+ libdjvu/XMLParser.cpp | 1 +
+ libdjvu/ZPCodec.cpp | 2 ++
+ libdjvu/atomic.cpp | 1 +
+ libdjvu/ddjvuapi.cpp | 1 +
+ libdjvu/ddjvuapi.h | 1 +
+ libdjvu/miniexp.cpp | 1 +
+ libdjvu/miniexp.h | 3 ++-
+ tools/bzz.cpp | 1 +
+ tools/c44.cpp | 1 +
+ tools/cjb2.cpp | 1 +
+ tools/cpaldjvu.cpp | 1 +
+ tools/csepdjvu.cpp | 1 +
+ tools/ddjvu.cpp | 1 +
+ tools/djvm.cpp | 2 +-
+ tools/djvmcvt.cpp | 1 +
+ tools/djvudump.cpp | 1 +
+ tools/djvuextract.cpp | 1 +
+ tools/djvumake.cpp | 1 +
+ tools/djvups.cpp | 1 +
+ tools/djvused.cpp | 1 +
+ tools/djvuserve.cpp | 1 +
+ tools/djvutxt.cpp | 1 +
+ tools/tiff2pdf.h | 1 +
+ xmltools/djvutoxml.cpp | 1 +
+ xmltools/djvuxmlparser.cpp | 1 +
+ 53 files changed, 63 insertions(+), 3 deletions(-)
+
+diff --git a/libdjvu/BSByteStream.cpp b/libdjvu/BSByteStream.cpp
+index b762ccf..d662ab0 100644
+--- a/libdjvu/BSByteStream.cpp
++++ b/libdjvu/BSByteStream.cpp
+@@ -62,6 +62,7 @@
+
+ // - Author: Leon Bottou, 07/1998
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+diff --git a/libdjvu/BSEncodeByteStream.cpp b/libdjvu/BSEncodeByteStream.cpp
+index 5d80e51..68bc3e3 100644
+--- a/libdjvu/BSEncodeByteStream.cpp
++++ b/libdjvu/BSEncodeByteStream.cpp
+@@ -71,6 +71,7 @@
+ #include "GOS.h"
+ #endif
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+diff --git a/libdjvu/ByteStream.cpp b/libdjvu/ByteStream.cpp
+index 158c33c..be01847 100644
+--- a/libdjvu/ByteStream.cpp
++++ b/libdjvu/ByteStream.cpp
+@@ -73,6 +73,7 @@
+ #include "GOS.h"
+ #include "GURL.h"
+ #include "DjVuMessage.h"
++#include <stddef.h>
+ #include <fcntl.h>
+ #if defined(WIN32) || defined(__CYGWIN32__)
+ # include <io.h>
+diff --git a/libdjvu/DjVuFileCache.cpp b/libdjvu/DjVuFileCache.cpp
+index 6b1e85d..7d7a192 100644
+--- a/libdjvu/DjVuFileCache.cpp
++++ b/libdjvu/DjVuFileCache.cpp
+@@ -63,6 +63,7 @@
+ #include "DjVuFileCache.h"
+ #include "debug.h"
+
++#include <stddef.h>
+ #include <stdlib.h>
+
+
+diff --git a/libdjvu/DjVuGlobal.cpp b/libdjvu/DjVuGlobal.cpp
+index e6d3cec..df9278e 100644
+--- a/libdjvu/DjVuGlobal.cpp
++++ b/libdjvu/DjVuGlobal.cpp
+@@ -76,6 +76,8 @@
+ #include "GThreads.h"
+ #include "GException.h"
+ #include "GContainer.h"
++
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+diff --git a/libdjvu/DjVuGlobalMemory.cpp b/libdjvu/DjVuGlobalMemory.cpp
+index 3c6012c..c8ba309 100644
+--- a/libdjvu/DjVuGlobalMemory.cpp
++++ b/libdjvu/DjVuGlobalMemory.cpp
+@@ -67,6 +67,8 @@
+
+ #include "DjVuGlobal.h"
+ #include "GException.h"
++
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include "debug.h"
+diff --git a/libdjvu/DjVuMessage.cpp b/libdjvu/DjVuMessage.cpp
+index 6f5a735..1726025 100644
+--- a/libdjvu/DjVuMessage.cpp
++++ b/libdjvu/DjVuMessage.cpp
+@@ -71,6 +71,7 @@
+ #include "debug.h"
+ #include <ctype.h>
+ #include <string.h>
++#include <stddef.h>
+ #include <stdlib.h>
+ #ifdef WIN32
+ # include <tchar.h>
+diff --git a/libdjvu/DjVuMessageLite.cpp b/libdjvu/DjVuMessageLite.cpp
+index b8c1010..5daa9d9 100644
+--- a/libdjvu/DjVuMessageLite.cpp
++++ b/libdjvu/DjVuMessageLite.cpp
+@@ -73,8 +73,8 @@
+ #include "debug.h"
+ #include <ctype.h>
+ #include <string.h>
++#include <stddef.h>
+ #include <stdlib.h>
+-// #include <stdio.h>
+ #ifdef WIN32
+ #include <tchar.h>
+ #include <windows.h>
+diff --git a/libdjvu/DjVuPalette.cpp b/libdjvu/DjVuPalette.cpp
+index c489f7b..76b0bf4 100644
+--- a/libdjvu/DjVuPalette.cpp
++++ b/libdjvu/DjVuPalette.cpp
+@@ -64,6 +64,8 @@
+ #include "ByteStream.h"
+ #include "BSByteStream.h"
+ #include "DjVuPalette.h"
++
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <math.h>
+
+diff --git a/libdjvu/DjVuPort.h b/libdjvu/DjVuPort.h
+index f6a92f6..e2b3125 100644
+--- a/libdjvu/DjVuPort.h
++++ b/libdjvu/DjVuPort.h
+@@ -65,6 +65,7 @@
+
+ #include "GThreads.h"
+ #include "GURL.h"
++#include "stddef.h"
+
+ #ifdef HAVE_NAMESPACES
+ namespace DJVU {
+diff --git a/libdjvu/DjVuToPS.cpp b/libdjvu/DjVuToPS.cpp
+index 5517bf3..6914ff9 100644
+--- a/libdjvu/DjVuToPS.cpp
++++ b/libdjvu/DjVuToPS.cpp
+@@ -72,6 +72,7 @@
+ #include "GPixmap.h"
+ #include "debug.h"
+ #include <stdarg.h>
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <time.h>
+diff --git a/libdjvu/GBitmap.cpp b/libdjvu/GBitmap.cpp
+index ab5c0de..797edcc 100644
+--- a/libdjvu/GBitmap.cpp
++++ b/libdjvu/GBitmap.cpp
+@@ -66,6 +66,8 @@
+ #include "GString.h"
+ #include "GThreads.h"
+ #include "GException.h"
++#include <stddef.h>
++#include <stdlib.h>
+ #include <string.h>
+
+ // - Author: Leon Bottou, 05/1997
+diff --git a/libdjvu/GException.cpp b/libdjvu/GException.cpp
+index 2ea179a..89da70f 100644
+--- a/libdjvu/GException.cpp
++++ b/libdjvu/GException.cpp
+@@ -60,6 +60,7 @@
+ # pragma implementation
+ #endif
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+diff --git a/libdjvu/GOS.cpp b/libdjvu/GOS.cpp
+index e784932..d2088e2 100644
+--- a/libdjvu/GOS.cpp
++++ b/libdjvu/GOS.cpp
+@@ -65,6 +65,7 @@
+ #include "GOS.h"
+ #include "GURL.h"
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <ctype.h>
+diff --git a/libdjvu/GPixmap.cpp b/libdjvu/GPixmap.cpp
+index 392df54..4bf6f57 100644
+--- a/libdjvu/GPixmap.cpp
++++ b/libdjvu/GPixmap.cpp
+@@ -75,6 +75,8 @@
+ #include "GThreads.h"
+ #include "Arrays.h"
+ #include "JPEGDecoder.h"
++
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <math.h>
+ #include <assert.h>
+diff --git a/libdjvu/GSmartPointer.cpp b/libdjvu/GSmartPointer.cpp
+index 6e523e7..58aef5b 100644
+--- a/libdjvu/GSmartPointer.cpp
++++ b/libdjvu/GSmartPointer.cpp
+@@ -67,6 +67,7 @@
+ // Our original implementation consisted of multiple classes.
+ // <http://prdownloads.sourceforge.net/djvu/DjVu2_2b-src.tgz>.
+
++#include <stddef.h>
+ #include <string.h>
+ #if PARANOID_DEBUG
+ # include <assert.h>
+diff --git a/libdjvu/GSmartPointer.h b/libdjvu/GSmartPointer.h
+index 82781bd..8a8bb8a 100644
+--- a/libdjvu/GSmartPointer.h
++++ b/libdjvu/GSmartPointer.h
+@@ -97,6 +97,8 @@
+ #include "DjVuGlobal.h"
+ #include "atomic.h"
+
++#include <stddef.h>
++
+ #ifdef HAVE_NAMESPACES
+ namespace DJVU {
+ # ifdef NOT_DEFINED // Just to fool emacs c++ mode
+diff --git a/libdjvu/GString.cpp b/libdjvu/GString.cpp
+index 03f6226..350b11b 100644
+--- a/libdjvu/GString.cpp
++++ b/libdjvu/GString.cpp
+@@ -73,6 +73,7 @@
+ #include "GThreads.h"
+ #include "debug.h"
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+diff --git a/libdjvu/GString.h b/libdjvu/GString.h
+index b63b753..3aa1f76 100644
+--- a/libdjvu/GString.h
++++ b/libdjvu/GString.h
+@@ -108,6 +108,7 @@
+ #include "DjVuGlobal.h"
+ #include "GContainer.h"
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdarg.h>
+ #ifdef WIN32
+diff --git a/libdjvu/GThreads.cpp b/libdjvu/GThreads.cpp
+index d81f3c3..253fed8 100644
+--- a/libdjvu/GThreads.cpp
++++ b/libdjvu/GThreads.cpp
+@@ -71,6 +71,8 @@
+ #include "GThreads.h"
+ #include "GException.h"
+ #include "DjVuMessageLite.h"
++
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+
+diff --git a/libdjvu/GURL.cpp b/libdjvu/GURL.cpp
+index c37bf52..a80078c 100644
+--- a/libdjvu/GURL.cpp
++++ b/libdjvu/GURL.cpp
+@@ -72,6 +72,7 @@
+ #include "GURL.h"
+ #include "debug.h"
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <ctype.h>
+diff --git a/libdjvu/GUnicode.cpp b/libdjvu/GUnicode.cpp
+index 415c081..a8b25b8 100644
+--- a/libdjvu/GUnicode.cpp
++++ b/libdjvu/GUnicode.cpp
+@@ -62,6 +62,8 @@
+
+ #include "GString.h"
+
++#include <stddef.h>
++
+ #if HAS_ICONV
+ #include <iconv.h>
+ #endif
+diff --git a/libdjvu/IFFByteStream.h b/libdjvu/IFFByteStream.h
+index a653f8c..e31b216 100644
+--- a/libdjvu/IFFByteStream.h
++++ b/libdjvu/IFFByteStream.h
+@@ -124,6 +124,7 @@
+
+
+ #include "DjVuGlobal.h"
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+diff --git a/libdjvu/IW44EncodeCodec.cpp b/libdjvu/IW44EncodeCodec.cpp
+index 8d7b12c..49081b7 100644
+--- a/libdjvu/IW44EncodeCodec.cpp
++++ b/libdjvu/IW44EncodeCodec.cpp
+@@ -76,6 +76,7 @@
+ #include "IFFByteStream.h"
+ #include "GRect.h"
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <math.h>
+diff --git a/libdjvu/IW44Image.cpp b/libdjvu/IW44Image.cpp
+index 9476726..4a19fb5 100644
+--- a/libdjvu/IW44Image.cpp
++++ b/libdjvu/IW44Image.cpp
+@@ -76,6 +76,7 @@
+ #include "IFFByteStream.h"
+ #include "GRect.h"
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <math.h>
+diff --git a/libdjvu/JPEGDecoder.h b/libdjvu/JPEGDecoder.h
+index bd430a0..fad1d4c 100644
+--- a/libdjvu/JPEGDecoder.h
++++ b/libdjvu/JPEGDecoder.h
+@@ -64,6 +64,7 @@
+
+ #ifdef NEED_JPEG_DECODER
+
++#include <stddef.h>
+ #include <string.h>
+ #include <setjmp.h>
+
+diff --git a/libdjvu/MMX.cpp b/libdjvu/MMX.cpp
+index 5ab60bb..528dab6 100644
+--- a/libdjvu/MMX.cpp
++++ b/libdjvu/MMX.cpp
+@@ -62,6 +62,7 @@
+
+ #include "MMX.h"
+ #include <stdio.h>
++#include <stddef.h>
+ #include <stdlib.h>
+
+
+diff --git a/libdjvu/UnicodeByteStream.h b/libdjvu/UnicodeByteStream.h
+index 0ae112b..9b49a17 100644
+--- a/libdjvu/UnicodeByteStream.h
++++ b/libdjvu/UnicodeByteStream.h
+@@ -88,6 +88,7 @@
+ #include "GString.h"
+ #include "ByteStream.h"
+
++#include <stddef.h>
+
+ #ifdef HAVE_NAMESPACES
+ namespace DJVU {
+diff --git a/libdjvu/XMLParser.cpp b/libdjvu/XMLParser.cpp
+index 84386c5..7da923a 100644
+--- a/libdjvu/XMLParser.cpp
++++ b/libdjvu/XMLParser.cpp
+@@ -75,6 +75,7 @@
+ #include "debug.h"
+ #include <stdio.h>
+ #include <ctype.h>
++#include <stddef.h>
+ #include <stdlib.h>
+
+
+diff --git a/libdjvu/ZPCodec.cpp b/libdjvu/ZPCodec.cpp
+index f6e971d..ff5b9bf 100644
+--- a/libdjvu/ZPCodec.cpp
++++ b/libdjvu/ZPCodec.cpp
+@@ -66,6 +66,8 @@
+ #include "ZPCodec.h"
+ #include "ByteStream.h"
+ #include "GException.h"
++
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <assert.h>
+ #include <math.h>
+diff --git a/libdjvu/atomic.cpp b/libdjvu/atomic.cpp
+index bdc193e..63fd483 100644
+--- a/libdjvu/atomic.cpp
++++ b/libdjvu/atomic.cpp
+@@ -28,6 +28,7 @@
+ # include "config.h"
+ #endif
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <assert.h>
+ #include "atomic.h"
+diff --git a/libdjvu/ddjvuapi.cpp b/libdjvu/ddjvuapi.cpp
+index b18b84b..f40f5aa 100644
+--- a/libdjvu/ddjvuapi.cpp
++++ b/libdjvu/ddjvuapi.cpp
+@@ -60,6 +60,7 @@
+ # pragma implementation "ddjvuapi.h"
+ #endif
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+diff --git a/libdjvu/ddjvuapi.h b/libdjvu/ddjvuapi.h
+index d0ed48f..841f223 100644
+--- a/libdjvu/ddjvuapi.h
++++ b/libdjvu/ddjvuapi.h
+@@ -64,6 +64,7 @@ extern "C" {
+ }
+ #endif
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+
+diff --git a/libdjvu/miniexp.cpp b/libdjvu/miniexp.cpp
+index e0fb087..fc51297 100644
+--- a/libdjvu/miniexp.cpp
++++ b/libdjvu/miniexp.cpp
+@@ -23,6 +23,7 @@
+ # pragma implementation "miniexp.h"
+ #endif
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <ctype.h>
+diff --git a/libdjvu/miniexp.h b/libdjvu/miniexp.h
+index 91e345d..993005b 100644
+--- a/libdjvu/miniexp.h
++++ b/libdjvu/miniexp.h
+@@ -38,7 +38,8 @@ extern "C" {
+ #ifndef MINILISPAPI
+ # define MINILISPAPI /**/
+ #endif
+-
++
++#include <stddef.h>
+
+ /* -------------------------------------------------- */
+ /* LISP EXPRESSIONS */
+diff --git a/tools/bzz.cpp b/tools/bzz.cpp
+index ca092e1..2ebc7b9 100644
+--- a/tools/bzz.cpp
++++ b/tools/bzz.cpp
+@@ -94,6 +94,7 @@
+ #include "GURL.h"
+ #include "DjVuMessage.h"
+ #include <locale.h>
++#include <stddef.h>
+ #include <stdlib.h>
+
+ static const char *program = "(unknown)";
+diff --git a/tools/c44.cpp b/tools/c44.cpp
+index 6f23b53..855504b 100644
+--- a/tools/c44.cpp
++++ b/tools/c44.cpp
+@@ -226,6 +226,7 @@
+ #include <locale.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <stddef.h>
+ #include <stdlib.h>
+
+ // command line data
+diff --git a/tools/cjb2.cpp b/tools/cjb2.cpp
+index 8cf89b9..11eb662 100644
+--- a/tools/cjb2.cpp
++++ b/tools/cjb2.cpp
+@@ -120,6 +120,7 @@
+ #include "jb2tune.h"
+
+ #include <locale.h>
++#include <stddef.h>
+ #include <stdlib.h>
+ #if HAVE_TIFF
+ #include <tiffio.h>
+diff --git a/tools/cpaldjvu.cpp b/tools/cpaldjvu.cpp
+index 111cbd3..b640a7a 100644
+--- a/tools/cpaldjvu.cpp
++++ b/tools/cpaldjvu.cpp
+@@ -118,6 +118,7 @@
+ #include "jb2tune.h"
+
+ #include <locale.h>
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <math.h>
+
+diff --git a/tools/csepdjvu.cpp b/tools/csepdjvu.cpp
+index cd721f8..d5203d5 100644
+--- a/tools/csepdjvu.cpp
++++ b/tools/csepdjvu.cpp
+@@ -162,6 +162,7 @@
+ #include "jb2tune.h"
+
+ #include <locale.h>
++#include <stddef.h>
+ #include <stdlib.h>
+
+ #undef MIN
+diff --git a/tools/ddjvu.cpp b/tools/ddjvu.cpp
+index 817e045..981a270 100644
+--- a/tools/ddjvu.cpp
++++ b/tools/ddjvu.cpp
+@@ -62,6 +62,7 @@
+ # include "config.h"
+ #endif
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <stdarg.h>
+diff --git a/tools/djvm.cpp b/tools/djvm.cpp
+index 951bd66..6ea88c2 100644
+--- a/tools/djvm.cpp
++++ b/tools/djvm.cpp
+@@ -135,9 +135,9 @@
+ #include "DjVuMessage.h"
+
+ #include <locale.h>
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+-#include <stdlib.h>
+
+ static const char * progname;
+
+diff --git a/tools/djvmcvt.cpp b/tools/djvmcvt.cpp
+index 9ca1c54..20b468a 100644
+--- a/tools/djvmcvt.cpp
++++ b/tools/djvmcvt.cpp
+@@ -144,6 +144,7 @@
+
+ #include <locale.h>
+ #include <stdio.h>
++#include <stddef.h>
+ #include <stdlib.h>
+
+ static const char * progname;
+diff --git a/tools/djvudump.cpp b/tools/djvudump.cpp
+index 6a0215a..2dddbdf 100644
+--- a/tools/djvudump.cpp
++++ b/tools/djvudump.cpp
+@@ -119,6 +119,7 @@ xxx
+ #include <locale.h>
+ #include <stdio.h>
+ #include <ctype.h>
++#include <stddef.h>
+ #include <stdlib.h>
+
+ void
+diff --git a/tools/djvuextract.cpp b/tools/djvuextract.cpp
+index 4a9f381..907b99c 100644
+--- a/tools/djvuextract.cpp
++++ b/tools/djvuextract.cpp
+@@ -105,6 +105,7 @@
+ #include "GOS.h"
+ #include "DjVuMessage.h"
+ #include <locale.h>
++#include <stddef.h>
+ #include <stdlib.h>
+
+
+diff --git a/tools/djvumake.cpp b/tools/djvumake.cpp
+index 7020484..4c5fc0f 100644
+--- a/tools/djvumake.cpp
++++ b/tools/djvumake.cpp
+@@ -153,6 +153,7 @@
+
+ #include <locale.h>
+ #include <stdio.h>
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <ctype.h>
+
+diff --git a/tools/djvups.cpp b/tools/djvups.cpp
+index 51aa999..632b832 100644
+--- a/tools/djvups.cpp
++++ b/tools/djvups.cpp
+@@ -57,6 +57,7 @@
+ # include "config.h"
+ #endif
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <stdarg.h>
+diff --git a/tools/djvused.cpp b/tools/djvused.cpp
+index de84dcd..687fdca 100644
+--- a/tools/djvused.cpp
++++ b/tools/djvused.cpp
+@@ -61,6 +61,7 @@
+ #endif
+
+ #include <stdio.h>
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdarg.h>
+ #include <errno.h>
+diff --git a/tools/djvuserve.cpp b/tools/djvuserve.cpp
+index 19a17da..818fe78 100644
+--- a/tools/djvuserve.cpp
++++ b/tools/djvuserve.cpp
+@@ -73,6 +73,7 @@
+
+ #include <locale.h>
+ #include <stdio.h>
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <sys/stat.h>
+ #include <time.h>
+diff --git a/tools/djvutxt.cpp b/tools/djvutxt.cpp
+index ba2c745..9e9124c 100644
+--- a/tools/djvutxt.cpp
++++ b/tools/djvutxt.cpp
+@@ -61,6 +61,7 @@
+ # include "config.h"
+ #endif
+
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <stdarg.h>
+diff --git a/tools/tiff2pdf.h b/tools/tiff2pdf.h
+index 082f5fb..656dc43 100644
+--- a/tools/tiff2pdf.h
++++ b/tools/tiff2pdf.h
+@@ -22,6 +22,7 @@
+ # endif
+ # if HAVE_TIFF
+ # include <stdio.h>
++# include <stddef.h>
+ # include <stdlib.h>
+ # include <tiff.h>
+ # include <tiffio.h>
+diff --git a/xmltools/djvutoxml.cpp b/xmltools/djvutoxml.cpp
+index 17c769b..b40535e 100644
+--- a/xmltools/djvutoxml.cpp
++++ b/xmltools/djvutoxml.cpp
+@@ -71,6 +71,7 @@
+
+ #include <locale.h>
+ #include <stdio.h>
++#include <stddef.h>
+ #include <stdlib.h>
+ #include <sys/stat.h>
+ #include <assert.h>
+diff --git a/xmltools/djvuxmlparser.cpp b/xmltools/djvuxmlparser.cpp
+index bdc5768..6679a9d 100644
+--- a/xmltools/djvuxmlparser.cpp
++++ b/xmltools/djvuxmlparser.cpp
+@@ -70,6 +70,7 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <locale.h>
++#include <stddef.h>
+ #include <stdlib.h>
+
+ static void
+--
+1.7.4.1
+
+From 3cc41e2a72bbd6d34e81a9a214abbebf41cc00c7 Mon Sep 17 00:00:00 2001
+From: Leon Bottou <leon@bottou.org>
+Date: Sat, 21 May 2011 09:27:17 -0700
+Subject: [PATCH] Added ddjvu option to skip corrupted pages.
+
+---
+ tools/ddjvu.1 | 7 +++++++
+ tools/ddjvu.cpp | 49 +++++++++++++++++++++++++++++++++----------------
+ 2 files changed, 40 insertions(+), 16 deletions(-)
+
+diff --git a/tools/ddjvu.1 b/tools/ddjvu.1
+index 29285c3..7d3d105 100644
+--- a/tools/ddjvu.1
++++ b/tools/ddjvu.1
+@@ -178,6 +178,13 @@ select specific layers of a DjVu image.
+ These modes can fail if the DjVu image does
+ not contain the selected layer.
+ .RE
++.TP
++.BI "-skip"
++Instead of aborting when encountering a corrupted page,
++this option causes
++.BR ddjvu
++to simply skip the corrupted page and continue with the next.
++This is useful for processing certain damaged files.
+
+ .SH RESOLUTION OPTIONS
+ The following options control the resolution of the output image.
+diff --git a/tools/ddjvu.cpp b/tools/ddjvu.cpp
+index 981a270..b9cb038 100644
+--- a/tools/ddjvu.cpp
++++ b/tools/ddjvu.cpp
+@@ -132,6 +132,7 @@ ddjvu_rect_t info_size;
+ ddjvu_rect_t info_segment;
+ const char *inputfilename = 0;
+ const char *outputfilename = 0;
++int flag_skip_corrupted = 0;
+
+ #if HAVE_TIFF2PDF
+ char *tempfilename = 0;
+@@ -164,7 +165,6 @@ handle(int wait)
+ if (msg->m_error.filename)
+ fprintf(stderr,"ddjvu: '%s:%d'\n",
+ msg->m_error.filename, msg->m_error.lineno);
+- exit(10);
+ default:
+ break;
+ }
+@@ -554,8 +554,16 @@ dopage(int pageno)
+ while (! ddjvu_page_decoding_done(page))
+ handle(TRUE);
+ if (ddjvu_page_decoding_error(page))
+- die(i18n("Cannot decode page %d."), pageno);
+-
++ {
++ handle(FALSE);
++ fprintf(stderr,"ddjvu: ");
++ fprintf(stderr,i18n("Cannot decode page %d."), pageno);
++ fprintf(stderr,"\n");
++ if (flag_skip_corrupted)
++ return;
++ else
++ exit(10);
++ }
+ timingdata[1] = ticks();
+ /* Open files */
+ if (flag_format == 't')
+@@ -753,19 +761,20 @@ usage()
+ i18n("DjVu decompression utility\n\n"
+ "Usage: ddjvu [options] [<djvufile> [<outputfile>]]\n\n"
+ "Options:\n"
+- " -verbose Prints various informational messages.\n"
+- " -format=FMT Selects output format: pbm,pgm,ppm,pnm,rle,tiff.\n"
+- " -scale=N Selects display scale.\n"
+- " -size=WxH Selects size of rendered image.\n"
+- " -subsample=N Selects direct subsampling factor.\n"
+- " -aspect=no Authorizes aspect ratio changes\n"
+- " -segment=WxH+X+Y Selects which segment of the rendered image\n"
+- " -mode=black Renders a meaningful bitonal image.\n"
+- " -mode=mask Only renders the mask layer.\n"
+- " -mode=foreground Only renders the foreground layer.\n"
+- " -mode=background Only renders the background layer.\n"
+- " -page=PAGESPEC Selects page(s) to be decoded.\n"
+- " -quality=QUALITY Specifies jpeg quality for lossy tiff output.\n"
++ " -verbose Print various informational messages.\n"
++ " -format=FMT Select output format: pbm,pgm,ppm,pnm,rle,tiff.\n"
++ " -scale=N Select display scale.\n"
++ " -size=WxH Select size of rendered image.\n"
++ " -subsample=N Select direct subsampling factor.\n"
++ " -aspect=no Authorize aspect ratio changes\n"
++ " -segment=WxH+X+Y Select which segment of the rendered image\n"
++ " -mode=black Render a meaningful bitonal image.\n"
++ " -mode=mask Only render the mask layer.\n"
++ " -mode=foreground Only render the foreground layer.\n"
++ " -mode=background Only render the background layer.\n"
++ " -page=PAGESPEC Select page(s) to be decoded.\n"
++ " -skip Skip corrupted pages instead of aborting.\n"
++ " -quality=QUALITY Specify jpeg quality for lossy tiff output.\n"
+ "\n"
+ "If <outputfile> is a single dash or omitted, the decompressed image\n"
+ "is sent to the standard output. If <djvufile> is a single dash or\n"
+@@ -846,6 +855,12 @@ parse_option(int argc, char **argv, int i)
+ die(i18n(errarg), opt);
+ flag_verbose = 1;
+ }
++ if (!strcmp(opt,"skip"))
++ {
++ if (arg)
++ die(i18n(errarg), opt);
++ flag_skip_corrupted = 1;
++ }
+ else if (!strcmp(opt,"scale"))
+ {
+ if (!arg)
+@@ -1012,6 +1027,8 @@ main(int argc, char **argv)
+ die(i18n("Cannot open djvu document '%s'."), inputfilename);
+ while (! ddjvu_document_decoding_done(doc))
+ handle(TRUE);
++ if (ddjvu_document_decoding_error(doc))
++ die(i18n("Cannot decode document."));
+
+ /* Process all pages */
+ i = ddjvu_document_get_pagenum(doc);
+--
+1.7.4.1
+
+From 6a6e6a047b41a431cfc091bd71fcad554fd79437 Mon Sep 17 00:00:00 2001
+From: Leon Bottou <leon@bottou.org>
+Date: Mon, 30 May 2011 18:52:33 -0700
+Subject: [PATCH] Added option -o outputfile to djvudump.
+
+---
+ tools/djvudump.1 | 2 +-
+ tools/djvudump.cpp | 34 +++++++++++++++++++++++++---------
+ 2 files changed, 26 insertions(+), 10 deletions(-)
+
+diff --git a/tools/djvudump.1 b/tools/djvudump.1
+index c86b7d5..e39a318 100644
+--- a/tools/djvudump.1
++++ b/tools/djvudump.1
+@@ -27,7 +27,7 @@
+ djvudump \- Display internal structure of DjVu files.
+
+ .SH SYNOPSIS
+-.BI "djvudump " "djvufiles" "..."
++.BI "djvudump [-o " "outputfile" "] " "djvufiles" "..."
+
+ .SH DESCRIPTION
+ Program
+diff --git a/tools/djvudump.cpp b/tools/djvudump.cpp
+index 2dddbdf..6daaf2c 100644
+--- a/tools/djvudump.cpp
++++ b/tools/djvudump.cpp
+@@ -122,6 +122,9 @@ xxx
+ #include <stddef.h>
+ #include <stdlib.h>
+
++const char *outputfile = 0;
++FILE *outputf = stdout;
++
+ void
+ display(const GURL &url)
+ {
+@@ -134,7 +137,7 @@ display(const GURL &url)
+ obs->seek(0);
+ obs->readall(buf, size);
+ GNativeString ns = str;
+- fputs((const char*)ns, stdout);
++ fputs((const char*)ns, outputf);
+ }
+
+
+@@ -146,7 +149,7 @@ usage()
+ "DJVUDUMP --- DjVuLibre-" DJVULIBRE_VERSION "\n"
+ #endif
+ "Describes DjVu and IFF85 files\n\n"
+- "Usage: djvudump <iff_filenames>\n" );
++ "Usage: djvudump [-o outputfile] <iff_filenames>\n" );
+ exit(1);
+ }
+
+@@ -156,24 +159,37 @@ main(int argc, char **argv)
+ setlocale(LC_ALL,"");
+ setlocale(LC_NUMERIC,"C");
+ djvu_programname(argv[0]);
+- GArray<GUTF8String> dargv(0,argc-1);
++ // get output file name
++ if (argc>2 && !strcmp(argv[1],"-o"))
++ {
++ outputfile = argv[2];
++ argv += 2;
++ argc -= 2;
++ }
++ // convert iff file name
++ GArray<GUTF8String> dargv(0, argc-1);
+ for(int i=0;i<argc;++i)
+ dargv[i]=GNativeString(argv[i]);
++ if (argc <= 1)
++ usage();
++ if (outputfile && !(outputf = fopen(outputfile,"w")))
++ {
++ DjVuPrintErrorUTF8("djvudump: Cannot open output file.\n");
++ exit(1);
++ }
+ G_TRY
+ {
+- if (argc<=1)
+- usage();
+ for (int i=1; i<argc; i++)
+- {
++ {
+ const GURL::Filename::UTF8 url(dargv[i]);
+ display(url);
+- }
++ }
+ }
+ G_CATCH(ex)
+- {
++ {
+ ex.perror();
+ exit(1);
+- }
++ }
+ G_ENDCATCH;
+ return 0;
+ }
+--
+1.7.4.1
+
+From 6db359d1ad5e7e863fac53301e7ff884cfe44423 Mon Sep 17 00:00:00 2001
+From: Bill C Riemers <briemers@redhat.com>
+Date: Thu, 2 Jun 2011 13:17:27 -0400
+Subject: [PATCH] Correct error copying an error in the annotation class of assigning a tempory
+ GUTF8String directly to a const char *.
+
+---
+ libdjvu/DjVuAnno.cpp | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/libdjvu/DjVuAnno.cpp b/libdjvu/DjVuAnno.cpp
+index 6ca5b4e..e2a9108 100644
+--- a/libdjvu/DjVuAnno.cpp
++++ b/libdjvu/DjVuAnno.cpp
+@@ -261,7 +261,8 @@ GLObject::print(ByteStream & str, int compact, int indent, int * cur_pos) const
+ to_print=buffer.format("%d",number);
+ break;
+ case STRING:
+- to_print=make_c_string(string);
++ buffer=make_c_string(string);
++ to_print=(const char *)buffer;
+ break;
+ case SYMBOL:
+ to_print=buffer.format("%s",(const char *)symbol);
+--
+1.7.4.1
+
+From 2b26415c3c46ffb7532ca250990668564be62d39 Mon Sep 17 00:00:00 2001
+From: Leon Bottou <leon@bottou.org>
+Date: Thu, 2 Jun 2011 09:48:49 -0700
+Subject: [PATCH] Corrected polarity of xmp annotation saving
+
+---
+ libdjvu/DjVuAnno.cpp | 19 ++++++++++---------
+ 1 files changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/libdjvu/DjVuAnno.cpp b/libdjvu/DjVuAnno.cpp
+index e2a9108..8e16dd8 100644
+--- a/libdjvu/DjVuAnno.cpp
++++ b/libdjvu/DjVuAnno.cpp
+@@ -254,25 +254,24 @@ GLObject::print(ByteStream & str, int compact, int indent, int * cur_pos) const
+ if (!cur_pos) { cur_pos = &local_cur_pos; }
+
+ GUTF8String buffer;
+- const char * to_print=0;
+ switch(type)
+ {
+ case NUMBER:
+- to_print=buffer.format("%d",number);
++ buffer.format("%d",number);
+ break;
+ case STRING:
+- buffer=make_c_string(string);
+- to_print=(const char *)buffer;
++ buffer = make_c_string(string);
+ break;
+ case SYMBOL:
+- to_print=buffer.format("%s",(const char *)symbol);
++ buffer.format("%s",(const char *)symbol);
+ break;
+ case LIST:
+- to_print=buffer.format("(%s",(const char *)name);
++ buffer.format("(%s",(const char *)name);
+ break;
+ case INVALID:
+ break;
+ }
++ const char * to_print = (const char*)buffer;
+ if (!compact && *cur_pos+strlen(to_print)>70)
+ {
+ char ch='\n';
+@@ -1375,7 +1374,7 @@ DjVuANT::encode_raw(void) const
+ }
+ //*** XMP Metadata
+ del_all_items(XMP_TAG, parser);
+- if (!xmpmetadata)
++ if (!!xmpmetadata)
+ {
+ GUTF8String mdatabuffer("(");
+ mdatabuffer += XMP_TAG;
+@@ -1385,8 +1384,10 @@ DjVuANT::encode_raw(void) const
+ //*** Mapareas
+ del_all_items(GMapArea::MAPAREA_TAG, parser);
+ for(GPosition pos=map_areas;pos;++pos)
+- parser.parse(map_areas[pos]->print());
+-
++ {
++ GUTF8String mapareabuffer = map_areas[pos]->print();
++ parser.parse(mapareabuffer);
++ }
+ GP<ByteStream> gstr=ByteStream::create();
+ ByteStream &str=*gstr;
+ parser.print(str, 1);
+--
+1.7.4.1
+
+From 65600b5801d11ff8ca8db3a25bf004fc06f4515b Mon Sep 17 00:00:00 2001
+From: Leon Bottou <leon@bottou.org>
+Date: Sat, 4 Jun 2011 15:29:18 -0700
+Subject: [PATCH] Eliminate warnings with gcc-4.6.0
+
+---
+ libdjvu/Arrays.cpp | 2 -
+ libdjvu/DjVuDocEditor.cpp | 37 +++++++++----------
+ libdjvu/GString.cpp | 44 ++++++++--------------
+ libdjvu/JPEGDecoder.cpp | 2 -
+ libdjvu/XMLParser.cpp | 7 +---
+ tools/ddjvu.cpp | 2 +-
+ tools/jb2cmp/patterns.cpp | 87 +-------------------------------------------
+ tools/tiff2pdf.c | 9 ++---
+ 8 files changed, 40 insertions(+), 150 deletions(-)
+
+diff --git a/libdjvu/Arrays.cpp b/libdjvu/Arrays.cpp
+index c4f74ca..6c7f23a 100644
+--- a/libdjvu/Arrays.cpp
++++ b/libdjvu/Arrays.cpp
+@@ -239,9 +239,7 @@ ArrayRep::ins(int n, const void * what, unsigned int howmany)
+ copy(ndata, lobound-minlo, hibound-minlo,
+ data, lobound-minlo, hibound-minlo);
+ destroy(data, lobound-minlo, hibound-minlo);
+- void *tmp=data;
+ data=ndata;
+- tmp=data;
+ maxhi = nmaxhi;
+ }
+
+diff --git a/libdjvu/DjVuDocEditor.cpp b/libdjvu/DjVuDocEditor.cpp
+index 2247e40..f1d8b0d 100644
+--- a/libdjvu/DjVuDocEditor.cpp
++++ b/libdjvu/DjVuDocEditor.cpp
+@@ -555,27 +555,24 @@ DjVuDocEditor::insert_file(const GURL &file_url, bool is_page,
+ can_compress_flag);
+ }
+
+- // Oh. It does exist... Check that it has IFF structure
++ // Oh. It does exist... Check that it has IFF structure
+ {
+- const GP<IFFByteStream> giff(
+- IFFByteStream::create(file_pool->get_stream()));
+- IFFByteStream &iff=*giff;
+- GUTF8String chkid;
+-
+- int length;
+- length=iff.get_chunk(chkid);
+- if (chkid!="FORM:DJVI" && chkid!="FORM:DJVU" &&
+- chkid!="FORM:BM44" && chkid!="FORM:PM44")
+- G_THROW( ERR_MSG("DjVuDocEditor.not_1_page") "\t"+file_url.get_string());
+-
+- // Wonderful. It's even a DjVu file. Scan for NDIR chunks.
+- // If NDIR chunk is found, ignore the file
+- while(iff.get_chunk(chkid))
+- {
+- if (chkid=="NDIR")
+- return false;
+- iff.close_chunk();
+- }
++ const GP<IFFByteStream> giff(
++ IFFByteStream::create(file_pool->get_stream()));
++ IFFByteStream &iff=*giff;
++ GUTF8String chkid;
++ if (chkid!="FORM:DJVI" && chkid!="FORM:DJVU" &&
++ chkid!="FORM:BM44" && chkid!="FORM:PM44")
++ G_THROW( ERR_MSG("DjVuDocEditor.not_1_page") "\t"
++ + file_url.get_string());
++ // Wonderful. It's even a DjVu file. Scan for NDIR chunks.
++ // If NDIR chunk is found, ignore the file
++ while(iff.get_chunk(chkid))
++ {
++ if (chkid=="NDIR")
++ return false;
++ iff.close_chunk();
++ }
+ }
+ return insert_file(file_pool,file_url,is_page,file_pos,name2id,source);
+ }
+diff --git a/libdjvu/GString.cpp b/libdjvu/GString.cpp
+index 350b11b..ed92a7f 100644
+--- a/libdjvu/GString.cpp
++++ b/libdjvu/GString.cpp
+@@ -643,26 +643,22 @@ GBaseString::UTF8ToNative(
+ const char *source=(*this);
+ GP<GStringRep> retval;
+ if(source && source[0])
+- {
+-#if DO_CHANGELOCALE
+- GUTF8String lc_ctype(setlocale(LC_CTYPE,0));
+-#endif
+- bool repeat;
+- for(repeat=!currentlocale;;repeat=false)
+ {
+- retval=(*this)->toNative((GStringRep::EscapeMode)escape);
+ #if DO_CHANGELOCALE
+- if (!repeat || retval || (lc_ctype == setlocale(LC_CTYPE,"")))
++ GUTF8String lc_ctype(setlocale(LC_CTYPE,0));
++ bool repeat;
++ for(repeat=!currentlocale;;repeat=false)
++ {
+ #endif
+- break;
+- }
++ retval=(*this)->toNative((GStringRep::EscapeMode)escape);
+ #if DO_CHANGELOCALE
+- if(!repeat)
+- {
++ if (!repeat || retval || (lc_ctype == setlocale(LC_CTYPE,"")))
++ break;
++ }
++ if(!repeat)
+ setlocale(LC_CTYPE,(const char *)lc_ctype);
+- }
+ #endif
+- }
++ }
+ return GNativeString(retval);
+ }
+
+@@ -697,27 +693,19 @@ GBaseString::NativeToUTF8(void) const
+ const char *source=(*this);
+ #if DO_CHANGELOCALE
+ GUTF8String lc_ctype=setlocale(LC_CTYPE,0);
+-#endif
+ bool repeat;
+ for(repeat=true;;repeat=false)
+- {
+- if( (retval=GStringRep::NativeToUTF8(source)) )
+ {
+- if(GStringRep::cmp(retval->toNative(),source))
+- {
+- retval=GStringRep::UTF8::create((unsigned int)0);
+- }
+- }
+-#if DO_CHANGELOCALE
+- if(!repeat || retval || (lc_ctype == setlocale(LC_CTYPE,"")))
+ #endif
+- break;
+- }
++ if( (retval=GStringRep::NativeToUTF8(source)) )
++ if(GStringRep::cmp(retval->toNative(),source))
++ retval=GStringRep::UTF8::create((unsigned int)0);
+ #if DO_CHANGELOCALE
++ if(!repeat || retval || (lc_ctype == setlocale(LC_CTYPE,"")))
++ break;
++ }
+ if(!repeat)
+- {
+ setlocale(LC_CTYPE,(const char *)lc_ctype);
+- }
+ #endif
+ }
+ return GUTF8String(retval);
+diff --git a/libdjvu/JPEGDecoder.cpp b/libdjvu/JPEGDecoder.cpp
+index cb7aa97..f22f77a 100644
+--- a/libdjvu/JPEGDecoder.cpp
++++ b/libdjvu/JPEGDecoder.cpp
+@@ -153,7 +153,6 @@ JPEGDecoder::decode(ByteStream & bs,GPixmap &pix)
+
+ JSAMPARRAY buffer; /* Output row buffer */
+ int row_stride; /* physical row width in output buffer */
+- int full_buf_size;
+ int isGrey,i;
+
+ cinfo.err = jpeg_std_error(&jerr.pub);
+@@ -184,7 +183,6 @@ JPEGDecoder::decode(ByteStream & bs,GPixmap &pix)
+
+ /* JSAMPLEs per row in output buffer */
+ row_stride = cinfo.output_width * cinfo.output_components;
+- full_buf_size = row_stride * cinfo.output_height;
+
+ /* Make a one-row-high sample array that will go away when done with image */
+ buffer = (*cinfo.mem->alloc_sarray)
+diff --git a/libdjvu/XMLParser.cpp b/libdjvu/XMLParser.cpp
+index 7da923a..026b27d 100644
+--- a/libdjvu/XMLParser.cpp
++++ b/libdjvu/XMLParser.cpp
+@@ -646,17 +646,12 @@ lt_XMLParser::Impl::parse(const lt_XMLTags &tags, GURL *pdjvufile)
+ GPosition datapos=args.contains("data");
+ if(datapos)
+ {
+- bool isDjVuType=false;
+ GPosition typePos(args.contains("type"));
+ if(typePos)
+- {
+- if(args[typePos] != mimetype)
+ {
+- // DjVuPrintErrorUTF8("Ignoring %s Object tag\n",mimetype);
++ if(args[typePos] != mimetype)
+ continue;
+ }
+- isDjVuType=true;
+- }
+ const GURL url = (pdjvufile) ? *pdjvufile
+ : GURL::UTF8(args[datapos],
+ (args[datapos][0] == '/') ? codebase.base() : codebase);
+diff --git a/tools/ddjvu.cpp b/tools/ddjvu.cpp
+index b9cb038..3b4ce16 100644
+--- a/tools/ddjvu.cpp
++++ b/tools/ddjvu.cpp
+@@ -855,7 +855,7 @@ parse_option(int argc, char **argv, int i)
+ die(i18n(errarg), opt);
+ flag_verbose = 1;
+ }
+- if (!strcmp(opt,"skip"))
++ else if (!strcmp(opt,"skip"))
+ {
+ if (arg)
+ die(i18n(errarg), opt);
+diff --git a/tools/jb2cmp/patterns.cpp b/tools/jb2cmp/patterns.cpp
+index e456902..b31cf4e 100644
+--- a/tools/jb2cmp/patterns.cpp
++++ b/tools/jb2cmp/patterns.cpp
+@@ -303,11 +303,8 @@ static int32 distance_by_pixeldiff_functions(Image *i1, Image *i2,
+ int32 (*compare_row)(byte *, byte *, int32),
+ int32 (*compare_with_white)(byte *, int32), int32 ceiling)
+ {
+- byte **p1, **p2;
+ int32 w1, w2, h1, h2;
+ int32 shift_x, shift_y; /* of i1's coordinate system with respect to i2 */
+- /*int32 s = 0, i, i_start, i_cap;
+- int32 right_margin_start, right_margin_width;*/
+
+ /* make i1 to be narrower than i2 */
+ if (i1->width > i2->width)
+@@ -317,8 +314,8 @@ static int32 distance_by_pixeldiff_functions(Image *i1, Image *i2,
+ i2 = img;
+ }
+
+- w1 = i1->width; h1 = i1->height; p1 = i1->pixels;
+- w2 = i2->width; h2 = i2->height; p2 = i2->pixels;
++ w1 = i1->width; h1 = i1->height;
++ w2 = i2->width; h2 = i2->height;
+
+ /* (shift_x, shift_y) */
+ /* is what should be added to i1's coordinates to get i2's coordinates. */
+@@ -339,86 +336,6 @@ static int32 distance_by_pixeldiff_functions(Image *i1, Image *i2,
+
+ return distance_by_pixeldiff_functions_by_shift(
+ i1, i2, compare_row, compare_with_white, ceiling, shift_x, shift_y);
+-
+-/* FIXME */
+-#if 0
+- /* Compute difference in the non-overlapping top margin */
+-
+- if (shift_y < 0)
+- {
+- /* i1 has top rows not covered by i2 */
+- i_cap = -shift_y;
+- for (i = 0; i < i_cap; i++)
+- {
+- assert(i >= 0 && i < h1);
+- s += compare_with_white(p1[i], w1);
+- if (s > ceiling) return maxint;
+- }
+- i_start = i_cap; /* topmost overlapping row in i1's coords */
+- }
+- else
+- {
+- /* i2 has top rows not covered by i1 */
+- for (i = 0; i < shift_y; i++)
+- {
+- assert(i >= 0 && i < h2);
+- s += compare_with_white(p2[i], w2);
+- if (s > ceiling) return maxint;
+- }
+- i_start = 0;
+- }
+-
+- /* Compute difference in the overlapping area */
+-
+- i_cap = h2 - shift_y;
+- if (h1 < i_cap) i_cap = h1;
+-
+- right_margin_start = shift_x + w1;
+- right_margin_width = w2 - right_margin_start;
+-
+- for (i = i_start; i < i_cap; i++) /* i is a coordinate in i1 system */
+- {
+- int32 y = i + shift_y; /* same row coordinate in i2 system */
+- assert(y >= 0 && y < h2);
+- s += compare_with_white(p2[y], shift_x);
+- if (s > ceiling) return maxint;
+- assert(i >= 0 && i < h1);
+- assert(shift_x + w1 <= w2);
+- assert(i < h1);
+- s += compare_row(p2[y] + shift_x, p1[i], w1);
+- if (s > ceiling) return maxint;
+- s += compare_with_white(p2[y] + right_margin_start, right_margin_width);
+- if (s > ceiling) return maxint;
+- }
+-
+-
+- /* Compute difference in the non-overlapping bottom margin */
+-
+- if (i_cap == h1)
+- {
+- /* i2 has bottom rows not covered by i1 */
+- i_start = i_cap + shift_y;
+- for (i = i_start; i < h2; i++)
+- {
+- assert(i >= 0 && i < h2);
+- s += compare_with_white(p2[i], w2);
+- if (s > ceiling) return maxint;
+- }
+- }
+- else
+- {
+- /* i1 has bottom rows not covered by i2 */
+- i_start = i_cap;
+- for (i = i_cap; i < h1; i++)
+- {
+- assert(i >= 0 && i < h1);
+- s += compare_with_white(p1[i], w1);
+- if (s > ceiling) return maxint;
+- }
+- }
+-
+- return s;
+-#endif
+ }
+
+ #endif
+diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
+index 36949f1..2db8703 100644
+--- a/tools/tiff2pdf.c
++++ b/tools/tiff2pdf.c
+@@ -721,7 +721,6 @@ tiff2pdf(TIFF *input, FILE *outputfile, int argc, const char **argv)
+ const char *outfilename = "<null>";
+ T2P *t2p = NULL;
+ TIFF *output = NULL;
+- tsize_t written=0;
+ int c;
+
+ /* T2P */
+@@ -874,7 +873,7 @@ tiff2pdf(TIFF *input, FILE *outputfile, int argc, const char **argv)
+ TIFFSeekFile(output, (toff_t) 0, SEEK_SET);
+
+ /* Write */
+- written = t2p_write_pdf(t2p, input, output);
++ t2p_write_pdf(t2p, input, output);
+ if(t2p->t2p_error != 0){
+ TIFFError(TIFF2PDF_MODULE, "An error occurred creating output PDF file");
+ goto fail;
+@@ -2633,7 +2632,6 @@ static tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output,
+ tsize_t read=0;
+ uint16 i=0;
+ ttile_t tilecount=0;
+- tsize_t tilesize=0;
+ ttile_t septilecount=0;
+ tsize_t septilesize=0;
+ #ifdef JPEG_SUPPORT
+@@ -2819,7 +2817,6 @@ static tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output,
+ if(t2p->pdf_sample == T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG){
+ septilesize=TIFFTileSize(input);
+ septilecount=TIFFNumberOfTiles(input);
+- tilesize=septilesize*t2p->tiff_samplesperpixel;
+ tilecount=septilecount/t2p->tiff_samplesperpixel;
+ buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
+ if(buffer==NULL){
+@@ -3802,7 +3799,6 @@ static tsize_t t2p_write_pdf_info(T2P* t2p, TIFF* input, TIFF* output){
+ tsize_t written=0;
+ char* info;
+ char buffer[512];
+- int buflen=0;
+
+ if(t2p->pdf_datetime==NULL){
+ t2p_pdf_tifftime(t2p, input);
+@@ -3815,7 +3811,8 @@ static tsize_t t2p_write_pdf_info(T2P* t2p, TIFF* input, TIFF* output){
+ }
+ written += TIFFWriteFile(output, (tdata_t) "\r/Producer ", 11);
+ _TIFFmemset((tdata_t)buffer, 0x00, 512);
+- buflen=sprintf(buffer, "libtiff / tiff2pdf - %d / %s", TIFFLIB_VERSION, T2P_VERSION);
++ sprintf(buffer, "libtiff / tiff2pdf - %d / %s",
++ TIFFLIB_VERSION, T2P_VERSION);
+ written += t2p_write_pdf_string(buffer, output);
+ written += TIFFWriteFile(output, (tdata_t) "\r", 1);
+ if(t2p->pdf_creator != NULL){
+--
+1.7.4.1
+
+From 5b3d074c2b315e7339ce279c559c3a99f26bef6a Mon Sep 17 00:00:00 2001
+From: Leon Bottou <leon@bottou.org>
+Date: Sat, 4 Jun 2011 17:37:00 -0700
+Subject: [PATCH] Fix MMX code when using gcc-4.6
+
+Fix MMX macros
+Enable MMX on x86_64
+---
+ libdjvu/MMX.cpp | 17 ++++++++++++++++-
+ libdjvu/MMX.h | 11 ++++++-----
+ tools/ddjvu.cpp | 1 -
+ 3 files changed, 22 insertions(+), 7 deletions(-)
+
+diff --git a/libdjvu/MMX.cpp b/libdjvu/MMX.cpp
+index 528dab6..e70fdd8 100644
+--- a/libdjvu/MMX.cpp
++++ b/libdjvu/MMX.cpp
+@@ -167,8 +167,23 @@ MMXControl::enable_mmx()
+ : "=m" (cpuflags) :
+ : "eax","ecx","edx");
+ #endif
++#if defined(MMX) && defined(__GNUC__) && defined(__x86_64__)
++ // Detection of MMX for GCC
++ __asm__ volatile (// Check that CR0:EM is clear
++ "xorl %%edx,%%edx\n\t"
++ "smsw %%ax\n\t"
++ "andl $4,%%eax\n\t"
++ "jnz 1f\n\t"
++ // Execute CPUID
++ "movl $1,%%eax\n\t"
++ "cpuid\n"
++ // Finish
++ "1:\tmovl %%edx, %0"
++ : "=m" (cpuflags) :
++ : "eax","ebx","ecx","edx");
++#endif
+ #if defined(MMX) && defined(_MSC_VER) && defined(_M_IX86)
+- // Detection of MMX for MSVC
++ // Detection of MMX for MSVC 32 bits
+ __asm { pushfd
+ pop ecx
+ xor edx,edx
+diff --git a/libdjvu/MMX.h b/libdjvu/MMX.h
+index b0af5e5..f8780af 100644
+--- a/libdjvu/MMX.h
++++ b/libdjvu/MMX.h
+@@ -143,17 +143,18 @@ class MMXControl
+
+ #ifndef NO_MMX
+
+-#if defined(__GNUC__) && defined(__i386__)
++#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
++typedef struct{ char c[8]; } MMX_t;
+ #define MMXemms \
+ __asm__ volatile("emms" : : : "memory" )
+ #define MMXrr(op,src,dst) \
+- __asm__ volatile( #op " %%" #src ",%%" #dst : : : "memory")
++ __asm__ volatile( #op " %%" #src ",%%" #dst : : : "memory" )
+ #define MMXir(op,imm,dst) \
+- __asm__ volatile( #op " %0,%%" #dst : : "i" (imm) : "memory")
++ __asm__ volatile( #op " %0,%%" #dst : : "i" (imm) : "memory" )
+ #define MMXar(op,addr,dst) \
+- __asm__ volatile( #op " %0,%%" #dst : : "m" (*(addr)) : "memory")
++ __asm__ volatile( #op " %0,%%" #dst : : "m" (*(MMX_t*)(addr)) : "memory" )
+ #define MMXra(op,src,addr) \
+- __asm__ volatile( #op " %%" #src ",%0" : : "m" (*(addr)) : "memory")
++ __asm__ volatile( #op " %%" #src ",%0" : "=m" (*(MMX_t*)(addr)) : : "memory")
+ #define MMX 1
+ #endif
+
+diff --git a/tools/ddjvu.cpp b/tools/ddjvu.cpp
+index 3b4ce16..216c6cb 100644
+--- a/tools/ddjvu.cpp
++++ b/tools/ddjvu.cpp
+@@ -846,7 +846,6 @@ parse_option(int argc, char **argv, int i)
+ arg = opt;
+ opt = "subsample";
+ }
+-
+ /* Parse options */
+ if (!strcmp(opt,"v") ||
+ !strcmp(opt,"verbose"))
+--
+1.7.4.1
+
+From fbed8e51e5970b12ce36afb0dec8c4e02992c0f8 Mon Sep 17 00:00:00 2001
+From: Leon Bottou <leon@bottou.org>
+Date: Thu, 9 Jun 2011 14:37:52 -0700
+Subject: [PATCH] Fixed regression in djvm.
+
+---
+ libdjvu/DjVuDocEditor.cpp | 1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/libdjvu/DjVuDocEditor.cpp b/libdjvu/DjVuDocEditor.cpp
+index f1d8b0d..baeb7dd 100644
+--- a/libdjvu/DjVuDocEditor.cpp
++++ b/libdjvu/DjVuDocEditor.cpp
+@@ -561,6 +561,7 @@ DjVuDocEditor::insert_file(const GURL &file_url, bool is_page,
+ IFFByteStream::create(file_pool->get_stream()));
+ IFFByteStream &iff=*giff;
+ GUTF8String chkid;
++ iff.get_chunk(chkid);
+ if (chkid!="FORM:DJVI" && chkid!="FORM:DJVU" &&
+ chkid!="FORM:BM44" && chkid!="FORM:PM44")
+ G_THROW( ERR_MSG("DjVuDocEditor.not_1_page") "\t"
+--
+1.7.4.1
+
+From f63327438954b8831a1a9f43afc8b6d16e1d3baf Mon Sep 17 00:00:00 2001
+From: Leon Bottou <leon@bottou.org>
+Date: Wed, 15 Jun 2011 00:05:50 -0700
+Subject: [PATCH] Encode oblique text as separate lines.
+
+---
+ tools/csepdjvu.cpp | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/tools/csepdjvu.cpp b/tools/csepdjvu.cpp
+index d5203d5..08f7a27 100644
+--- a/tools/csepdjvu.cpp
++++ b/tools/csepdjvu.cpp
+@@ -1288,7 +1288,7 @@ Comments::textmark(GP<TxtMark> mark)
+ int shx = (mark->x - lastx) * 100 / fontsize;
+ int shy = (mark->y - lasty) * 100 / fontsize;
+ int inter = dirx * shx + diry * shy;
+- if ( (dirx == lastdirx) && (diry == lastdiry) &&
++ if ( (dirx || diry) && (dirx == lastdirx) && (diry == lastdiry) &&
+ (inter > -150) && (inter < 300) &&
+ abs(diry * shx + dirx * shy) < 80 )
+ mark->inter = inter;
+--
+1.7.4.1
+
+From ea9fd2acab2e298ba721eb79f5026d34e6ef141f Mon Sep 17 00:00:00 2001
+From: Barak A. Pearlmutter <barak+git@cs.nuim.ie>
+Date: Wed, 22 Jun 2011 11:21:41 +0100
+Subject: [PATCH] consistent prototype for ddjvu_anno_get_xmp
+
+---
+ libdjvu/ddjvuapi.h | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/libdjvu/ddjvuapi.h b/libdjvu/ddjvuapi.h
+index 841f223..14b63eb 100644
+--- a/libdjvu/ddjvuapi.h
++++ b/libdjvu/ddjvuapi.h
+@@ -1619,7 +1619,7 @@ ddjvu_anno_get_metadata(miniexp_t annotations, miniexp_t key);
+ Returns zero if no such key is present. */
+
+ DDJVUAPI const char *
+-ddjvu_anno_get_xmp(miniexp_t annotations, miniexp_t xmp);
++ddjvu_anno_get_xmp(miniexp_t annotations);
+
+
+ /* -------------------------------------------------- */
+--
+1.7.4.1
+
+From 701d1261493e175955aac97921949f4e4241750d Mon Sep 17 00:00:00 2001
+From: Leon Bottou <leon@bottou.org>
+Date: Sun, 11 Sep 2011 09:59:26 -0700
+Subject: [PATCH] Fixed typo in man page.
+
+---
+ tools/ddjvu.1 | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/tools/ddjvu.1 b/tools/ddjvu.1
+index 7d3d105..cbb8307 100644
+--- a/tools/ddjvu.1
++++ b/tools/ddjvu.1
+@@ -66,7 +66,7 @@ and
+ .BR "ppm"
+ respectively produce a Portable Bitmap (PBM),
+ Portable Graymap (PGM),
+-or Portable Pixmap (PGM) file.
++or Portable Pixmap (PPM) file.
+ Format
+ .B "pnm"
+ produces a PBM, PGM, or PPM
+--
+1.7.4.1
+