OGRErr OGRShapeLayer::SyncToDisk() { if( bHeaderDirty ) { if( hSHP != NULL ) SHPWriteHeader( hSHP ); if( hDBF != NULL ) DBFUpdateHeader( hDBF ); bHeaderDirty = FALSE; } if( hSHP != NULL ) { hSHP->sHooks.FFlush( hSHP->fpSHP ); if( hSHP->fpSHX != NULL ) hSHP->sHooks.FFlush( hSHP->fpSHX ); } if( hDBF != NULL ) hDBF->sHooks.FFlush( hDBF->fp ); return OGRERR_NONE; }
void SHPAPI_CALL DBFClose(DBFHandle psDBF) { /* -------------------------------------------------------------------- */ /* Write out header if not already written. */ /* -------------------------------------------------------------------- */ if( psDBF->bNoHeader ) DBFWriteHeader( psDBF ); DBFFlushRecord( psDBF ); /* -------------------------------------------------------------------- */ /* Update last access date, and number of records if we have */ /* write access. */ /* -------------------------------------------------------------------- */ if( psDBF->bUpdated ) DBFUpdateHeader( psDBF ); /* -------------------------------------------------------------------- */ /* Close, and free resources. */ /* -------------------------------------------------------------------- */ fclose( psDBF->fp ); if( psDBF->panFieldOffset != NULL ) { free( psDBF->panFieldOffset ); free( psDBF->panFieldSize ); free( psDBF->panFieldDecimals ); free( psDBF->pachFieldType ); } free( psDBF->pszHeader ); free( psDBF->pszCurrentRecord ); free( psDBF ); if( pszStringField != NULL ) { free( pszStringField ); pszStringField = NULL; nStringFieldLen = 0; } }