mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-06-04 19:11:07 +00:00
sprintf -> snprintf
vsprintf -> vsnprintf
This commit is contained in:
parent
1bb513d584
commit
1efb92f899
29 changed files with 168 additions and 147 deletions
|
@ -158,12 +158,9 @@ void Sys_Printf (char *fmt, ...)
|
|||
unsigned char *p;
|
||||
|
||||
va_start (argptr,fmt);
|
||||
vsprintf (text,fmt,argptr);
|
||||
vsnprintf (text, sizeof(text), fmt, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
if (strlen(text) > sizeof(text))
|
||||
Sys_Error("memory overwrite in Sys_Printf");
|
||||
|
||||
if (nostdout)
|
||||
return;
|
||||
|
||||
|
@ -194,8 +191,8 @@ void Sys_Error (char *error, ...)
|
|||
// change stdin to non blocking
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
|
||||
|
||||
va_start (argptr,error);
|
||||
vsprintf (string,error,argptr);
|
||||
va_start (argptr, error);
|
||||
vsnprintf (string, sizeof(string), error, argptr);
|
||||
va_end (argptr);
|
||||
fprintf(stderr, "Error: %s\n", string);
|
||||
|
||||
|
@ -209,8 +206,8 @@ void Sys_Warn (char *warning, ...)
|
|||
va_list argptr;
|
||||
char string[1024];
|
||||
|
||||
va_start (argptr,warning);
|
||||
vsprintf (string,warning,argptr);
|
||||
va_start (argptr, warning);
|
||||
vsnprintf (string, sizeof(string), warning,argptr);
|
||||
va_end (argptr);
|
||||
fprintf(stderr, "Warning: %s", string);
|
||||
}
|
||||
|
@ -293,11 +290,11 @@ int Sys_FileRead (int handle, void *dest, int count)
|
|||
void Sys_DebugLog(char *file, char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char data[1024];
|
||||
static char data[1024]; // why static ?
|
||||
int fd;
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsprintf(data, fmt, argptr);
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (data, sizeof(data), fmt, argptr);
|
||||
va_end(argptr);
|
||||
// fd = open(file, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, 0666);
|
||||
fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666);
|
||||
|
@ -322,7 +319,7 @@ void Sys_EditFile(char *filename)
|
|||
editor = getenv("EDIT");
|
||||
if (!editor)
|
||||
editor = "vi";
|
||||
sprintf(cmd, "xterm -e %s %s", editor, filename);
|
||||
snprintf (cmd, sizeof(cmd), "xterm -e %s %s", editor, filename);
|
||||
system(cmd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue