1904 if( nNewBufSize < INT_MAX - nNewBufSize / 3 )
1905 nNewBufSize += nNewBufSize / 3;
1907 nNewBufSize = INT_MAX;
1912 if( nNewBufSize >= 10 * 1024 * 1024 )
1914 if( psSHP->nBufSize < 10 * 1024 * 1024 )
1917 psSHP->sHooks.FSeek( psSHP->fpSHP, 0, 2 );
1918 nFileSize = psSHP->sHooks.FTell(psSHP->fpSHP);
1919 if( nFileSize >= UINT_MAX )
1920 psSHP->nFileSize = UINT_MAX;
1922 psSHP->nFileSize =
STATIC_CAST(
unsigned int, nFileSize);
1925 if( psSHP->panRecOffset[hEntity] >= psSHP->nFileSize ||
1930 psSHP->panRecSize[hEntity] > psSHP->nFileSize - psSHP->panRecOffset[hEntity] )
1933 snprintf(
str,
sizeof(
str),
1934 "Error in fread() reading object of size %d at offset %u from .shp file",
1936 str[
sizeof(
str)-1] =
'\0';
1938 psSHP->sHooks.Error(
str );
1946 snprintf( szErrorMsg,
sizeof(szErrorMsg),
1947 "Not enough memory to allocate requested memory (nNewBufSize=%d). "
1948 "Probably broken SHP file", nNewBufSize);
1949 szErrorMsg[
sizeof(szErrorMsg)-1] =
'\0';
1950 psSHP->sHooks.Error( szErrorMsg );
1955 psSHP->pabyRec = pabyRecNew;
1956 psSHP->nBufSize = nNewBufSize;
#define STATIC_CAST(type, x)
static void * SfRealloc(void *pMem, int nNewSize)