1803 return psDBF->pszCodePage;
1815 int nOldRecordLength, nOldHeaderLength;
1816 int nDeletedFieldOffset, nDeletedFieldSize;
1821 if (iField < 0 || iField >= psDBF->nFields)
1829 nOldRecordLength = psDBF->nRecordLength;
1830 nOldHeaderLength = psDBF->nHeaderLength;
1831 nDeletedFieldOffset = psDBF->panFieldOffset[iField];
1832 nDeletedFieldSize = psDBF->panFieldSize[iField];
1835 for (i = iField + 1; i < psDBF->nFields; i++)
1837 psDBF->panFieldOffset[i-1] = psDBF->panFieldOffset[i] - nDeletedFieldSize;
1838 psDBF->panFieldSize[i-1] = psDBF->panFieldSize[i];
1839 psDBF->panFieldDecimals[i-1] = psDBF->panFieldDecimals[i];
1840 psDBF->pachFieldType[i-1] = psDBF->pachFieldType[i];
1846 psDBF->panFieldOffset = (
int *)
1847 SfRealloc( psDBF->panFieldOffset,
sizeof(
int) * psDBF->nFields );
1849 psDBF->panFieldSize = (
int *)
1850 SfRealloc( psDBF->panFieldSize,
sizeof(
int) * psDBF->nFields );
1852 psDBF->panFieldDecimals = (
int *)
1853 SfRealloc( psDBF->panFieldDecimals,
sizeof(
int) * psDBF->nFields );
1855 psDBF->pachFieldType = (
char *)
1856 SfRealloc( psDBF->pachFieldType,
sizeof(
char) * psDBF->nFields );
1859 psDBF->nHeaderLength -= 32;
1860 psDBF->nRecordLength -= nDeletedFieldSize;
1863 memmove(psDBF->pszHeader + iField*32,
1864 psDBF->pszHeader + (iField+1)*32,
1865 sizeof(
char) * (psDBF->nFields - iField)*32);
1867 psDBF->pszHeader = (
char *)
SfRealloc(psDBF->pszHeader,psDBF->nFields*32);
1870 psDBF->pszCurrentRecord = (
char *)
SfRealloc(psDBF->pszCurrentRecord,
1871 psDBF->nRecordLength);
1874 if ( psDBF->bNoHeader && psDBF->nRecords == 0 )
1878 psDBF->bNoHeader =
TRUE;
1882 pszRecord = (
char *)
malloc(
sizeof(
char) * nOldRecordLength);
1885 for (iRecord = 0; iRecord < psDBF->nRecords; iRecord++)
1888 nOldRecordLength * (
SAOffset) iRecord + nOldHeaderLength;
1891 psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 );
1892 psDBF->sHooks.FRead( pszRecord, nOldRecordLength, 1, psDBF->fp );
1895 psDBF->nRecordLength * (
SAOffset) iRecord + psDBF->nHeaderLength;
1898 psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 );
1899 psDBF->sHooks.FWrite( pszRecord, nDeletedFieldOffset, 1, psDBF->fp );
1900 psDBF->sHooks.FWrite( pszRecord + nDeletedFieldOffset + nDeletedFieldSize,
1901 nOldRecordLength - nDeletedFieldOffset - nDeletedFieldSize,
1911 psDBF->nCurrentRecord = -1;
1912 psDBF->bCurrentRecordModified =
FALSE;
static void * SfRealloc(void *pMem, int nNewSize)
static int DBFFlushRecord(DBFHandle psDBF)
int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField)
void SHPAPI_CALL DBFUpdateHeader(DBFHandle psDBF)