Fix off-by-one error in various CON text truncation warnings

git-svn-id: https://svn.eduke32.com/eduke32@8720 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/duke3d/src/gamedef.cpp
This commit is contained in:
terminx 2020-03-12 00:58:15 +00:00 committed by Christoph Oelckers
parent 19630b0d4e
commit 086141e205

View file

@ -5080,7 +5080,7 @@ repeatcase:
{ {
gamename[i] = *textptr; gamename[i] = *textptr;
textptr++,i++; textptr++,i++;
if (EDUKE32_PREDICT_FALSE(i >= (signed)sizeof(gamename)-1)) if (EDUKE32_PREDICT_FALSE(i >= (signed)sizeof(gamename)))
{ {
initprintf("%s:%d: warning: truncating game name to %d characters.\n", initprintf("%s:%d: warning: truncating game name to %d characters.\n",
g_scriptFileName,g_lineNumber,(int32_t)sizeof(gamename)-1); g_scriptFileName,g_lineNumber,(int32_t)sizeof(gamename)-1);
@ -5155,7 +5155,7 @@ repeatcase:
{ {
g_gametypeNames[j][i] = *textptr; g_gametypeNames[j][i] = *textptr;
textptr++,i++; textptr++,i++;
if (EDUKE32_PREDICT_FALSE(i >= (signed)sizeof(g_gametypeNames[j])-1)) if (EDUKE32_PREDICT_FALSE(i >= (signed)sizeof(g_gametypeNames[j])))
{ {
initprintf("%s:%d: warning: truncating gametype name to %d characters.\n", initprintf("%s:%d: warning: truncating gametype name to %d characters.\n",
g_scriptFileName,g_lineNumber,(int32_t)sizeof(g_gametypeNames[j])-1); g_scriptFileName,g_lineNumber,(int32_t)sizeof(g_gametypeNames[j])-1);
@ -5244,7 +5244,7 @@ repeatcase:
if (EDUKE32_PREDICT_FALSE(i >= 32)) if (EDUKE32_PREDICT_FALSE(i >= 32))
{ {
initprintf("%s:%d: warning: truncating level name to %d characters.\n", initprintf("%s:%d: warning: truncating level name to %d characters.\n",
g_scriptFileName,g_lineNumber,32); g_scriptFileName,g_lineNumber,31);
g_warningCnt++; g_warningCnt++;
scriptSkipLine(); scriptSkipLine();
break; break;
@ -5330,7 +5330,7 @@ repeatcase:
{ {
*(CheatDescriptions[k]+i) = *textptr; *(CheatDescriptions[k]+i) = *textptr;
textptr++,i++; textptr++,i++;
if (EDUKE32_PREDICT_FALSE(i >= MAXCHEATDESC-1)) if (EDUKE32_PREDICT_FALSE(i >= MAXCHEATDESC))
{ {
initprintf("%s:%d: warning: truncating cheat text to %d characters.\n",g_scriptFileName,g_lineNumber,MAXCHEATDESC-1); initprintf("%s:%d: warning: truncating cheat text to %d characters.\n",g_scriptFileName,g_lineNumber,MAXCHEATDESC-1);
g_warningCnt++; g_warningCnt++;
@ -5388,7 +5388,7 @@ repeatcase:
{ {
CheatStrings[k][i] = Btolower(*textptr); CheatStrings[k][i] = Btolower(*textptr);
textptr++,i++; textptr++,i++;
if (EDUKE32_PREDICT_FALSE(i >= (signed)sizeof(CheatStrings[k])-1)) if (EDUKE32_PREDICT_FALSE(i >= (signed)sizeof(CheatStrings[k])))
{ {
initprintf("%s:%d: warning: truncating cheat string to %d characters.\n", initprintf("%s:%d: warning: truncating cheat string to %d characters.\n",
g_scriptFileName,g_lineNumber,(signed)sizeof(CheatStrings[k])-1); g_scriptFileName,g_lineNumber,(signed)sizeof(CheatStrings[k])-1);