From c5d306fadd5d7504484027e8f0c33fa2e0ee6191 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Fri, 28 Jan 2000 21:46:30 +0000 Subject: [PATCH] added USE_64BIT_API option --- libtiff/tif_unix.c | 11 ++++++++++- libtiff/tiffconf.h | 8 +++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/libtiff/tif_unix.c b/libtiff/tif_unix.c index f848369e..232b2355 100644 --- a/libtiff/tif_unix.c +++ b/libtiff/tif_unix.c @@ -1,4 +1,4 @@ -/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_unix.c,v 1.2 1999-09-24 03:05:12 warmerda Exp $ */ +/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_unix.c,v 1.3 2000-01-28 21:46:30 warmerda Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -47,7 +47,11 @@ _tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size) static toff_t _tiffSeekProc(thandle_t fd, toff_t off, int whence) { +#if USE_64BIT_API == 1 + return ((toff_t) lseek64((int) fd, (off64_t) off, whence)); +#else return ((toff_t) lseek((int) fd, (off_t) off, whence)); +#endif } static int @@ -64,10 +68,15 @@ _tiffSizeProc(thandle_t fd) #ifdef _AM29K long fsize; return ((fsize = lseek((int) fd, 0, SEEK_END)) < 0 ? 0 : fsize); +#else +#if USE_64BIT_API == 1 + struct stat64 sb; + return (toff_t) (fstat64((int) fd, &sb) < 0 ? 0 : sb.st_size); #else struct stat sb; return (toff_t) (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size); #endif +#endif } #ifdef HAVE_MMAP diff --git a/libtiff/tiffconf.h b/libtiff/tiffconf.h index 46a7f3b2..c33662c0 100644 --- a/libtiff/tiffconf.h +++ b/libtiff/tiffconf.h @@ -1,4 +1,4 @@ -/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/Attic/tiffconf.h,v 1.1 1999-07-27 21:50:27 mike Exp $ */ +/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/Attic/tiffconf.h,v 1.2 2000-01-28 21:46:30 warmerda Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. @@ -51,6 +51,8 @@ * HOST_BIGENDIAN native cpu byte order: 1 if big-endian (Motorola) * or 0 if little-endian (Intel); this may be used * in codecs to optimize code + * USE_64BIT_API set to 1 if tif_unix.c should use lseek64(), + * fstat64() and stat64 allowing 2-4GB files. */ #ifndef HAVE_IEEEFP #define HAVE_IEEEFP 1 @@ -62,6 +64,10 @@ #define HOST_BIGENDIAN 1 #endif +#ifndef USE_64BIT_API +# define USE_64BIT_API 0 +#endif + #ifndef FEATURE_SUPPORT /* * Feature support definitions: