1932 int *panFieldOffsetNew;
1933 int *panFieldSizeNew;
1934 int *panFieldDecimalsNew;
1935 char *pachFieldTypeNew;
1940 if ( psDBF->nFields == 0 )
1947 panFieldOffsetNew = (
int *)
malloc(
sizeof(
int) * psDBF->nFields);
1948 panFieldSizeNew = (
int *)
malloc(
sizeof(
int) * psDBF->nFields);
1949 panFieldDecimalsNew = (
int *)
malloc(
sizeof(
int) * psDBF->nFields);
1950 pachFieldTypeNew = (
char *)
malloc(
sizeof(
char) * psDBF->nFields);
1951 pszHeaderNew = (
char*)
malloc(
sizeof(
char) * 32 * psDBF->nFields);
1954 for(i=0; i < psDBF->nFields; i++)
1956 panFieldSizeNew[i] = psDBF->panFieldSize[panMap[i]];
1957 panFieldDecimalsNew[i] = psDBF->panFieldDecimals[panMap[i]];
1958 pachFieldTypeNew[i] = psDBF->pachFieldType[panMap[i]];
1959 memcpy(pszHeaderNew + i * 32,
1960 psDBF->pszHeader + panMap[i] * 32, 32);
1962 panFieldOffsetNew[0] = 1;
1963 for(i=1; i < psDBF->nFields; i++)
1965 panFieldOffsetNew[i] = panFieldOffsetNew[i - 1] + panFieldSizeNew[i - 1];
1968 free(psDBF->pszHeader);
1969 psDBF->pszHeader = pszHeaderNew;
1972 if ( !(psDBF->bNoHeader && psDBF->nRecords == 0) )
1975 psDBF->bNoHeader =
TRUE;
1979 pszRecord = (
char *)
malloc(
sizeof(
char) * psDBF->nRecordLength);
1980 pszRecordNew = (
char *)
malloc(
sizeof(
char) * psDBF->nRecordLength);
1983 for (iRecord = 0; iRecord < psDBF->nRecords; iRecord++)
1986 psDBF->nRecordLength * (
SAOffset) iRecord + psDBF->nHeaderLength;
1989 psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 );
1990 psDBF->sHooks.FRead( pszRecord, psDBF->nRecordLength, 1, psDBF->fp );
1992 pszRecordNew[0] = pszRecord[0];
1994 for(i=0; i < psDBF->nFields; i++)
1996 memcpy(pszRecordNew + panFieldOffsetNew[i],
1997 pszRecord + psDBF->panFieldOffset[panMap[i]],
1998 psDBF->panFieldSize[panMap[i]]);
2002 psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 );
2003 psDBF->sHooks.FWrite( pszRecordNew, psDBF->nRecordLength, 1, psDBF->fp );
2011 free(psDBF->panFieldOffset);
2012 free(psDBF->panFieldSize);
2013 free(psDBF->panFieldDecimals);
2014 free(psDBF->pachFieldType);
2016 psDBF->panFieldOffset = panFieldOffsetNew;
2017 psDBF->panFieldSize = panFieldSizeNew;
2018 psDBF->panFieldDecimals =panFieldDecimalsNew;
2019 psDBF->pachFieldType = pachFieldTypeNew;
2021 psDBF->nCurrentRecord = -1;
2022 psDBF->bCurrentRecordModified =
FALSE;
static int DBFFlushRecord(DBFHandle psDBF)
void SHPAPI_CALL DBFUpdateHeader(DBFHandle psDBF)