PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ DBFLoadRecord()

static int DBFLoadRecord ( DBFHandle  psDBF,
int  iRecord 
)
static

Definition at line 291 of file dbfopen.c.

References DBFFlushRecord(), FALSE, SHPAPI_CALL, and TRUE.

Referenced by DBFIsRecordDeleted(), DBFMarkRecordDeleted(), DBFReadAttribute(), DBFWriteAttribute(), DBFWriteAttributeDirectly(), and DBFWriteTuple().

293 {
294  if( psDBF->nCurrentRecord != iRecord )
295  {
296  SAOffset nRecordOffset;
297 
298  if( !DBFFlushRecord( psDBF ) )
299  return FALSE;
300 
301  nRecordOffset =
302  psDBF->nRecordLength * (SAOffset) iRecord + psDBF->nHeaderLength;
303 
304  if( psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, SEEK_SET ) != 0 )
305  {
306  char szMessage[128];
307  sprintf( szMessage, "fseek(%ld) failed on DBF file.\n",
308  (long) nRecordOffset );
309  psDBF->sHooks.Error( szMessage );
310  return FALSE;
311  }
312 
313  if( psDBF->sHooks.FRead( psDBF->pszCurrentRecord,
314  psDBF->nRecordLength, 1, psDBF->fp ) != 1 )
315  {
316  char szMessage[128];
317  sprintf( szMessage, "fread(%d) failed on DBF file.\n",
318  psDBF->nRecordLength );
319  psDBF->sHooks.Error( szMessage );
320  return FALSE;
321  }
322 
323  psDBF->nCurrentRecord = iRecord;
324  }
325 
326  return TRUE;
327 }
unsigned long SAOffset
Definition: shapefil.h:250
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:
Here is the caller graph for this function: