diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-01-18 11:18:30 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-01-18 11:18:30 +0000 |
commit | d5b1d635e3cbfd4d919e11ec0bcb4fced2d7b212 (patch) | |
tree | cf13487ebe01f7931bea29e1136a37ea762a076f | |
parent | 31accee3d73f4b87a333844e128eb9258f5f8f11 (diff) |
web2c: Printing of file offsets when sizeof(off_t) > sizeof(long)
git-svn-id: svn://tug.org/texlive/trunk@25140 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/c-auto.in | 3 | ||||
-rwxr-xr-x | Build/source/texk/web2c/configure | 40 | ||||
-rw-r--r-- | Build/source/texk/web2c/configure.ac | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/image/writejbig2.w | 15 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/writejbig2.c | 13 | ||||
-rw-r--r-- | Build/source/texk/web2c/w2c/config.h | 9 |
9 files changed, 86 insertions, 16 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 4629794f50b..46c5a546e0d 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,8 @@ +2012-01-18 Peter Breitenlohner <peb@mppmu.mpg.de> + + * configure.ac: Check sizeof(off_t). + * w2c/config.h: Define LONGINTEGER_TYPE and LONGINTEGER_PRId. + 2011-12-23 Peter Breitenlohner <peb@mppmu.mpg.de> * configure.ac [OTANGLE]: For ovf2ovp and ovp2ovf (Web2C). diff --git a/Build/source/texk/web2c/c-auto.in b/Build/source/texk/web2c/c-auto.in index b6a3138c87e..c8eecefcbad 100644 --- a/Build/source/texk/web2c/c-auto.in +++ b/Build/source/texk/web2c/c-auto.in @@ -294,6 +294,9 @@ /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG +/* The size of `off_t', as computed by sizeof. */ +#undef SIZEOF_OFF_T + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS diff --git a/Build/source/texk/web2c/configure b/Build/source/texk/web2c/configure index 19436bfcff1..d17db77a7e1 100755 --- a/Build/source/texk/web2c/configure +++ b/Build/source/texk/web2c/configure @@ -22642,6 +22642,46 @@ ${top_srcdir}/../../libs/obsdcompat/*.[ch]: cd ${top_builddir}/../../libs/obsdcompat && $(MAKE) $(AM_MAKEFLAGS) rebuild' +# Check size of off_t (using <kpathsea/config.h>) +eval CPPFLAGS=\"$KPATHSEA_INCLUDES \$CPPFLAGS\" +eval LIBS=\"$KPATHSEA_LIBS \$LIBS\" + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 +$as_echo_n "checking size of off_t... " >&6; } +if ${ac_cv_sizeof_off_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default +#include <kpathsea/config.h> +"; then : + +else + if test "$ac_cv_type_off_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (off_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_off_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5 +$as_echo "$ac_cv_sizeof_off_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_OFF_T $ac_cv_sizeof_off_t +_ACEOF + + + # Checks for xpdf poppler features. eval CPPFLAGS=\"$POPPLER_INCLUDES \$CPPFLAGS\" eval LIBS=\"$POPPLER_LIBS \$LIBS\" diff --git a/Build/source/texk/web2c/configure.ac b/Build/source/texk/web2c/configure.ac index 0f3a25a8397..05741f88f31 100644 --- a/Build/source/texk/web2c/configure.ac +++ b/Build/source/texk/web2c/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with Autoconf to produce a configure script for Web2c. dnl -dnl Copyright (C) 2009-2011 Peter Breitenlohner <tex-live@tug.org> +dnl Copyright (C) 2009-2012 Peter Breitenlohner <tex-live@tug.org> dnl dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, @@ -275,6 +275,11 @@ KPSE_TECKIT_FLAGS KPSE_ICU_XETEX_FLAGS([icule]) KPSE_OBSDCOMPAT_FLAGS +# Check size of off_t (using <kpathsea/config.h>) +KPSE_ADD_FLAGS([kpathsea]) +AC_CHECK_SIZEOF([off_t], , AC_INCLUDES_DEFAULT +[#include <kpathsea/config.h>]) + # Checks for xpdf poppler features. KPSE_ADD_FLAGS([poppler]) AC_LANG_PUSH([C++]) diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 358943084b4..e0e43e8d65c 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,8 @@ +2012-01-18 Peter Breitenlohner <peb@mppmu.mpg.de> + + * image/writejbig2.w (getstreamlen): Change type to `off_t'. + Use LONGINTEGER_TYPE and LONGINTEGER_PRId for printing. + 2012-01-11 Peter Breitenlohner <peb@mppmu.mpg.de> Consistent support for large JBIG2 files. diff --git a/Build/source/texk/web2c/luatexdir/image/writejbig2.w b/Build/source/texk/web2c/luatexdir/image/writejbig2.w index 8b186b6b740..d23183fab6c 100644 --- a/Build/source/texk/web2c/luatexdir/image/writejbig2.w +++ b/Build/source/texk/web2c/luatexdir/image/writejbig2.w @@ -362,15 +362,14 @@ unsigned int read4bytes(FILE * f) } @ @c -static unsigned long getstreamlen(LITEM * slip, boolean refer) +static off_t getstreamlen(LITEM * slip, boolean refer) { SEGINFO *sip; - unsigned long len = 0; + off_t len = 0; for (; slip != NULL; slip = slip->next) { sip = slip->d; if (refer || sip->isrefered) - len += (unsigned long) (sip->hdrend - sip->hdrstart) - + (unsigned long) (sip->dataend - sip->datastart); + len += (sip->hdrend - sip->hdrstart) + (sip->dataend - sip->datastart); } return len; } @@ -729,8 +728,8 @@ static void wr_jbig2(PDF pdf, FILEINFO * fip, unsigned long page) pdf_printf(pdf, "/Height %i\n", pip->height); pdf_puts(pdf, "/ColorSpace /DeviceGray\n"); pdf_puts(pdf, "/BitsPerComponent 1\n"); - pdf_printf(pdf, "/Length %lu\n", - getstreamlen(pip->segments.first, true)); + pdf_printf(pdf, "/Length %" LONGINTEGER_PRId "\n", + (LONGINTEGER_TYPE) getstreamlen(pip->segments.first, true)); pdf_puts(pdf, "/Filter [/JBIG2Decode]\n"); if (fip->page0.last != NULL) { if (fip->pdfpage0objnum == 0) { @@ -744,8 +743,8 @@ static void wr_jbig2(PDF pdf, FILEINFO * fip, unsigned long page) pip = find_pageinfo(&(fip->page0), page); assert(pip != NULL); pdf_begin_dict(pdf, (int) fip->pdfpage0objnum, 0); - pdf_printf(pdf, "/Length %lu\n", - getstreamlen(pip->segments.first, false)); + pdf_printf(pdf, "/Length %" LONGINTEGER_PRId "\n", + (LONGINTEGER_TYPE) getstreamlen(pip->segments.first, false)); } pdf_puts(pdf, ">>\n"); pdf_puts(pdf, "stream\n"); diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index 4ce39544bee..fc5aa84049d 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,3 +1,8 @@ +2012-01-18 Peter Breitenlohner <peb@mppmu.mpg.de> + + * writejbig2.c (getstreamlen): Change type to `off_t'. + Use LONGINTEGER_TYPE and LONGINTEGER_PRId for printing. + 2012-01-11 Peter Breitenlohner <peb@mppmu.mpg.de> Consistent support for large JBIG2 files. diff --git a/Build/source/texk/web2c/pdftexdir/writejbig2.c b/Build/source/texk/web2c/pdftexdir/writejbig2.c index a0a2d0ddf82..264270413d3 100644 --- a/Build/source/texk/web2c/pdftexdir/writejbig2.c +++ b/Build/source/texk/web2c/pdftexdir/writejbig2.c @@ -357,15 +357,14 @@ static unsigned long read4bytes(FILE * f) /**********************************************************************/ -static unsigned long getstreamlen(LITEM * slip, boolean refer) +static off_t getstreamlen(LITEM * slip, boolean refer) { SEGINFO *sip; - unsigned long len = 0; + off_t len = 0; for (; slip != NULL; slip = slip->next) { sip = slip->d; if (refer || sip->isrefered) - len += (unsigned long) (sip->hdrend - sip->hdrstart) - + (unsigned long) (sip->dataend - sip->datastart); + len += (sip->hdrend - sip->hdrstart) + (sip->dataend - sip->datastart); } return len; } @@ -721,7 +720,8 @@ static void wr_jbig2(FILEINFO * fip, unsigned long page) pdf_printf("/Height %i\n", pip->height); pdf_puts("/ColorSpace /DeviceGray\n"); pdf_puts("/BitsPerComponent 1\n"); - pdf_printf("/Length %lu\n", getstreamlen(pip->segments.first, true)); + pdf_printf("/Length %" LONGINTEGER_PRId "\n", + (LONGINTEGER_TYPE) getstreamlen(pip->segments.first, true)); pdf_puts("/Filter [/JBIG2Decode]\n"); if (fip->page0.last != NULL) { if (fip->pdfpage0objnum == 0) { @@ -735,7 +735,8 @@ static void wr_jbig2(FILEINFO * fip, unsigned long page) pip = find_pageinfo(&(fip->page0), page); assert(pip != NULL); pdfbegindict(fip->pdfpage0objnum, 0); - pdf_printf("/Length %lu\n", getstreamlen(pip->segments.first, false)); + pdf_printf("/Length %" LONGINTEGER_PRId "\n", + (LONGINTEGER_TYPE) getstreamlen(pip->segments.first, false)); } pdf_puts(">>\n"); pdf_puts("stream\n"); diff --git a/Build/source/texk/web2c/w2c/config.h b/Build/source/texk/web2c/w2c/config.h index 4d325139138..eb6b916d9ec 100644 --- a/Build/source/texk/web2c/w2c/config.h +++ b/Build/source/texk/web2c/w2c/config.h @@ -1,6 +1,6 @@ /* w2c/config.h: All .c files include this first. -Copyright 1995, 1996, 2006, 2007, 2009, 2010 Karl Berry. +Copyright 1995, 1996, 2006, 2007, 2009, 2010, 2012 Karl Berry. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -75,6 +75,13 @@ typedef INTEGER_TYPE integer; /* We need a type that's at least off_t wide */ typedef off_t longinteger; +#if SIZEOF_LONG < SIZEOF_OFF_T +#define LONGINTEGER_TYPE long long +#define LONGINTEGER_PRId "lld" +#else +#define LONGINTEGER_TYPE long +#define LONGINTEGER_PRId "ld" +#endif /* I don't want to write a configure test for remove when all Unix machines have unlink. But, for the sake of non-Unix machines that |