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)); Bstrcpy(lo, ExtGetSectorType(sector[sectnum].lotag));
if (!in3dmode()) 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 else
Bsprintf(tempbuf,"%hu %s", TrackerCast(sector[sectnum].lotag), lo); Bsnprintf(tempbuf, sizeof(tempbuf), "%hu %s", TrackerCast(sector[sectnum].lotag), lo);
} }
return tempbuf; return tempbuf;
} }
@ -767,7 +767,7 @@ const char *ExtGetWallCaption(int16_t wallnum)
#endif #endif
{ {
taglab_handle1(lt&1, wall[wallnum].lotag, lostr); 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 else
{ {
if (cursprite == spritenum) 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); else Bstrcpy(tempbuf, lo);
} }

View file

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

View file

@ -2426,8 +2426,8 @@ badindex:
switch (code&M32_VARTYPE_MASK) switch (code&M32_VARTYPE_MASK)
{ {
case M32_FLAG_ARRAY: case M32_FLAG_ARRAY:
Bsprintf(buf, "%s[%s]", aGameArrays[code&(MAXGAMEARRAYS-1)].szLabel? Bsnprintf(buf, sizeof(buf), "%s[%s]", aGameArrays[code&(MAXGAMEARRAYS-1)].szLabel
aGameArrays[code&(MAXGAMEARRAYS-1)].szLabel:"???", buf2); ? aGameArrays[code&(MAXGAMEARRAYS-1)].szLabel : "???", buf2);
break; break;
case M32_FLAG_STRUCT: case M32_FLAG_STRUCT:
{ {
@ -2441,14 +2441,14 @@ badindex:
memberid -= LIGHT_X; 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; break;
case M32_FLAG_VAR: case M32_FLAG_VAR:
Bsprintf(buf, "???"); Bstrcpy(buf, "???");
break; break;
case M32_FLAG_LOCAL: case M32_FLAG_LOCAL:
Bsprintf(buf, ".local[%s]", buf2); Bsnprintf(buf, sizeof(buf), ".local[%s]", buf2);
break; break;
} }
} }
@ -2465,7 +2465,7 @@ badindex:
Bstrcat(buf2, buf); 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); 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) if (g_gameNamePtr)
#ifdef EDUKE32_STANDALONE #ifdef EDUKE32_STANDALONE
Bsprintf(apptitle, "%s - %s", boardfilename, g_gameNamePtr); Bsnprintf(apptitle, sizeof(apptitle), "%s - %s", boardfilename, g_gameNamePtr);
#else #else
Bsprintf(apptitle, "%s - %s - " APPNAME, boardfilename, g_gameNamePtr); Bsnprintf(apptitle, sizeof(apptitle), "%s - %s - " APPNAME, boardfilename, g_gameNamePtr);
#endif #endif
else else
Bsprintf(apptitle, "%s - " APPNAME, boardfilename); Bsnprintf(apptitle, sizeof(apptitle), "%s - " APPNAME, boardfilename);
} }
else else
{ {