diff options
author | Robin Watts <robin.watts@artifex.com> | 2015-05-14 17:12:42 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-05-15 13:06:56 +0100 |
commit | 7d5ff30c37c9e5b271fdb2b8cb3219068048322e (patch) | |
tree | 5f60d1d03235f2cff161207e00515c5a4a69ef73 /source/tools | |
parent | 250e8a11e1debfbd9c4fc84ad895bf923aac135e (diff) | |
download | mupdf-7d5ff30c37c9e5b271fdb2b8cb3219068048322e.tar.xz |
Support pdf files larger than 2Gig.
If FZ_LARGEFILE is defined when building, MuPDF uses 64bit offsets
for files; this allows us to open streams larger than 2Gig.
The downsides to this are that:
* The xref entries are larger.
* All PDF ints are held as 64bit things rather than 32bit things
(to cope with /Prev entries, hint stream offsets etc).
* All file positions are stored as 64bits rather than 32.
The implementation works by detecting FZ_LARGEFILE. Some #ifdeffery
in fitz/system.h sets fz_off_t to either int or int64_t as appropriate,
and sets defines for fz_fopen, fz_fseek, fz_ftell etc as required.
These call the fseeko64 etc functions on linux (and so define
_LARGEFILE64_SOURCE) and the explicit 64bit functions on windows.
Diffstat (limited to 'source/tools')
-rw-r--r-- | source/tools/mudraw.c | 2 | ||||
-rw-r--r-- | source/tools/pdfextract.c | 2 | ||||
-rw-r--r-- | source/tools/pdfshow.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 12795ba2..1d83eed3 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -424,7 +424,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) else { sprintf(buf, output, pagenum); - file = fopen(buf, "wb"); + file = fz_fopen(buf, "wb"); if (file == NULL) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot open file '%s': %s", buf, strerror(errno)); } diff --git a/source/tools/pdfextract.c b/source/tools/pdfextract.c index 7e454fc7..a89566cc 100644 --- a/source/tools/pdfextract.c +++ b/source/tools/pdfextract.c @@ -142,7 +142,7 @@ static void savefont(pdf_obj *dict, int num) snprintf(namebuf, sizeof(namebuf), "%s-%04d.%s", fontname, num, ext); printf("extracting font %s\n", namebuf); - f = fopen(namebuf, "wb"); + f = fz_fopen(namebuf, "wb"); if (!f) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot create font file"); diff --git a/source/tools/pdfshow.c b/source/tools/pdfshow.c index f2b01daa..04a2c859 100644 --- a/source/tools/pdfshow.c +++ b/source/tools/pdfshow.c @@ -239,7 +239,7 @@ int pdfshow_main(int argc, char **argv) out = stdout; if (output) { - out = fopen(output, "wb"); + out = fz_fopen(output, "wb"); if (!out) { fprintf(stderr, "cannot open output file: '%s'\n", output); |