From 7d3da75ef7b91d9d402e820035787bc045ff4ae4 Mon Sep 17 00:00:00 2001 From: mittorn Date: Sat, 26 Mar 2016 19:21:08 +0000 Subject: [PATCH] Fix client warnings --- cl_dll/Android.mk | 2 +- cl_dll/MOTD.cpp | 2 +- cl_dll/StudioModelRenderer.cpp | 3 ++- cl_dll/cl_util.h | 4 ++-- cl_dll/death.cpp | 5 +++-- cl_dll/geiger.cpp | 4 ++-- cl_dll/health.cpp | 3 ++- cl_dll/hl/hl_weapons.cpp | 4 ++-- cl_dll/hud.cpp | 6 ++++-- cl_dll/menu.cpp | 3 ++- cl_dll/message.cpp | 4 ++-- cl_dll/parsemsg.cpp | 2 +- cl_dll/saytext.cpp | 3 ++- cl_dll/scoreboard.cpp | 2 +- cl_dll/status_icons.cpp | 3 ++- dlls/crowbar.cpp | 4 ++-- dlls/effects.h | 4 ++-- dlls/egon.cpp | 2 +- dlls/handgrenade.cpp | 2 +- dlls/player.h | 2 +- dlls/rpg.cpp | 2 +- dlls/satchel.cpp | 8 ++++---- dlls/squeakgrenade.cpp | 2 +- dlls/tripmine.cpp | 2 +- dlls/util.h | 2 +- dlls/weapons.h | 2 +- engine/cdll_int.h | 9 +++++++-- engine/eiface.h | 6 ------ pm_shared/pm_defs.h | 3 ++- pm_shared/pm_shared.c | 3 +++ 30 files changed, 57 insertions(+), 46 deletions(-) diff --git a/cl_dll/Android.mk b/cl_dll/Android.mk index 83417047..8fa7a388 100755 --- a/cl_dll/Android.mk +++ b/cl_dll/Android.mk @@ -91,7 +91,7 @@ SRCS+=./input_xash3d.cpp SRCS+=./scoreboard.cpp SRCS+=./MOTD.cpp INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls -DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -fpermissive -w +DEFINES = -Wextra -Wno-missing-field-initializers -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -fpermissive LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \ $(LOCAL_PATH)/../common \ diff --git a/cl_dll/MOTD.cpp b/cl_dll/MOTD.cpp index 68030cf9..0ef2ced2 100644 --- a/cl_dll/MOTD.cpp +++ b/cl_dll/MOTD.cpp @@ -129,7 +129,7 @@ int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf ) BEGIN_READ( pbuf, iSize ); int is_finished = READ_BYTE(); - strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) ); + strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) - 1 ); if ( is_finished ) { diff --git a/cl_dll/StudioModelRenderer.cpp b/cl_dll/StudioModelRenderer.cpp index e0845c29..fa2fbabf 100644 --- a/cl_dll/StudioModelRenderer.cpp +++ b/cl_dll/StudioModelRenderer.cpp @@ -911,7 +911,8 @@ void CStudioModelRenderer::StudioSetupBones ( void ) for (i = 0; i < m_pStudioHeader->numbones; i++) { - for( int j = 0; j < LEGS_BONES_COUNT; j++ ) + int j; + for( j = 0; j < LEGS_BONES_COUNT; j++ ) { if( !strcmp( pbones[i].name, legs_bones[j] )) break; diff --git a/cl_dll/cl_util.h b/cl_dll/cl_util.h index 4876ca27..78eb82d4 100644 --- a/cl_dll/cl_util.h +++ b/cl_dll/cl_util.h @@ -104,14 +104,14 @@ inline int TextMessageDrawChar( int x, int y, int number, int r, int g, in inline int DrawConsoleString( int x, int y, const char *string ) { if( hud_textmode->value == 1 ) - return gHUD.DrawHudString( x, y, 9999, (char*)string, 255*g_hud_text_color[0], 255*g_hud_text_color[1], 255*g_hud_text_color[2]); + return gHUD.DrawHudString( x, y, 9999, (char*)string, (int)(255.0*g_hud_text_color[0]), (int)(255.0*g_hud_text_color[1]), (int)(255.0*g_hud_text_color[2])); return gEngfuncs.pfnDrawConsoleString( x, y, (char*) string ); } inline void GetConsoleStringSize( const char *string, int *width, int *height ) { if( hud_textmode->value == 1 ) - *height = 13, *width = gHUD.DrawHudStringLen(string); + *height = 13, *width = gHUD.DrawHudStringLen((char*)string); else gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height ); } diff --git a/cl_dll/death.cpp b/cl_dll/death.cpp index 760b005c..46b50050 100644 --- a/cl_dll/death.cpp +++ b/cl_dll/death.cpp @@ -157,6 +157,7 @@ int CHudDeathNotice :: Draw( float flTime ) // This message handler may be better off elsewhere int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbuf ) { + int i; m_iFlags |= HUD_ACTIVE; BEGIN_READ( pbuf, iSize ); @@ -166,12 +167,12 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p char killedwith[32]; strcpy( killedwith, "d_" ); - strncat( killedwith, READ_STRING(), 32 ); + strncat( killedwith, READ_STRING(), 31 ); gHUD.m_Spectator.DeathMessage(victim); - for ( int i = 0; i < MAX_DEATHNOTICES; i++ ) + for ( i = 0; i < MAX_DEATHNOTICES; i++ ) { if ( rgDeathNoticeList[i].iId == 0 ) break; diff --git a/cl_dll/geiger.cpp b/cl_dll/geiger.cpp index 6f5f984f..3fb09788 100644 --- a/cl_dll/geiger.cpp +++ b/cl_dll/geiger.cpp @@ -64,9 +64,9 @@ int CHudGeiger::MsgFunc_Geiger(const char *pszName, int iSize, void *pbuf) int CHudGeiger::Draw (float flTime) { int pct; - float flvol; + float flvol = 0; int rg[3]; - int i; + int i = 0; if (m_iGeigerRange < 1000 && m_iGeigerRange > 0) { diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index 0b73efca..3aa78aeb 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -379,6 +379,7 @@ int CHudHealth::DrawDamage(float flTime) { int r, g, b, a; DAMAGE_IMAGE *pdmg; + int i; if (!m_bitsDamage) return 1; @@ -390,7 +391,7 @@ int CHudHealth::DrawDamage(float flTime) ScaleColors(r, g, b, a); // Draw all the items - for (int i = 0; i < NUM_DMG_TYPES; i++) + for ( i = 0; i < NUM_DMG_TYPES; i++) { if (m_bitsDamage & giDmgFlags[i]) { diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 3572bdaa..03be4579 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -288,7 +288,7 @@ Only produces random numbers to match the server ones. */ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker, int shared_rand ) { - float x, y, z; + float x = 0, y = 0, z; for ( ULONG iShot = 1; iShot <= cShots; iShot++ ) { @@ -579,7 +579,7 @@ void CBasePlayerWeapon::PrintState( void ) COM_Log( "c:\\hl.log", "%i ", m_iClip ); } -int RandomLong( int a, int b ) +long int RandomLong( long int a, long int b ) { return gEngfuncs.pfnRandomLong(a, b); } diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index 36bb50ad..f172b362 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -304,10 +304,11 @@ void CHud :: VidInit( void ) if (m_pSpriteList) { + int j; // count the number of sprites of the appropriate res m_iSpriteCount = 0; client_sprite_t *p = m_pSpriteList; - for ( int j = 0; j < m_iSpriteCountAllRes; j++ ) + for ( j = 0; j < m_iSpriteCountAllRes; j++ ) { if ( p->iRes == m_iRes ) m_iSpriteCount++; @@ -340,13 +341,14 @@ void CHud :: VidInit( void ) } else { + int j; // we have already have loaded the sprite reference from hud.txt, but // we need to make sure all the sprites have been loaded (we've gone through a transition, or loaded a save game) client_sprite_t *p = m_pSpriteList; // count the number of sprites of the appropriate res m_iSpriteCount = 0; - for ( int j = 0; j < m_iSpriteCountAllRes; j++ ) + for ( j = 0; j < m_iSpriteCountAllRes; j++ ) { if ( p->iRes == m_iRes ) m_iSpriteCount++; diff --git a/cl_dll/menu.cpp b/cl_dll/menu.cpp index 60ae2403..bd242119 100644 --- a/cl_dll/menu.cpp +++ b/cl_dll/menu.cpp @@ -64,6 +64,7 @@ int CHudMenu :: VidInit( void ) int CHudMenu :: Draw( float flTime ) { + int i; // check for if menu is set to disappear if ( m_flShutoffTime > 0 ) { @@ -83,7 +84,7 @@ int CHudMenu :: Draw( float flTime ) // count the number of newlines int nlc = 0; - for ( int i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ ) + for ( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ ) { if ( g_szMenuString[i] == '\n' ) nlc++; diff --git a/cl_dll/message.cpp b/cl_dll/message.cpp index 61ea55a7..5854329e 100644 --- a/cl_dll/message.cpp +++ b/cl_dll/message.cpp @@ -140,7 +140,7 @@ int CHudMessage::YPosition( float y, int height ) void CHudMessage::MessageScanNextChar( void ) { - int srcRed, srcGreen, srcBlue, destRed, destGreen, destBlue; + int srcRed, srcGreen, srcBlue, destRed = 0, destGreen = 0, destBlue = 0; int blend; srcRed = m_parms.pMessage->r1; @@ -319,7 +319,7 @@ int CHudMessage::Draw( float fTime ) { int i, drawn; client_textmessage_t *pMessage; - float endTime; + float endTime = 0; drawn = 0; diff --git a/cl_dll/parsemsg.cpp b/cl_dll/parsemsg.cpp index 84f03b8b..73d51f3b 100644 --- a/cl_dll/parsemsg.cpp +++ b/cl_dll/parsemsg.cpp @@ -142,7 +142,7 @@ char* READ_STRING( void ) break; string[l] = c; l++; - } while (l < sizeof(string)-1); + } while (l < (int)sizeof(string)-1); string[l] = 0; diff --git a/cl_dll/saytext.cpp b/cl_dll/saytext.cpp index 3a7616a5..ddfa00fe 100644 --- a/cl_dll/saytext.cpp +++ b/cl_dll/saytext.cpp @@ -162,10 +162,11 @@ int CHudSayText :: MsgFunc_SayText( const char *pszName, int iSize, void *pbuf ) void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex ) { + int i; ConsolePrint( pszBuf ); // find an empty string slot - for ( int i = 0; i < MAX_LINES; i++ ) + for ( i = 0; i < MAX_LINES; i++ ) { if ( ! *g_szLineBuffer[i] ) break; diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index c7431328..9fca2b7a 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -526,7 +526,7 @@ int CHudScoreboard :: MsgFunc_TeamInfo( const char *pszName, int iSize, void *pb if ( j > m_iNumTeams ) { // they aren't in a listed team, so make a new one // search through for an empty team slot - for ( int j = 1; j <= m_iNumTeams; j++ ) + for ( j = 1; j <= m_iNumTeams; j++ ) { if ( g_TeamInfo[j].name[0] == '\0' ) break; diff --git a/cl_dll/status_icons.cpp b/cl_dll/status_icons.cpp index 9207143e..57ccdb49 100644 --- a/cl_dll/status_icons.cpp +++ b/cl_dll/status_icons.cpp @@ -106,8 +106,9 @@ int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *p // add the icon to the icon list, and set it's drawing color void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue ) { + int i; // check to see if the sprite is in the current list - for ( int i = 0; i < MAX_ICONSPRITES; i++ ) + for ( i = 0; i < MAX_ICONSPRITES; i++ ) { if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) ) break; diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index de6ad845..ef21e503 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -147,7 +147,7 @@ void CCrowbar::PrimaryAttack() { if (! Swing( 1 )) { - SetThink( &SwingAgain ); + SetThink( &CCrowbar::SwingAgain ); pev->nextthink = gpGlobals->time + 0.1; } } @@ -306,7 +306,7 @@ int CCrowbar::Swing( int fFirst ) #endif m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25; - SetThink( &Smack ); + SetThink( &CCrowbar::Smack ); pev->nextthink = UTIL_WeaponTimeBase() + 0.2; diff --git a/dlls/effects.h b/dlls/effects.h index c62a3ee4..388c4202 100644 --- a/dlls/effects.h +++ b/dlls/effects.h @@ -79,7 +79,7 @@ public: inline void AnimateAndDie( float framerate ) { - SetThink( &AnimateUntilDead); + SetThink( &CSprite::AnimateUntilDead ); pev->framerate = framerate; pev->dmgtime = gpGlobals->time + (m_maxFrame / framerate); pev->nextthink = gpGlobals->time; @@ -168,7 +168,7 @@ public: static CBeam *BeamCreate( const char *pSpriteName, int width ); - inline void LiveForTime( float time ) { SetThink( &SUB_Remove); pev->nextthink = gpGlobals->time + time; } + inline void LiveForTime( float time ) { SetThink( &CBaseEntity::SUB_Remove ); pev->nextthink = gpGlobals->time + time; } inline void BeamDamageInstant( TraceResult *ptr, float damage ) { pev->dmg = damage; diff --git a/dlls/egon.cpp b/dlls/egon.cpp index 98d246a7..a2809baf 100644 --- a/dlls/egon.cpp +++ b/dlls/egon.cpp @@ -281,7 +281,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir ) #endif - float timedist; + float timedist = 0; switch ( m_fireMode ) { diff --git a/dlls/handgrenade.cpp b/dlls/handgrenade.cpp index 2233b8a0..bd2f5b86 100644 --- a/dlls/handgrenade.cpp +++ b/dlls/handgrenade.cpp @@ -103,7 +103,7 @@ void CHandGrenade::Holster( int skiplocal /* = 0 */ ) { // no more grenades! m_pPlayer->pev->weapons &= ~(1<nextthink = gpGlobals->time + 0.1; } diff --git a/dlls/player.h b/dlls/player.h index 417da04e..88dbb042 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -292,7 +292,7 @@ public: void SetCustomDecalFrames( int nFrames ); int GetCustomDecalFrames( void ); - void CBasePlayer::TabulateAmmo( void ); + void TabulateAmmo( void ); float m_flStartCharge; float m_flAmmoStartCharge; diff --git a/dlls/rpg.cpp b/dlls/rpg.cpp index e13af4ab..3b4478c4 100644 --- a/dlls/rpg.cpp +++ b/dlls/rpg.cpp @@ -284,7 +284,7 @@ void CRpgRocket :: FollowThink( void ) void CRpg::Reload( void ) { - int iResult; + int iResult = 0; if ( m_iClip == 1 ) { diff --git a/dlls/satchel.cpp b/dlls/satchel.cpp index 0bd6513d..9c4688c2 100644 --- a/dlls/satchel.cpp +++ b/dlls/satchel.cpp @@ -77,9 +77,9 @@ void CSatchelCharge :: Spawn( void ) UTIL_SetSize(pev, Vector( -4, -4, -4), Vector(4, 4, 4)); // Uses point-sized, and can be stepped over UTIL_SetOrigin( pev, pev->origin ); - SetTouch( &SatchelSlide ); - SetUse( &DetonateUse ); - SetThink( &SatchelThink ); + SetTouch( &CSatchelCharge::SatchelSlide ); + SetUse( &CSatchelCharge::DetonateUse ); + SetThink( &CSatchelCharge::SatchelThink ); pev->nextthink = gpGlobals->time + 0.1; pev->gravity = 0.5; @@ -322,7 +322,7 @@ void CSatchel::Holster( int skiplocal /* = 0 */ ) if ( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] && !m_chargeReady ) { m_pPlayer->pev->weapons &= ~(1<nextthink = gpGlobals->time + 0.1; } } diff --git a/dlls/squeakgrenade.cpp b/dlls/squeakgrenade.cpp index 0eacb2d8..7cef6f2c 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -483,7 +483,7 @@ void CSqueak::Holster( int skiplocal /* = 0 */ ) if ( !m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ] ) { m_pPlayer->pev->weapons &= ~(1<nextthink = gpGlobals->time + 0.1; return; } diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index ce140f6c..6d8e6816 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -420,7 +420,7 @@ void CTripmine::Holster( int skiplocal /* = 0 */ ) { // out of mines m_pPlayer->pev->weapons &= ~(1<nextthink = gpGlobals->time + 0.1; } diff --git a/dlls/util.h b/dlls/util.h index 1edc0411..e9d26c1f 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -248,7 +248,7 @@ typedef enum { ignore_monsters=1, dont_ignore_monsters=0, missile=2 } IGNORE_MON typedef enum { ignore_glass=1, dont_ignore_glass=0 } IGNORE_GLASS; extern void UTIL_TraceLine (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr); extern void UTIL_TraceLine (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t *pentIgnore, TraceResult *ptr); -typedef enum { point_hull=0, human_hull=1, large_hull=2, head_hull=3 }; +enum { point_hull=0, human_hull=1, large_hull=2, head_hull=3 }; extern void UTIL_TraceHull (const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr); extern TraceResult UTIL_GetGlobalTrace (void); extern void UTIL_TraceModel (const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr); diff --git a/dlls/weapons.h b/dlls/weapons.h index afde3247..f03bdab8 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -486,7 +486,7 @@ public: int Restore( CRestore &restore ); static TYPEDESCRIPTION m_SaveData[]; - HasWeapon( CBasePlayerItem *pCheckItem ); + bool HasWeapon( CBasePlayerItem *pCheckItem ); BOOL PackWeapon( CBasePlayerItem *pWeapon ); BOOL PackAmmo( int iszName, int iCount ); diff --git a/engine/cdll_int.h b/engine/cdll_int.h index dd3b0a02..eff8d0e1 100644 --- a/engine/cdll_int.h +++ b/engine/cdll_int.h @@ -93,6 +93,11 @@ typedef struct client_textmessage_s const char *pMessage; } client_textmessage_t; +#if __MSC_VER == 1200 +#define longlong_t __int64 +#else +#define longlong_t long long +#endif typedef struct hud_player_info_s { char *name; @@ -106,7 +111,7 @@ typedef struct hud_player_info_s short topcolor; short bottomcolor; - unsigned long long m_nSteamID; + unsigned longlong_t m_nSteamID_1; } hud_player_info_t; typedef struct cl_enginefuncs_s @@ -305,4 +310,4 @@ typedef struct cl_enginefuncs_s } #endif -#endif//CDLL_INT_H \ No newline at end of file +#endif//CDLL_INT_H diff --git a/engine/eiface.h b/engine/eiface.h index 64984b10..9d09045a 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -34,12 +34,6 @@ // This is conveniently done for them in extdll.h // -#ifdef _WIN32 -#define DLLEXPORT __stdcall -#else -#define DLLEXPORT /* */ -#endif - typedef enum { at_notice, diff --git a/pm_shared/pm_defs.h b/pm_shared/pm_defs.h index 2a2ee680..58d49081 100644 --- a/pm_shared/pm_defs.h +++ b/pm_shared/pm_defs.h @@ -81,6 +81,7 @@ typedef struct physent_s vec3_t vuser3; vec3_t vuser4; } physent_t; +typedef struct hull_s hull_t; typedef struct playermove_s { @@ -195,7 +196,7 @@ typedef struct playermove_s int (*PM_TruePointContents)( float *p ); int (*PM_HullPointContents)( struct hull_s *hull, int num, float *p ); pmtrace_t (*PM_PlayerTrace)( float *start, float *end, int traceFlags, int ignore_pe ); - struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehulll, int ignore_pe ); + pmtrace_t *(*PM_TraceLine)( float *start, float *end, int flags, int usehulll, int ignore_pe ); long (*RandomLong)( long lLow, long lHigh ); float (*RandomFloat)( float flLow, float flHigh ); int (*PM_GetModelType)( struct model_s *mod ); diff --git a/pm_shared/pm_shared.c b/pm_shared/pm_shared.c index 2216e7e9..262b3f1e 100644 --- a/pm_shared/pm_shared.c +++ b/pm_shared/pm_shared.c @@ -24,6 +24,9 @@ #include // NULL #include // sqrt #include // strcpy +#ifdef stricmp +#include // strncasecmp +#endif #include // atoi #include // isspace