* The use of va in the ansi color stuff was preventing developer 1 mode (and

probably various other things) from working properly
This commit is contained in:
Tim Angus 2006-01-22 19:38:50 +00:00
parent 3404fbac56
commit 7b930770e7

View file

@ -1221,6 +1221,7 @@ void Sys_ANSIColorify( const char *msg, char *buffer, int bufferSize )
int msgLength, pos; int msgLength, pos;
int i, j; int i, j;
char *escapeCode; char *escapeCode;
char tempBuffer[ 7 ];
if( !msg || !buffer ) if( !msg || !buffer )
return; return;
@ -1234,7 +1235,8 @@ void Sys_ANSIColorify( const char *msg, char *buffer, int bufferSize )
{ {
if( msg[ i ] == '\n' ) if( msg[ i ] == '\n' )
{ {
strncat( buffer, va( "%c[0m\n", 0x1B ), bufferSize ); Com_sprintf( tempBuffer, 7, "%c[0m\n", 0x1B );
strncat( buffer, tempBuffer, bufferSize );
i++; i++;
} }
else if( msg[ i ] == Q_COLOR_ESCAPE ) else if( msg[ i ] == Q_COLOR_ESCAPE )
@ -1254,13 +1256,19 @@ void Sys_ANSIColorify( const char *msg, char *buffer, int bufferSize )
} }
if( escapeCode ) if( escapeCode )
strncat( buffer, va( "%c[%sm", 0x1B, escapeCode ), bufferSize ); {
Com_sprintf( tempBuffer, 7, "%c[%sm", 0x1B, escapeCode );
strncat( buffer, tempBuffer, bufferSize );
}
i++; i++;
} }
} }
else else
strncat( buffer, va( "%c", msg[ i++ ] ), bufferSize ); {
Com_sprintf( tempBuffer, 7, "%c", msg[ i++ ] );
strncat( buffer, tempBuffer, bufferSize );
}
} }
} }