1833{
1836 char szErrorMsg[160];
1839
1840
1841
1842
1843 if( hEntity < 0 || hEntity >= psSHP->
nRecords )
1845
1846
1847
1848
1850 {
1851 unsigned int nOffset, nLength;
1852
1856 {
1858 snprintf(
str,
sizeof(
str),
1859 "Error in fseek()/fread() reading object from .shx file at offset %d",
1860 100 + 8 * hEntity);
1861 str[
sizeof(
str)-1] =
'\0';
1862
1865 }
1868
1869 if( nOffset >
STATIC_CAST(
unsigned int, INT_MAX) )
1870 {
1872 snprintf(
str,
sizeof(
str),
1873 "Invalid offset for entity %d", hEntity);
1874 str[
sizeof(
str)-1] =
'\0';
1875
1878 }
1879 if( nLength >
STATIC_CAST(
unsigned int, INT_MAX / 2 - 4) )
1880 {
1882 snprintf(
str,
sizeof(
str),
1883 "Invalid length for entity %d", hEntity);
1884 str[
sizeof(
str)-1] =
'\0';
1885
1888 }
1889
1892 }
static void SwapWord(int length, void *wordP)
#define STATIC_CAST(type, x)
void(* Error)(const char *message)
SAOffset(* FRead)(void *p, SAOffset size, SAOffset nmemb, SAFile file)
SAOffset(* FSeek)(SAFile file, SAOffset offset, int whence)
unsigned int * panRecSize
unsigned int * panRecOffset