Skip to content

Commit

Permalink
Pass hooks as const pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
thbeu committed Nov 2, 2023
1 parent 15ac95b commit 4baee4f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
5 changes: 3 additions & 2 deletions dbfopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ static int DBFGetLenWithoutExtension(const char *pszBasename)
/************************************************************************/

DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszFilename, const char *pszAccess,
SAHooks *psHooks)
const SAHooks *psHooks)
{
/* -------------------------------------------------------------------- */
/* We only allow the access strings "rb" and "r+". */
Expand Down Expand Up @@ -647,7 +647,8 @@ DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszFilename,
/************************************************************************/

DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszFilename,
const char *pszCodePage, SAHooks *psHooks)
const char *pszCodePage,
const SAHooks *psHooks)
{
/* -------------------------------------------------------------------- */
/* Compute the base (layer) name. If there is any extension */
Expand Down
3 changes: 2 additions & 1 deletion sbnsearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ static void SwapWord(int length, void *wordP)
/* SBNOpenDiskTree() */
/************************************************************************/

SBNSearchHandle SBNOpenDiskTree(const char *pszSBNFilename, SAHooks *psHooks)
SBNSearchHandle SBNOpenDiskTree(const char *pszSBNFilename,
const SAHooks *psHooks)
{
/* -------------------------------------------------------------------- */
/* Establish the byte order on this machine. */
Expand Down
18 changes: 9 additions & 9 deletions shapefil.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,13 @@ extern "C"
SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile,
const char *pszAccess);
SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile,
const char *pszAccess, SAHooks *psHooks);
const char *pszAccess, const SAHooks *psHooks);
SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszShapeFile,
const char *pszAccess, SAHooks *psHooks,
const char *pszAccess, const SAHooks *psHooks,
int bRestoreSHX);

int SHPAPI_CALL SHPRestoreSHX(const char *pszShapeFile,
const char *pszAccess, SAHooks *psHooks);
const char *pszAccess, const SAHooks *psHooks);

/* If setting bFastMode = TRUE, the content of SHPReadObject() is owned by the SHPHandle. */
/* So you cannot have 2 valid instances of SHPReadObject() simultaneously. */
Expand All @@ -285,7 +285,7 @@ extern "C"

SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType);
SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType,
SAHooks *psHooks);
const SAHooks *psHooks);
void SHPAPI_CALL SHPGetInfo(SHPHandle hSHP, int *pnEntities,
int *pnShapeType, double *padfMinBound,
double *padfMaxBound);
Expand Down Expand Up @@ -376,7 +376,7 @@ extern "C"
typedef struct SHPDiskTreeInfo *SHPTreeDiskHandle;

SHPTreeDiskHandle SHPAPI_CALL SHPOpenDiskTree(const char *pszQIXFilename,
SAHooks *psHooks);
const SAHooks *psHooks);

void SHPAPI_CALL SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree);

Expand All @@ -385,7 +385,7 @@ extern "C"
double *padfBoundsMax, int *pnShapeCount);

int SHPAPI_CALL SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename,
SAHooks *psHooks);
const SAHooks *psHooks);

/* -------------------------------------------------------------------- */
/* SBN Search API */
Expand All @@ -394,7 +394,7 @@ extern "C"
typedef struct SBNSearchInfo *SBNSearchHandle;

SBNSearchHandle SHPAPI_CALL SBNOpenDiskTree(const char *pszSBNFilename,
SAHooks *psHooks);
const SAHooks *psHooks);

void SHPAPI_CALL SBNCloseDiskTree(SBNSearchHandle hSBN);

Expand Down Expand Up @@ -483,13 +483,13 @@ extern "C"
DBFHandle SHPAPI_CALL DBFOpen(const char *pszDBFFile,
const char *pszAccess);
DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile,
const char *pszAccess, SAHooks *psHooks);
const char *pszAccess, const SAHooks *psHooks);
DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile);
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile,
const char *pszCodePage);
DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile,
const char *pszCodePage,
SAHooks *psHooks);
const SAHooks *psHooks);

int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF);
int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF);
Expand Down
8 changes: 4 additions & 4 deletions shpopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static int SHPGetLenWithoutExtension(const char *pszBasename)
/************************************************************************/

SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszLayer, const char *pszAccess,
SAHooks *psHooks)
const SAHooks *psHooks)
{
/* -------------------------------------------------------------------- */
/* Ensure the access string is one of the legal ones. We */
Expand Down Expand Up @@ -666,7 +666,7 @@ SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszLayer, const char *pszAccess,
/************************************************************************/

SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszLayer, const char *pszAccess,
SAHooks *psHooks, int bRestoreSHX)
const SAHooks *psHooks, int bRestoreSHX)
{
if (!bRestoreSHX)
return SHPOpenLL(pszLayer, pszAccess, psHooks);
Expand All @@ -689,7 +689,7 @@ SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszLayer, const char *pszAccess,
/************************************************************************/

int SHPAPI_CALL SHPRestoreSHX(const char *pszLayer, const char *pszAccess,
SAHooks *psHooks)
const SAHooks *psHooks)
{
/* -------------------------------------------------------------------- */
/* Ensure the access string is one of the legal ones. We */
Expand Down Expand Up @@ -981,7 +981,7 @@ SHPHandle SHPAPI_CALL SHPCreate(const char *pszLayer, int nShapeType)
/************************************************************************/

SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszLayer, int nShapeType,
SAHooks *psHooks)
const SAHooks *psHooks)
{
/* -------------------------------------------------------------------- */
/* Establish the byte order on this system. */
Expand Down
9 changes: 6 additions & 3 deletions shptree.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,8 @@ struct SHPDiskTreeInfo
/* SHPOpenDiskTree() */
/************************************************************************/

SHPTreeDiskHandle SHPOpenDiskTree(const char *pszQIXFilename, SAHooks *psHooks)
SHPTreeDiskHandle SHPOpenDiskTree(const char *pszQIXFilename,
const SAHooks *psHooks)
{
SHPTreeDiskHandle hDiskTree;

Expand Down Expand Up @@ -1049,7 +1050,8 @@ static int SHPGetSubNodeOffset(SHPTreeNode *node)
/* SHPWriteTreeNode() */
/************************************************************************/

static void SHPWriteTreeNode(SAFile fp, SHPTreeNode *node, SAHooks *psHooks)
static void SHPWriteTreeNode(SAFile fp, SHPTreeNode *node,
const SAHooks *psHooks)
{
int i, j;
int offset;
Expand Down Expand Up @@ -1111,7 +1113,8 @@ int SHPAPI_CALL SHPWriteTree(SHPTree *tree, const char *filename)
/* SHPWriteTreeLL() */
/************************************************************************/

int SHPWriteTreeLL(SHPTree *tree, const char *filename, SAHooks *psHooks)
int SHPWriteTreeLL(SHPTree *tree, const char *filename,
const SAHooks *psHooks)
{
char signature[4] = "SQT";
int i;
Expand Down

0 comments on commit 4baee4f

Please sign in to comment.