1838 char szErrorMsg[160];
1845 if( hEntity < 0 || hEntity >= psSHP->nRecords )
1851 if( psSHP->panRecOffset[hEntity] == 0 && psSHP->fpSHX !=
SHPLIB_NULLPTR )
1853 unsigned int nOffset, nLength;
1855 if( psSHP->sHooks.FSeek( psSHP->fpSHX, 100 + 8 * hEntity, 0 ) != 0 ||
1856 psSHP->sHooks.FRead( &nOffset, 1, 4, psSHP->fpSHX ) != 4 ||
1857 psSHP->sHooks.FRead( &nLength, 1, 4, psSHP->fpSHX ) != 4 )
1860 snprintf(
str,
sizeof(
str),
1861 "Error in fseek()/fread() reading object from .shx file at offset %d",
1863 str[
sizeof(
str)-1] =
'\0';
1865 psSHP->sHooks.Error(
str );
1871 if( nOffset >
STATIC_CAST(
unsigned int, INT_MAX) )
1874 snprintf(
str,
sizeof(
str),
1875 "Invalid offset for entity %d", hEntity);
1876 str[
sizeof(
str)-1] =
'\0';
1878 psSHP->sHooks.Error(
str );
1881 if( nLength >
STATIC_CAST(
unsigned int, INT_MAX / 2 - 4) )
1884 snprintf(
str,
sizeof(
str),
1885 "Invalid length for entity %d", hEntity);
1886 str[
sizeof(
str)-1] =
'\0';
1888 psSHP->sHooks.Error(
str );
1892 psSHP->panRecOffset[hEntity] = nOffset*2;
1893 psSHP->panRecSize[hEntity] = nLength*2;
static void SwapWord(int length, void *wordP)
#define STATIC_CAST(type, x)