mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-25 14:24:45 +00:00
public: remove Q_vsprintf, replace by proper Q_vsnprintf proper calls
Fixes weird off by one error caused by glibc updates? I didn't tracked what causes it exactly but replacing it seems to work. Anyway, we should remove all 99999 hacks in libpublic.
This commit is contained in:
parent
5b52a9a19f
commit
096ee34f67
@ -2583,7 +2583,7 @@ void CL_ServerCommand( qboolean reliable, const char *fmt, ... )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
va_start( argptr, fmt );
|
va_start( argptr, fmt );
|
||||||
Q_vsprintf( string, fmt, argptr );
|
Q_vsnprintf( string, sizeof( string ), fmt, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
if( reliable )
|
if( reliable )
|
||||||
|
@ -733,7 +733,7 @@ void GAME_EXPORT Host_Error( const char *error, ... )
|
|||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
||||||
va_start( argptr, error );
|
va_start( argptr, error );
|
||||||
Q_vsprintf( hosterror1, error, argptr );
|
Q_vsnprintf( hosterror1, sizeof( hosterror1 ), error, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
CL_WriteMessageHistory (); // before Q_error call
|
CL_WriteMessageHistory (); // before Q_error call
|
||||||
|
@ -34,7 +34,7 @@ void SV_ClientPrintf( sv_client_t *cl, const char *fmt, ... )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
va_start( argptr, fmt );
|
va_start( argptr, fmt );
|
||||||
Q_vsprintf( string, fmt, argptr );
|
Q_vsnprintf( string, sizeof( string ), fmt, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
MSG_BeginServerCmd( &cl->netchan.message, svc_print );
|
MSG_BeginServerCmd( &cl->netchan.message, svc_print );
|
||||||
@ -56,7 +56,7 @@ void SV_BroadcastPrintf( sv_client_t *ignore, const char *fmt, ... )
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
va_start( argptr, fmt );
|
va_start( argptr, fmt );
|
||||||
Q_vsprintf( string, fmt, argptr );
|
Q_vsnprintf( string, sizeof( string ), fmt, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
if( sv.state == ss_active )
|
if( sv.state == ss_active )
|
||||||
@ -97,7 +97,7 @@ void SV_BroadcastCommand( const char *fmt, ... )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
va_start( argptr, fmt );
|
va_start( argptr, fmt );
|
||||||
Q_vsprintf( string, fmt, argptr );
|
Q_vsnprintf( string, sizeof( string ), fmt, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
MSG_BeginServerCmd( &sv.reliable_datagram, svc_stufftext );
|
MSG_BeginServerCmd( &sv.reliable_datagram, svc_stufftext );
|
||||||
|
@ -2064,7 +2064,7 @@ int FS_VPrintf( file_t *file, const char *format, va_list ap )
|
|||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
tempbuff = (char *)Mem_Malloc( fs_mempool, buff_size );
|
tempbuff = (char *)Mem_Malloc( fs_mempool, buff_size );
|
||||||
len = Q_vsprintf( tempbuff, format, ap );
|
len = Q_vsnprintf( tempbuff, buff_size, format, ap );
|
||||||
|
|
||||||
if( len >= 0 && len < buff_size )
|
if( len >= 0 && len < buff_size )
|
||||||
break;
|
break;
|
||||||
|
@ -80,7 +80,6 @@ qboolean Q_stricmpext( const char *pattern, const char *text );
|
|||||||
qboolean Q_strnicmpext( const char *pattern, const char *text, size_t minimumlen );
|
qboolean Q_strnicmpext( const char *pattern, const char *text, size_t minimumlen );
|
||||||
const byte *Q_memmem( const byte *haystack, size_t haystacklen, const byte *needle, size_t needlelen );
|
const byte *Q_memmem( const byte *haystack, size_t haystacklen, const byte *needle, size_t needlelen );
|
||||||
const char *Q_timestamp( int format );
|
const char *Q_timestamp( int format );
|
||||||
#define Q_vsprintf( buffer, format, args ) Q_vsnprintf( buffer, 99999, format, args )
|
|
||||||
int Q_vsnprintf( char *buffer, size_t buffersize, const char *format, va_list args );
|
int Q_vsnprintf( char *buffer, size_t buffersize, const char *format, va_list args );
|
||||||
int Q_snprintf( char *buffer, size_t buffersize, const char *format, ... ) _format( 3 );
|
int Q_snprintf( char *buffer, size_t buffersize, const char *format, ... ) _format( 3 );
|
||||||
int Q_sprintf( char *buffer, const char *format, ... ) _format( 2 );
|
int Q_sprintf( char *buffer, const char *format, ... ) _format( 2 );
|
||||||
|
@ -55,7 +55,7 @@ void R_Speeds_Printf( const char *msg, ... )
|
|||||||
char text[2048];
|
char text[2048];
|
||||||
|
|
||||||
va_start( argptr, msg );
|
va_start( argptr, msg );
|
||||||
Q_vsprintf( text, msg, argptr );
|
Q_vsnprintf( text, sizeof( text ), msg, argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Q_strncat( r_speeds_msg, text, sizeof( r_speeds_msg ));
|
Q_strncat( r_speeds_msg, text, sizeof( r_speeds_msg ));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user