Commit b1de34b3 authored by Richard Gobeille's avatar Richard Gobeille
Browse files

Duke3d: fix GCC 12 warnings

parent 8b7738c3
......@@ -124,7 +124,7 @@ void G_ShowDebugHelp(void)
static void G_AddDemo(const char* param)
{
Bstrncpy(tempbuf, param, sizeof(tempbuf));
Bstrncpyz(tempbuf, param, sizeof(tempbuf));
char * colon = (char *) Bstrchr(tempbuf, ':');
int32_t framespertic=-1, numrepeats=1;
......
......@@ -2321,7 +2321,7 @@ static void C_ReplaceQuoteSubstring(const size_t q, char const * const query, ch
Bstrncpy(tempbuf, apStrings[q], i);
Bstrcat(tempbuf, replacement);
Bstrcat(tempbuf, &apStrings[q][i + querylength]);
Bstrncpy(apStrings[q], tempbuf, MAXQUOTELEN - 1);
Bstrncpyz(apStrings[q], tempbuf, MAXQUOTELEN);
i = MAXQUOTELEN - querylength - 2;
}
}
......
......@@ -6554,7 +6554,7 @@ badindex:
tw = Gv_GetVar(*insptr++);
VM_ABORT_IF(bad_quote(tw), "invalid quote %d", (int)tw);
VLOG_F(LOG_VM, apStrings[tw]);
VLOG_F(LOG_VM, "%s", apStrings[tw]);
dispatch();
vInstruction(CON_RESPAWNHITAG):
......
......@@ -300,7 +300,7 @@ static int32_t LoadGroupsCache(void)
fg->next = grpcache;
grpcache = fg;
Bstrncpy(fg->name, fname, BMAX_PATH);
Bstrncpyz(fg->name, fname, BMAX_PATH);
fg->size = fsize;
fg->mtime = fmtime;
fg->crcval = fcrcval;
......@@ -449,7 +449,7 @@ static void ProcessGroups(BUILDVFS_FIND_REC *srch, native_t maxsize)
}
fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
Bstrncpy(fgg->name, sidx->name, BMAX_PATH);
Bstrncpyz(fgg->name, sidx->name, BMAX_PATH);
fgg->size = st.st_size;
fgg->mtime = st.st_mtime;
fgg->crcval = crcval;
......
......@@ -1919,10 +1919,7 @@ static void Menu_RefreshBoundGamefuncNames(const int32_t sc)
if (s_gfstring_linecount == MAXBNSTRINGLINES - 1)
Bstrncat(s_override_gfstring, "...\n", bbufsize);
else
{
Bsnprintf(tempbuf, MAXBNLINELEN, "\"%s\"\n", M_KEYBOARDKEYS.entrylist[i]->name);
Bstrncat(s_override_gfstring, tempbuf, bbufsize);
}
Bsnprintf(tempbuf, bbufsize, "%s\"%s\"\n", s_override_gfstring, M_KEYBOARDKEYS.entrylist[i]->name);
s_gfstring_linecount++;
}
}
......@@ -7263,7 +7260,7 @@ static void Menu_RunInput_EntryString_Activate(MenuEntry_t *entry)
auto object = (MenuString_t*)entry->entry;
if (object->variable)
strncpy(typebuf, object->variable, TYPEBUFSIZE);
Bstrncpyz(typebuf, object->variable, TYPEBUFSIZE);
else
typebuf[0] = '\0';
object->editfield = typebuf;
......
......@@ -2440,9 +2440,9 @@ static void Net_ParseServerPacket(ENetEvent *event)
}
P_ResetPlayer(pbuf[1]);
Bmemcpy(&g_player[pbuf[1]].ps->pos.x, &pbuf[2], sizeof(vec3_t) * 2);
Bmemcpy(&g_player[pbuf[1]].ps->pos, &pbuf[2], sizeof(vec3_t));
Bmemcpy(&sprite[g_player[pbuf[1]].ps->i], &pbuf[2], sizeof(vec3_t));
Bmemcpy(&g_player[pbuf[1]].ps->opos, &pbuf[14], sizeof(vec3_t));
break;
case PACKET_PLAYER_PING:
......@@ -4654,7 +4654,8 @@ void Net_SpawnPlayer(int32_t player)
packbuf[byteOffset++] = PACKET_PLAYER_SPAWN;
packbuf[byteOffset++] = player;
Bmemcpy(&packbuf[byteOffset], &g_player[player].ps->pos.x, sizeof(vec3_t) * 2);
Bmemcpy(&packbuf[byteOffset], &g_player[player].ps->pos, sizeof(vec3_t));
Bmemcpy(&packbuf[byteOffset], &g_player[player].ps->opos, sizeof(vec3_t));
byteOffset += sizeof(vec3_t) * 2;
packbuf[byteOffset++] = 0;
......
......@@ -185,7 +185,7 @@ static void ReadSaveGameHeaders_CACHE1D(BUILDVFS_FIND_REC *f)
msv.isAutoSave = h.isAutoSave();
msv.isOldScriptVer = h.userbytever < ud.userbytever;
strncpy(msv.brief.path, fn, ARRAY_SIZE(msv.brief.path));
Bstrncpyz(msv.brief.path, fn, ARRAY_SIZE(msv.brief.path));
++g_numinternalsaves;
if (k >= 0 && h.savename[0] != '\0')
......@@ -1749,11 +1749,11 @@ int32_t sv_saveandmakesnapshot(buildvfs_FILE fil, char const *name, int8_t spot,
const time_t t = time(NULL);
struct tm * st;
Bstrncpyz(h.savename, "EDuke32 demo", sizeof(h.savename));
if (t>=0 && (st = localtime(&t)))
Bsnprintf(h.savename, sizeof(h.savename), "Demo %04d%02d%02d %s",
st->tm_year+1900, st->tm_mon+1, st->tm_mday, s_buildRev);
else Bsprintf(h.savename, "EDuke32 demo");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment