Applied changes for seek allowing 2-4GB seeks.
This commit is contained in:
parent
592e7e59db
commit
d9fbb1bc81
@ -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
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@ -52,23 +52,30 @@ _tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
|
|||||||
static toff_t
|
static toff_t
|
||||||
_tiffSeekProc(thandle_t fd, toff_t off, int whence)
|
_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)
|
switch(whence)
|
||||||
{
|
{
|
||||||
case 0:
|
case SEEK_SET:
|
||||||
dwMoveMethod = FILE_BEGIN;
|
dwMoveMethod = FILE_BEGIN;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case SEEK_CUR:
|
||||||
dwMoveMethod = FILE_CURRENT;
|
dwMoveMethod = FILE_CURRENT;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case SEEK_END:
|
||||||
dwMoveMethod = FILE_END;
|
dwMoveMethod = FILE_END;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dwMoveMethod = FILE_BEGIN;
|
dwMoveMethod = FILE_BEGIN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ((toff_t)SetFilePointer(fd, off, NULL, dwMoveMethod));
|
dwMoveHigh = 0;
|
||||||
|
return ((toff_t)SetFilePointer(fd, (LONG) off, (PLONG)&dwMoveHigh,
|
||||||
|
dwMoveMethod));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -109,7 +116,7 @@ _tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
|
|||||||
toff_t size;
|
toff_t size;
|
||||||
HANDLE hMapFile;
|
HANDLE hMapFile;
|
||||||
|
|
||||||
if ((size = _tiffSizeProc(fd)) == (toff_t)-1)
|
if ((size = _tiffSizeProc(fd)) == 0xFFFFFFFF)
|
||||||
return (0);
|
return (0);
|
||||||
hMapFile = CreateFileMapping(fd, NULL, PAGE_READONLY, 0, size, NULL);
|
hMapFile = CreateFileMapping(fd, NULL, PAGE_READONLY, 0, size, NULL);
|
||||||
if (hMapFile == NULL)
|
if (hMapFile == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user