mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-03-10 12:01:43 +00:00
pr_edict.c: replaced another strcpy() call with q_strlcpy(), tweaked a warning message.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1586 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
0825fb705c
commit
32c80b20b0
1 changed files with 6 additions and 6 deletions
|
@ -801,18 +801,18 @@ static qboolean ED_ParseEpair (void *base, ddef_t *key, const char *s)
|
||||||
|
|
||||||
for (i = 0; i < 3 && (w <= end); i++) // ericw -- added (w <= end) check
|
for (i = 0; i < 3 && (w <= end); i++) // ericw -- added (w <= end) check
|
||||||
{
|
{
|
||||||
// set `v` to the next space (or 0 byte), and change that char to a 0 byte
|
// set v to the next space (or 0 byte), and change that char to a 0 byte
|
||||||
while (*v && *v != ' ')
|
while (*v && *v != ' ')
|
||||||
v++;
|
v++;
|
||||||
*v = 0;
|
*v = 0;
|
||||||
((float *)d)[i] = atof (w);
|
((float *)d)[i] = atof (w);
|
||||||
w = v = v+1;
|
w = v = v+1;
|
||||||
}
|
}
|
||||||
|
// ericw -- fill remaining elements to 0 in case we hit the end of string
|
||||||
// ericw -- fill remaining elements to 0.0f in case we hit the end of string before reading 3 floats
|
// before reading 3 floats.
|
||||||
if (i < 3)
|
if (i < 3)
|
||||||
{
|
{
|
||||||
Con_DWarning("vanilla will read garbage for \"%s\" \"%s\"\n", PR_GetString(key->s_name), s);
|
Con_DWarning ("Avoided reading garbage for \"%s\" \"%s\"\n", PR_GetString(key->s_name), s);
|
||||||
for (; i < 3; i++)
|
for (; i < 3; i++)
|
||||||
((float *)d)[i] = 0.0f;
|
((float *)d)[i] = 0.0f;
|
||||||
}
|
}
|
||||||
|
@ -896,7 +896,7 @@ const char *ED_ParseEdict (const char *data, edict_t *ent)
|
||||||
if (!strcmp(com_token, "light"))
|
if (!strcmp(com_token, "light"))
|
||||||
strcpy (com_token, "light_lev"); // hack for single light def
|
strcpy (com_token, "light_lev"); // hack for single light def
|
||||||
|
|
||||||
strcpy (keyname, com_token);
|
q_strlcpy (keyname, com_token, sizeof(keyname));
|
||||||
|
|
||||||
// another hack to fix keynames with trailing spaces
|
// another hack to fix keynames with trailing spaces
|
||||||
n = strlen(keyname);
|
n = strlen(keyname);
|
||||||
|
|
Loading…
Reference in a new issue