Skip to content

Commit

Permalink
- Replace vsprintf function in bg_lib.c with vsnprintf implementation…
Browse files Browse the repository at this point in the history
… started by Patrick Powell.

- Remove all calls to vsprintf in the engine and gamecode and replace them with calls to vsnprintf.
  • Loading branch information
Thilo Schulz committed Mar 25, 2008
1 parent 5728fc2 commit bb47026
Show file tree
Hide file tree
Showing 19 changed files with 793 additions and 289 deletions.
2 changes: 1 addition & 1 deletion README
Expand Up @@ -144,7 +144,7 @@ New cvars
New commands
video [filename] - start video capture (use with demo command)
stopvideo - stop video capture
print - print out the contents of a cvar
print - print out the contents of a cvar


------------------------------------------------------------ Miscellaneous -----
Expand Down
2 changes: 1 addition & 1 deletion code/botlib/be_aas_main.c
Expand Up @@ -60,7 +60,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, "%s", str);
} //end of the function AAS_Error
Expand Down
4 changes: 2 additions & 2 deletions code/botlib/l_precomp.c
Expand Up @@ -131,7 +131,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);
Expand All @@ -155,7 +155,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);
Expand Down
4 changes: 2 additions & 2 deletions code/botlib/l_script.c
Expand Up @@ -236,7 +236,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);
Expand All @@ -262,7 +262,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);
Expand Down
8 changes: 4 additions & 4 deletions code/cgame/cg_main.c
Expand Up @@ -419,7 +419,7 @@ void QDECL CG_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( text );
Expand All @@ -430,7 +430,7 @@ void QDECL CG_Error( 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_Error( text );
Expand All @@ -441,7 +441,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);

CG_Error( "%s", text);
Expand All @@ -452,7 +452,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);

CG_Printf ("%s", text);
Expand Down
2 changes: 1 addition & 1 deletion code/game/ai_main.c
Expand Up @@ -99,7 +99,7 @@ void QDECL BotAI_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) {
Expand Down

0 comments on commit bb47026

Please sign in to comment.