Skip to content

Commit

Permalink
Merge pull request #59 from thbeu/build-no-warnings
Browse files Browse the repository at this point in the history
Add type casts for MSVC build w/o warnings
  • Loading branch information
rouault authored Nov 2, 2023
2 parents 2cbfdc3 + 7038a24 commit c5c0f1a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contrib/shpdxf.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ int main(int argc, char **argv)
char id[255];

// Proceed to process data.
for (int recNum = 0; (recNum < shp_numrec) && (recNum < MaxElem); recNum++)
for (int recNum = 0; (recNum < shp_numrec) && (recNum < (int)MaxElem); recNum++)
{
if (idfld >= 0)
switch (idfld_type)
Expand Down
2 changes: 1 addition & 1 deletion contrib/shpgeo.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ char *asFileName(const char *fil, char *ext)
/* -------------------------------------------------------------------- */
char pszBasename[120];
strcpy(pszBasename, fil);
int i = strlen(pszBasename) - 1;
int i = (int)strlen(pszBasename) - 1;
for (; i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/' &&
pszBasename[i] != '\\';
i--)
Expand Down
5 changes: 3 additions & 2 deletions dbfdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ int main(int argc, char **argv)
{
const DBFFieldType eType =
DBFGetFieldInfo(hDBF, i, szTitle, &nWidth, &nDecimals);
if ((int)strlen(szTitle) > nWidth)
panWidth[i] = strlen(szTitle);
const int titleLen = (int)strlen(szTitle);
if (titleLen > nWidth)
panWidth[i] = titleLen;
else
panWidth[i] = nWidth;

Expand Down
2 changes: 1 addition & 1 deletion safileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void SASetupDefaultHooks(SAHooks *psHooks)

static wchar_t *Utf8ToWideChar(const char *pszFilename)
{
const int nMulti = strlen(pszFilename) + 1;
const int nMulti = (int)strlen(pszFilename) + 1;
const int nWide =
MultiByteToWideChar(CP_UTF8, 0, pszFilename, nMulti, 0, 0);
if (nWide == 0)
Expand Down

0 comments on commit c5c0f1a

Please sign in to comment.