1902 if( nNewBufSize < INT_MAX - nNewBufSize / 3 )
1903 nNewBufSize += nNewBufSize / 3;
1905 nNewBufSize = INT_MAX;
1910 if( nNewBufSize >= 10 * 1024 * 1024 )
1912 if( psSHP->nBufSize < 10 * 1024 * 1024 )
1915 psSHP->sHooks.FSeek( psSHP->fpSHP, 0, 2 );
1916 nFileSize = psSHP->sHooks.FTell(psSHP->fpSHP);
1917 if( nFileSize >= UINT_MAX )
1918 psSHP->nFileSize = UINT_MAX;
1920 psSHP->nFileSize =
STATIC_CAST(
unsigned int, nFileSize);
1923 if( psSHP->panRecOffset[hEntity] >= psSHP->nFileSize ||
1928 psSHP->panRecSize[hEntity] > psSHP->nFileSize - psSHP->panRecOffset[hEntity] )
1931 snprintf(
str,
sizeof(
str),
1932 "Error in fread() reading object of size %d at offset %u from .shp file",
1934 str[
sizeof(
str)-1] =
'\0';
1936 psSHP->sHooks.Error(
str );
1944 snprintf( szErrorMsg,
sizeof(szErrorMsg),
1945 "Not enough memory to allocate requested memory (nNewBufSize=%d). "
1946 "Probably broken SHP file", nNewBufSize);
1947 szErrorMsg[
sizeof(szErrorMsg)-1] =
'\0';
1948 psSHP->sHooks.Error( szErrorMsg );
1953 psSHP->pabyRec = pabyRecNew;
1954 psSHP->nBufSize = nNewBufSize;
#define STATIC_CAST(type, x)
static void * SfRealloc(void *pMem, int nNewSize)