Applied changes for seek allowing 2-4GB seeks.

This commit is contained in:
Frank Warmerdam 2000-01-28 21:42:48 +00:00
parent 592e7e59db
commit d9fbb1bc81

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_win32.c,v 1.4 1999-11-27 21:43:59 warmerda Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_win32.c,v 1.5 2000-01-28 21:42:48 warmerda Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -52,23 +52,30 @@ _tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
static toff_t
_tiffSeekProc(thandle_t fd, toff_t off, int whence)
{
DWORD dwMoveMethod;
DWORD dwMoveMethod, dwMoveHigh;
/* we use this as a special code, so avoid accepting it */
if( off == 0xFFFFFFFF )
return 0xFFFFFFFF;
switch(whence)
{
case 0:
case SEEK_SET:
dwMoveMethod = FILE_BEGIN;
break;
case 1:
case SEEK_CUR:
dwMoveMethod = FILE_CURRENT;
break;
case 2:
case SEEK_END:
dwMoveMethod = FILE_END;
break;
default:
dwMoveMethod = FILE_BEGIN;
break;
}
return ((toff_t)SetFilePointer(fd, off, NULL, dwMoveMethod));
dwMoveHigh = 0;
return ((toff_t)SetFilePointer(fd, (LONG) off, (PLONG)&dwMoveHigh,
dwMoveMethod));
}
static int
@ -109,7 +116,7 @@ _tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
toff_t size;
HANDLE hMapFile;
if ((size = _tiffSizeProc(fd)) == (toff_t)-1)
if ((size = _tiffSizeProc(fd)) == 0xFFFFFFFF)
return (0);
hMapFile = CreateFileMapping(fd, NULL, PAGE_READONLY, 0, size, NULL);
if (hMapFile == NULL)