1743 return psDBF->pszCodePage;
1755 int nOldRecordLength, nOldHeaderLength;
1756 int nDeletedFieldOffset, nDeletedFieldSize;
1761 if (iField < 0 || iField >= psDBF->nFields)
1769 nOldRecordLength = psDBF->nRecordLength;
1770 nOldHeaderLength = psDBF->nHeaderLength;
1771 nDeletedFieldOffset = psDBF->panFieldOffset[iField];
1772 nDeletedFieldSize = psDBF->panFieldSize[iField];
1775 for (i = iField + 1; i < psDBF->nFields; i++)
1777 psDBF->panFieldOffset[i - 1] = psDBF->panFieldOffset[i] - nDeletedFieldSize;
1778 psDBF->panFieldSize[i - 1] = psDBF->panFieldSize[i];
1779 psDBF->panFieldDecimals[i - 1] = psDBF->panFieldDecimals[i];
1780 psDBF->pachFieldType[i - 1] = psDBF->pachFieldType[i];
1786 psDBF->panFieldOffset = (
int *)
SfRealloc(psDBF->panFieldOffset,
sizeof(
int) * psDBF->nFields);
1788 psDBF->panFieldSize = (
int *)
SfRealloc(psDBF->panFieldSize,
sizeof(
int) * psDBF->nFields);
1790 psDBF->panFieldDecimals = (
int *)
SfRealloc(psDBF->panFieldDecimals,
sizeof(
int) * psDBF->nFields);
1792 psDBF->pachFieldType = (
char *)
SfRealloc(psDBF->pachFieldType,
sizeof(
char) * psDBF->nFields);
1795 psDBF->nHeaderLength -= 32;
1796 psDBF->nRecordLength -= nDeletedFieldSize;
1799 memmove(psDBF->pszHeader + iField * 32,
1800 psDBF->pszHeader + (iField + 1) * 32,
1801 sizeof(
char) * (psDBF->nFields - iField) * 32);
1803 psDBF->pszHeader = (
char *)
SfRealloc(psDBF->pszHeader, psDBF->nFields * 32);
1806 psDBF->pszCurrentRecord = (
char *)
SfRealloc(psDBF->pszCurrentRecord, psDBF->nRecordLength);
1809 if (psDBF->bNoHeader && psDBF->nRecords == 0)
1813 psDBF->bNoHeader =
TRUE;
1817 pszRecord = (
char *)
malloc(
sizeof(
char) * nOldRecordLength);
1820 for (iRecord = 0; iRecord < psDBF->nRecords; iRecord++)
1822 nRecordOffset = nOldRecordLength * (
SAOffset)iRecord + nOldHeaderLength;
1825 psDBF->sHooks.FSeek(psDBF->fp, nRecordOffset, 0);
1826 psDBF->sHooks.FRead(pszRecord, nOldRecordLength, 1, psDBF->fp);
1828 nRecordOffset = psDBF->nRecordLength * (
SAOffset)iRecord + psDBF->nHeaderLength;
1831 psDBF->sHooks.FSeek(psDBF->fp, nRecordOffset, 0);
1832 psDBF->sHooks.FWrite(pszRecord, nDeletedFieldOffset, 1, psDBF->fp);
1833 psDBF->sHooks.FWrite(pszRecord + nDeletedFieldOffset + nDeletedFieldSize,
1834 nOldRecordLength - nDeletedFieldOffset - nDeletedFieldSize,
1844 psDBF->nCurrentRecord = -1;
1845 psDBF->bCurrentRecordModified =
FALSE;
static void * SfRealloc(void *pMem, int nNewSize)
static int DBFFlushRecord(DBFHandle psDBF)
void SHPAPI_CALL DBFUpdateHeader(DBFHandle psDBF)
int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField)