Skip to content

Commit

Permalink
Remove CPLsnprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
thbeu committed Jan 24, 2024
1 parent 8cf92b2 commit 067325d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion contrib/csv2shp.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void strip_crlf(char *line)
}
}

static void IGNORE_FGETS_RET_VAL(char* s)
static void IGNORE_FGETS_RET_VAL(char *s)
{
(void)s;
}
Expand Down
4 changes: 2 additions & 2 deletions contrib/shpsort.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ static void copy_related(const char *inName, const char *outName,
size_t name_len = strlen(inName);
const size_t old_len = strlen(old_ext);
const size_t new_len = strlen(new_ext);
if( name_len < old_len )

if (name_len < old_len)
return;

char *in = malloc(name_len - old_len + new_len + 1);
Expand Down
11 changes: 4 additions & 7 deletions dbfopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
#define snprintf _snprintf
#endif
#endif

#define CPLsprintf sprintf
#define CPLsnprintf snprintf
#endif

#ifndef FALSE
Expand Down Expand Up @@ -1322,8 +1319,8 @@ static bool DBFWriteAttribute(DBFHandle psDBF, int hEntity, int iField,
char szFormat[20];
snprintf(szFormat, sizeof(szFormat), "%%%d.%df", nWidth,
psDBF->panFieldDecimals[iField]);
CPLsnprintf(szSField, sizeof(szSField), szFormat,
*STATIC_CAST(double *, pValue));
snprintf(szSField, sizeof(szSField), szFormat,
*STATIC_CAST(double *, pValue));
szSField[sizeof(szSField) - 1] = '\0';
if (STATIC_CAST(int, strlen(szSField)) >
psDBF->panFieldSize[iField])
Expand Down Expand Up @@ -2053,7 +2050,7 @@ int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField,
/* -------------------------------------------------------------------- */
/* Update the header information. */
/* -------------------------------------------------------------------- */
char *pszFInfo = psDBF->pszHeader + XBASE_FLDHDR_SZ * iField;
unsigned char *pszFInfo = psDBF->pszHeader + XBASE_FLDHDR_SZ * iField;

for (int i = 0; i < XBASE_FLDHDR_SZ; i++)
pszFInfo[i] = '\0';
Expand Down Expand Up @@ -2247,7 +2244,7 @@ int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField,

SAOffset nRecordOffset =
psDBF->nRecordLength * STATIC_CAST(SAOffset, psDBF->nRecords) +
psDBF->nHeaderLength;
STATIC_CAST(SAOffset, psDBF->nHeaderLength);

psDBF->sHooks.FSeek(psDBF->fp, nRecordOffset, 0);
psDBF->sHooks.FWrite(&ch, 1, 1, psDBF->fp);
Expand Down
21 changes: 12 additions & 9 deletions shapefil.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,25 @@ extern "C"
{
#endif

/************************************************************************/
/* Version related macros (added in 1.6.0) */
/************************************************************************/
/************************************************************************/
/* Version related macros (added in 1.6.0) */
/************************************************************************/

#define SHAPELIB_VERSION_MAJOR 1
#define SHAPELIB_VERSION_MINOR 6
#define SHAPELIB_VERSION_MICRO 0

#define SHAPELIB_MAKE_VERSION_NUMBER(major, minor, micro) \
((major) * 10000 + (minor) * 100 + (micro))
#define SHAPELIB_MAKE_VERSION_NUMBER(major, minor, micro) \
((major)*10000 + (minor)*100 + (micro))

#define SHAPELIB_VERSION_NUMBER \
SHAPELIB_MAKE_VERSION_NUMBER(SHAPELIB_VERSION_MAJOR, SHAPELIB_VERSION_MINOR, SHAPELIB_VERSION_MICRO)
#define SHAPELIB_VERSION_NUMBER \
SHAPELIB_MAKE_VERSION_NUMBER(SHAPELIB_VERSION_MAJOR, \
SHAPELIB_VERSION_MINOR, \
SHAPELIB_VERSION_MICRO)

#define SHAPELIB_AT_LEAST(major, minor, micro) \
(SHAPELIB_VERSION_NUMBER >= SHAPELIB_MAKE_VERSION_NUMBER(major, minor, micro))
#define SHAPELIB_AT_LEAST(major, minor, micro) \
(SHAPELIB_VERSION_NUMBER >= \
SHAPELIB_MAKE_VERSION_NUMBER(major, minor, micro))

/************************************************************************/
/* Configuration options. */
Expand Down

0 comments on commit 067325d

Please sign in to comment.