PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ DBFWriteTuple()

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

Definition at line 1492 of file dbfopen.c.

1493 {
1494  int i;
1495  unsigned char *pabyRec;
1496 
1497  /* -------------------------------------------------------------------- */
1498  /* Is this a valid record? */
1499  /* -------------------------------------------------------------------- */
1500  if (hEntity < 0 || hEntity > psDBF->nRecords)
1501  return (FALSE);
1502 
1503  if (psDBF->bNoHeader)
1504  DBFWriteHeader(psDBF);
1505 
1506  /* -------------------------------------------------------------------- */
1507  /* Is this a brand new record? */
1508  /* -------------------------------------------------------------------- */
1509  if (hEntity == psDBF->nRecords)
1510  {
1511  if (!DBFFlushRecord(psDBF))
1512  return FALSE;
1513 
1514  psDBF->nRecords++;
1515  for (i = 0; i < psDBF->nRecordLength; i++)
1516  psDBF->pszCurrentRecord[i] = ' ';
1517 
1518  psDBF->nCurrentRecord = hEntity;
1519  }
1520 
1521  /* -------------------------------------------------------------------- */
1522  /* Is this an existing record, but different than the last one */
1523  /* we accessed? */
1524  /* -------------------------------------------------------------------- */
1525  if (!DBFLoadRecord(psDBF, hEntity))
1526  return FALSE;
1527 
1528  pabyRec = (unsigned char *)psDBF->pszCurrentRecord;
1529 
1530  memcpy(pabyRec, pRawTuple, psDBF->nRecordLength);
1531 
1532  psDBF->bCurrentRecordModified = TRUE;
1533  psDBF->bUpdated = TRUE;
1534 
1535  return (TRUE);
1536 }
static int DBFLoadRecord(DBFHandle psDBF, int iRecord)
Definition: dbfopen.c:286
static void DBFWriteHeader(DBFHandle psDBF)
Definition: dbfopen.c:198
#define TRUE
Definition: dbfopen.c:169
#define FALSE
Definition: dbfopen.c:168
static int DBFFlushRecord(DBFHandle psDBF)
Definition: dbfopen.c:258

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

Here is the call graph for this function: