Fixed a bunch of compiler warnings.

This commit is contained in:
lotodore
2007-09-30 18:50:46 +00:00
parent 0e11228a95
commit 0d1650e9a9
9 changed files with 79 additions and 77 deletions
+13 -11
View File
@@ -31,11 +31,12 @@ using namespace std;
struct IrcContext
{
IrcContext(IrcThread &t) : ircThread(t), session(NULL), serverPort(0) {}
IrcContext(IrcThread &t) : ircThread(t), session(NULL), serverPort(0), useIPv6(false) {}
IrcThread &ircThread;
irc_session_t *session;
string serverAddress;
unsigned serverPort;
bool useIPv6;
string nick;
string channel;
};
@@ -87,7 +88,7 @@ void irc_handle_server_error(irc_session_t *session, unsigned irc_error_code)
}
void
irc_event_connect(irc_session_t *session, const char *irc_event, const char *origin, const char **params, unsigned count)
irc_event_connect(irc_session_t *session, const char */*irc_event*/, const char *origin, const char **/*params*/, unsigned /*count*/)
{
IrcContext *context = (IrcContext *) irc_get_ctx(session);
@@ -96,7 +97,7 @@ irc_event_connect(irc_session_t *session, const char *irc_event, const char *ori
}
void
irc_event_join(irc_session_t *session, const char *irc_event, const char *origin, const char **params, unsigned count)
irc_event_join(irc_session_t *session, const char */*irc_event*/, const char *origin, const char **/*params*/, unsigned /*count*/)
{
// someone joined the channel.
IrcContext *context = (IrcContext *) irc_get_ctx(session);
@@ -108,12 +109,12 @@ irc_event_join(irc_session_t *session, const char *irc_event, const char *origin
}
void
irc_event_nick(irc_session_t *session, const char *irc_event, const char *origin, const char **params, unsigned count)
irc_event_nick(irc_session_t *session, const char */*irc_event*/, const char *origin, const char **params, unsigned count)
{
// someone changed his/her nick
IrcContext *context = (IrcContext *) irc_get_ctx(session);
if (context->nick != params[0]) // only act if this was not an auto-rename
if (count && context->nick != params[0]) // only act if this was not an auto-rename
{
if (context->nick == origin)
context->nick = params[0];
@@ -122,7 +123,7 @@ irc_event_nick(irc_session_t *session, const char *irc_event, const char *origin
}
void
irc_event_kick(irc_session_t *session, const char *irc_event, const char *origin, const char **params, unsigned count)
irc_event_kick(irc_session_t *session, const char */*irc_event*/, const char *origin, const char **params, unsigned count)
{
// someone got kicked
IrcContext *context = (IrcContext *) irc_get_ctx(session);
@@ -140,7 +141,7 @@ irc_event_kick(irc_session_t *session, const char *irc_event, const char *origin
}
void
irc_event_leave(irc_session_t *session, const char *irc_event, const char *origin, const char **params, unsigned count)
irc_event_leave(irc_session_t *session, const char */*irc_event*/, const char *origin, const char **/*params*/, unsigned /*count*/)
{
// someone left the channel.
IrcContext *context = (IrcContext *) irc_get_ctx(session);
@@ -149,20 +150,20 @@ irc_event_leave(irc_session_t *session, const char *irc_event, const char *origi
}
void
irc_event_channel(irc_session_t *session, const char *irc_event, const char *origin, const char **params, unsigned count)
irc_event_channel(irc_session_t *session, const char */*irc_event*/, const char *origin, const char **params, unsigned count)
{
IrcContext *context = (IrcContext *) irc_get_ctx(session);
if (context->channel == params[0]) // check whether this message is for our channel
if (count >= 2 && context->channel == params[0]) // check whether this message is for our channel
{
// Signal the message (if any) to GUI.
if (params[1] && *params[1] != 0)
if (*params[1] != 0)
context->ircThread.GetCallback().SignalIrcChatMsg(origin, params[1]);
}
}
void
irc_event_numeric(irc_session_t * session, unsigned irc_event, const char *origin, const char **params, unsigned count)
irc_event_numeric(irc_session_t * session, unsigned irc_event, const char */*origin*/, const char **params, unsigned count)
{
switch (irc_event)
{
@@ -254,6 +255,7 @@ IrcThread::Init(const std::string &serverAddress, unsigned serverPort, bool ipv6
context.serverAddress = serverAddress;
context.serverPort = serverPort;
context.useIPv6 = ipv6;
context.nick = nick;
context.channel = channel;
+6 -6
View File
@@ -862,7 +862,7 @@ ServerGameStateComputerAction::Process(ServerGameThread &server)
}
int
ServerGameStateComputerAction::InternalProcess(ServerGameThread &server, SessionWrapper session, boost::shared_ptr<NetPacket> packet)
ServerGameStateComputerAction::InternalProcess(ServerGameThread &/*server*/, SessionWrapper /*session*/, boost::shared_ptr<NetPacket> /*packet*/)
{
return MSG_SOCK_INTERNAL_PENDING;
}
@@ -917,7 +917,7 @@ ServerGameStateDealCardsDelay::Process(ServerGameThread &server)
}
int
ServerGameStateDealCardsDelay::InternalProcess(ServerGameThread &server, SessionWrapper session, boost::shared_ptr<NetPacket> packet)
ServerGameStateDealCardsDelay::InternalProcess(ServerGameThread &/*server*/, SessionWrapper /*session*/, boost::shared_ptr<NetPacket> /*packet*/)
{
return MSG_SOCK_INTERNAL_PENDING;
}
@@ -961,7 +961,7 @@ ServerGameStateShowCardsDelay::Process(ServerGameThread &server)
}
int
ServerGameStateShowCardsDelay::InternalProcess(ServerGameThread &server, SessionWrapper session, boost::shared_ptr<NetPacket> packet)
ServerGameStateShowCardsDelay::InternalProcess(ServerGameThread &/*server*/, SessionWrapper /*session*/, boost::shared_ptr<NetPacket> /*packet*/)
{
return MSG_SOCK_INTERNAL_PENDING;
}
@@ -999,7 +999,7 @@ ServerGameStateNextHandDelay::Process(ServerGameThread &server)
}
int
ServerGameStateNextHandDelay::InternalProcess(ServerGameThread &server, SessionWrapper session, boost::shared_ptr<NetPacket> packet)
ServerGameStateNextHandDelay::InternalProcess(ServerGameThread &/*server*/, SessionWrapper /*session*/, boost::shared_ptr<NetPacket> /*packet*/)
{
return MSG_SOCK_INTERNAL_PENDING;
}
@@ -1060,7 +1060,7 @@ ServerGameStateNextGameDelay::Process(ServerGameThread &server)
}
int
ServerGameStateNextGameDelay::InternalProcess(ServerGameThread &server, SessionWrapper session, boost::shared_ptr<NetPacket> packet)
ServerGameStateNextGameDelay::InternalProcess(ServerGameThread &/*server*/, SessionWrapper /*session*/, boost::shared_ptr<NetPacket> /*packet*/)
{
return MSG_SOCK_INTERNAL_PENDING;
}
@@ -1087,7 +1087,7 @@ ServerGameStateFinal::~ServerGameStateFinal()
}
int
ServerGameStateFinal::InternalProcess(ServerGameThread &server, SessionWrapper session, boost::shared_ptr<NetPacket> packet)
ServerGameStateFinal::InternalProcess(ServerGameThread &/*server*/, SessionWrapper /*session*/, boost::shared_ptr<NetPacket> /*packet*/)
{
return MSG_SOCK_INTERNAL_PENDING;
}
+1 -1
View File
@@ -40,7 +40,7 @@ public:
ServerSenderCallback(ServerGameThread &server) : m_server(server) {}
virtual ~ServerSenderCallback() {}
virtual void SignalNetError(SOCKET sock, int errorID, int osErrorID)
virtual void SignalNetError(SOCKET /*sock*/, int /*errorID*/, int /*osErrorID*/)
{
// We just ignore send errors for now, on server side.
// A serious send error should trigger a read error or a read
+1 -1
View File
@@ -42,7 +42,7 @@ public:
ServerSenderCallback(ServerLobbyThread &server) : m_server(server) {}
virtual ~ServerSenderCallback() {}
virtual void SignalNetError(SOCKET sock, int errorID, int osErrorID)
virtual void SignalNetError(SOCKET /*sock*/, int /*errorID*/, int /*osErrorID*/)
{
// We just ignore send errors for now, on server side.
// A serious send error should trigger a read error or a read
+41 -41
View File
@@ -1,42 +1,42 @@
/***************************************************************************
* Copyright (C) 2007 by Lothar May *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef _WIN32
#error This source code is not for Win32.
#endif
#include <net/socket_helper.h>
bool
socket_string_to_addr(const char *str, int addrFamily, struct sockaddr * addr, int addrLen)
{
if (addrFamily == AF_INET)
return (inet_pton(addrFamily, str, &((struct sockaddr_in *)addr)->sin_addr) == 1);
else if (addrFamily == AF_INET6)
return (inet_pton(addrFamily, str, &((struct sockaddr_in6 *)addr)->sin6_addr) == 1);
else
return false;
}
bool
socket_resolve(const char *str, const char *port, int addrFamily, int sockType, int protocol, struct sockaddr *addr, int addrLen)
{
/***************************************************************************
* Copyright (C) 2007 by Lothar May *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef _WIN32
#error This source code is not for Win32.
#endif
#include <net/socket_helper.h>
bool
socket_string_to_addr(const char *str, int addrFamily, struct sockaddr *addr, int /*addrLen*/)
{
if (addrFamily == AF_INET)
return (inet_pton(addrFamily, str, &((struct sockaddr_in *)addr)->sin_addr) == 1);
else if (addrFamily == AF_INET6)
return (inet_pton(addrFamily, str, &((struct sockaddr_in6 *)addr)->sin6_addr) == 1);
else
return false;
}
bool
socket_resolve(const char *str, const char *port, int addrFamily, int sockType, int protocol, struct sockaddr *addr, int addrLen)
{
bool retVal = false;
if (str && *str != 0)
@@ -64,5 +64,5 @@ socket_resolve(const char *str, const char *port, int addrFamily, int sockType,
}
}
return retVal;
}
}