PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ DBFWriteTuple()

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

Definition at line 1549 of file dbfopen.c.

References DBFFlushRecord(), DBFLoadRecord(), DBFReadTuple(), DBFWriteHeader(), FALSE, SHPAPI_CALL1, and TRUE.

1551 {
1552  int i;
1553  unsigned char *pabyRec;
1554 
1555 /* -------------------------------------------------------------------- */
1556 /* Is this a valid record? */
1557 /* -------------------------------------------------------------------- */
1558  if( hEntity < 0 || hEntity > psDBF->nRecords )
1559  return( FALSE );
1560 
1561  if( psDBF->bNoHeader )
1562  DBFWriteHeader(psDBF);
1563 
1564 /* -------------------------------------------------------------------- */
1565 /* Is this a brand new record? */
1566 /* -------------------------------------------------------------------- */
1567  if( hEntity == psDBF->nRecords )
1568  {
1569  if( !DBFFlushRecord( psDBF ) )
1570  return FALSE;
1571 
1572  psDBF->nRecords++;
1573  for( i = 0; i < psDBF->nRecordLength; i++ )
1574  psDBF->pszCurrentRecord[i] = ' ';
1575 
1576  psDBF->nCurrentRecord = hEntity;
1577  }
1578 
1579 /* -------------------------------------------------------------------- */
1580 /* Is this an existing record, but different than the last one */
1581 /* we accessed? */
1582 /* -------------------------------------------------------------------- */
1583  if( !DBFLoadRecord( psDBF, hEntity ) )
1584  return FALSE;
1585 
1586  pabyRec = (unsigned char *) psDBF->pszCurrentRecord;
1587 
1588  memcpy ( pabyRec, pRawTuple, psDBF->nRecordLength );
1589 
1590  psDBF->bCurrentRecordModified = TRUE;
1591  psDBF->bUpdated = TRUE;
1592 
1593  return( TRUE );
1594 }
static int DBFLoadRecord(DBFHandle psDBF, int iRecord)
Definition: dbfopen.c:291
static void DBFWriteHeader(DBFHandle psDBF)
Definition: dbfopen.c:197
static int DBFFlushRecord(DBFHandle psDBF)
Definition: dbfopen.c:258
#define FALSE
Definition: dbfopen.c:168
#define TRUE
Definition: dbfopen.c:169
Here is the call graph for this function: