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

◆ DBFWriteTuple()

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

Definition at line 1576 of file dbfopen.c.

1578{
1579 int i;
1580 unsigned char *pabyRec;
1581
1582/* -------------------------------------------------------------------- */
1583/* Is this a valid record? */
1584/* -------------------------------------------------------------------- */
1585 if( hEntity < 0 || hEntity > psDBF->nRecords )
1586 return( FALSE );
1587
1588 if( psDBF->bNoHeader )
1589 DBFWriteHeader(psDBF);
1590
1591/* -------------------------------------------------------------------- */
1592/* Is this a brand new record? */
1593/* -------------------------------------------------------------------- */
1594 if( hEntity == psDBF->nRecords )
1595 {
1596 if( !DBFFlushRecord( psDBF ) )
1597 return FALSE;
1598
1599 psDBF->nRecords++;
1600 for( i = 0; i < psDBF->nRecordLength; i++ )
1601 psDBF->pszCurrentRecord[i] = ' ';
1602
1603 psDBF->nCurrentRecord = hEntity;
1604 }
1605
1606/* -------------------------------------------------------------------- */
1607/* Is this an existing record, but different than the last one */
1608/* we accessed? */
1609/* -------------------------------------------------------------------- */
1610 if( !DBFLoadRecord( psDBF, hEntity ) )
1611 return FALSE;
1612
1613 pabyRec = REINTERPRET_CAST(unsigned char *, psDBF->pszCurrentRecord);
1614
1615 memcpy ( pabyRec, pRawTuple, psDBF->nRecordLength );
1616
1618 psDBF->bUpdated = TRUE;
1619
1620 return( TRUE );
1621}
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: