From 2812ab9149b8f903dae957abeebe8c6da671d471 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 17 Dec 2012 13:24:14 +1030 Subject: [PATCH 5/5] win32 large file support - not tested --- goo/gtypes.h | 2 ++ poppler/Stream.cc | 13 +++++++++++++ utils/pdfinfo.cc | 3 +++ 3 files changed, 18 insertions(+) diff --git a/goo/gtypes.h b/goo/gtypes.h index 5247041..6e9c1ac 100644 --- a/goo/gtypes.h +++ b/goo/gtypes.h @@ -55,6 +55,8 @@ typedef unsigned long Gulong; typedef off_t Goffset; #elif HAVE_FSEEK64 typedef off64_t Goffset; +#elif _WIN32 +typedef __int64 Goffset; #else typedef long Goffset; #endif diff --git a/poppler/Stream.cc b/poppler/Stream.cc index f13603c..92d8573 100644 --- a/poppler/Stream.cc +++ b/poppler/Stream.cc @@ -805,6 +805,9 @@ void FileStream::reset() { #elif HAVE_FSEEK64 savePos = ftell64(f); fseek64(f, start, SEEK_SET); +#elif _WIN32 + savePos = _ftelli64(f); + _fseeki64(f, start, SEEK_SET); #else savePos = ftell(f); fseek(f, start, SEEK_SET); @@ -820,6 +823,8 @@ void FileStream::close() { fseeko(f, savePos, SEEK_SET); #elif HAVE_FSEEK64 fseek64(f, savePos, SEEK_SET); +#elif _WIN32 + _fseeki64(f, savePos, SEEK_SET); #else fseek(f, savePos, SEEK_SET); #endif @@ -856,6 +861,8 @@ void FileStream::setPos(Goffset pos, int dir) { fseeko(f, pos, SEEK_SET); #elif HAVE_FSEEK64 fseek64(f, pos, SEEK_SET); +#elif _WIN32 + _fseeki64(f, pos, SEEK_SET); #else fseek(f, pos, SEEK_SET); #endif @@ -867,6 +874,9 @@ void FileStream::setPos(Goffset pos, int dir) { #elif HAVE_FSEEK64 fseek64(f, 0, SEEK_END); size = ftell64(f); +#elif _WIN32 + _fseeki64(f, 0, SEEK_END); + size = _ftelli64(f); #else fseek(f, 0, SEEK_END); size = ftell(f); @@ -879,6 +889,9 @@ void FileStream::setPos(Goffset pos, int dir) { #elif HAVE_FSEEK64 fseek64(f, -pos, SEEK_END); bufPos = ftell64(f); +#elif _WIN32 + _fseeki64(f, -pos, SEEK_END); + bufPos = _ftelli64(f); #else fseek(f, -pos, SEEK_END); bufPos = ftell(f); diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc index 734c2b9..22d5c43 100644 --- a/utils/pdfinfo.cc +++ b/utils/pdfinfo.cc @@ -357,6 +357,9 @@ int main(int argc, char *argv[]) { #elif HAVE_FSEEK64 fseek64(f, 0, SEEK_END); printf("File size: %lld bytes\n", (long long)ftell64(f)); +#elif _WIN32 + _fseeki64(f, 0, SEEK_END); + printf("File size: %lld bytes\n", (long long)_ftelli64(f)); #else fseek(f, 0, SEEK_END); printf("File size: %lld bytes\n", (long long)ftell(f)); -- 1.7.10.4