Fixing loads of msvc warnings (mainly size_t vs int issues).

This commit is contained in:
lotodore
2011-04-10 10:04:42 +00:00
parent 3cb3a5c3a8
commit 8bac902580
31 changed files with 304 additions and 304 deletions
+3 -3
View File
@@ -99,10 +99,10 @@ ChatCleanerManager::HandleGameChatText(unsigned gameId, unsigned playerId, const
netRequest->playerId = playerId;
OCTET_STRING_fromBuf(&netRequest->playerName,
name.c_str(),
name.length());
(int)name.length());
OCTET_STRING_fromBuf(&netRequest->chatMessage,
text.c_str(),
text.length());
(int)text.length());
SendMessageToServer(tmpChat);
}
}
@@ -135,7 +135,7 @@ ChatCleanerManager::HandleConnect(const boost::system::error_code& ec,
netInit->requestedVersion = CLEANER_PROTOCOL_VERSION;
OCTET_STRING_fromBuf(&netInit->clientSecret,
m_clientSecret.c_str(),
m_clientSecret.length());
(int)m_clientSecret.length());
SendMessageToServer(tmpInit);
m_socket->async_read_some(
boost::asio::buffer(m_recvBuf, sizeof(m_recvBuf)),
+4 -4
View File
@@ -920,7 +920,7 @@ ClientStateStartSession::InternalHandlePacket(boost::shared_ptr<ClientThread> cl
UnauthenticatedLogin_t *noauthLogin = &netInit->login.choice.unauthenticatedLogin;
OCTET_STRING_fromBuf(&noauthLogin->nickName,
context.GetPlayerName().c_str(),
context.GetPlayerName().length());
(int)context.GetPlayerName().length());
string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile());
if (!avatarFile.empty()) {
MD5Buf tmpMD5;
@@ -995,7 +995,7 @@ ClientStateWaitEnterLogin::TimerLoop(const boost::system::error_code& ec, boost:
GuestLogin_t *guestLogin = &netInit->login.choice.guestLogin;
OCTET_STRING_fromBuf(&guestLogin->nickName,
context.GetPlayerName().c_str(),
context.GetPlayerName().length());
(int)context.GetPlayerName().length());
client->GetSender().Send(context.GetSessionData(), init);
client->SetState(ClientStateWaitSession::Instance());
@@ -1013,7 +1013,7 @@ ClientStateWaitEnterLogin::TimerLoop(const boost::system::error_code& ec, boost:
string outUserData(tmpSession->AuthGetNextOutMsg());
OCTET_STRING_fromBuf(&authLogin->clientUserData,
outUserData.c_str(),
outUserData.length());
(int)outUserData.length());
string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile());
if (!avatarFile.empty()) {
MD5Buf tmpMD5;
@@ -1089,7 +1089,7 @@ ClientStateWaitAuthChallenge::InternalHandlePacket(boost::shared_ptr<ClientThrea
OCTET_STRING_fromBuf(&outResponse->clientResponse,
outUserData.c_str(),
outUserData.length());
(int)outUserData.length());
client->GetSender().Send(tmpSession, packet);
client->SetState(ClientStateWaitAuthVerify::Instance());
} else
+7 -7
View File
@@ -162,7 +162,7 @@ ClientThread::SendGameChatMessage(const std::string &msg)
ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage;
OCTET_STRING_fromBuf(&netChat->chatText,
msg.c_str(),
msg.length());
(int)msg.length());
netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypeGame;
netChat->chatRequestType.choice.chatRequestTypeGame.gameId = GetGameId();
@@ -181,7 +181,7 @@ ClientThread::SendLobbyChatMessage(const std::string &msg)
ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage;
OCTET_STRING_fromBuf(&netChat->chatText,
msg.c_str(),
msg.length());
(int)msg.length());
netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypeLobby;
@@ -199,7 +199,7 @@ ClientThread::SendPrivateChatMessage(unsigned targetPlayerId, const std::string
ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage;
OCTET_STRING_fromBuf(&netChat->chatText,
msg.c_str(),
msg.length());
(int)msg.length());
netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypePrivate;
netChat->chatRequestType.choice.chatRequestTypePrivate.targetPlayerId = targetPlayerId;
@@ -221,7 +221,7 @@ ClientThread::SendJoinFirstGame(const std::string &password, bool autoLeave)
netJoinGame->password = OCTET_STRING_new_fromBuf(
&asn_DEF_UTF8String,
password.c_str(),
password.length());
(int)password.length());
}
netJoinGame->joinGameAction.present = joinGameAction_PR_joinExistingGame;
@@ -243,7 +243,7 @@ ClientThread::SendJoinGame(unsigned gameId, const std::string &password, bool au
netJoinGame->password = OCTET_STRING_new_fromBuf(
&asn_DEF_UTF8String,
password.c_str(),
password.length());
(int)password.length());
}
netJoinGame->joinGameAction.present = joinGameAction_PR_joinExistingGame;
@@ -265,7 +265,7 @@ ClientThread::SendCreateGame(const GameData &gameData, const std::string &name,
netJoinGame->password = OCTET_STRING_new_fromBuf(
&asn_DEF_UTF8String,
password.c_str(),
password.length());
(int)password.length());
}
netJoinGame->joinGameAction.present = joinGameAction_PR_joinNewGame;
@@ -273,7 +273,7 @@ ClientThread::SendCreateGame(const GameData &gameData, const std::string &name,
NetPacket::SetGameData(gameData, &joinNew->gameInfo);
OCTET_STRING_fromBuf(&joinNew->gameInfo.gameName,
name.c_str(),
name.length());
(int)name.length());
m_ioService->post(boost::bind(&ClientThread::SendSessionPacket, shared_from_this(), packet));
}
+1 -1
View File
@@ -37,7 +37,7 @@ DownloadHelper::~DownloadHelper()
}
void
DownloadHelper::InternalInit(const string &/*url*/, const string &targetFileName, const string &/*user*/, const string &/*password*/, int /*filesize*/)
DownloadHelper::InternalInit(const string &/*url*/, const string &targetFileName, const string &/*user*/, const string &/*password*/, size_t /*filesize*/)
{
// Open target file for writing.
GetData()->targetFile = fopen(targetFileName.c_str(), "wb");
+1 -1
View File
@@ -51,7 +51,7 @@ struct IrcContext {
string channelPassword;
unsigned renameTries;
bool sendingBlocked;
unsigned sendCounter;
size_t sendCounter;
queue<string> sendQueue;
};
+1 -1
View File
@@ -35,7 +35,7 @@ NetPacket::~NetPacket()
}
boost::shared_ptr<NetPacket>
NetPacket::Create(char *data, unsigned &dataSize)
NetPacket::Create(char *data, size_t &dataSize)
{
boost::shared_ptr<NetPacket> tmpPacket;
+3 -3
View File
@@ -238,7 +238,7 @@ ServerGame::InternalStartGame()
// Set start data.
StartData startData;
startData.numberOfPlayers = playerData.size();
startData.numberOfPlayers = (int)playerData.size();
int tmpDealerPos = 0;
Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0);
@@ -793,10 +793,10 @@ ServerGame::RemoveDisconnectedPlayers()
}
}
size_t
int
ServerGame::GetCurNumberOfPlayers() const
{
return GetFullPlayerDataList().size();
return (int)GetFullPlayerDataList().size();
}
void
+4 -4
View File
@@ -408,7 +408,7 @@ ServerGameStateInit::HandleNewSession(boost::shared_ptr<ServerGame> server, boos
if (session && session->GetPlayerData()) {
const GameData &tmpGameData = server->GetGameData();
// Check the number of players.
if (server->GetCurNumberOfPlayers() >= (size_t)tmpGameData.maxNumberOfPlayers) {
if (server->GetCurNumberOfPlayers() >= tmpGameData.maxNumberOfPlayers) {
server->MoveSessionToLobby(session, NTF_NET_REMOVED_GAME_FULL);
} else {
session->GetPlayerData()->SetGameAdmin(session->GetPlayerData()->GetUniqueId() == server->GetAdminPlayerId());
@@ -426,7 +426,7 @@ ServerGameStateInit::HandleNewSession(boost::shared_ptr<ServerGame> server, boos
OCTET_STRING_fromBuf(
&joinAck->gameInfo.gameName,
server->GetName().c_str(),
server->GetName().length());
(int)server->GetName().length());
server->GetLobbyThread().GetSender().Send(session, packet);
// Send notifications for connected players to client.
@@ -447,7 +447,7 @@ ServerGameStateInit::HandleNewSession(boost::shared_ptr<ServerGame> server, boos
// Notify lobby.
server->GetLobbyThread().NotifyPlayerJoinedGame(server->GetId(), session->GetPlayerData()->GetUniqueId());
if (server->GetCurNumberOfPlayers() == (size_t)tmpGameData.maxNumberOfPlayers) {
if (server->GetCurNumberOfPlayers() == tmpGameData.maxNumberOfPlayers) {
// Automatically start the game if it is full.
RegisterAutoStartTimer(server);
}
@@ -582,7 +582,7 @@ ServerGameStateInit::InternalProcessPacket(boost::shared_ptr<ServerGame> server,
if (session->GetPlayerData()->IsGameAdmin()
&& netStartEvent->gameId == server->GetId()
&& (server->GetGameData().gameType != GAME_TYPE_RANKING // ranking games need to be full
|| server->GetGameData().maxNumberOfPlayers == (int)server->GetCurNumberOfPlayers())) {
|| server->GetGameData().maxNumberOfPlayers == server->GetCurNumberOfPlayers())) {
SendStartEvent(*server, netStartEvent->fillWithComputerPlayers);
} else { // kick players who try to start but are not allowed to
server->MoveSessionToLobby(session, NTF_NET_REMOVED_START_FAILED);
+9 -9
View File
@@ -561,7 +561,7 @@ ServerLobbyThread::SendGlobalChat(const string &message)
OCTET_STRING_fromBuf(
&netChat->chatText,
message.c_str(),
message.length());
(int)message.length());
m_sessionManager.SendToAllSessions(GetSender(), packet, SessionData::Established);
m_gameSessionManager.SendToAllSessions(GetSender(), packet, SessionData::Game);
@@ -577,7 +577,7 @@ ServerLobbyThread::SendGlobalMsgBox(const string &message)
OCTET_STRING_fromBuf(
&netDialog->notificationText,
message.c_str(),
message.length());
(int)message.length());
m_sessionManager.SendToAllSessions(GetSender(), packet, SessionData::Established);
m_gameSessionManager.SendToAllSessions(GetSender(), packet, SessionData::Game);
}
@@ -592,7 +592,7 @@ ServerLobbyThread::SendChatBotMsg(const std::string &message)
OCTET_STRING_fromBuf(
&netChat->chatText,
message.c_str(),
message.length());
(int)message.length());
m_sessionManager.SendLobbyMsgToAllSessions(GetSender(), packet, SessionData::Established);
m_gameSessionManager.SendLobbyMsgToAllSessions(GetSender(), packet, SessionData::Game);
@@ -613,7 +613,7 @@ ServerLobbyThread::SendChatBotMsg(unsigned gameId, const std::string &message)
OCTET_STRING_fromBuf(
&netChat->chatText,
message.c_str(),
message.length());
(int)message.length());
GameMap::const_iterator pos = m_gameMap.find(gameId);
if (pos != m_gameMap.end()) {
@@ -1075,7 +1075,7 @@ ServerLobbyThread::HandleNetPacketAuthClientResponse(boost::shared_ptr<SessionDa
OCTET_STRING_fromBuf(
&verification->serverVerification,
(char *)outVerification.c_str(),
outVerification.size());
(int)outVerification.size());
GetSender().Send(session, packet);
// The last message is only for server verification.
// We are done now, the user has logged in.
@@ -1193,12 +1193,12 @@ ServerLobbyThread::HandleNetPacketRetrievePlayerInfo(boost::shared_ptr<SessionDa
OCTET_STRING_fromBuf(
&data->playerName,
tmpPlayer->GetName().c_str(),
tmpPlayer->GetName().length());
(int)tmpPlayer->GetName().length());
if (!tmpPlayer->GetCountry().empty()) {
data->countryCode = OCTET_STRING_new_fromBuf(
&asn_DEF_UTF8String,
tmpPlayer->GetCountry().c_str(),
tmpPlayer->GetCountry().length());
(int)tmpPlayer->GetCountry().length());
}
if (!tmpPlayer->GetAvatarMD5().IsZero()) {
data->avatarData = (struct PlayerInfoData::avatarData *)calloc(1, sizeof(struct PlayerInfoData::avatarData));
@@ -1503,7 +1503,7 @@ ServerLobbyThread::EstablishSession(boost::shared_ptr<SessionData> session)
OCTET_STRING_fromBuf(
&netInitAck->yourSessionId,
(char *)&sessionId,
boost::uuids::uuid::static_size());
(int)boost::uuids::uuid::static_size());
netInitAck->yourPlayerId = session->GetPlayerData()->GetUniqueId();
GetSender().Send(session, ack);
@@ -2124,7 +2124,7 @@ ServerLobbyThread::CreateNetPacketGameListNew(const ServerGame &game)
OCTET_STRING_fromBuf(
&gameNew->gameInfo.gameName,
game.GetName().c_str(),
game.GetName().length());
(int)game.GetName().length());
gameNew->isPrivate = game.IsPasswordProtected();
PlayerIdList tmpList = game.GetPlayerIdList();
+1 -1
View File
@@ -286,7 +286,7 @@ unsigned
SessionManager::GetRawSessionCount()
{
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
return m_sessionMap.size();
return (unsigned)m_sessionMap.size();
}
unsigned
+1 -1
View File
@@ -43,7 +43,7 @@ TransferHelper::~TransferHelper()
}
void
TransferHelper::Init(const string &url, const string &targetFileName, const string &user, const string &password, int filesize)
TransferHelper::Init(const string &url, const string &targetFileName, const string &user, const string &password, size_t filesize)
{
// Initialise curl.
m_data->curlHandle = curl_easy_init();
+1 -1
View File
@@ -40,7 +40,7 @@ UploaderThread::~UploaderThread()
}
void
UploaderThread::QueueUpload(const string &url, const string &user, const string &pwd, const string &filename, int filesize)
UploaderThread::QueueUpload(const string &url, const string &user, const string &pwd, const string &filename, size_t filesize)
{
boost::mutex::scoped_lock lock(m_uploadQueueMutex);
m_uploadQueue.push(UploadData(url, user, pwd, filename, filesize));
+1 -1
View File
@@ -44,7 +44,7 @@ UploadHelper::~UploadHelper()
}
void
UploadHelper::InternalInit(const string &/*url*/, const string &targetFileName, const string &user, const string &password, int filesize)
UploadHelper::InternalInit(const string &/*url*/, const string &targetFileName, const string &user, const string &password, size_t filesize)
{
// Open target file for reading.
GetData()->targetFile = fopen(targetFileName.c_str(), "rb");