PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ DBFUpdateHeader()

void SHPAPI_CALL DBFUpdateHeader ( DBFHandle  psDBF)

Definition at line 304 of file dbfopen.c.

306 {
307  unsigned char abyFileHeader[XBASE_FILEHDR_SZ];
308 
309  if( psDBF->bNoHeader )
310  DBFWriteHeader( psDBF );
311 
312  if( !DBFFlushRecord( psDBF ) )
313  return;
314 
315  psDBF->sHooks.FSeek( psDBF->fp, 0, 0 );
316  psDBF->sHooks.FRead( abyFileHeader, sizeof(abyFileHeader), 1, psDBF->fp );
317 
318  abyFileHeader[1] = STATIC_CAST(unsigned char, psDBF->nUpdateYearSince1900);
319  abyFileHeader[2] = STATIC_CAST(unsigned char, psDBF->nUpdateMonth);
320  abyFileHeader[3] = STATIC_CAST(unsigned char, psDBF->nUpdateDay);
321  abyFileHeader[4] = STATIC_CAST(unsigned char, psDBF->nRecords & 0xFF);
322  abyFileHeader[5] = STATIC_CAST(unsigned char, (psDBF->nRecords>>8) & 0xFF);
323  abyFileHeader[6] = STATIC_CAST(unsigned char, (psDBF->nRecords>>16) & 0xFF);
324  abyFileHeader[7] = STATIC_CAST(unsigned char, (psDBF->nRecords>>24) & 0xFF);
325 
326  psDBF->sHooks.FSeek( psDBF->fp, 0, 0 );
327  psDBF->sHooks.FWrite( abyFileHeader, sizeof(abyFileHeader), 1, psDBF->fp );
328 
329  psDBF->sHooks.FFlush( psDBF->fp );
330 }
#define STATIC_CAST(type, x)
Definition: dbfopen.c:96
#define XBASE_FILEHDR_SZ
Definition: dbfopen.c:77
static void DBFWriteHeader(DBFHandle psDBF)
Definition: dbfopen.c:127
static int DBFFlushRecord(DBFHandle psDBF)
Definition: dbfopen.c:195
int nUpdateDay
Definition: shapefil.h:629
int nUpdateMonth
Definition: shapefil.h:628
int nUpdateYearSince1900
Definition: shapefil.h:627
SAFile fp
Definition: shapefil.h:592
SAHooks sHooks
Definition: shapefil.h:590
int bNoHeader
Definition: shapefil.h:615
int nRecords
Definition: shapefil.h:594
int(* FFlush)(SAFile file)
Definition: shapefil.h:295
SAOffset(* FWrite)(void *p, SAOffset size, SAOffset nmemb, SAFile file)
Definition: shapefil.h:292
SAOffset(* FRead)(void *p, SAOffset size, SAOffset nmemb, SAFile file)
Definition: shapefil.h:291
SAOffset(* FSeek)(SAFile file, SAOffset offset, int whence)
Definition: shapefil.h:293

References DBFInfo::bNoHeader, DBFFlushRecord(), DBFWriteHeader(), SAHooks::FFlush, DBFInfo::fp, SAHooks::FRead, SAHooks::FSeek, SAHooks::FWrite, DBFInfo::nRecords, DBFInfo::nUpdateDay, DBFInfo::nUpdateMonth, DBFInfo::nUpdateYearSince1900, DBFInfo::sHooks, STATIC_CAST, and XBASE_FILEHDR_SZ.

Referenced by DBFAddNativeFieldType(), DBFAlterFieldDefn(), DBFClose(), and DBFReorderFields().

Here is the call graph for this function:
Here is the caller graph for this function: