From 8cb15be7c067b8ac3d24b972a6f5b05e687e934a Mon Sep 17 00:00:00 2001 From: oy Date: Mon, 16 Aug 2010 02:21:18 +0200 Subject: [PATCH] added fixes for compiler errors and warnings by sworddragon --- src/base/system.c | 18 +++++++++--------- src/engine/client/input.cpp | 4 ++-- src/engine/client/input.h | 2 +- src/engine/client/sound.cpp | 2 +- src/engine/client/text.cpp | 8 ++++---- src/engine/shared/datafile.cpp | 2 +- src/engine/shared/huffman.cpp | 4 ++-- src/engine/shared/huffman.h | 2 +- src/engine/textrender.h | 2 +- src/game/client/components/chat.cpp | 4 ++-- src/game/server/gamecontroller.cpp | 2 +- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/base/system.c b/src/base/system.c index fe1c13562..d61d2dc4f 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -656,7 +656,7 @@ NETSOCKET net_udp_create(NETADDR bindaddr) { /* TODO: IPv6 support */ struct sockaddr addr; - unsigned int mode = 1; + unsigned long mode = 1; int broadcast = 1; /* create socket */ @@ -674,9 +674,9 @@ NETSOCKET net_udp_create(NETADDR bindaddr) /* set non-blocking */ #if defined(CONF_FAMILY_WINDOWS) - ioctlsocket(sock, FIONBIO, (unsigned long *)&mode); + ioctlsocket(sock, FIONBIO, &mode); #else - ioctl(sock, FIONBIO, (unsigned long *)&mode); + ioctl(sock, FIONBIO, &mode); #endif /* set boardcast */ @@ -763,21 +763,21 @@ NETSOCKET net_tcp_create(const NETADDR *a) int net_tcp_set_non_blocking(NETSOCKET sock) { - unsigned int mode = 1; + unsigned long mode = 1; #if defined(CONF_FAMILY_WINDOWS) - return ioctlsocket(sock, FIONBIO, (unsigned long *)&mode); + return ioctlsocket(sock, FIONBIO, &mode); #else - return ioctl(sock, FIONBIO, (unsigned long *)&mode); + return ioctl(sock, FIONBIO, &mode); #endif } int net_tcp_set_blocking(NETSOCKET sock) { - unsigned int mode = 0; + unsigned long mode = 0; #if defined(CONF_FAMILY_WINDOWS) - return ioctlsocket(sock, FIONBIO, (unsigned long *)&mode); + return ioctlsocket(sock, FIONBIO, &mode); #else - return ioctl(sock, FIONBIO, (unsigned long *)&mode); + return ioctl(sock, FIONBIO, &mode); #endif } diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index 32e61bbb8..c6d3f58e1 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -65,8 +65,8 @@ void CInput::MouseRelative(int *x, int *y) } } - *x = nx*Sens; - *y = ny*Sens; + *x = (int)(nx*Sens); + *y = (int)(ny*Sens); } void CInput::MouseModeAbsolute() diff --git a/src/engine/client/input.h b/src/engine/client/input.h index cc4e32e33..0b6d5b76f 100644 --- a/src/engine/client/input.h +++ b/src/engine/client/input.h @@ -8,7 +8,7 @@ class CInput : public IEngineInput int m_InputGrabbed; unsigned int m_LastRelease; - unsigned int m_ReleaseDelta; + int m_ReleaseDelta; void AddEvent(int Unicode, int Key, int Flags); diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp index df8fa66b4..b829686c8 100644 --- a/src/engine/client/sound.cpp +++ b/src/engine/client/sound.cpp @@ -121,7 +121,7 @@ static void Mix(short *pFinalOut, unsigned Frames) const int Range = 1500; // magic value, remove int dx = v->m_X - m_CenterX; int dy = v->m_Y - m_CenterY; - int Dist = sqrtf((float)dx*dx+dy*dy); // float here. nasty + int Dist = (int)sqrtf((float)dx*dx+dy*dy); // float here. nasty int p = IntAbs(dx); if(Dist < Range) { diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index 672fde60d..ef741c129 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -509,7 +509,7 @@ public: return Cursor.m_X; } - virtual float TextLineCount(void *pFontSetV, float Size, const char *pText, int LineWidth) + virtual int TextLineCount(void *pFontSetV, float Size, const char *pText, float LineWidth) { CTextCursor Cursor; SetCursor(&Cursor, 0, 0, Size, 0); @@ -551,14 +551,14 @@ public: FakeToScreenX = (Graphics()->ScreenWidth()/(ScreenX1-ScreenX0)); FakeToScreenY = (Graphics()->ScreenHeight()/(ScreenY1-ScreenY0)); - ActualX = pCursor->m_X * FakeToScreenX; - ActualY = pCursor->m_Y * FakeToScreenY; + ActualX = (int)(pCursor->m_X * FakeToScreenX); + ActualY = (int)(pCursor->m_Y * FakeToScreenY); CursorX = ActualX / FakeToScreenX; CursorY = ActualY / FakeToScreenY; // same with size - ActualSize = Size * FakeToScreenY; + ActualSize = (int)(Size * FakeToScreenY); Size = ActualSize / FakeToScreenY; // fetch pFont data diff --git a/src/engine/shared/datafile.cpp b/src/engine/shared/datafile.cpp index e7905f811..69b187eac 100644 --- a/src/engine/shared/datafile.cpp +++ b/src/engine/shared/datafile.cpp @@ -383,7 +383,7 @@ bool CDataFileReader::Close() unsigned CDataFileReader::Crc() { - if(!m_pDataFile) return -1; + if(!m_pDataFile) return 0xFFFFFFFF; return m_pDataFile->m_Crc; } diff --git a/src/engine/shared/huffman.cpp b/src/engine/shared/huffman.cpp index 8b0c1cd01..bb7aeaa8f 100644 --- a/src/engine/shared/huffman.cpp +++ b/src/engine/shared/huffman.cpp @@ -7,7 +7,7 @@ struct CHuffmanConstructNode int m_Frequency; }; -void CHuffman::Setbits_r(CNode *pNode, int Bits, int Depth) +void CHuffman::Setbits_r(CNode *pNode, int Bits, unsigned Depth) { if(pNode->m_aLeafs[1] != 0xffff) Setbits_r(&m_aNodes[pNode->m_aLeafs[1]], Bits|(1<TextEx(&Cursor, m_Input.GetString()+m_Input.GetCursorOffset(), -1); } - y -= 8; + y -= 8.0f; int i; int64 Now = time_get(); @@ -225,7 +225,7 @@ void CChat::OnRender() y -= Cursor.m_Y + Cursor.m_FontSize; // cut off if msgs waste too much space - int HeightLimit = m_Show ? 0.0f : 200.0f; + float HeightLimit = m_Show ? 0.0f : 200.0f; if(y < HeightLimit) break; diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index deb9c6e0f..997f16386 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -611,7 +611,7 @@ void IGameController::Tick() do { CPlayer *pP = 0; - int PD = aTScore[M]; + float PD = aTScore[M]; for(int i = 0; i < MAX_CLIENTS; i++) { if(!GameServer()->m_apPlayers[i] || !CanBeMovedOnBalance(i))