vsprintf -> Q_vsnprintf

This commit is contained in:
Jonathan Gray 2013-05-07 14:27:05 +10:00
parent 518c81038f
commit ec595883ab
26 changed files with 43 additions and 43 deletions

View file

@ -79,7 +79,7 @@ void Com_ScriptError( const char *msg, ... ) {
char string[32000];
va_start( argptr, msg );
vsprintf( string, msg,argptr );
Q_vsnprintf( string, sizeof(string), msg,argptr );
va_end( argptr );
Com_Error( ERR_DROP, "File %s, line %i: %s", pi->parseFile, pi->lines, string );
@ -90,7 +90,7 @@ void Com_ScriptWarning( const char *msg, ... ) {
char string[32000];
va_start( argptr, msg );
vsprintf( string, msg,argptr );
Q_vsnprintf( string, sizeof(string), msg,argptr );
va_end( argptr );
Com_Printf( "File %s, line %i: %s", pi->parseFile, pi->lines, string );

View file

@ -656,7 +656,7 @@ void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
char bigbuffer[32000]; // big, but small enough to fit in PPC stack
va_start (argptr,fmt);
len = vsprintf (bigbuffer,fmt,argptr);
len = Q_vsnprintf (bigbuffer,sizeof(bigbuffer),fmt,argptr);
va_end (argptr);
if ( len >= sizeof( bigbuffer ) ) {
Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" );
@ -687,7 +687,7 @@ char * QDECL va( char *format, ... ) {
index++;
va_start (argptr, format);
vsprintf (buf, format,argptr);
Q_vsnprintf (buf, sizeof(*string), format,argptr);
va_end (argptr);
return buf;

View file

@ -464,7 +464,7 @@ void idStr::snprintf
va_list argptr;
va_start (argptr,fmt);
len = vsprintf (buffer,fmt,argptr);
len = Q_vsnprintf (buffer,sizeof(buffer),fmt,argptr);
va_end (argptr);
assert ( len < size );

View file

@ -43,7 +43,7 @@ void QDECL AAS_Error(char *fmt, ...)
va_list arglist;
va_start(arglist, fmt);
vsprintf(str, fmt, arglist);
Q_vsnprintf(str, sizeof(str), fmt, arglist);
va_end(arglist);
botimport.Print(PRT_FATAL, str);
} //end of the function AAS_Error

View file

@ -120,7 +120,7 @@ void QDECL SourceError(source_t *source, char *str, ...)
va_list ap;
va_start(ap, str);
vsprintf(text, str, ap);
Q_vsnprintf(text, sizeof(text), str, ap);
va_end(ap);
#ifdef BOTLIB
botimport.Print(PRT_ERROR, "file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text);
@ -144,7 +144,7 @@ void QDECL SourceWarning(source_t *source, char *str, ...)
va_list ap;
va_start(ap, str);
vsprintf(text, str, ap);
Q_vsnprintf(text, sizeof(text), str, ap);
va_end(ap);
#ifdef BOTLIB
botimport.Print(PRT_WARNING, "file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text);

View file

@ -221,7 +221,7 @@ void QDECL ScriptError(script_t *script, char *str, ...)
if (script->flags & SCFL_NOERRORS) return;
va_start(ap, str);
vsprintf(text, str, ap);
Q_vsnprintf(text, sizeof(text), str, ap);
va_end(ap);
#ifdef BOTLIB
botimport.Print(PRT_ERROR, "file %s, line %d: %s\n", script->filename, script->line, text);
@ -247,7 +247,7 @@ void QDECL ScriptWarning(script_t *script, char *str, ...)
if (script->flags & SCFL_NOWARNINGS) return;
va_start(ap, str);
vsprintf(text, str, ap);
Q_vsnprintf(text, sizeof(text), str, ap);
va_end(ap);
#ifdef BOTLIB
botimport.Print(PRT_WARNING, "file %s, line %d: %s\n", script->filename, script->line, text);

View file

@ -43,7 +43,7 @@ void SFxHelper::Print( const char *msg, ... )
char text[1024];
va_start( argptr, msg );
vsprintf( text, msg, argptr );
Q_vsnprintf( text, sizeof(text), msg, argptr );
va_end( argptr );
Com_DPrintf( text );

View file

@ -2392,7 +2392,7 @@ void QDECL CL_RefPrintf( int print_level, const char *fmt, ...) {
char msg[MAXPRINTMSG];
va_start (argptr,fmt);
vsprintf (msg,fmt,argptr);
Q_vsnprintf (msg,sizeof(msg),fmt,argptr);
va_end (argptr);
if ( print_level == PRINT_ALL ) {

View file

@ -28,7 +28,7 @@ void Debug_Printf (vmCvar_t *cv, int debugLevel, char *fmt, ...)
color = S_COLOR_RED;
va_start (argptr,fmt);
vsprintf (msg, fmt, argptr);
Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
va_end (argptr);
Com_Printf("%s%5i:%s", color, level.time, msg);
@ -66,7 +66,7 @@ void Debug_NPCPrintf (gentity_t *printNPC, vmCvar_t *cv, int debugLevel, char *f
color = COLOR_RED;
va_start (argptr,fmt);
vsprintf (msg, fmt, argptr);
Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
va_end (argptr);
Com_Printf ("%c%c%5i (%s) %s", Q_COLOR_ESCAPE, color, level.time, printNPC->targetname, msg);

View file

@ -281,7 +281,7 @@ void G_DebugPrint( int level, const char *format, ... )
return;
va_start (argptr, format);
vsprintf (text, format, argptr);
Q_vsnprintf (text, sizeof(text), format, argptr);
va_end (argptr);
//Add the color formatting

View file

@ -80,7 +80,7 @@ void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... ) {
char *p;
va_start (argptr,fmt);
if (vsprintf (msg, fmt, argptr) > sizeof(msg)) {
if (Q_vsnprintf (msg, sizeof(msg), fmt, argptr) > sizeof(msg)) {
G_Error ( "PrintMsg overrun" );
}
va_end (argptr);

View file

@ -304,7 +304,7 @@ void COM_ParseError( char *format, ... )
static char string[4096];
va_start (argptr, format);
vsprintf (string, format, argptr);
Q_vsnprintf (string, sizeof(string), format, argptr);
va_end (argptr);
Com_Printf("ERROR: %s, line %d: %s\n", com_parsename, com_lines, string);
@ -316,7 +316,7 @@ void COM_ParseWarning( char *format, ... )
static char string[4096];
va_start (argptr, format);
vsprintf (string, format, argptr);
Q_vsnprintf (string, sizeof(string), format, argptr);
va_end (argptr);
Com_Printf("WARNING: %s, line %d: %s\n", com_parsename, com_lines, string);
@ -1055,7 +1055,7 @@ void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
char bigbuffer[32000]; // big, but small enough to fit in PPC stack
va_start (argptr,fmt);
len = vsprintf (bigbuffer,fmt,argptr);
len = Q_vsnprintf (bigbuffer,sizeof(bigbuffer),fmt,argptr);
va_end (argptr);
if ( len >= sizeof( bigbuffer ) ) {
Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" );
@ -1091,7 +1091,7 @@ char * QDECL va( const char *format, ... ) {
index++;
va_start (argptr, format);
vsprintf (buf, format,argptr);
Q_vsnprintf (buf,sizeof(*string),format,argptr);
va_end (argptr);
return buf;

View file

@ -162,7 +162,7 @@ int CInterpreter::Error( char *format, ... )
}
va_start (argptr, format);
vsprintf (error_msg, format, argptr);
Q_vsnprintf (error_msg, sizeof(error_msg), format, argptr);
va_end (argptr);
strcpy((char *) work_dir, getcwd( (char *) &work_dir, 1024 ) );

View file

@ -63,7 +63,7 @@ static void Q3_CenterPrint ( const char *format, ... )
char text[1024];
va_start (argptr, format);
vsprintf (text, format, argptr);
Q_vsnprintf (text, sizeof(text), format, argptr);
va_end (argptr);
// FIXME: added '!' so you can print something that's hasn't been precached, '@' searches only for precache text
@ -646,7 +646,7 @@ void Q3_DebugPrint( int level, const char *format, ... )
char text[1024];
va_start (argptr, format);
vsprintf (text, format, argptr);
Q_vsnprintf (text, sizeof(text), format, argptr);
va_end (argptr);
//Add the color formatting

View file

@ -327,7 +327,7 @@ void QDECL Sys_Error( const char *error, ... ) {
MSG msg;
va_start (argptr, error);
vsprintf (text, error, argptr);
Q_vsnprintf (text, sizeof(text), error, argptr);
va_end (argptr);
Conbuf_AppendText( text );

View file

@ -131,7 +131,7 @@ void QDECL Com_Printf( const char *fmt, ... ) {
qboolean silent;
va_start (argptr,fmt);
vsprintf (msg,fmt,argptr);
Q_vsnprintf (msg,sizeof(msg),fmt,argptr);
va_end (argptr);
if ( rd_buffer ) {
@ -216,7 +216,7 @@ void QDECL Com_DPrintf( const char *fmt, ...) {
}
va_start (argptr,fmt);
vsprintf (msg,fmt,argptr);
Q_vsnprintf (msg,sizeof(msg),fmt,argptr);
va_end (argptr);
Com_Printf ("%s", msg);
@ -229,7 +229,7 @@ void QDECL Com_OPrintf( const char *fmt, ...)
char msg[MAXPRINTMSG];
va_start (argptr,fmt);
vsprintf (msg,fmt,argptr);
Q_vsnprintf (msg,sizeof(msg),fmt,argptr);
va_end (argptr);
#ifdef _DEBUG
OutputDebugString(msg);
@ -289,7 +289,7 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
com_errorEntered = qtrue;
va_start (argptr,fmt);
vsprintf (com_errorMessage,fmt,argptr);
Q_vsnprintf (com_errorMessage,sizeof(com_errorMessage),fmt,argptr);
va_end (argptr);
if ( code != ERR_DISCONNECT ) {

View file

@ -1526,7 +1526,7 @@ void QDECL FS_Printf( fileHandle_t h, const char *fmt, ... ) {
char msg[MAXPRINTMSG];
va_start (argptr,fmt);
vsprintf (msg,fmt,argptr);
Q_vsnprintf (msg,sizeof(msg),fmt,argptr);
va_end (argptr);
FS_Write(msg, strlen(msg), h);

View file

@ -377,7 +377,7 @@ void QDECL FS_Printf( fileHandle_t h, const char *fmt, ... ) {
char msg[MAXPRINTMSG];
va_start (argptr,fmt);
vsprintf (msg,fmt,argptr);
Q_vsnprintf (msg,sizeof(msg),fmt,argptr);
va_end (argptr);
FS_Write(msg, strlen(msg), h);

View file

@ -568,7 +568,7 @@ void QDECL NET_OutOfBandPrint( netsrc_t sock, netadr_t adr, const char *format,
string[3] = -1;
va_start( argptr, format );
vsprintf( string+4, format, argptr );
Q_vsnprintf( string+4, sizeof(string) - 4, format, argptr );
va_end( argptr );
// send the datagram

View file

@ -270,7 +270,7 @@ void QDECL BotImport_Print(int type, char *fmt, ...)
va_list ap;
va_start(ap, fmt);
vsprintf(str, fmt, ap);
Q_vsnprintf(str, sizeof(str), fmt, ap);
va_end(ap);
switch(type) {

View file

@ -157,7 +157,7 @@ void QDECL SV_SendServerCommand(client_t *cl, const char *fmt, ...) {
int j;
va_start (argptr,fmt);
vsprintf ((char *)message, fmt,argptr);
Q_vsnprintf ((char *)message, sizeof(message), fmt,argptr);
va_end (argptr);
// Fix to http://aluigi.altervista.org/adv/q3msgboom-adv.txt

View file

@ -17,7 +17,7 @@ void QDECL Com_Error( int level, const char *error, ... ) {
char text[1024];
va_start (argptr, error);
vsprintf (text, error, argptr);
Q_vsnprintf (text, sizeof(text), error, argptr);
va_end (argptr);
trap_Error( va("%s", text) );
@ -28,7 +28,7 @@ void QDECL Com_Printf( const char *msg, ... ) {
char text[1024];
va_start (argptr, msg);
vsprintf (text, msg, argptr);
Q_vsnprintf (text, sizeof(text), msg, argptr);
va_end (argptr);
trap_Print( va("%s", text) );

View file

@ -389,7 +389,7 @@ void PC_SourceWarning(int handle, char *format, ...) {
static char string[4096];
va_start (argptr, format);
vsprintf (string, format, argptr);
Q_vsnprintf (string, sizeof(string), format, argptr);
va_end (argptr);
filename[0] = '\0';
@ -411,7 +411,7 @@ void PC_SourceError(int handle, char *format, ...) {
static char string[4096];
va_start (argptr, format);
vsprintf (string, format, argptr);
Q_vsnprintf (string, sizeof(string), format, argptr);
va_end (argptr);
filename[0] = '\0';

View file

@ -121,7 +121,7 @@ void Sys_Printf (char *fmt, ...)
unsigned char *p;
va_start (argptr,fmt);
vsnprintf (text,sizeof(text),fmt,argptr);
Q_vsnprintf (text,sizeof(text),fmt,argptr);
va_end (argptr);
if (strlen(text) > sizeof(text))
@ -227,7 +227,7 @@ void Sys_Error( const char *error, ...)
CL_Shutdown ();
va_start (argptr,error);
vsprintf (string,error,argptr);
Q_vsnprintf (string,sizeof(string),error,argptr);
va_end (argptr);
fprintf(stderr, "Sys_Error: %s\n", string);
@ -240,7 +240,7 @@ void Sys_Warn (char *warning, ...)
char string[1024];
va_start (argptr,warning);
vsprintf (string,warning,argptr);
Q_vsnprintf (string,sizeof(string),warning,argptr);
va_end (argptr);
fprintf(stderr, "Warning: %s", string);
}

View file

@ -353,7 +353,7 @@ void QDECL Sys_Error( const char *error, ... ) {
MSG msg;
va_start (argptr, error);
vsprintf (text, error, argptr);
Q_vsnprintf (text, sizeof(text), error, argptr);
va_end (argptr);
Conbuf_AppendText( text );

View file

@ -103,7 +103,7 @@ void Sys_Error( const char *error, ... ) {
char text[256];
va_start (argptr, error);
vsprintf (text, error, argptr);
Q_vsnprintf (text, sizeof(text), error, argptr);
va_end (argptr);
#ifdef _GAMECUBE