PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ DBFWriteTuple()

int SHPAPI_CALL DBFWriteTuple ( DBFHandle  psDBF,
int  hEntity,
void *  pRawTuple 
)

Definition at line 1585 of file dbfopen.c.

1587{
1588 int i;
1589 unsigned char *pabyRec;
1590
1591/* -------------------------------------------------------------------- */
1592/* Is this a valid record? */
1593/* -------------------------------------------------------------------- */
1594 if( hEntity < 0 || hEntity > psDBF->nRecords )
1595 return( FALSE );
1596
1597 if( psDBF->bNoHeader )
1598 DBFWriteHeader(psDBF);
1599
1600/* -------------------------------------------------------------------- */
1601/* Is this a brand new record? */
1602/* -------------------------------------------------------------------- */
1603 if( hEntity == psDBF->nRecords )
1604 {
1605 if( !DBFFlushRecord( psDBF ) )
1606 return FALSE;
1607
1608 psDBF->nRecords++;
1609 for( i = 0; i < psDBF->nRecordLength; i++ )
1610 psDBF->pszCurrentRecord[i] = ' ';
1611
1612 psDBF->nCurrentRecord = hEntity;
1613 }
1614
1615/* -------------------------------------------------------------------- */
1616/* Is this an existing record, but different than the last one */
1617/* we accessed? */
1618/* -------------------------------------------------------------------- */
1619 if( !DBFLoadRecord( psDBF, hEntity ) )
1620 return FALSE;
1621
1622 pabyRec = REINTERPRET_CAST(unsigned char *, psDBF->pszCurrentRecord);
1623
1624 memcpy ( pabyRec, pRawTuple, psDBF->nRecordLength );
1625
1627 psDBF->bUpdated = TRUE;
1628
1629 return( TRUE );
1630}
static int DBFLoadRecord(DBFHandle psDBF, int iRecord)
Definition dbfopen.c:257
#define REINTERPRET_CAST(type, x)
Definition dbfopen.c:97
static void DBFWriteHeader(DBFHandle psDBF)
Definition dbfopen.c:127
#define TRUE
Definition dbfopen.c:73
#define FALSE
Definition dbfopen.c:72
static int DBFFlushRecord(DBFHandle psDBF)
Definition dbfopen.c:195
int nRecordLength
Definition shapefil.h:596
int bUpdated
Definition shapefil.h:616
char * pszCurrentRecord
Definition shapefil.h:610
int bCurrentRecordModified
Definition shapefil.h:609
int bNoHeader
Definition shapefil.h:615
int nRecords
Definition shapefil.h:594
int nCurrentRecord
Definition shapefil.h:608

References DBFInfo::bCurrentRecordModified, DBFInfo::bNoHeader, DBFInfo::bUpdated, DBFFlushRecord(), DBFLoadRecord(), DBFWriteHeader(), FALSE, DBFInfo::nCurrentRecord, DBFInfo::nRecordLength, DBFInfo::nRecords, DBFInfo::pszCurrentRecord, REINTERPRET_CAST, and TRUE.

Here is the call graph for this function: