Browse Source

Replace snprintf by _snprintf, for MSVC

caseclosed
Alibek Omarov 7 years ago
parent
commit
6161c6d4d8
  1. 8
      cl_dll/text_message.cpp
  2. 4
      dlls/client.cpp

8
cl_dll/text_message.cpp

@ -181,20 +181,20 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
switch( msg_dest ) switch( msg_dest )
{ {
case HUD_PRINTCENTER: case HUD_PRINTCENTER:
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] ); _snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
CenterPrint( ConvertCRtoNL( psz ) ); CenterPrint( ConvertCRtoNL( psz ) );
break; break;
case HUD_PRINTNOTIFY: case HUD_PRINTNOTIFY:
psz[0] = 1; // mark this message to go into the notify buffer psz[0] = 1; // mark this message to go into the notify buffer
snprintf( psz + 1, MSG_BUF_SIZE - 1, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] ); _snprintf( psz + 1, MSG_BUF_SIZE - 1, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
ConsolePrint( ConvertCRtoNL( psz ) ); ConsolePrint( ConvertCRtoNL( psz ) );
break; break;
case HUD_PRINTTALK: case HUD_PRINTTALK:
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] ); _snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), MSG_BUF_SIZE ); gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), MSG_BUF_SIZE );
break; break;
case HUD_PRINTCONSOLE: case HUD_PRINTCONSOLE:
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] ); _snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
ConsolePrint( ConvertCRtoNL( psz ) ); ConsolePrint( ConvertCRtoNL( psz ) );
break; break;
} }

4
dlls/client.cpp

@ -108,7 +108,7 @@ void ClientDisconnect( edict_t *pEntity )
char text[256] = ""; char text[256] = "";
if( pEntity->v.netname ) if( pEntity->v.netname )
snprintf( text, sizeof(text), "- %s has left the game\n", STRING( pEntity->v.netname ) ); _snprintf( text, sizeof(text), "- %s has left the game\n", STRING( pEntity->v.netname ) );
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL ); MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
WRITE_BYTE( ENTINDEX( pEntity ) ); WRITE_BYTE( ENTINDEX( pEntity ) );
WRITE_STRING( text ); WRITE_STRING( text );
@ -660,7 +660,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
if( gpGlobals->maxClients > 1 ) if( gpGlobals->maxClients > 1 )
{ {
char text[256]; char text[256];
snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) ); _snprintf( text, 256, "* %s changed name to %s\n", STRING( pEntity->v.netname ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL ); MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
WRITE_BYTE( ENTINDEX( pEntity ) ); WRITE_BYTE( ENTINDEX( pEntity ) );
WRITE_STRING( text ); WRITE_STRING( text );

Loading…
Cancel
Save