diff options
-rwxr-xr-x | config-mingw32 | 11 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | libqpdf/QUtil.cc | 12 |
3 files changed, 24 insertions, 0 deletions
diff --git a/config-mingw32 b/config-mingw32 index 3fabdb0e..d128e3f6 100755 --- a/config-mingw32 +++ b/config-mingw32 @@ -1,2 +1,13 @@ #!/bin/sh ./configure --disable-test-compare-images --enable-external-libs --with-windows-wordsize=32 --with-buildrules=mingw +# As of autoconf 2.69 and gcc 4.6, autoconf's configure fails to +# recognize that defining _FILE_OFFSET_BITS works with mingw32. +# Append to qpdf-config.h rather than passing CPPFLAGS on the +# commandline. This way we don't defeat the fact that test_large_file +# and other things that only use the public interface can be built +# without any special flags. +cat >> libqpdf/qpdf/qpdf-config.h <<EOF +#ifndef _FILE_OFFSET_BITS +# define _FILE_OFFSET_BITS 64 +#endif +EOF diff --git a/configure.ac b/configure.ac index b8435f68..24831ee8 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,7 @@ AC_ARG_WITH(large-file-test-path, AC_SYS_LARGEFILE AC_FUNC_FSEEKO +AC_CHECK_FUNCS([fseeko64]) AC_TYPE_UINT16_T AC_TYPE_UINT32_T diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index bdb73f54..0db61eed 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -126,8 +126,14 @@ QUtil::fseek_off_t(FILE* stream, qpdf_offset_t offset, int whence) { #if HAVE_FSEEKO return fseeko(stream, (off_t)offset, whence); +#elif HAVE_FSEEKO64 + return fseeko64(stream, offset, whence); #else +# ifdef _MSC_VER + return _fseeki64(stream, offset, whence); +# else return fseek(stream, (long)offset, whence); +# endif #endif } @@ -136,8 +142,14 @@ QUtil::ftell_off_t(FILE* stream) { #if HAVE_FSEEKO return (qpdf_offset_t)ftello(stream); +#elif HAVE_FSEEKO64 + return (qpdf_offset_t)ftello64(stream); #else +# ifdef _MSC_VER + return _ftelli64(stream); +# else return (qpdf_offset_t)ftell(stream); +# endif #endif } |