fix compile on linux

fixed some warnings.
(gcc seems not to like char variables as array subscript)



git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3330 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-06-05 07:36:55 +00:00
parent 004dfffff0
commit 4e98655aa3
5 changed files with 22 additions and 22 deletions

View File

@ -151,7 +151,7 @@ void ClientSide::OnClientData(unsigned char data)
delete[] buffer;
}
void ServerSide::OnServerData(char sock, unsigned char data)
void ServerSide::OnServerData(int sock, unsigned char data)
{
size_t recv_size;
char *buffer = NULL;
@ -193,7 +193,7 @@ void ServerSide::OnServerData(char sock, unsigned char data)
sent = 0x30;
// Send to all
for (char i=0; i < m_numplayers ; i++)
for (int i=0; i < m_numplayers ; i++)
{
if (i == sock)
continue;
@ -222,11 +222,11 @@ void ServerSide::OnServerData(char sock, unsigned char data)
wxT("WARNING : Player %s does Not have this Game !\n"), m_client[sock].nick.c_str());
four_bytes = (int)error_str.size();
for (char i=0; i < 2; i++)
for (int i=0; i < 2; i++)
Event->AppendText(error_str);
// Send to all
for (char i=0; i < m_numplayers ; i++)
for (int i=0; i < m_numplayers ; i++)
{
if (i == sock)
continue;
@ -253,7 +253,7 @@ void ServerSide::OnServerData(char sock, unsigned char data)
four_bytes = (int)buffer_str.size();
// Send to all
for (char i=0; i < m_numplayers ; i++)
for (int i=0; i < m_numplayers ; i++)
{
m_client[i].socket.Send((const char*)&data, 1);

View File

@ -56,7 +56,7 @@ void NetPlay::OnNetEvent(wxCommandEvent& event)
m_numClients--;
AppendText( wxString::Format(wxT("ERROR : Network Error !\n"
"*Player : %s has been dropped from the game.\n\n"),
event.GetString().mb_str()) );
(const char *)event.GetString().mb_str()) );
}
}
break;
@ -518,7 +518,7 @@ bool ClientSide::isNewPadData(u32 *netValues, bool current, bool isVersus)
}
bool ServerSide::isNewPadData(u32 *netValues, bool current, char client)
bool ServerSide::isNewPadData(u32 *netValues, bool current, int client)
{
#ifdef USE_TCP
if (current)

View File

@ -210,7 +210,7 @@ void *ServerSide::Entry()
m_socket.Close();
// Delete the Thread and close clients sockets
for (char i=0; i < m_numplayers ; i++)
for (int i=0; i < m_numplayers ; i++)
m_client[i].socket.Close();
break;
@ -314,7 +314,7 @@ bool ServerSide::SyncValues(unsigned char socketnb, sf::IPAddress Address)
return true;
}
void ServerSide::Write(char socknb, const char *data, size_t size, long *ping)
void ServerSide::Write(int socknb, const char *data, size_t size, long *ping)
{
wxCriticalSectionLocker lock(m_CriticalSection);
@ -345,7 +345,7 @@ void ServerSide::Write(char socknb, const char *data, size_t size, long *ping)
m_client[socknb].socket.Send(data, size);
}
void ServerSide::WriteUDP(char socknb, const char *data, size_t size)
void ServerSide::WriteUDP(int socknb, const char *data, size_t size)
{
wxCriticalSectionLocker lock(m_CriticalSection);

View File

@ -70,12 +70,12 @@ void NetPlay::OnJoin(wxCommandEvent& WXUNUSED(event))
std::string port_str = m_address.substr(m_address.find(':') + 1);
TryParseUInt(port_str, (u32*)&server_port); // Server port
TryParseUInt(m_SetPort->GetValue().mb_str(), (u32*)&m_port); // User port
TryParseUInt((const char *)m_SetPort->GetValue().mb_str(), (u32*)&m_port); // User port
if (m_nick.size() > 255)
m_nick = m_nick.substr(0 , 255);
SetTitle(_("Net Play : Connecting to Host..."));
SetTitle(wxT("Net Play : Connecting to Host..."));
// Create the client socket
sf::SocketTCP sock_client;
@ -96,14 +96,14 @@ void NetPlay::OnJoin(wxCommandEvent& WXUNUSED(event))
}
else
{
SetTitle(_("Net Play"));
SetTitle(wxT("Net Play"));
PanicAlert("Can't Bind UDP socket on the specified Port: %d ! \n"
"Make sure port is forwarded and not in use !", m_port);
}
}
else
{
SetTitle(_("Net Play"));
SetTitle(wxT("Net Play"));
PanicAlert("Can't connect to the specified IP Address ! \nMake sure Hosting port is forwarded !");
}
}
@ -252,9 +252,9 @@ void NetPlay::DrawGUI()
ConfigIni.Get("Netplay", "UsedPort", (int*)&m_port, 12345);
ConfigIni.Get("Netplay", "LastIP", &m_address, "127.0.0.1:54321");
m_SetNick->SetValue(_(m_nick.c_str()));
m_SetNick->SetValue(wxString::FromAscii(m_nick.c_str()));
m_SetPort->SetValue(wxString::Format(wxT("%d"), m_port));
m_ConAddr->SetValue(_(m_address.c_str()));
m_ConAddr->SetValue(wxString::FromAscii(m_address.c_str()));
}
Center(); Show();
@ -265,7 +265,7 @@ void NetPlay::DrawNetWindow()
// Remove everything from the precedent GUI :D
DestroyChildren();
SetTitle(_("Net Play : Connection Window"));
SetTitle(wxT("Net Play : Connection Window"));
wxPanel *panel = new wxPanel(this);
wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
@ -322,7 +322,7 @@ void NetPlay::DrawNetWindow()
m_wtfismyip = new wxButton(panel, ID_BUTTON_GETIP, wxT("What is my IP"));
m_ChangeGame = new wxButton(panel, ID_CHANGEGAME, wxT("Change Game"));
wxStaticBoxSizer* sBottom3 = new wxStaticBoxSizer(wxVERTICAL, panel, _("Host"));
wxStaticBoxSizer* sBottom3 = new wxStaticBoxSizer(wxVERTICAL, panel, wxT("Host"));
sBottom3->Add(m_ChangeGame, 0, wxALL | wxEXPAND, 5);
sBottom3->Add(m_wtfismyip, 0, wxALL | wxEXPAND, 5);

View File

@ -83,15 +83,15 @@ class ServerSide : public wxThread
virtual void *Entry();
void Write(char socknb, const char *data, size_t size, long *ping=NULL);
void WriteUDP(char socknb, const char *data, size_t size);
bool isNewPadData(u32 *netValues, bool current, char client=0);
void Write(int socknb, const char *data, size_t size, long *ping=NULL);
void WriteUDP(int socknb, const char *data, size_t size);
bool isNewPadData(u32 *netValues, bool current, int client=0);
private:
bool SyncValues(unsigned char, sf::IPAddress);
bool RecvT(sf::SocketUDP Socket, char * Data, size_t Max, size_t& Recvd, float Time = 0);
char GetSocket(sf::SocketTCP Socket);
void OnServerData(char sock, unsigned char data);
void OnServerData(int sock, unsigned char data);
void IsEveryoneReady();
NetPlay *m_netptr;