2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

Visual C++ and mingw32 fixes for large files

This commit is contained in:
Jay Berkenbilt 2012-06-26 16:52:30 -04:00
parent f60bb8e071
commit 0802ba275f
3 changed files with 24 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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
}