summaryrefslogtreecommitdiff
path: root/libtiff/tif_open.c
diff options
context:
space:
mode:
authorJoris Van Damme <joris.at.lebbeke@skynet.be>2007-07-11 15:52:48 +0000
committerJoris Van Damme <joris.at.lebbeke@skynet.be>2007-07-11 15:52:48 +0000
commitc4bddab560793471683b19d9fd440844e95f1bf9 (patch)
tree79c506c135ddad443aa1a319be389b1d25dce267 /libtiff/tif_open.c
parentd83d6100fd2f0f0ddf2f063eb3caf07f13a1ba54 (diff)
downloadlibtiff-git-c4bddab560793471683b19d9fd440844e95f1bf9.tar.gz
BigTIFF upgrade: restoration of mapping functions protocol
Diffstat (limited to 'libtiff/tif_open.c')
-rw-r--r--libtiff/tif_open.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/libtiff/tif_open.c b/libtiff/tif_open.c
index 4c4b861b..d9dd7f6c 100644
--- a/libtiff/tif_open.c
+++ b/libtiff/tif_open.c
@@ -1,4 +1,4 @@
-/* $Id: tif_open.c,v 1.41 2007-06-29 11:30:29 joris Exp $ */
+/* $Id: tif_open.c,v 1.42 2007-07-11 15:52:48 joris Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -33,14 +33,14 @@
* Dummy functions to fill the omitted client procedures.
*/
static int
-_tiffDummyMapProc(thandle_t fd, void** pbase, tmsize_t* psize)
+_tiffDummyMapProc(thandle_t fd, void** pbase, toff_t* psize)
{
(void) fd; (void) pbase; (void) psize;
return (0);
}
static void
-_tiffDummyUnmapProc(thandle_t fd, void* base, tmsize_t size)
+_tiffDummyUnmapProc(thandle_t fd, void* base, toff_t size)
{
(void) fd; (void) base; (void) size;
}
@@ -450,9 +450,17 @@ TIFFClientOpen(
* has not explicitly suppressed usage with the
* 'm' flag in the open mode (see above).
*/
- if ((tif->tif_flags & TIFF_MAPPED) &&
- !TIFFMapFileContents(tif,(void**)(&tif->tif_base),&tif->tif_size))
- tif->tif_flags &= ~TIFF_MAPPED;
+ if (tif->tif_flags & TIFF_MAPPED)
+ {
+ toff_t n;
+ if (TIFFMapFileContents(tif,(void**)(&tif->tif_base),&n))
+ {
+ tif->tif_size=(tmsize_t)n;
+ assert((toff_t)tif->tif_size==n);
+ }
+ else
+ tif->tif_flags &= ~TIFF_MAPPED;
+ }
if (TIFFReadDirectory(tif)) {
tif->tif_rawcc = (tmsize_t)-1;
tif->tif_flags |= TIFF_BUFFERSETUP;