Skip to content

Commit

Permalink
Shapelib: resync with OSGeo/shapelib#130
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed May 29, 2024
1 parent 8257ccc commit 12d74a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
15 changes: 10 additions & 5 deletions ogr/ogrsf_frmts/shape/shpopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
#endif
#endif

/* Allows customization of the message in vendored builds (such as GDAL) */
#ifndef SHP_RESTORE_SHX_HINT_MESSAGE
#define SHP_RESTORE_SHX_HINT_MESSAGE \
"Use SHPRestoreSHX() to restore or create it."
#endif

/************************************************************************/
/* SHPWriteHeader() */
/* */
Expand Down Expand Up @@ -327,11 +333,10 @@ SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszLayer, const char *pszAccess,
const size_t nMessageLen = strlen(pszFullname) * 2 + 256;
char *pszMessage = STATIC_CAST(char *, malloc(nMessageLen));
pszFullname[nLenWithoutExtension] = 0;
snprintf(pszMessage, nMessageLen,
"Unable to open %s.shx or %s.SHX. "
"Set SHAPE_RESTORE_SHX config option to YES to restore or "
"create it.",
pszFullname, pszFullname);
snprintf(
pszMessage, nMessageLen,
"Unable to open %s.shx or %s.SHX. " SHP_RESTORE_SHX_HINT_MESSAGE,
pszFullname, pszFullname);
psHooks->Error(pszMessage);
free(pszMessage);

Expand Down
3 changes: 3 additions & 0 deletions ogr/ogrsf_frmts/shape/shpopen_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
#include "gdal_shapelib_symbol_rename.h"
#endif

#define SHP_RESTORE_SHX_HINT_MESSAGE \
"Set SHAPE_RESTORE_SHX config option to YES to restore or create it."

#include "shpopen.c"

0 comments on commit 12d74a5

Please sign in to comment.