PostGIS 3.6.2dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ DBFCloneEmpty()

DBFHandle SHPAPI_CALL DBFCloneEmpty ( DBFHandle  psDBF,
const char *  pszFilename 
)

Definition at line 1650 of file dbfopen.c.

1651{
1652 DBFHandle newDBF;
1653
1654 newDBF = DBFCreateEx ( pszFilename, psDBF->pszCodePage );
1655 if ( newDBF == SHPLIB_NULLPTR ) return SHPLIB_NULLPTR;
1656
1657 newDBF->nFields = psDBF->nFields;
1658 newDBF->nRecordLength = psDBF->nRecordLength;
1659 newDBF->nHeaderLength = psDBF->nHeaderLength;
1660
1661 if( psDBF->pszHeader )
1662 {
1663 newDBF->pszHeader = STATIC_CAST(char *, malloc ( XBASE_FLDHDR_SZ * psDBF->nFields ));
1664 memcpy ( newDBF->pszHeader, psDBF->pszHeader, XBASE_FLDHDR_SZ * psDBF->nFields );
1665 }
1666
1667 newDBF->panFieldOffset = STATIC_CAST(int *, malloc ( sizeof(int) * psDBF->nFields ));
1668 memcpy ( newDBF->panFieldOffset, psDBF->panFieldOffset, sizeof(int) * psDBF->nFields );
1669 newDBF->panFieldSize = STATIC_CAST(int *, malloc ( sizeof(int) * psDBF->nFields ));
1670 memcpy ( newDBF->panFieldSize, psDBF->panFieldSize, sizeof(int) * psDBF->nFields );
1671 newDBF->panFieldDecimals = STATIC_CAST(int *, malloc ( sizeof(int) * psDBF->nFields ));
1672 memcpy ( newDBF->panFieldDecimals, psDBF->panFieldDecimals, sizeof(int) * psDBF->nFields );
1673 newDBF->pachFieldType = STATIC_CAST(char *, malloc ( sizeof(char) * psDBF->nFields ));
1674 memcpy ( newDBF->pachFieldType, psDBF->pachFieldType, sizeof(char)*psDBF->nFields );
1675
1676 newDBF->bNoHeader = TRUE;
1677 newDBF->bUpdated = TRUE;
1679
1680 DBFWriteHeader ( newDBF );
1681 DBFClose ( newDBF );
1682
1683 newDBF = DBFOpen ( pszFilename, "rb+" );
1685
1686 return ( newDBF );
1687}
DBFHandle SHPAPI_CALL DBFOpen(const char *pszFilename, const char *pszAccess)
Definition dbfopen.c:351
#define STATIC_CAST(type, x)
Definition dbfopen.c:96
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszFilename, const char *pszCodePage)
Definition dbfopen.c:662
void SHPAPI_CALL DBFClose(DBFHandle psDBF)
Definition dbfopen.c:599
static void DBFWriteHeader(DBFHandle psDBF)
Definition dbfopen.c:127
#define TRUE
Definition dbfopen.c:73
#define SHPLIB_NULLPTR
Definition dbfopen.c:99
void * malloc(YYSIZE_T)
#define XBASE_FLDHDR_SZ
Definition shapefil.h:648
int bWriteEndOfFileChar
Definition shapefil.h:631
int nRecordLength
Definition shapefil.h:596
int * panFieldOffset
Definition shapefil.h:601
int * panFieldDecimals
Definition shapefil.h:603
char * pszCodePage
Definition shapefil.h:625
int nFields
Definition shapefil.h:600
int bUpdated
Definition shapefil.h:616
int nHeaderLength
Definition shapefil.h:597
int * panFieldSize
Definition shapefil.h:602
char * pszHeader
Definition shapefil.h:606
char * pachFieldType
Definition shapefil.h:604
int bNoHeader
Definition shapefil.h:615

References DBFInfo::bNoHeader, DBFInfo::bUpdated, DBFInfo::bWriteEndOfFileChar, DBFClose(), DBFCreateEx(), DBFOpen(), DBFWriteHeader(), malloc(), DBFInfo::nFields, DBFInfo::nHeaderLength, DBFInfo::nRecordLength, DBFInfo::pachFieldType, DBFInfo::panFieldDecimals, DBFInfo::panFieldOffset, DBFInfo::panFieldSize, DBFInfo::pszCodePage, DBFInfo::pszHeader, SHPLIB_NULLPTR, STATIC_CAST, TRUE, and XBASE_FLDHDR_SZ.

Here is the call graph for this function: