mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-21 18:32:08 +00:00
Revert "Replace a few instance of strncpy with strlcpy"
This reverts commit 2e27f32d3e
.
This commit is contained in:
parent
2e27f32d3e
commit
9b3917cd72
9 changed files with 29 additions and 21 deletions
|
@ -419,7 +419,7 @@ static void readPlayer(MYFILE *f, INT32 num)
|
|||
if (fastcmp(word, "PICNAME"))
|
||||
{
|
||||
SLOTFOUND
|
||||
strlcpy(description[num].picname, word2, sizeof(description->picname));
|
||||
strncpy(description[num].picname, word2, 8);
|
||||
}
|
||||
// new character select
|
||||
else if (fastcmp(word, "DISPLAYNAME"))
|
||||
|
@ -3889,7 +3889,9 @@ static void readmaincfg(MYFILE *f)
|
|||
lumpnum_t lumpnum;
|
||||
char newname[9];
|
||||
|
||||
strlcpy(newname, word2, sizeof(newname));
|
||||
strncpy(newname, word2, 8);
|
||||
|
||||
newname[8] = '\0';
|
||||
|
||||
lumpnum = W_CheckNumForName(newname);
|
||||
|
||||
|
|
|
@ -2338,7 +2338,7 @@ void F_InitMenuPresValues(void)
|
|||
activeMenuId = MainDef.menuid;
|
||||
|
||||
// Set defaults for presentation values
|
||||
strlcpy(curbgname, "TITLESKY", sizeof(curbgname));
|
||||
strncpy(curbgname, "TITLESKY", 9);
|
||||
curfadevalue = 16;
|
||||
curbgcolor = -1;
|
||||
curbgxspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollxspeed;
|
||||
|
@ -2348,7 +2348,7 @@ void F_InitMenuPresValues(void)
|
|||
curhidepics = hidetitlepics;
|
||||
curttmode = ttmode;
|
||||
curttscale = ttscale;
|
||||
strlcpy(curttname, ttname, sizeof(curttname));
|
||||
strncpy(curttname, ttname, 9);
|
||||
curttx = ttx;
|
||||
curtty = tty;
|
||||
curttloop = ttloop;
|
||||
|
|
14
src/m_menu.c
14
src/m_menu.c
|
@ -2615,7 +2615,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval,
|
|||
}
|
||||
else if (menupres[menutype].bgname[0])
|
||||
{
|
||||
strlcpy(curbgname, menupres[menutype].bgname, sizeof(curbgname));
|
||||
strncpy(curbgname, menupres[menutype].bgname, 8);
|
||||
curbgxspeed = menupres[menutype].titlescrollxspeed != INT32_MAX ? menupres[menutype].titlescrollxspeed : titlescrollxspeed;
|
||||
curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed;
|
||||
return true;
|
||||
|
@ -2628,7 +2628,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval,
|
|||
curbghide = true;
|
||||
else
|
||||
{
|
||||
strlcpy(curbgname, defaultname, sizeof(curbgname));
|
||||
strncpy(curbgname, defaultname, 9);
|
||||
curbgxspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollxspeed;
|
||||
curbgyspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollyspeed;
|
||||
}
|
||||
|
@ -2767,7 +2767,7 @@ void M_ChangeMenuMusic(const char *defaultmusname, boolean defaultmuslooping)
|
|||
void M_SetMenuCurBackground(const char *defaultname)
|
||||
{
|
||||
char name[9];
|
||||
strlcpy(name, defaultname, 9);
|
||||
strncpy(name, defaultname, 8);
|
||||
M_IterateMenuTree(MIT_SetCurBackground, &name);
|
||||
}
|
||||
|
||||
|
@ -2820,7 +2820,7 @@ static void M_HandleMenuPresState(menu_t *newMenu)
|
|||
activeMenuId = newMenu ? newMenu->menuid : 0;
|
||||
|
||||
// Set defaults for presentation values
|
||||
strlcpy(curbgname, "TITLESKY", sizeof(curbgname));
|
||||
strncpy(curbgname, "TITLESKY", 9);
|
||||
curfadevalue = 16;
|
||||
curhidepics = hidetitlepics;
|
||||
curbgcolor = -1;
|
||||
|
@ -5785,7 +5785,7 @@ static void M_DrawLevelPlatterMenu(void)
|
|||
{
|
||||
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||
// Draw and animate foreground
|
||||
if (!strcmp("RECATKBG", curbgname))
|
||||
if (!strncmp("RECATKBG", curbgname, 8))
|
||||
M_DrawRecordAttackForeground();
|
||||
}
|
||||
|
||||
|
@ -6033,7 +6033,7 @@ static void M_DrawMessageMenu(void)
|
|||
else
|
||||
{
|
||||
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||
if (!strcmp("RECATKBG", curbgname))
|
||||
if (!strncmp("RECATKBG", curbgname, 8))
|
||||
M_DrawRecordAttackForeground();
|
||||
}
|
||||
}
|
||||
|
@ -9583,7 +9583,7 @@ void M_DrawTimeAttackMenu(void)
|
|||
{
|
||||
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||
// Draw and animate foreground
|
||||
if (!strcmp("RECATKBG", curbgname))
|
||||
if (!strncmp("RECATKBG", curbgname, 8))
|
||||
M_DrawRecordAttackForeground();
|
||||
}
|
||||
if (curfadevalue)
|
||||
|
|
|
@ -340,7 +340,7 @@ typedef struct
|
|||
{
|
||||
boolean used;
|
||||
char notes[441];
|
||||
char picname[9];
|
||||
char picname[8];
|
||||
char skinname[SKINNAMESIZE*2+2]; // skin&skin\0
|
||||
patch_t *charpic;
|
||||
UINT8 prev;
|
||||
|
|
|
@ -2883,7 +2883,9 @@ static void P_RunLevelScript(const char *scriptname)
|
|||
lumpnum_t lumpnum;
|
||||
char newname[9];
|
||||
|
||||
strlcpy(newname, scriptname, sizeof(newname));
|
||||
strncpy(newname, scriptname, 8);
|
||||
|
||||
newname[8] = '\0';
|
||||
|
||||
lumpnum = W_CheckNumForName(newname);
|
||||
|
||||
|
|
|
@ -2603,7 +2603,7 @@ INT32 R_CheckTextureNumForName(const char *name)
|
|||
return 0;
|
||||
|
||||
for (i = 0; i < tidcachelen; i++)
|
||||
if (!strcasecmp(tidcache[i].name, name))
|
||||
if (!strncasecmp(tidcache[i].name, name, 8))
|
||||
return tidcache[i].id;
|
||||
|
||||
// Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier
|
||||
|
@ -2613,7 +2613,8 @@ INT32 R_CheckTextureNumForName(const char *name)
|
|||
{
|
||||
tidcachelen++;
|
||||
Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
|
||||
strlcpy(tidcache[tidcachelen-1].name, name, sizeof(tidcache->name));
|
||||
strncpy(tidcache[tidcachelen-1].name, name, 8);
|
||||
tidcache[tidcachelen-1].name[8] = '\0';
|
||||
#ifndef ZDEBUG
|
||||
CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
|
||||
#endif
|
||||
|
|
|
@ -391,7 +391,7 @@ const char *R_GetPalname(UINT16 num)
|
|||
if (num > 0 && num <= 10000)
|
||||
snprintf(newpal, 8, "PAL%04u", num-1);
|
||||
|
||||
strlcpy(palname, newpal, sizeof(palname));
|
||||
strncpy(palname, newpal, 8);
|
||||
return palname;
|
||||
}
|
||||
|
||||
|
|
|
@ -440,15 +440,17 @@ static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filen
|
|||
else
|
||||
lump_p->compression = CM_NOCOMPRESSION;
|
||||
memset(lump_p->name, 0x00, 9);
|
||||
strlcpy(lump_p->name, fileinfo->name, 9);
|
||||
strncpy(lump_p->name, fileinfo->name, 8);
|
||||
|
||||
// Allocate the lump's long name.
|
||||
lump_p->longname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
||||
strlcpy(lump_p->longname, fileinfo->name, 9);
|
||||
strncpy(lump_p->longname, fileinfo->name, 8);
|
||||
lump_p->longname[8] = '\0';
|
||||
|
||||
// Allocate the lump's full name.
|
||||
lump_p->fullname = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
|
||||
strlcpy(lump_p->fullname, fileinfo->name, 9);
|
||||
strncpy(lump_p->fullname, fileinfo->name, 8);
|
||||
lump_p->fullname[8] = '\0';
|
||||
}
|
||||
free(fileinfov);
|
||||
*nlmp = numlumps;
|
||||
|
|
|
@ -1740,8 +1740,9 @@ static void Y_CalculateCompetitionWinners(void)
|
|||
data.competition.monitors[data.competition.numplayers] = monitors[winner];
|
||||
data.competition.scores[data.competition.numplayers] = scores[winner];
|
||||
|
||||
strlcpy(tempname, player_names[winner], 9);
|
||||
strlcpy(data.competition.name[data.competition.numplayers], tempname, 9);
|
||||
strncpy(tempname, player_names[winner], 8);
|
||||
tempname[8] = '\0';
|
||||
strncpy(data.competition.name[data.competition.numplayers], tempname, 9);
|
||||
|
||||
data.competition.color[data.competition.numplayers] = &players[winner].skincolor;
|
||||
data.competition.character[data.competition.numplayers] = &players[winner].skin;
|
||||
|
|
Loading…
Reference in a new issue