From 1c1d9ae18385f1a152c93f115289defbd64394ab Mon Sep 17 00:00:00 2001 From: Night Owl Date: Tue, 11 Jul 2017 02:24:19 +0500 Subject: [PATCH] Remove unneeded strcpy usage. --- cl_dll/com_weapons.cpp | 2 +- cl_dll/com_weapons.h | 2 +- cl_dll/ev_hldm.cpp | 19 +++++++++---------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/cl_dll/com_weapons.cpp b/cl_dll/com_weapons.cpp index 774df091..5621149b 100644 --- a/cl_dll/com_weapons.cpp +++ b/cl_dll/com_weapons.cpp @@ -283,7 +283,7 @@ unsigned short stub_PrecacheEvent( int type, const char *s ) return 0; } -const char *stub_NameForFunction( unsigned int function ) +const char *stub_NameForFunction( void *function ) { return "func"; } diff --git a/cl_dll/com_weapons.h b/cl_dll/com_weapons.h index 8559e20b..0a538f0f 100644 --- a/cl_dll/com_weapons.h +++ b/cl_dll/com_weapons.h @@ -34,7 +34,7 @@ void HUD_SetMaxSpeed( const struct edict_s *ed, float speed ); int stub_PrecacheModel( const char* s ); int stub_PrecacheSound( const char* s ); unsigned short stub_PrecacheEvent( int type, const char *s ); -const char *stub_NameForFunction( unsigned int function ); +const char *stub_NameForFunction( void *function ); void stub_SetModel( struct edict_s *e, const char *m ); extern cvar_t *cl_lw; diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 7bb3a797..d94f9fea 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -1695,7 +1695,7 @@ void EV_TrainPitchAdjust( event_args_t *args ) int pitch; int stop; - char sz[256]; + const char *pszSound; idx = args->entindex; @@ -1711,36 +1711,35 @@ void EV_TrainPitchAdjust( event_args_t *args ) switch( noise ) { case 1: - strcpy( sz, "plats/ttrain1.wav" ); + pszSound = "plats/ttrain1.wav"; break; case 2: - strcpy( sz, "plats/ttrain2.wav" ); + pszSound = "plats/ttrain2.wav"; break; case 3: - strcpy( sz, "plats/ttrain3.wav" ); + pszSound = "plats/ttrain3.wav"; break; case 4: - strcpy( sz, "plats/ttrain4.wav"); + pszSound = "plats/ttrain4.wav"; break; case 5: - strcpy( sz, "plats/ttrain6.wav"); + pszSound = "plats/ttrain6.wav"; break; case 6: - strcpy( sz, "plats/ttrain7.wav"); + pszSound = "plats/ttrain7.wav"; break; default: // no sound - strcpy( sz, "" ); return; } if( stop ) { - gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, sz ); + gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, pszSound ); } else { - gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, sz, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch ); + gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, pszSound, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch ); } }