A new user interface for you! Read more...

File fix-newer-gcc.patch of Package pokerth

diff -Nur PokerTH-1.1.1-src/src/core/common/avatarmanager.cpp new/src/core/common/avatarmanager.cpp
--- PokerTH-1.1.1-src/src/core/common/avatarmanager.cpp	2014-01-10 22:18:20.759643128 +0100
+++ new/src/core/common/avatarmanager.cpp	2016-05-24 13:15:23.920242075 +0200
@@ -57,15 +57,14 @@
 #define MAX_HEADER_SIZE PNG_HEADER_SIZE
 
 
-using namespace std;
 using namespace boost::filesystem;
 
 struct AvatarFileState {
-	ifstream		inputStream;
+	std::ifstream		inputStream;
 };
 
 AvatarManager::AvatarManager(bool useExternalServer, const std::string &externalServerAddress,
-							 const string &externalServerUser, const string &externalServerPassword)
+							 const std::string &externalServerUser, const std::string &externalServerPassword)
 	: m_useExternalServer(useExternalServer), m_externalServerAddress(externalServerAddress),
 	  m_externalServerUser(externalServerUser), m_externalServerPassword(externalServerPassword)
 {
@@ -79,7 +78,7 @@
 }
 
 bool
-AvatarManager::Init(const string &dataDir, const string &cacheDir)
+AvatarManager::Init(const std::string &dataDir, const std::string &cacheDir)
 {
 	bool retVal = true;
 	bool tmpRet;
@@ -113,7 +112,7 @@
 {
 	bool retVal = false;
 	path filePath(fileName);
-	string tmpFileName(filePath.file_string());
+std::string tmpFileName(filePath.file_string());
 
 	if (!fileName.empty() && !tmpFileName.empty()) {
 		unsigned outFileSize = 0;
@@ -143,22 +142,22 @@
 	try {
 		outFileType = GetAvatarFileType(fileName);
 		boost::shared_ptr<AvatarFileState> fileState(new AvatarFileState);
-		fileState->inputStream.open(fileName.c_str(), ios_base::in | ios_base::binary);
+		fileState->inputStream.open(fileName.c_str(), std::ios_base::in | std::ios_base::binary);
 		if (!fileState->inputStream.fail()) {
 			// Find out file size.
 			// Not fully portable, but works on win/linux/mac.
-			fileState->inputStream.seekg(0, ios_base::beg);
+			fileState->inputStream.seekg(0, std::ios_base::beg);
 			std::streampos startPos = fileState->inputStream.tellg();
-			fileState->inputStream.seekg(0, ios_base::end);
+			fileState->inputStream.seekg(0, std::ios_base::end);
 			std::streampos endPos = fileState->inputStream.tellg();
-			fileState->inputStream.seekg(0, ios_base::beg);
+			fileState->inputStream.seekg(0, std::ios_base::beg);
 			std::streamoff posDiff(endPos - startPos);
 			outFileSize = (unsigned)posDiff;
 			if (outFileSize >= MIN_AVATAR_FILE_SIZE && outFileSize <= MAX_AVATAR_FILE_SIZE) {
 				// Validate type of file by verifying image header.
 				unsigned char fileHeader[MAX_HEADER_SIZE];
 				fileState->inputStream.read((char *)fileHeader, sizeof(fileHeader));
-				fileState->inputStream.seekg(0, ios_base::beg);
+				fileState->inputStream.seekg(0, std::ios_base::beg);
 
 				if (IsValidAvatarFileType(outFileType, fileHeader, sizeof(fileHeader)))
 					retVal = fileState;
@@ -188,7 +187,7 @@
 }
 
 int
-AvatarManager::AvatarFileToNetPackets(const string &fileName, unsigned requestId, NetPacketList &packets)
+AvatarManager::AvatarFileToNetPackets(const std::string &fileName, unsigned requestId, NetPacketList &packets)
 {
 	int retVal = ERR_NET_INVALID_AVATAR_FILE;
 	unsigned fileSize = 0;
@@ -205,7 +204,7 @@
 
 		unsigned numBytes = 0;
 		unsigned totalBytesRead = 0;
-		vector<unsigned char> tmpData(MAX_FILE_DATA_SIZE);
+		std::vector<unsigned char> tmpData(MAX_FILE_DATA_SIZE);
 		do {
 			numBytes = ChunkReadAvatarFile(tmpState, &tmpData[0], MAX_FILE_DATA_SIZE);
 			if (numBytes) {
@@ -235,12 +234,12 @@
 }
 
 AvatarFileType
-AvatarManager::GetAvatarFileType(const string &fileName)
+AvatarManager::GetAvatarFileType(const std::string &fileName)
 {
 	AvatarFileType fileType;
 
 	path filePath(fileName);
-	string ext(extension(filePath));
+std::string ext(extension(filePath));
 	if (boost::algorithm::iequals(ext, ".png"))
 		fileType = AVATAR_FILE_TYPE_PNG;
 	else if (boost::algorithm::iequals(ext, ".jpg") || boost::algorithm::iequals(ext, ".jpeg"))
@@ -253,10 +252,10 @@
 	return fileType;
 }
 
-string
+std::string
 AvatarManager::GetAvatarFileExtension(AvatarFileType fileType)
 {
-	string ext;
+std::string ext;
 	switch (fileType) {
 	case AVATAR_FILE_TYPE_PNG:
 		ext = ".png";
@@ -342,7 +341,7 @@
 bool
 AvatarManager::HasAvatar(const MD5Buf &md5buf) const
 {
-	string tmpFile;
+std::string tmpFile;
 	return GetAvatarFileName(md5buf, tmpFile);
 }
 
@@ -350,20 +349,20 @@
 AvatarManager::StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFileType, const unsigned char *data, size_t size, bool upload)
 {
 	bool retVal = false;
-	string cacheDir;
+std::string cacheDir;
 	{
 		boost::mutex::scoped_lock lock(m_cacheDirMutex);
 		cacheDir = m_cacheDir;
 	}
 	try {
-		string ext(GetAvatarFileExtension(avatarFileType));
+	std::string ext(GetAvatarFileExtension(avatarFileType));
 		if (!ext.empty() && !cacheDir.empty()) {
 			// Check header before storing file.
 			if (IsValidAvatarFileType(avatarFileType, data, size)) {
 				path tmpPath(cacheDir);
 				tmpPath /= (md5buf.ToString() + ext);
-				string fileName(tmpPath.file_string());
-				ofstream o(fileName.c_str(), ios_base::out | ios_base::binary | ios_base::trunc);
+			std::string fileName(tmpPath.file_string());
+				std::ofstream o(fileName.c_str(), std::ios_base::out | std::ios_base::binary | std::ios_base::trunc);
 				if (!o.fail()) {
 					o.write((const char *)data, size);
 					o.close();
@@ -419,7 +418,7 @@
 void
 AvatarManager::RemoveOldAvatarCacheEntries()
 {
-	string cacheDir;
+std::string cacheDir;
 	{
 		boost::mutex::scoped_lock lock(m_cacheDirMutex);
 		cacheDir = m_cacheDir;
@@ -441,7 +440,7 @@
 				while (i != end) {
 					bool keepFile = false;
 					path filePath(i->second);
-					string fileString(filePath.file_string());
+				std::string fileString(filePath.file_string());
 					// Only consider files which are definitely in the cache dir.
 					if (fileString.size() > cacheDir.size() && fileString.substr(0, cacheDir.size()) == cacheDir) {
 						// Only consider files with MD5 as file name.
@@ -521,9 +520,9 @@
 
 			while (i != end) {
 				if (is_regular(i->status())) {
-					string md5sum(basename(i->path()));
+				std::string md5sum(basename(i->path()));
 					MD5Buf md5buf;
-					string fileName(i->path().file_string());
+				std::string fileName(i->path().file_string());
 					if (md5buf.FromString(md5sum)) {
 						// Only consider files with md5sum as name.
 						avatars.insert(AvatarMap::value_type(md5buf, fileName));
diff -Nur PokerTH-1.1.1-src/src/core/common/crypthelper.cpp new/src/core/common/crypthelper.cpp
--- PokerTH-1.1.1-src/src/core/common/crypthelper.cpp	2014-01-10 22:18:20.760643128 +0100
+++ new/src/core/common/crypthelper.cpp	2016-05-24 12:43:35.206101342 +0200
@@ -60,8 +60,8 @@
 std::string
 HashBuf::ToString() const
 {
-	// Create a hex-based string from the MD5 data.
-	string retValue;
+	// Create a hex-based std::string from the MD5 data.
+std::string retValue;
 	char tmpBuf[2 + 1];
 	tmpBuf[sizeof(tmpBuf) - 1] = 0;
 	const unsigned char *tmpData = GetData();
@@ -75,7 +75,7 @@
 bool
 HashBuf::FromString(const std::string &text)
 {
-	// Convert hex-based string to MD5 data.
+	// Convert hex-based std::string to MD5 data.
 	bool retVal = false;
 	int tmpSize = GetDataSize();
 	if (text.size() == 2 * (unsigned)tmpSize) {
@@ -274,7 +274,7 @@
 }
 
 bool
-CryptHelper::AES128Encrypt(const unsigned char *keyData, unsigned keySize, const string &plainStr, std::vector<unsigned char> &outCipher)
+CryptHelper::AES128Encrypt(const unsigned char *keyData, unsigned keySize, const std::string &plainStr, std::vector<unsigned char> &outCipher)
 {
 	bool retVal = false;
 	unsigned plainSize = static_cast<unsigned>(plainStr.size());
@@ -329,7 +329,7 @@
 }
 
 bool
-CryptHelper::AES128Decrypt(const unsigned char *keyData, unsigned keySize, const unsigned char *cipher, unsigned cipherSize, string &outPlain)
+CryptHelper::AES128Decrypt(const unsigned char *keyData, unsigned keySize, const unsigned char *cipher, unsigned cipherSize, std::string &outPlain)
 {
 	bool retVal = false;
 	if (keySize && cipherSize) {
@@ -373,7 +373,7 @@
 		// Remove trailing zeroes (padding).
 		if (!outPlain.empty()) {
 			size_t pos = outPlain.find_first_of('\0');
-			if (pos != string::npos)
+			if (pos !=std::string::npos)
 				outPlain = outPlain.substr(0, pos);
 		}
 	}
diff -Nur PokerTH-1.1.1-src/src/core/common/loghelper_client.cpp new/src/core/common/loghelper_client.cpp
--- PokerTH-1.1.1-src/src/core/common/loghelper_client.cpp	2014-01-10 22:18:20.760643128 +0100
+++ new/src/core/common/loghelper_client.cpp	2016-05-24 12:34:02.326303988 +0200
@@ -50,7 +50,7 @@
 }
 
 void
-internal_log_err(const string &msg)
+internal_log_err(const std::string &msg)
 {
 	cerr << msg;
 }
diff -Nur PokerTH-1.1.1-src/src/core/common/loghelper_server.cpp new/src/core/common/loghelper_server.cpp
--- PokerTH-1.1.1-src/src/core/common/loghelper_server.cpp	2014-01-10 22:18:20.760643128 +0100
+++ new/src/core/common/loghelper_server.cpp	2016-05-24 12:34:02.326303988 +0200
@@ -50,11 +50,11 @@
 
 #define SERVER_MSG_LOG_FILE_NAME				"server_messages.log"
 
-static string g_logFile;
+static std::string g_logFile;
 static int g_logLevel = 1;
 
 void
-loghelper_init(const string &logDir, int logLevel)
+loghelper_init(const std::string &logDir, int logLevel)
 {
 	path tmpLogFile(logDir);
 	tmpLogFile /= SERVER_MSG_LOG_FILE_NAME;
@@ -64,7 +64,7 @@
 }
 
 void
-internal_log_err(const string &msg)
+internal_log_err(const std::string &msg)
 {
 	if (!g_logFile.empty()) {
 		ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
diff -Nur PokerTH-1.1.1-src/src/net/common/clientstate.cpp new/src/net/common/clientstate.cpp
--- PokerTH-1.1.1-src/src/net/common/clientstate.cpp	2014-01-10 22:18:20.916643111 +0100
+++ new/src/net/common/clientstate.cpp	2016-05-24 15:21:15.237924232 +0200
@@ -57,7 +57,6 @@
 #include <fstream>
 #include <sstream>
 
-using namespace std;
 using namespace boost::filesystem;
 
 #define CLIENT_WAIT_TIMEOUT_MSEC	50
@@ -132,7 +131,7 @@
 ClientStateStartResolve::Enter(boost::shared_ptr<ClientThread> client)
 {
 	ClientContext &context = client->GetContext();
-	ostringstream portStr;
+	std::ostringstream portStr;
 	portStr << context.GetServerPort();
 	boost::asio::ip::tcp::resolver::query q(context.GetServerAddr(), portStr.str());
 
@@ -302,8 +301,8 @@
 
 		// Unzip the file using zlib.
 		try {
-			ifstream inFile(zippedServerListPath.directory_string().c_str(), ios_base::in | ios_base::binary);
-			ofstream outFile(xmlServerListPath.directory_string().c_str(), ios_base::out | ios_base::trunc);
+			std::ifstream inFile(zippedServerListPath.directory_string().c_str(), std::ios_base::in | std::ios_base::binary);
+			std::ofstream outFile(xmlServerListPath.directory_string().c_str(), std::ios_base::out | std::ios_base::trunc);
 			boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
 			in.push(boost::iostreams::zlib_decompressor());
 			in.push(inFile);
@@ -661,7 +660,7 @@
 		// Chat message - display it in the GUI.
 		const ChatMessage &netMessage = tmpPacket->GetMsg()->chatmessage();
 
-		string playerName;
+	 std::string playerName;
 		if (netMessage.chattype() == ChatMessage::chatTypeBroadcast) {
 			client->GetCallback().SignalNetClientGameChatMsg("(global notice)", netMessage.chattext());
 			client->GetCallback().SignalNetClientLobbyChatMsg("(global notice)", netMessage.chattext());
@@ -951,7 +950,7 @@
 			}
 			netInit->set_login(InitMessage::unauthenticatedLogin);
 			netInit->set_nickname(context.GetPlayerName());
-			string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile());
+		 std::string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile());
 			if (!avatarFile.empty()) {
 				MD5Buf tmpMD5;
 				if (client->GetAvatarManager().GetHashForAvatar(avatarFile, tmpMD5)) {
@@ -1050,9 +1049,9 @@
 				tmpSession->CreateClientAuthSession(client->GetAuthContext(), context.GetPlayerName(), context.GetPassword());
 				if (!tmpSession->AuthStep(1, ""))
 					throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PASSWORD, 0);
-				string outUserData(tmpSession->AuthGetNextOutMsg());
+			 std::string outUserData(tmpSession->AuthGetNextOutMsg());
 				netInit->set_clientuserdata(outUserData);
-				string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile());
+			 std::string avatarFile = client->GetQtToolsInterface().stringFromUtf8(context.GetAvatarFile());
 				if (!avatarFile.empty()) {
 					MD5Buf tmpMD5;
 					if (client->GetAvatarManager().GetHashForAvatar(avatarFile, tmpMD5)) {
@@ -1105,11 +1104,11 @@
 {
 	if (tmpPacket->GetMsg()->messagetype() == PokerTHMessage::Type_AuthServerChallengeMessage) {
 		const AuthServerChallengeMessage &netAuth = tmpPacket->GetMsg()->authserverchallengemessage();
-		string challengeStr(netAuth.serverchallenge());
+	 std::string challengeStr(netAuth.serverchallenge());
 		boost::shared_ptr<SessionData> tmpSession = client->GetContext().GetSessionData();
 		if (!tmpSession->AuthStep(2, challengeStr.c_str()))
 			throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PASSWORD, 0);
-		string outUserData(tmpSession->AuthGetNextOutMsg());
+	 std::string outUserData(tmpSession->AuthGetNextOutMsg());
 
 		boost::shared_ptr<NetPacket> packet(new NetPacket);
 		packet->GetMsg()->set_messagetype(PokerTHMessage::Type_AuthClientResponseMessage);
@@ -1153,7 +1152,7 @@
 	if (tmpPacket->GetMsg()->messagetype() == PokerTHMessage::Type_AuthServerVerificationMessage) {
 		// Check subtype.
 		const AuthServerVerificationMessage &netAuth = tmpPacket->GetMsg()->authserververificationmessage();
-		string verificationStr(netAuth.serververification());
+	 std::string verificationStr(netAuth.serververification());
 		boost::shared_ptr<SessionData> tmpSession = client->GetContext().GetSessionData();
 		if (!tmpSession->AuthStep(3, verificationStr.c_str()))
 			throw ClientException(__FILE__, __LINE__, ERR_NET_INVALID_PASSWORD, 0);
@@ -1583,14 +1582,14 @@
 		// These are the cards. Good luck.
 		const HandStartMessage &netHandStart = tmpPacket->GetMsg()->handstartmessage();
 		int myCards[2];
-		string userPassword(client->GetContext().GetPassword());
+	 std::string userPassword(client->GetContext().GetPassword());
 		if (netHandStart.has_plaincards() && userPassword.empty()) {
 			const HandStartMessage::PlainCards &plainCards = netHandStart.plaincards();
 			myCards[0] = (int)plainCards.plaincard1();
 			myCards[1] = (int)plainCards.plaincard2();
 		} else if (netHandStart.has_encryptedcards() && !userPassword.empty()) {
-			const string &encryptedCards = netHandStart.encryptedcards();
-			string plainCards;
+			const std::string &encryptedCards = netHandStart.encryptedcards();
+		 std::string plainCards;
 			if (!CryptHelper::AES128Decrypt((const unsigned char *)userPassword.c_str(),
 											(unsigned)userPassword.size(),
 											(const unsigned char *)encryptedCards.data(),
@@ -1598,7 +1597,7 @@
 											plainCards)) {
 				throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
 			}
-			istringstream cardDataStream(plainCards);
+			std::istringstream cardDataStream(plainCards);
 			unsigned tmpPlayerId, tmpGameId;
 			int tmpHandNum;
 			cardDataStream >> tmpPlayerId;