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
+4 -4
View File
@@ -97,10 +97,10 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
cacheDir += "cache\\"; cacheDir += "cache\\";
//create directories on first start of app //create directories on first start of app
mkdir(configFileName.c_str()); _mkdir(configFileName.c_str());
mkdir(logDir.c_str()); _mkdir(logDir.c_str());
mkdir(dataDir.c_str()); _mkdir(dataDir.c_str());
mkdir(cacheDir.c_str()); _mkdir(cacheDir.c_str());
#else #else
//define app-dir //define app-dir
+2 -2
View File
@@ -59,9 +59,9 @@ public:
bool GetHashForAvatar(const std::string &fileName, MD5Buf &md5buf) const; bool GetHashForAvatar(const std::string &fileName, MD5Buf &md5buf) const;
bool GetAvatarFileName(const MD5Buf &md5buf, std::string &fileName) const; bool GetAvatarFileName(const MD5Buf &md5buf, std::string &fileName) const;
bool HasAvatar(const MD5Buf &md5buf) const; bool HasAvatar(const MD5Buf &md5buf) const;
bool StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFileType, const unsigned char *data, unsigned size, bool upload); bool StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFileType, const unsigned char *data, size_t size, bool upload);
static bool IsValidAvatarFileType(AvatarFileType avatarFileType, const unsigned char *fileHeader, unsigned fileHeaderSize); static bool IsValidAvatarFileType(AvatarFileType avatarFileType, const unsigned char *fileHeader, size_t fileHeaderSize);
void RemoveOldAvatarCacheEntries(); void RemoveOldAvatarCacheEntries();
+2 -2
View File
@@ -341,7 +341,7 @@ AvatarManager::HasAvatar(const MD5Buf &md5buf) const
} }
bool bool
AvatarManager::StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFileType, const unsigned char *data, unsigned size, bool upload) AvatarManager::StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFileType, const unsigned char *data, size_t size, bool upload)
{ {
bool retVal = false; bool retVal = false;
string cacheDir; string cacheDir;
@@ -380,7 +380,7 @@ AvatarManager::StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFil
} }
bool bool
AvatarManager::IsValidAvatarFileType(AvatarFileType avatarFileType, const unsigned char *fileHeader, unsigned fileHeaderSize) AvatarManager::IsValidAvatarFileType(AvatarFileType avatarFileType, const unsigned char *fileHeader, size_t fileHeaderSize)
{ {
bool validType = false; bool validType = false;
+1 -1
View File
@@ -166,7 +166,7 @@ CryptHelper::MD5Sum(const std::string &fileName, MD5Buf &buf)
if (file) { if (file) {
// Calculate MD5 sum of file. // Calculate MD5 sum of file.
unsigned char *readBuf = new unsigned char[8192]; unsigned char *readBuf = new unsigned char[8192];
int numBytes; size_t numBytes;
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
MD5_CTX context; MD5_CTX context;
+1 -1
View File
@@ -67,7 +67,7 @@ private:
std::string m_clientSecret; std::string m_clientSecret;
std::string m_serverSecret; std::string m_serverSecret;
unsigned char m_recvBuf[2*MAX_CLEANER_PACKET_SIZE]; unsigned char m_recvBuf[2*MAX_CLEANER_PACKET_SIZE];
unsigned m_recvBufUsed; size_t m_recvBufUsed;
}; };
#endif #endif
+3 -3
View File
@@ -99,10 +99,10 @@ ChatCleanerManager::HandleGameChatText(unsigned gameId, unsigned playerId, const
netRequest->playerId = playerId; netRequest->playerId = playerId;
OCTET_STRING_fromBuf(&netRequest->playerName, OCTET_STRING_fromBuf(&netRequest->playerName,
name.c_str(), name.c_str(),
name.length()); (int)name.length());
OCTET_STRING_fromBuf(&netRequest->chatMessage, OCTET_STRING_fromBuf(&netRequest->chatMessage,
text.c_str(), text.c_str(),
text.length()); (int)text.length());
SendMessageToServer(tmpChat); SendMessageToServer(tmpChat);
} }
} }
@@ -135,7 +135,7 @@ ChatCleanerManager::HandleConnect(const boost::system::error_code& ec,
netInit->requestedVersion = CLEANER_PROTOCOL_VERSION; netInit->requestedVersion = CLEANER_PROTOCOL_VERSION;
OCTET_STRING_fromBuf(&netInit->clientSecret, OCTET_STRING_fromBuf(&netInit->clientSecret,
m_clientSecret.c_str(), m_clientSecret.c_str(),
m_clientSecret.length()); (int)m_clientSecret.length());
SendMessageToServer(tmpInit); SendMessageToServer(tmpInit);
m_socket->async_read_some( m_socket->async_read_some(
boost::asio::buffer(m_recvBuf, sizeof(m_recvBuf)), 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; UnauthenticatedLogin_t *noauthLogin = &netInit->login.choice.unauthenticatedLogin;
OCTET_STRING_fromBuf(&noauthLogin->nickName, OCTET_STRING_fromBuf(&noauthLogin->nickName,
context.GetPlayerName().c_str(), context.GetPlayerName().c_str(),
context.GetPlayerName().length()); (int)context.GetPlayerName().length());
string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile()); string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile());
if (!avatarFile.empty()) { if (!avatarFile.empty()) {
MD5Buf tmpMD5; MD5Buf tmpMD5;
@@ -995,7 +995,7 @@ ClientStateWaitEnterLogin::TimerLoop(const boost::system::error_code& ec, boost:
GuestLogin_t *guestLogin = &netInit->login.choice.guestLogin; GuestLogin_t *guestLogin = &netInit->login.choice.guestLogin;
OCTET_STRING_fromBuf(&guestLogin->nickName, OCTET_STRING_fromBuf(&guestLogin->nickName,
context.GetPlayerName().c_str(), context.GetPlayerName().c_str(),
context.GetPlayerName().length()); (int)context.GetPlayerName().length());
client->GetSender().Send(context.GetSessionData(), init); client->GetSender().Send(context.GetSessionData(), init);
client->SetState(ClientStateWaitSession::Instance()); client->SetState(ClientStateWaitSession::Instance());
@@ -1013,7 +1013,7 @@ ClientStateWaitEnterLogin::TimerLoop(const boost::system::error_code& ec, boost:
string outUserData(tmpSession->AuthGetNextOutMsg()); string outUserData(tmpSession->AuthGetNextOutMsg());
OCTET_STRING_fromBuf(&authLogin->clientUserData, OCTET_STRING_fromBuf(&authLogin->clientUserData,
outUserData.c_str(), outUserData.c_str(),
outUserData.length()); (int)outUserData.length());
string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile()); string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile());
if (!avatarFile.empty()) { if (!avatarFile.empty()) {
MD5Buf tmpMD5; MD5Buf tmpMD5;
@@ -1089,7 +1089,7 @@ ClientStateWaitAuthChallenge::InternalHandlePacket(boost::shared_ptr<ClientThrea
OCTET_STRING_fromBuf(&outResponse->clientResponse, OCTET_STRING_fromBuf(&outResponse->clientResponse,
outUserData.c_str(), outUserData.c_str(),
outUserData.length()); (int)outUserData.length());
client->GetSender().Send(tmpSession, packet); client->GetSender().Send(tmpSession, packet);
client->SetState(ClientStateWaitAuthVerify::Instance()); client->SetState(ClientStateWaitAuthVerify::Instance());
} else } else
+7 -7
View File
@@ -162,7 +162,7 @@ ClientThread::SendGameChatMessage(const std::string &msg)
ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage; ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage;
OCTET_STRING_fromBuf(&netChat->chatText, OCTET_STRING_fromBuf(&netChat->chatText,
msg.c_str(), msg.c_str(),
msg.length()); (int)msg.length());
netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypeGame; netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypeGame;
netChat->chatRequestType.choice.chatRequestTypeGame.gameId = GetGameId(); netChat->chatRequestType.choice.chatRequestTypeGame.gameId = GetGameId();
@@ -181,7 +181,7 @@ ClientThread::SendLobbyChatMessage(const std::string &msg)
ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage; ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage;
OCTET_STRING_fromBuf(&netChat->chatText, OCTET_STRING_fromBuf(&netChat->chatText,
msg.c_str(), msg.c_str(),
msg.length()); (int)msg.length());
netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypeLobby; netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypeLobby;
@@ -199,7 +199,7 @@ ClientThread::SendPrivateChatMessage(unsigned targetPlayerId, const std::string
ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage; ChatRequestMessage_t *netChat = &packet->GetMsg()->choice.chatRequestMessage;
OCTET_STRING_fromBuf(&netChat->chatText, OCTET_STRING_fromBuf(&netChat->chatText,
msg.c_str(), msg.c_str(),
msg.length()); (int)msg.length());
netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypePrivate; netChat->chatRequestType.present = chatRequestType_PR_chatRequestTypePrivate;
netChat->chatRequestType.choice.chatRequestTypePrivate.targetPlayerId = targetPlayerId; netChat->chatRequestType.choice.chatRequestTypePrivate.targetPlayerId = targetPlayerId;
@@ -221,7 +221,7 @@ ClientThread::SendJoinFirstGame(const std::string &password, bool autoLeave)
netJoinGame->password = OCTET_STRING_new_fromBuf( netJoinGame->password = OCTET_STRING_new_fromBuf(
&asn_DEF_UTF8String, &asn_DEF_UTF8String,
password.c_str(), password.c_str(),
password.length()); (int)password.length());
} }
netJoinGame->joinGameAction.present = joinGameAction_PR_joinExistingGame; 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( netJoinGame->password = OCTET_STRING_new_fromBuf(
&asn_DEF_UTF8String, &asn_DEF_UTF8String,
password.c_str(), password.c_str(),
password.length()); (int)password.length());
} }
netJoinGame->joinGameAction.present = joinGameAction_PR_joinExistingGame; 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( netJoinGame->password = OCTET_STRING_new_fromBuf(
&asn_DEF_UTF8String, &asn_DEF_UTF8String,
password.c_str(), password.c_str(),
password.length()); (int)password.length());
} }
netJoinGame->joinGameAction.present = joinGameAction_PR_joinNewGame; netJoinGame->joinGameAction.present = joinGameAction_PR_joinNewGame;
@@ -273,7 +273,7 @@ ClientThread::SendCreateGame(const GameData &gameData, const std::string &name,
NetPacket::SetGameData(gameData, &joinNew->gameInfo); NetPacket::SetGameData(gameData, &joinNew->gameInfo);
OCTET_STRING_fromBuf(&joinNew->gameInfo.gameName, OCTET_STRING_fromBuf(&joinNew->gameInfo.gameName,
name.c_str(), name.c_str(),
name.length()); (int)name.length());
m_ioService->post(boost::bind(&ClientThread::SendSessionPacket, shared_from_this(), packet)); m_ioService->post(boost::bind(&ClientThread::SendSessionPacket, shared_from_this(), packet));
} }
+1 -1
View File
@@ -37,7 +37,7 @@ DownloadHelper::~DownloadHelper()
} }
void 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. // Open target file for writing.
GetData()->targetFile = fopen(targetFileName.c_str(), "wb"); GetData()->targetFile = fopen(targetFileName.c_str(), "wb");
+1 -1
View File
@@ -51,7 +51,7 @@ struct IrcContext {
string channelPassword; string channelPassword;
unsigned renameTries; unsigned renameTries;
bool sendingBlocked; bool sendingBlocked;
unsigned sendCounter; size_t sendCounter;
queue<string> sendQueue; queue<string> sendQueue;
}; };
+1 -1
View File
@@ -35,7 +35,7 @@ NetPacket::~NetPacket()
} }
boost::shared_ptr<NetPacket> boost::shared_ptr<NetPacket>
NetPacket::Create(char *data, unsigned &dataSize) NetPacket::Create(char *data, size_t &dataSize)
{ {
boost::shared_ptr<NetPacket> tmpPacket; boost::shared_ptr<NetPacket> tmpPacket;
+3 -3
View File
@@ -238,7 +238,7 @@ ServerGame::InternalStartGame()
// Set start data. // Set start data.
StartData startData; StartData startData;
startData.numberOfPlayers = playerData.size(); startData.numberOfPlayers = (int)playerData.size();
int tmpDealerPos = 0; int tmpDealerPos = 0;
Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0); Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0);
@@ -793,10 +793,10 @@ ServerGame::RemoveDisconnectedPlayers()
} }
} }
size_t int
ServerGame::GetCurNumberOfPlayers() const ServerGame::GetCurNumberOfPlayers() const
{ {
return GetFullPlayerDataList().size(); return (int)GetFullPlayerDataList().size();
} }
void void
+4 -4
View File
@@ -408,7 +408,7 @@ ServerGameStateInit::HandleNewSession(boost::shared_ptr<ServerGame> server, boos
if (session && session->GetPlayerData()) { if (session && session->GetPlayerData()) {
const GameData &tmpGameData = server->GetGameData(); const GameData &tmpGameData = server->GetGameData();
// Check the number of players. // 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); server->MoveSessionToLobby(session, NTF_NET_REMOVED_GAME_FULL);
} else { } else {
session->GetPlayerData()->SetGameAdmin(session->GetPlayerData()->GetUniqueId() == server->GetAdminPlayerId()); session->GetPlayerData()->SetGameAdmin(session->GetPlayerData()->GetUniqueId() == server->GetAdminPlayerId());
@@ -426,7 +426,7 @@ ServerGameStateInit::HandleNewSession(boost::shared_ptr<ServerGame> server, boos
OCTET_STRING_fromBuf( OCTET_STRING_fromBuf(
&joinAck->gameInfo.gameName, &joinAck->gameInfo.gameName,
server->GetName().c_str(), server->GetName().c_str(),
server->GetName().length()); (int)server->GetName().length());
server->GetLobbyThread().GetSender().Send(session, packet); server->GetLobbyThread().GetSender().Send(session, packet);
// Send notifications for connected players to client. // Send notifications for connected players to client.
@@ -447,7 +447,7 @@ ServerGameStateInit::HandleNewSession(boost::shared_ptr<ServerGame> server, boos
// Notify lobby. // Notify lobby.
server->GetLobbyThread().NotifyPlayerJoinedGame(server->GetId(), session->GetPlayerData()->GetUniqueId()); 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. // Automatically start the game if it is full.
RegisterAutoStartTimer(server); RegisterAutoStartTimer(server);
} }
@@ -582,7 +582,7 @@ ServerGameStateInit::InternalProcessPacket(boost::shared_ptr<ServerGame> server,
if (session->GetPlayerData()->IsGameAdmin() if (session->GetPlayerData()->IsGameAdmin()
&& netStartEvent->gameId == server->GetId() && netStartEvent->gameId == server->GetId()
&& (server->GetGameData().gameType != GAME_TYPE_RANKING // ranking games need to be full && (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); SendStartEvent(*server, netStartEvent->fillWithComputerPlayers);
} else { // kick players who try to start but are not allowed to } else { // kick players who try to start but are not allowed to
server->MoveSessionToLobby(session, NTF_NET_REMOVED_START_FAILED); server->MoveSessionToLobby(session, NTF_NET_REMOVED_START_FAILED);
+9 -9
View File
@@ -561,7 +561,7 @@ ServerLobbyThread::SendGlobalChat(const string &message)
OCTET_STRING_fromBuf( OCTET_STRING_fromBuf(
&netChat->chatText, &netChat->chatText,
message.c_str(), message.c_str(),
message.length()); (int)message.length());
m_sessionManager.SendToAllSessions(GetSender(), packet, SessionData::Established); m_sessionManager.SendToAllSessions(GetSender(), packet, SessionData::Established);
m_gameSessionManager.SendToAllSessions(GetSender(), packet, SessionData::Game); m_gameSessionManager.SendToAllSessions(GetSender(), packet, SessionData::Game);
@@ -577,7 +577,7 @@ ServerLobbyThread::SendGlobalMsgBox(const string &message)
OCTET_STRING_fromBuf( OCTET_STRING_fromBuf(
&netDialog->notificationText, &netDialog->notificationText,
message.c_str(), message.c_str(),
message.length()); (int)message.length());
m_sessionManager.SendToAllSessions(GetSender(), packet, SessionData::Established); m_sessionManager.SendToAllSessions(GetSender(), packet, SessionData::Established);
m_gameSessionManager.SendToAllSessions(GetSender(), packet, SessionData::Game); m_gameSessionManager.SendToAllSessions(GetSender(), packet, SessionData::Game);
} }
@@ -592,7 +592,7 @@ ServerLobbyThread::SendChatBotMsg(const std::string &message)
OCTET_STRING_fromBuf( OCTET_STRING_fromBuf(
&netChat->chatText, &netChat->chatText,
message.c_str(), message.c_str(),
message.length()); (int)message.length());
m_sessionManager.SendLobbyMsgToAllSessions(GetSender(), packet, SessionData::Established); m_sessionManager.SendLobbyMsgToAllSessions(GetSender(), packet, SessionData::Established);
m_gameSessionManager.SendLobbyMsgToAllSessions(GetSender(), packet, SessionData::Game); m_gameSessionManager.SendLobbyMsgToAllSessions(GetSender(), packet, SessionData::Game);
@@ -613,7 +613,7 @@ ServerLobbyThread::SendChatBotMsg(unsigned gameId, const std::string &message)
OCTET_STRING_fromBuf( OCTET_STRING_fromBuf(
&netChat->chatText, &netChat->chatText,
message.c_str(), message.c_str(),
message.length()); (int)message.length());
GameMap::const_iterator pos = m_gameMap.find(gameId); GameMap::const_iterator pos = m_gameMap.find(gameId);
if (pos != m_gameMap.end()) { if (pos != m_gameMap.end()) {
@@ -1075,7 +1075,7 @@ ServerLobbyThread::HandleNetPacketAuthClientResponse(boost::shared_ptr<SessionDa
OCTET_STRING_fromBuf( OCTET_STRING_fromBuf(
&verification->serverVerification, &verification->serverVerification,
(char *)outVerification.c_str(), (char *)outVerification.c_str(),
outVerification.size()); (int)outVerification.size());
GetSender().Send(session, packet); GetSender().Send(session, packet);
// The last message is only for server verification. // The last message is only for server verification.
// We are done now, the user has logged in. // We are done now, the user has logged in.
@@ -1193,12 +1193,12 @@ ServerLobbyThread::HandleNetPacketRetrievePlayerInfo(boost::shared_ptr<SessionDa
OCTET_STRING_fromBuf( OCTET_STRING_fromBuf(
&data->playerName, &data->playerName,
tmpPlayer->GetName().c_str(), tmpPlayer->GetName().c_str(),
tmpPlayer->GetName().length()); (int)tmpPlayer->GetName().length());
if (!tmpPlayer->GetCountry().empty()) { if (!tmpPlayer->GetCountry().empty()) {
data->countryCode = OCTET_STRING_new_fromBuf( data->countryCode = OCTET_STRING_new_fromBuf(
&asn_DEF_UTF8String, &asn_DEF_UTF8String,
tmpPlayer->GetCountry().c_str(), tmpPlayer->GetCountry().c_str(),
tmpPlayer->GetCountry().length()); (int)tmpPlayer->GetCountry().length());
} }
if (!tmpPlayer->GetAvatarMD5().IsZero()) { if (!tmpPlayer->GetAvatarMD5().IsZero()) {
data->avatarData = (struct PlayerInfoData::avatarData *)calloc(1, sizeof(struct PlayerInfoData::avatarData)); 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( OCTET_STRING_fromBuf(
&netInitAck->yourSessionId, &netInitAck->yourSessionId,
(char *)&sessionId, (char *)&sessionId,
boost::uuids::uuid::static_size()); (int)boost::uuids::uuid::static_size());
netInitAck->yourPlayerId = session->GetPlayerData()->GetUniqueId(); netInitAck->yourPlayerId = session->GetPlayerData()->GetUniqueId();
GetSender().Send(session, ack); GetSender().Send(session, ack);
@@ -2124,7 +2124,7 @@ ServerLobbyThread::CreateNetPacketGameListNew(const ServerGame &game)
OCTET_STRING_fromBuf( OCTET_STRING_fromBuf(
&gameNew->gameInfo.gameName, &gameNew->gameInfo.gameName,
game.GetName().c_str(), game.GetName().c_str(),
game.GetName().length()); (int)game.GetName().length());
gameNew->isPrivate = game.IsPasswordProtected(); gameNew->isPrivate = game.IsPasswordProtected();
PlayerIdList tmpList = game.GetPlayerIdList(); PlayerIdList tmpList = game.GetPlayerIdList();
+1 -1
View File
@@ -286,7 +286,7 @@ unsigned
SessionManager::GetRawSessionCount() SessionManager::GetRawSessionCount()
{ {
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex); boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
return m_sessionMap.size(); return (unsigned)m_sessionMap.size();
} }
unsigned unsigned
+1 -1
View File
@@ -43,7 +43,7 @@ TransferHelper::~TransferHelper()
} }
void 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. // Initialise curl.
m_data->curlHandle = curl_easy_init(); m_data->curlHandle = curl_easy_init();
+1 -1
View File
@@ -40,7 +40,7 @@ UploaderThread::~UploaderThread()
} }
void 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); boost::mutex::scoped_lock lock(m_uploadQueueMutex);
m_uploadQueue.push(UploadData(url, user, pwd, filename, filesize)); m_uploadQueue.push(UploadData(url, user, pwd, filename, filesize));
+1 -1
View File
@@ -44,7 +44,7 @@ UploadHelper::~UploadHelper()
} }
void 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. // Open target file for reading.
GetData()->targetFile = fopen(targetFileName.c_str(), "rb"); GetData()->targetFile = fopen(targetFileName.c_str(), "rb");
+1 -1
View File
@@ -32,7 +32,7 @@ public:
protected: protected:
virtual void InternalInit(const std::string &url, const std::string &targetFileName, virtual void InternalInit(const std::string &url, const std::string &targetFileName,
const std::string &user, const std::string &password, int filesize); const std::string &user, const std::string &password, size_t filesize);
}; };
#endif #endif
+1 -1
View File
@@ -51,7 +51,7 @@ public:
NetPacket(MemAllocType alloc = NoAlloc); NetPacket(MemAllocType alloc = NoAlloc);
~NetPacket(); ~NetPacket();
static boost::shared_ptr<NetPacket> Create(char *data, unsigned &dataSize); static boost::shared_ptr<NetPacket> Create(char *data, size_t &dataSize);
const PokerTHMessage_t *GetMsg() const { const PokerTHMessage_t *GetMsg() const {
return m_msg; return m_msg;
+1 -1
View File
@@ -46,7 +46,7 @@ protected:
private: private:
NetPacketList receivedPackets; NetPacketList receivedPackets;
char recvBuf[RECV_BUF_SIZE]; char recvBuf[RECV_BUF_SIZE];
unsigned recvBufUsed; size_t recvBufUsed;
}; };
#endif #endif
+1 -1
View File
@@ -38,7 +38,7 @@ public:
~SendBuffer(); ~SendBuffer();
inline size_t GetSendBufLeft() const { inline size_t GetSendBufLeft() const {
int bytesLeft = sendBufAllocated - sendBufUsed; int bytesLeft = (int)(sendBufAllocated - sendBufUsed);
return bytesLeft < 0 ? (size_t)0 : (size_t)bytesLeft; return bytesLeft < 0 ? (size_t)0 : (size_t)bytesLeft;
} }
+1 -1
View File
@@ -133,7 +133,7 @@ protected:
void MoveSessionToLobby(boost::shared_ptr<SessionData> session, int reason); void MoveSessionToLobby(boost::shared_ptr<SessionData> session, int reason);
void RemoveDisconnectedPlayers(); void RemoveDisconnectedPlayers();
size_t GetCurNumberOfPlayers() const; int GetCurNumberOfPlayers() const;
void AssignPlayerNumbers(PlayerDataList &playerList); void AssignPlayerNumbers(PlayerDataList &playerList);
bool IsValidPlayer(unsigned playerId) const; bool IsValidPlayer(unsigned playerId) const;
+2 -2
View File
@@ -36,7 +36,7 @@ public:
// Set the parameters. Does not do any error checking. // Set the parameters. Does not do any error checking.
// Throws an exception on failure. // Throws an exception on failure.
void Init(const std::string &url, const std::string &targetFileName, void Init(const std::string &url, const std::string &targetFileName,
const std::string &user = "", const std::string &password = "", int filesize = 0); const std::string &user = "", const std::string &password = "", size_t filesize = 0);
// Returns true when done, false should call again. // Returns true when done, false should call again.
// Throws an exception on error. // Throws an exception on error.
@@ -49,7 +49,7 @@ protected:
boost::shared_ptr<TransferData> GetData(); boost::shared_ptr<TransferData> GetData();
virtual void InternalInit(const std::string &url, const std::string &targetFileName, virtual void InternalInit(const std::string &url, const std::string &targetFileName,
const std::string &user, const std::string &password, int filesize) = 0; const std::string &user, const std::string &password, size_t filesize) = 0;
private: private:
+3 -3
View File
@@ -36,19 +36,19 @@ public:
UploaderThread(); UploaderThread();
virtual ~UploaderThread(); virtual ~UploaderThread();
void QueueUpload(const std::string &url, const std::string &user, const std::string &pwd, const std::string &filename, int filesize); void QueueUpload(const std::string &url, const std::string &user, const std::string &pwd, const std::string &filename, size_t filesize);
protected: protected:
struct UploadData { struct UploadData {
UploadData() : filesize(0) {} UploadData() : filesize(0) {}
UploadData(const std::string &a, const std::string &u, const std::string &p, const std::string &f, int s) UploadData(const std::string &a, const std::string &u, const std::string &p, const std::string &f, size_t s)
: address(a), user(u), pwd(p), filename(f), filesize(s) {} : address(a), user(u), pwd(p), filename(f), filesize(s) {}
std::string address; std::string address;
std::string user; std::string user;
std::string pwd; std::string pwd;
std::string filename; std::string filename;
int filesize; size_t filesize;
}; };
typedef std::queue<UploadData> UploadDataQueue; typedef std::queue<UploadData> UploadDataQueue;
+1 -1
View File
@@ -32,7 +32,7 @@ public:
protected: protected:
virtual void InternalInit(const std::string &url, const std::string &targetFileName, virtual void InternalInit(const std::string &url, const std::string &targetFileName,
const std::string &user, const std::string &password, int filesize); const std::string &user, const std::string &password, size_t filesize);
}; };
#endif #endif
+1 -1
View File
@@ -54,7 +54,7 @@ struct AvatarFile {
AvatarFile() : fileType(AVATAR_FILE_TYPE_UNKNOWN), reportedSize(0) {} AvatarFile() : fileType(AVATAR_FILE_TYPE_UNKNOWN), reportedSize(0) {}
std::vector<unsigned char> fileData; std::vector<unsigned char> fileData;
AvatarFileType fileType; AvatarFileType fileType;
unsigned reportedSize; size_t reportedSize;
}; };
struct PlayerInfo { struct PlayerInfo {
+1 -1
View File
@@ -149,7 +149,7 @@ main(int argc, char *argv[])
{ {
ofstream pidStream(pidFile.c_str(), ios_base::out | ios_base::trunc); ofstream pidStream(pidFile.c_str(), ios_base::out | ios_base::trunc);
if (!pidStream.fail()) if (!pidStream.fail())
pidStream << getpid(); pidStream << _getpid();
else else
LOG_ERROR("Could not create process id file \"" << pidFile << "\"!"); LOG_ERROR("Could not create process id file \"" << pidFile << "\"!");
} }