Fix -Wformat-overflow warnings

git-svn-id: https://svn.eduke32.com/eduke32@6951 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-07-23 02:55:59 +00:00
parent cc999ff883
commit d1ea5176ff
4 changed files with 15 additions and 15 deletions

View file

@ -715,9 +715,9 @@ const char *ExtGetSectorCaption(int16_t sectnum)
{
Bstrcpy(lo, ExtGetSectorType(sector[sectnum].lotag));
if (!in3dmode())
Bsprintf(tempbuf,"%hu,%hu %s", TrackerCast(sector[sectnum].hitag), TrackerCast(sector[sectnum].lotag), lo);
Bsnprintf(tempbuf, sizeof(tempbuf), "%hu,%hu %s", TrackerCast(sector[sectnum].hitag), TrackerCast(sector[sectnum].lotag), lo);
else
Bsprintf(tempbuf,"%hu %s", TrackerCast(sector[sectnum].lotag), lo);
Bsnprintf(tempbuf, sizeof(tempbuf), "%hu %s", TrackerCast(sector[sectnum].lotag), lo);
}
return tempbuf;
}
@ -767,7 +767,7 @@ const char *ExtGetWallCaption(int16_t wallnum)
#endif
{
taglab_handle1(lt&1, wall[wallnum].lotag, lostr);
Bsprintf(tempbuf, "%s,%s", histr, lostr);
Bsnprintf(tempbuf, sizeof(tempbuf), "%s,%s", histr, lostr);
}
}
@ -870,7 +870,7 @@ const char *SectorEffectorText(int32_t spritenum)
else
{
if (cursprite == spritenum)
Bsprintf(tempbuf, "SE %d %s", TrackerCast(sprite[spritenum].lotag), lo);
Bsnprintf(tempbuf, sizeof(tempbuf), "SE %d %s", TrackerCast(sprite[spritenum].lotag), lo);
else Bstrcpy(tempbuf, lo);
}

View file

@ -412,7 +412,7 @@ void G_LoadGroups(int32_t autoload)
if (getcwd(cwd, BMAX_PATH))
{
Bsprintf(cwd, "%s/%s", cwd, g_modDir);
Bsnprintf(cwd, sizeof(cwd), "%s/%s", cwd, g_modDir);
if (!Bstrcmp(g_rootDir, cwd))
{
if (addsearchpath(cwd) == -2)
@ -422,7 +422,7 @@ void G_LoadGroups(int32_t autoload)
}
#ifdef USE_OPENGL
Bsprintf(cwd, "%s/%s", g_modDir, TEXCACHEFILE);
Bsnprintf(cwd, sizeof(cwd), "%s/%s", g_modDir, TEXCACHEFILE);
Bstrcpy(TEXCACHEFILE, cwd);
#endif
}

View file

@ -2426,8 +2426,8 @@ badindex:
switch (code&M32_VARTYPE_MASK)
{
case M32_FLAG_ARRAY:
Bsprintf(buf, "%s[%s]", aGameArrays[code&(MAXGAMEARRAYS-1)].szLabel?
aGameArrays[code&(MAXGAMEARRAYS-1)].szLabel:"???", buf2);
Bsnprintf(buf, sizeof(buf), "%s[%s]", aGameArrays[code&(MAXGAMEARRAYS-1)].szLabel
? aGameArrays[code&(MAXGAMEARRAYS-1)].szLabel : "???", buf2);
break;
case M32_FLAG_STRUCT:
{
@ -2441,14 +2441,14 @@ badindex:
memberid -= LIGHT_X;
}
Bsprintf(buf, "%s[%s].%s", pp1[code&3], buf2, pp2[code&3][memberid].name);
Bsnprintf(buf, sizeof(buf), "%s[%s].%s", pp1[code&3], buf2, pp2[code&3][memberid].name);
}
break;
case M32_FLAG_VAR:
Bsprintf(buf, "???");
Bstrcpy(buf, "???");
break;
case M32_FLAG_LOCAL:
Bsprintf(buf, ".local[%s]", buf2);
Bsnprintf(buf, sizeof(buf), ".local[%s]", buf2);
break;
}
}
@ -2465,7 +2465,7 @@ badindex:
Bstrcat(buf2, buf);
}
Bsprintf(buf, "%s%s", buf2, aGameVars[code].szLabel ? aGameVars[code].szLabel : "???");
Bsnprintf(buf, sizeof(buf), "%s%s", buf2, aGameVars[code].szLabel ? aGameVars[code].szLabel : "???");
}
OSD_Printf("L%d: %s%s=%d\n", g_errorLineNum, negate?"-":"", buf, val);

View file

@ -1809,12 +1809,12 @@ int G_EnterLevel(int gameMode)
{
if (g_gameNamePtr)
#ifdef EDUKE32_STANDALONE
Bsprintf(apptitle, "%s - %s", boardfilename, g_gameNamePtr);
Bsnprintf(apptitle, sizeof(apptitle), "%s - %s", boardfilename, g_gameNamePtr);
#else
Bsprintf(apptitle, "%s - %s - " APPNAME, boardfilename, g_gameNamePtr);
Bsnprintf(apptitle, sizeof(apptitle), "%s - %s - " APPNAME, boardfilename, g_gameNamePtr);
#endif
else
Bsprintf(apptitle, "%s - " APPNAME, boardfilename);
Bsnprintf(apptitle, sizeof(apptitle), "%s - " APPNAME, boardfilename);
}
else
{