diff options
author | Andrey Nazarov <skuller@skuller.net> | 2007-10-07 21:08:14 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2007-10-07 21:08:14 +0000 |
commit | d95d025a1bbfcdd43f1d13e1aedceed53c28d7cf (patch) | |
tree | d6a9241af6ab21337ed8d782d508efe539772c01 /source/sv_send.c | |
parent | e2a278c4a223328ac8c90d8c2b8b7c86cf095fa1 (diff) |
Use MSG_WriteData instead of MSG_WriteString when possible.
Dropped check for \xff byte inside MSG_WriteString,
clients nowadays should not use 3.20 anyway.
Diffstat (limited to 'source/sv_send.c')
-rw-r--r-- | source/sv_send.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/source/sv_send.c b/source/sv_send.c index 02369a2..1e981a3 100644 --- a/source/sv_send.c +++ b/source/sv_send.c @@ -117,17 +117,18 @@ NOT archived in MVD stream. void SV_ClientPrintf( client_t *client, int level, const char *fmt, ... ) { va_list argptr; char string[MAX_STRING_CHARS]; + int length; if( level < client->messagelevel ) return; va_start( argptr, fmt ); - Q_vsnprintf( string, sizeof( string ), fmt, argptr ); + length = Q_vsnprintf( string, sizeof( string ), fmt, argptr ); va_end( argptr ); MSG_WriteByte( svc_print ); MSG_WriteByte( level ); - MSG_WriteString( string ); + MSG_WriteData( string, length + 1 ); SV_ClientAddMessage( client, MSG_RELIABLE|MSG_CLEAR ); } @@ -144,15 +145,15 @@ void SV_BroadcastPrintf( int level, const char *fmt, ... ) { va_list argptr; char string[MAX_STRING_CHARS]; client_t *client; - int i; + int i, length; va_start( argptr, fmt ); - Q_vsnprintf( string, sizeof( string ), fmt, argptr ); + length = Q_vsnprintf( string, sizeof( string ), fmt, argptr ); va_end( argptr ); MSG_WriteByte( svc_print ); MSG_WriteByte( level ); - MSG_WriteString( string ); + MSG_WriteData( string, length + 1 ); // echo to console if( dedicated->integer ) { @@ -176,13 +177,14 @@ void SV_BroadcastPrintf( int level, const char *fmt, ... ) { void SV_ClientCommand( client_t *client, const char *fmt, ... ) { va_list argptr; char string[MAX_STRING_CHARS]; + int length; va_start( argptr, fmt ); - Q_vsnprintf( string, sizeof( string ), fmt, argptr ); + length = Q_vsnprintf( string, sizeof( string ), fmt, argptr ); va_end( argptr ); MSG_WriteByte( svc_stufftext ); - MSG_WriteString( string ); + MSG_WriteData( string, length + 1 ); SV_ClientAddMessage( client, MSG_RELIABLE|MSG_CLEAR ); } @@ -199,13 +201,14 @@ void SV_BroadcastCommand( const char *fmt, ... ) { va_list argptr; char string[MAX_STRING_CHARS]; client_t *client; + int length; va_start( argptr, fmt ); - Q_vsnprintf( string, sizeof( string ), fmt, argptr ); + length = Q_vsnprintf( string, sizeof( string ), fmt, argptr ); va_end( argptr ); MSG_WriteByte( svc_stufftext ); - MSG_WriteString( string ); + MSG_WriteData( string, length + 1 ); FOR_EACH_CLIENT( client ) { SV_ClientAddMessage( client, MSG_RELIABLE ); |