diff --git a/dbfopen.c b/dbfopen.c index 15378ec..84a0485 100644 --- a/dbfopen.c +++ b/dbfopen.c @@ -1169,7 +1169,8 @@ static bool DBFIsValueNULL(char chType, const char *pszValue) /* Contributed by Jim Matthews. */ /************************************************************************/ -int SHPAPI_CALL DBFIsAttributeNULL(DBFHandle psDBF, int iRecord, int iField) +int SHPAPI_CALL DBFIsAttributeNULL(const DBFHandle psDBF, int iRecord, + int iField) { const char *pszValue = DBFReadStringAttribute(psDBF, iRecord, iField); @@ -1185,7 +1186,7 @@ int SHPAPI_CALL DBFIsAttributeNULL(DBFHandle psDBF, int iRecord, int iField) /* Return the number of fields in this table. */ /************************************************************************/ -int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF) +int SHPAPI_CALL DBFGetFieldCount(const DBFHandle psDBF) { return (psDBF->nFields); } @@ -1196,7 +1197,7 @@ int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF) /* Return the number of records in this table. */ /************************************************************************/ -int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF) +int SHPAPI_CALL DBFGetRecordCount(const DBFHandle psDBF) { return (psDBF->nRecords); } @@ -1209,7 +1210,7 @@ int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF) /* bytes long. */ /************************************************************************/ -DBFFieldType SHPAPI_CALL DBFGetFieldInfo(DBFHandle psDBF, int iField, +DBFFieldType SHPAPI_CALL DBFGetFieldInfo(const DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals) { @@ -1621,7 +1622,8 @@ const char SHPAPI_CALL1(*) DBFReadTuple(DBFHandle psDBF, int hEntity) /* Read one of the attribute fields of a record. */ /************************************************************************/ -DBFHandle SHPAPI_CALL DBFCloneEmpty(DBFHandle psDBF, const char *pszFilename) +DBFHandle SHPAPI_CALL DBFCloneEmpty(const DBFHandle psDBF, + const char *pszFilename) { DBFHandle newDBF = DBFCreateEx(pszFilename, psDBF->pszCodePage); if (newDBF == SHPLIB_NULLPTR) @@ -1680,7 +1682,7 @@ DBFHandle SHPAPI_CALL DBFCloneEmpty(DBFHandle psDBF, const char *pszFilename) /* 'M' (Memo: 10 digits .DBT block ptr) */ /************************************************************************/ -char SHPAPI_CALL DBFGetNativeFieldType(DBFHandle psDBF, int iField) +char SHPAPI_CALL DBFGetNativeFieldType(const DBFHandle psDBF, int iField) { if (iField >= 0 && iField < psDBF->nFields) return psDBF->pachFieldType[iField]; @@ -1696,7 +1698,8 @@ char SHPAPI_CALL DBFGetNativeFieldType(DBFHandle psDBF, int iField) /* Contributed by Jim Matthews. */ /************************************************************************/ -int SHPAPI_CALL DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName) +int SHPAPI_CALL DBFGetFieldIndex(const DBFHandle psDBF, + const char *pszFieldName) { char name[XBASE_FLDNAME_LEN_READ + 1]; @@ -1716,7 +1719,7 @@ int SHPAPI_CALL DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName) /* it returns FALSE. */ /************************************************************************/ -int SHPAPI_CALL DBFIsRecordDeleted(DBFHandle psDBF, int iShape) +int SHPAPI_CALL DBFIsRecordDeleted(const DBFHandle psDBF, int iShape) { /* -------------------------------------------------------------------- */ /* Verify selection. */ @@ -1779,7 +1782,7 @@ int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, /* DBFGetCodePage */ /************************************************************************/ -const char SHPAPI_CALL1(*) DBFGetCodePage(DBFHandle psDBF) +const char SHPAPI_CALL1(*) DBFGetCodePage(const DBFHandle psDBF) { if (psDBF == SHPLIB_NULLPTR) return SHPLIB_NULLPTR; diff --git a/sbnsearch.c b/sbnsearch.c index 6cb8700..be08021 100644 --- a/sbnsearch.c +++ b/sbnsearch.c @@ -709,7 +709,7 @@ static int compare_ints(const void *a, const void *b) /* SBNSearchDiskTree() */ /************************************************************************/ -int *SBNSearchDiskTree(SBNSearchHandle hSBN, const double *padfBoundsMin, +int *SBNSearchDiskTree(const SBNSearchHandle hSBN, const double *padfBoundsMin, const double *padfBoundsMax, int *pnShapeCount) { *pnShapeCount = 0; @@ -808,7 +808,7 @@ int *SBNSearchDiskTree(SBNSearchHandle hSBN, const double *padfBoundsMin, /* SBNSearchDiskTreeInteger() */ /************************************************************************/ -int *SBNSearchDiskTreeInteger(SBNSearchHandle hSBN, int bMinX, int bMinY, +int *SBNSearchDiskTreeInteger(const SBNSearchHandle hSBN, int bMinX, int bMinY, int bMaxX, int bMaxY, int *pnShapeCount) { *pnShapeCount = 0; diff --git a/shapefil.h b/shapefil.h index 87f9c39..b30d3fb 100644 --- a/shapefil.h +++ b/shapefil.h @@ -292,13 +292,13 @@ extern "C" SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType); SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType, const SAHooks *psHooks); - void SHPAPI_CALL SHPGetInfo(SHPHandle hSHP, int *pnEntities, + void SHPAPI_CALL SHPGetInfo(const SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound); - SHPObject SHPAPI_CALL1(*) SHPReadObject(SHPHandle hSHP, int iShape); - int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, - SHPObject *psObject); + SHPObject SHPAPI_CALL1(*) SHPReadObject(const SHPHandle hSHP, int iShape); + int SHPAPI_CALL SHPWriteObject(const SHPHandle hSHP, int iShape, + const SHPObject *psObject); void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject); void SHPAPI_CALL SHPComputeExtents(SHPObject *psObject); @@ -311,10 +311,10 @@ extern "C" SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ); - int SHPAPI_CALL SHPRewindObject(SHPHandle hSHP, SHPObject *psObject); + int SHPAPI_CALL SHPRewindObject(const SHPHandle hSHP, SHPObject *psObject); - void SHPAPI_CALL SHPClose(SHPHandle hSHP); - void SHPAPI_CALL SHPWriteHeader(SHPHandle hSHP); + void SHPAPI_CALL SHPClose(const SHPHandle hSHP); + void SHPAPI_CALL SHPWriteHeader(const SHPHandle hSHP); const char SHPAPI_CALL1(*) SHPTypeName(int nSHPType); const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType); @@ -362,14 +362,14 @@ extern "C" const double *padfBoundsMin, const double *padfBoundsMax); void SHPAPI_CALL SHPDestroyTree(SHPTree *hTree); - int SHPAPI_CALL SHPWriteTree(SHPTree *hTree, const char *pszFilename); + int SHPAPI_CALL SHPWriteTree(const SHPTree *hTree, const char *pszFilename); int SHPAPI_CALL SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject); void SHPAPI_CALL SHPTreeTrimExtraNodes(SHPTree *hTree); int SHPAPI_CALL1(*) - SHPTreeFindLikelyShapes(SHPTree *hTree, double *padfBoundsMin, + SHPTreeFindLikelyShapes(const SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *); int SHPAPI_CALL SHPCheckBoundsOverlap(const double *, const double *, const double *, const double *, int); @@ -386,10 +386,12 @@ extern "C" void SHPAPI_CALL SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree); int SHPAPI_CALL1(*) - SHPSearchDiskTreeEx(SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, - double *padfBoundsMax, int *pnShapeCount); + SHPSearchDiskTreeEx(const SHPTreeDiskHandle hDiskTree, + double *padfBoundsMin, double *padfBoundsMax, + int *pnShapeCount); - int SHPAPI_CALL SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, + int SHPAPI_CALL SHPWriteTreeLL(const SHPTree *hTree, + const char *pszFilename, const SAHooks *psHooks); /* -------------------------------------------------------------------- */ @@ -404,12 +406,14 @@ extern "C" void SHPAPI_CALL SBNCloseDiskTree(SBNSearchHandle hSBN); int SHPAPI_CALL1(*) - SBNSearchDiskTree(SBNSearchHandle hSBN, const double *padfBoundsMin, + SBNSearchDiskTree(const SBNSearchHandle hSBN, + const double *padfBoundsMin, const double *padfBoundsMax, int *pnShapeCount); int SHPAPI_CALL1(*) - SBNSearchDiskTreeInteger(SBNSearchHandle hSBN, int bMinX, int bMinY, - int bMaxX, int bMaxY, int *pnShapeCount); + SBNSearchDiskTreeInteger(const SBNSearchHandle hSBN, int bMinX, + int bMinY, int bMaxX, int bMaxY, + int *pnShapeCount); void SHPAPI_CALL SBNSearchFreeIds(int *panShapeId); @@ -497,8 +501,8 @@ extern "C" const char *pszCodePage, const SAHooks *psHooks); - int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF); - int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF); + int SHPAPI_CALL DBFGetFieldCount(const DBFHandle psDBF); + int SHPAPI_CALL DBFGetRecordCount(const DBFHandle psDBF); int SHPAPI_CALL DBFAddField(DBFHandle hDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals); @@ -514,11 +518,12 @@ extern "C" const char *pszFieldName, char chType, int nWidth, int nDecimals); - DBFFieldType SHPAPI_CALL DBFGetFieldInfo(DBFHandle psDBF, int iField, + DBFFieldType SHPAPI_CALL DBFGetFieldInfo(const DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals); - int SHPAPI_CALL DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName); + int SHPAPI_CALL DBFGetFieldIndex(const DBFHandle psDBF, + const char *pszFieldName); int SHPAPI_CALL DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField); @@ -530,7 +535,8 @@ extern "C" DBFReadLogicalAttribute(DBFHandle hDBF, int iShape, int iField); SHPDate SHPAPI_CALL DBFReadDateAttribute(DBFHandle hDBF, int iShape, int iField); - int SHPAPI_CALL DBFIsAttributeNULL(DBFHandle hDBF, int iShape, int iField); + int SHPAPI_CALL DBFIsAttributeNULL(const DBFHandle hDBF, int iShape, + int iField); int SHPAPI_CALL DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField, int nFieldValue); @@ -554,18 +560,18 @@ extern "C" int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, const void *pRawTuple); - int SHPAPI_CALL DBFIsRecordDeleted(DBFHandle psDBF, int iShape); + int SHPAPI_CALL DBFIsRecordDeleted(const DBFHandle psDBF, int iShape); int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted); - DBFHandle SHPAPI_CALL DBFCloneEmpty(DBFHandle psDBF, + DBFHandle SHPAPI_CALL DBFCloneEmpty(const DBFHandle psDBF, const char *pszFilename); void SHPAPI_CALL DBFClose(DBFHandle hDBF); void SHPAPI_CALL DBFUpdateHeader(DBFHandle hDBF); - char SHPAPI_CALL DBFGetNativeFieldType(DBFHandle hDBF, int iField); + char SHPAPI_CALL DBFGetNativeFieldType(const DBFHandle hDBF, int iField); - const char SHPAPI_CALL1(*) DBFGetCodePage(DBFHandle psDBF); + const char SHPAPI_CALL1(*) DBFGetCodePage(const DBFHandle psDBF); void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD); diff --git a/shpopen.c b/shpopen.c index b609c25..ec3eff6 100644 --- a/shpopen.c +++ b/shpopen.c @@ -53,7 +53,7 @@ /* contents of the index (.shx) file. */ /************************************************************************/ -void SHPAPI_CALL SHPWriteHeader(SHPHandle psSHP) +void SHPAPI_CALL SHPWriteHeader(const SHPHandle psSHP) { if (psSHP->fpSHX == SHPLIB_NULLPTR) { @@ -857,7 +857,7 @@ int SHPAPI_CALL SHPRestoreSHX(const char *pszLayer, const char *pszAccess, /* Close the .shp and .shx files. */ /************************************************************************/ -void SHPAPI_CALL SHPClose(SHPHandle psSHP) +void SHPAPI_CALL SHPClose(const SHPHandle psSHP) { if (psSHP == SHPLIB_NULLPTR) return; @@ -924,8 +924,9 @@ void SHPAPI_CALL SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode) /* Fetch general information about the shape file. */ /************************************************************************/ -void SHPAPI_CALL SHPGetInfo(SHPHandle psSHP, int *pnEntities, int *pnShapeType, - double *padfMinBound, double *padfMaxBound) +void SHPAPI_CALL SHPGetInfo(const SHPHandle psSHP, int *pnEntities, + int *pnShapeType, double *padfMinBound, + double *padfMaxBound) { if (psSHP == SHPLIB_NULLPTR) return; @@ -1309,8 +1310,8 @@ SHPObject SHPAPI_CALL1(*) /* only possible to write vertices at the end of the file. */ /************************************************************************/ -int SHPAPI_CALL SHPWriteObject(SHPHandle psSHP, int nShapeId, - SHPObject *psObject) +int SHPAPI_CALL SHPWriteObject(const SHPHandle psSHP, int nShapeId, + const SHPObject *psObject) { psSHP->bUpdated = TRUE; @@ -1882,7 +1883,7 @@ static unsigned char *SHPReallocObjectBufIfNecessary(SHPHandle psSHP, /* for one shape. */ /************************************************************************/ -SHPObject SHPAPI_CALL1(*) SHPReadObject(SHPHandle psSHP, int hEntity) +SHPObject SHPAPI_CALL1(*) SHPReadObject(const SHPHandle psSHP, int hEntity) { /* -------------------------------------------------------------------- */ /* Validate the record/entity number. */ @@ -2913,7 +2914,7 @@ static int SHPRewindIsInnerRing(const SHPObject *psObject, int iOpRing, /* specification. */ /************************************************************************/ -int SHPAPI_CALL SHPRewindObject(SHPHandle hSHP, SHPObject *psObject) +int SHPAPI_CALL SHPRewindObject(const SHPHandle hSHP, SHPObject *psObject) { (void)hSHP; /* -------------------------------------------------------------------- */ diff --git a/shptree.c b/shptree.c index 7321f04..172eb72 100644 --- a/shptree.c +++ b/shptree.c @@ -501,7 +501,8 @@ int SHPAPI_CALL SHPTreeAddShapeId(SHPTree *psTree, SHPObject *psObject) /* tree node by tree node basis. */ /************************************************************************/ -static void SHPTreeCollectShapeIds(SHPTree *hTree, SHPTreeNode *psTreeNode, +static void SHPTreeCollectShapeIds(const SHPTree *hTree, + const SHPTreeNode *psTreeNode, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount, int *pnMaxShapes, int **ppanShapeList) @@ -566,7 +567,7 @@ static int SHPTreeCompareInts(const void *a, const void *b) } int SHPAPI_CALL1(*) - SHPTreeFindLikelyShapes(SHPTree *hTree, double *padfBoundsMin, + SHPTreeFindLikelyShapes(const SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount) { @@ -598,7 +599,6 @@ int SHPAPI_CALL1(*) /************************************************************************/ static int SHPTreeNodeTrim(SHPTreeNode *psTreeNode) - { int i; @@ -657,7 +657,6 @@ static int SHPTreeNodeTrim(SHPTreeNode *psTreeNode) /************************************************************************/ void SHPAPI_CALL SHPTreeTrimExtraNodes(SHPTree *hTree) - { SHPTreeNodeTrim(hTree->psRoot); } @@ -713,7 +712,7 @@ void SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree) /* SHPSearchDiskTreeNode() */ /************************************************************************/ -static bool SHPSearchDiskTreeNode(SHPTreeDiskHandle hDiskTree, +static bool SHPSearchDiskTreeNode(const SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, double *padfBoundsMax, int **ppanResultBuffer, int *pnBufferMax, int *pnResultCount, int bNeedSwap, @@ -907,8 +906,9 @@ int SHPAPI_CALL1(*) SHPSearchDiskTree(FILE *fp, double *padfBoundsMin, /************************************************************************/ int SHPAPI_CALL1(*) - SHPSearchDiskTreeEx(SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, - double *padfBoundsMax, int *pnShapeCount) + SHPSearchDiskTreeEx(const SHPTreeDiskHandle hDiskTree, + double *padfBoundsMin, double *padfBoundsMax, + int *pnShapeCount) { int nBufferMax = 0; @@ -1037,7 +1037,7 @@ static void SHPWriteTreeNode(SAFile fp, SHPTreeNode *node, /* SHPWriteTree() */ /************************************************************************/ -int SHPAPI_CALL SHPWriteTree(SHPTree *tree, const char *filename) +int SHPAPI_CALL SHPWriteTree(const SHPTree *tree, const char *filename) { SAHooks sHooks; @@ -1050,7 +1050,8 @@ int SHPAPI_CALL SHPWriteTree(SHPTree *tree, const char *filename) /* SHPWriteTreeLL() */ /************************************************************************/ -int SHPWriteTreeLL(SHPTree *tree, const char *filename, const SAHooks *psHooks) +int SHPWriteTreeLL(const SHPTree *tree, const char *filename, + const SAHooks *psHooks) { const char signature[4] = "SQT"; char abyBuf[32];