Skip to content

Commit

Permalink
fix the not so orthodox code
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Nov 30, 2024
1 parent ececdfe commit 53cd861
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
6 changes: 3 additions & 3 deletions deps/libgdal/gdal/frmts/sdts/sdts2shp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int main(int nArgc, char **papszArgv)
int i;
const char *pszCATDFilename = NULL;
const char *pszMODN = "LE01";
char *pszShapefile = "sdts_out.shp";
const char *szShapefile = "sdts_out.shp";
SDTSTransfer oTransfer;

/* --------------------------------------------------------------------
Expand All @@ -72,7 +72,7 @@ int main(int nArgc, char **papszArgv)
if (EQUAL(papszArgv[i], "-m") && i + 1 < nArgc)
pszMODN = papszArgv[++i];
else if (EQUAL(papszArgv[i], "-o") && i + 1 < nArgc)
pszShapefile = papszArgv[++i];
szShapefile = papszArgv[++i];
else if (EQUAL(papszArgv[i], "-v"))
bVerbose = TRUE;
else
Expand All @@ -88,7 +88,7 @@ int main(int nArgc, char **papszArgv)
/* Massage shapefile name to have no extension. */
/* --------------------------------------------------------------------
*/
pszShapefile = CPLStrdup(pszShapefile);
char *pszShapefile = CPLStrdup(szShapefile);
for (i = strlen(pszShapefile) - 1; i >= 0; i--)
{
if (pszShapefile[i] == '.')
Expand Down
29 changes: 29 additions & 0 deletions deps/libgdal/patches/libgdal_gdal_frmts_sdts_sdts2shp.cpp.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--- libgdal/gdal/frmts/sdts/sdts2shp.cpp.orig 2024-11-30 18:04:35.196334605 +0100
+++ libgdal/gdal/frmts/sdts/sdts2shp.cpp 2024-11-30 18:08:16.196188001 +0100
@@ -54,7 +54,7 @@
int i;
const char *pszCATDFilename = NULL;
const char *pszMODN = "LE01";
- char *pszShapefile = "sdts_out.shp";
+ const char *szShapefile = "sdts_out.shp";
SDTSTransfer oTransfer;

/* --------------------------------------------------------------------
@@ -72,7 +72,7 @@
if (EQUAL(papszArgv[i], "-m") && i + 1 < nArgc)
pszMODN = papszArgv[++i];
else if (EQUAL(papszArgv[i], "-o") && i + 1 < nArgc)
- pszShapefile = papszArgv[++i];
+ szShapefile = papszArgv[++i];
else if (EQUAL(papszArgv[i], "-v"))
bVerbose = TRUE;
else
@@ -88,7 +88,7 @@
/* Massage shapefile name to have no extension. */
/* --------------------------------------------------------------------
*/
- pszShapefile = CPLStrdup(pszShapefile);
+ char *pszShapefile = CPLStrdup(szShapefile);
for (i = strlen(pszShapefile) - 1; i >= 0; i--)
{
if (pszShapefile[i] == '.')

0 comments on commit 53cd861

Please sign in to comment.