added fixes for compiler errors and warnings by sworddragon

This commit is contained in:
oy 2010-08-16 02:21:18 +02:00
parent 4c2dcc4f2b
commit abc84ac0b0
11 changed files with 25 additions and 25 deletions

View file

@ -654,7 +654,7 @@ NETSOCKET net_udp_create(NETADDR bindaddr)
{ {
/* TODO: IPv6 support */ /* TODO: IPv6 support */
struct sockaddr addr; struct sockaddr addr;
unsigned int mode = 1; unsigned long mode = 1;
int broadcast = 1; int broadcast = 1;
/* create socket */ /* create socket */
@ -672,9 +672,9 @@ NETSOCKET net_udp_create(NETADDR bindaddr)
/* set non-blocking */ /* set non-blocking */
#if defined(CONF_FAMILY_WINDOWS) #if defined(CONF_FAMILY_WINDOWS)
ioctlsocket(sock, FIONBIO, (unsigned long *)&mode); ioctlsocket(sock, FIONBIO, &mode);
#else #else
ioctl(sock, FIONBIO, (unsigned long *)&mode); ioctl(sock, FIONBIO, &mode);
#endif #endif
/* set boardcast */ /* set boardcast */
@ -755,21 +755,21 @@ NETSOCKET net_tcp_create(const NETADDR *a)
int net_tcp_set_non_blocking(NETSOCKET sock) int net_tcp_set_non_blocking(NETSOCKET sock)
{ {
unsigned int mode = 1; unsigned long mode = 1;
#if defined(CONF_FAMILY_WINDOWS) #if defined(CONF_FAMILY_WINDOWS)
return ioctlsocket(sock, FIONBIO, (unsigned long *)&mode); return ioctlsocket(sock, FIONBIO, &mode);
#else #else
return ioctl(sock, FIONBIO, (unsigned long *)&mode); return ioctl(sock, FIONBIO, &mode);
#endif #endif
} }
int net_tcp_set_blocking(NETSOCKET sock) int net_tcp_set_blocking(NETSOCKET sock)
{ {
unsigned int mode = 0; unsigned long mode = 0;
#if defined(CONF_FAMILY_WINDOWS) #if defined(CONF_FAMILY_WINDOWS)
return ioctlsocket(sock, FIONBIO, (unsigned long *)&mode); return ioctlsocket(sock, FIONBIO, &mode);
#else #else
return ioctl(sock, FIONBIO, (unsigned long *)&mode); return ioctl(sock, FIONBIO, &mode);
#endif #endif
} }

View file

@ -65,8 +65,8 @@ void CInput::MouseRelative(int *x, int *y)
} }
} }
*x = nx*Sens; *x = (int)(nx*Sens);
*y = ny*Sens; *y = (int)(ny*Sens);
} }
void CInput::MouseModeAbsolute() void CInput::MouseModeAbsolute()

View file

@ -8,7 +8,7 @@ class CInput : public IEngineInput
int m_InputGrabbed; int m_InputGrabbed;
unsigned int m_LastRelease; unsigned int m_LastRelease;
unsigned int m_ReleaseDelta; int m_ReleaseDelta;
void AddEvent(int Unicode, int Key, int Flags); void AddEvent(int Unicode, int Key, int Flags);

View file

@ -121,7 +121,7 @@ static void Mix(short *pFinalOut, unsigned Frames)
const int Range = 1500; // magic value, remove const int Range = 1500; // magic value, remove
int dx = v->m_X - m_CenterX; int dx = v->m_X - m_CenterX;
int dy = v->m_Y - m_CenterY; 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); int p = IntAbs(dx);
if(Dist < Range) if(Dist < Range)
{ {

View file

@ -509,7 +509,7 @@ public:
return Cursor.m_X; 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; CTextCursor Cursor;
SetCursor(&Cursor, 0, 0, Size, 0); SetCursor(&Cursor, 0, 0, Size, 0);
@ -551,14 +551,14 @@ public:
FakeToScreenX = (Graphics()->ScreenWidth()/(ScreenX1-ScreenX0)); FakeToScreenX = (Graphics()->ScreenWidth()/(ScreenX1-ScreenX0));
FakeToScreenY = (Graphics()->ScreenHeight()/(ScreenY1-ScreenY0)); FakeToScreenY = (Graphics()->ScreenHeight()/(ScreenY1-ScreenY0));
ActualX = pCursor->m_X * FakeToScreenX; ActualX = (int)(pCursor->m_X * FakeToScreenX);
ActualY = pCursor->m_Y * FakeToScreenY; ActualY = (int)(pCursor->m_Y * FakeToScreenY);
CursorX = ActualX / FakeToScreenX; CursorX = ActualX / FakeToScreenX;
CursorY = ActualY / FakeToScreenY; CursorY = ActualY / FakeToScreenY;
// same with size // same with size
ActualSize = Size * FakeToScreenY; ActualSize = (int)(Size * FakeToScreenY);
Size = ActualSize / FakeToScreenY; Size = ActualSize / FakeToScreenY;
// fetch pFont data // fetch pFont data

View file

@ -383,7 +383,7 @@ bool CDataFileReader::Close()
unsigned CDataFileReader::Crc() unsigned CDataFileReader::Crc()
{ {
if(!m_pDataFile) return -1; if(!m_pDataFile) return 0xFFFFFFFF;
return m_pDataFile->m_Crc; return m_pDataFile->m_Crc;
} }

View file

@ -7,7 +7,7 @@ struct CHuffmanConstructNode
int m_Frequency; 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) if(pNode->m_aLeafs[1] != 0xffff)
Setbits_r(&m_aNodes[pNode->m_aLeafs[1]], Bits|(1<<Depth), Depth+1); Setbits_r(&m_aNodes[pNode->m_aLeafs[1]], Bits|(1<<Depth), Depth+1);
@ -52,7 +52,7 @@ void CHuffman::ConstructTree(const unsigned *pFrequencies)
// add the symbols // add the symbols
for(int i = 0; i < HUFFMAN_MAX_SYMBOLS; i++) for(int i = 0; i < HUFFMAN_MAX_SYMBOLS; i++)
{ {
m_aNodes[i].m_NumBits = -1; m_aNodes[i].m_NumBits = 0xFFFFFFFF;
m_aNodes[i].m_Symbol = i; m_aNodes[i].m_Symbol = i;
m_aNodes[i].m_aLeafs[0] = -1; m_aNodes[i].m_aLeafs[0] = -1;
m_aNodes[i].m_aLeafs[1] = -1; m_aNodes[i].m_aLeafs[1] = -1;

View file

@ -35,7 +35,7 @@ class CHuffman
CNode *m_pStartNode; CNode *m_pStartNode;
int m_NumNodes; int m_NumNodes;
void Setbits_r(CNode *pNode, int Bits, int Depth); void Setbits_r(CNode *pNode, int Bits, unsigned Depth);
void ConstructTree(const unsigned *pFrequencies); void ConstructTree(const unsigned *pFrequencies);
public: public:

View file

@ -45,7 +45,7 @@ public:
virtual void TextColor(float r, float g, float b, float a) = 0; virtual void TextColor(float r, float g, float b, float a) = 0;
virtual void Text(void *pFontSetV, float x, float y, float Size, const char *pText, int MaxWidth) = 0; virtual void Text(void *pFontSetV, float x, float y, float Size, const char *pText, int MaxWidth) = 0;
virtual float TextWidth(void *pFontSetV, float Size, const char *pText, int Length) = 0; virtual float TextWidth(void *pFontSetV, float Size, const char *pText, int Length) = 0;
virtual float TextLineCount(void *pFontSetV, float Size, const char *pText, int LineWidth) = 0; virtual int TextLineCount(void *pFontSetV, float Size, const char *pText, float LineWidth) = 0;
}; };
class IEngineTextRender : public ITextRender class IEngineTextRender : public ITextRender

View file

@ -203,7 +203,7 @@ void CChat::OnRender()
TextRender()->TextEx(&Cursor, m_Input.GetString()+m_Input.GetCursorOffset(), -1); TextRender()->TextEx(&Cursor, m_Input.GetString()+m_Input.GetCursorOffset(), -1);
} }
y -= 8; y -= 8.0f;
int i; int i;
int64 Now = time_get(); int64 Now = time_get();
@ -225,7 +225,7 @@ void CChat::OnRender()
y -= Cursor.m_Y + Cursor.m_FontSize; y -= Cursor.m_Y + Cursor.m_FontSize;
// cut off if msgs waste too much space // 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) if(y < HeightLimit)
break; break;

View file

@ -423,7 +423,7 @@ void IGameController::Tick()
do do
{ {
CPlayer *pP = 0; CPlayer *pP = 0;
int PD = aTScore[M]; float PD = aTScore[M];
for(int i = 0; i < MAX_CLIENTS; i++) for(int i = 0; i < MAX_CLIENTS; i++)
{ {
if(!GameServer()->m_apPlayers[i] || !CanBeMovedOnBalance(i)) if(!GameServer()->m_apPlayers[i] || !CanBeMovedOnBalance(i))