1836 char szErrorMsg[160];
1843 if( hEntity < 0 || hEntity >= psSHP->nRecords )
1849 if( psSHP->panRecOffset[hEntity] == 0 && psSHP->fpSHX !=
SHPLIB_NULLPTR )
1851 unsigned int nOffset, nLength;
1853 if( psSHP->sHooks.FSeek( psSHP->fpSHX, 100 + 8 * hEntity, 0 ) != 0 ||
1854 psSHP->sHooks.FRead( &nOffset, 1, 4, psSHP->fpSHX ) != 4 ||
1855 psSHP->sHooks.FRead( &nLength, 1, 4, psSHP->fpSHX ) != 4 )
1858 snprintf(
str,
sizeof(
str),
1859 "Error in fseek()/fread() reading object from .shx file at offset %d",
1861 str[
sizeof(
str)-1] =
'\0';
1863 psSHP->sHooks.Error(
str );
1869 if( nOffset >
STATIC_CAST(
unsigned int, INT_MAX) )
1872 snprintf(
str,
sizeof(
str),
1873 "Invalid offset for entity %d", hEntity);
1874 str[
sizeof(
str)-1] =
'\0';
1876 psSHP->sHooks.Error(
str );
1879 if( nLength >
STATIC_CAST(
unsigned int, INT_MAX / 2 - 4) )
1882 snprintf(
str,
sizeof(
str),
1883 "Invalid length for entity %d", hEntity);
1884 str[
sizeof(
str)-1] =
'\0';
1886 psSHP->sHooks.Error(
str );
1890 psSHP->panRecOffset[hEntity] = nOffset*2;
1891 psSHP->panRecSize[hEntity] = nLength*2;
static void SwapWord(int length, void *wordP)
#define STATIC_CAST(type, x)