mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 12:41:21 +00:00
cleanup Com_sprintf, minor tuning
This commit is contained in:
parent
6472514c8f
commit
5692388da1
2 changed files with 3 additions and 10 deletions
|
@ -1100,22 +1100,15 @@ Com_sprintf(char *dest, int size, char *fmt, ...)
|
|||
{
|
||||
int len;
|
||||
va_list argptr;
|
||||
static char bigbuffer[0x10000];
|
||||
|
||||
va_start(argptr, fmt);
|
||||
len = vsnprintf(bigbuffer, 0x10000, fmt, argptr);
|
||||
len = vsnprintf(dest, size, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
if ((len >= size) || (len == size))
|
||||
if (len >= size)
|
||||
{
|
||||
Com_Printf("Com_sprintf: overflow\n");
|
||||
|
||||
dest = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
bigbuffer[size - 1] = '\0';
|
||||
strcpy(dest, bigbuffer);
|
||||
}
|
||||
|
||||
char *
|
||||
|
|
|
@ -1218,7 +1218,7 @@ Cmd_PlayerList_f(edict_t *ent)
|
|||
|
||||
if (strlen(text) + strlen(st) > sizeof(text) - 50)
|
||||
{
|
||||
sprintf(text + strlen(text), "And more...\n");
|
||||
strcpy(text + strlen(text), "And more...\n");
|
||||
gi.cprintf(ent, PRINT_HIGH, "%s", text);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue