1 From 69f820bb3d7c4dc8c838f115cb4c7ee5fd188721 Mon Sep 17 00:00:00 2001
2 From: Jonathan Wakely <github@kayari.org>
3 Date: Thu, 26 Nov 2015 16:27:52 +0000
4 Subject: [PATCH] Qualify std::ifstream and std::ofstream
6 Starting with Boost 1.60.0 <boost/filesystem.hpp> includes
7 <boost/filesystem/fstream.hpp>, which declares ifstream and ofstream
8 types that make the unqualified names ifstream and ofstream ambiguous.
9 The names must be qualified to refer to the std versions.
11 src/core/common/avatarmanager.cpp | 4 ++--
12 src/core/common/loghelper_server.cpp | 6 +++---
13 src/net/common/clientstate.cpp | 4 ++--
14 src/net/common/clientthread.cpp | 4 ++--
15 src/net/common/downloaderthread.cpp | 2 +-
16 src/pokerth_server.cpp | 2 +-
17 src/zlib_compress.cpp | 4 ++--
18 7 files changed, 13 insertions(+), 13 deletions(-)
20 diff --git a/src/core/common/avatarmanager.cpp b/src/core/common/avatarmanager.cpp
21 index a8a52e4..0246b72 100644
22 --- a/src/core/common/avatarmanager.cpp
23 +++ b/src/core/common/avatarmanager.cpp
24 @@ -61,7 +61,7 @@ using namespace std;
25 using namespace boost::filesystem;
27 struct AvatarFileState {
28 - ifstream inputStream;
29 + std::ifstream inputStream;
32 AvatarManager::AvatarManager(bool useExternalServer, const std::string &externalServerAddress,
33 @@ -371,7 +371,7 @@ AvatarManager::StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFil
34 path tmpPath(cacheDir);
35 tmpPath /= (md5buf.ToString() + ext);
36 string fileName(tmpPath.file_string());
37 - ofstream o(fileName.c_str(), ios_base::out | ios_base::binary | ios_base::trunc);
38 + std::ofstream o(fileName.c_str(), ios_base::out | ios_base::binary | ios_base::trunc);
40 o.write((const char *)data, size);
42 diff --git a/src/core/common/loghelper_server.cpp b/src/core/common/loghelper_server.cpp
43 index f79e4ca..a0d0350 100644
44 --- a/src/core/common/loghelper_server.cpp
45 +++ b/src/core/common/loghelper_server.cpp
46 @@ -67,7 +67,7 @@ void
47 internal_log_err(const string &msg)
49 if (!g_logFile.empty()) {
50 - ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
51 + std::ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
53 o << second_clock::local_time() << " ERR: " << msg;
55 @@ -80,7 +80,7 @@ internal_log_msg(const std::string &msg)
58 if (!g_logFile.empty()) {
59 - ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
60 + std::ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
62 o << second_clock::local_time() << " MSG: " << msg;
64 @@ -92,7 +92,7 @@ internal_log_level(const std::string &msg, int logLevel)
66 if (g_logLevel >= logLevel) {
67 if (!g_logFile.empty()) {
68 - ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
69 + std::ofstream o(g_logFile.c_str(), ios_base::out | ios_base::app);
71 o << second_clock::local_time() << " OUT: " << msg;
73 diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp
74 index 143773b..080da2d 100644
75 --- a/src/net/common/clientstate.cpp
76 +++ b/src/net/common/clientstate.cpp
77 @@ -308,8 +308,8 @@ ClientStateReadingServerList::Enter(boost::shared_ptr<ClientThread> client)
79 // Unzip the file using zlib.
81 - ifstream inFile(zippedServerListPath.directory_string().c_str(), ios_base::in | ios_base::binary);
82 - ofstream outFile(xmlServerListPath.directory_string().c_str(), ios_base::out | ios_base::trunc);
83 + std::ifstream inFile(zippedServerListPath.directory_string().c_str(), ios_base::in | ios_base::binary);
84 + std::ofstream outFile(xmlServerListPath.directory_string().c_str(), ios_base::out | ios_base::trunc);
85 boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
86 in.push(boost::iostreams::zlib_decompressor());
88 diff --git a/src/net/common/clientthread.cpp b/src/net/common/clientthread.cpp
89 index d60a535..1f3a619 100644
90 --- a/src/net/common/clientthread.cpp
91 +++ b/src/net/common/clientthread.cpp
92 @@ -1695,7 +1695,7 @@ void
93 ClientThread::ReadSessionGuidFromFile()
95 string guidFileName(GetContext().GetCacheDir() + TEMP_GUID_FILENAME);
96 - ifstream guidStream(guidFileName.c_str(), ios::in | ios::binary);
97 + std::ifstream guidStream(guidFileName.c_str(), ios::in | ios::binary);
98 if (guidStream.good()) {
99 std::vector<char> tmpGuid(CLIENT_GUID_SIZE);
100 guidStream.read(&tmpGuid[0], CLIENT_GUID_SIZE);
101 @@ -1707,7 +1707,7 @@ void
102 ClientThread::WriteSessionGuidToFile() const
104 string guidFileName(GetContext().GetCacheDir() + TEMP_GUID_FILENAME);
105 - ofstream guidStream(guidFileName.c_str(), ios::out | ios::trunc | ios::binary);
106 + std::ofstream guidStream(guidFileName.c_str(), ios::out | ios::trunc | ios::binary);
107 if (guidStream.good()) {
108 guidStream.write(GetContext().GetSessionGuid().c_str(), GetContext().GetSessionGuid().size());
110 diff --git a/src/net/common/downloaderthread.cpp b/src/net/common/downloaderthread.cpp
111 index e58e3f8..56a9526 100644
112 --- a/src/net/common/downloaderthread.cpp
113 +++ b/src/net/common/downloaderthread.cpp
114 @@ -96,7 +96,7 @@ DownloaderThread::Main()
115 // Previous download was finished.
116 if (m_curDownloadData) {
117 path filepath(m_curDownloadData->filename);
118 - ifstream instream(filepath.file_string().c_str(), ios_base::in | ios_base::binary);
119 + std::ifstream instream(filepath.file_string().c_str(), ios_base::in | ios_base::binary);
120 // Find out file size.
121 // Not fully portable, but works on win/linux/mac.
122 instream.seekg(0, ios_base::beg);
123 diff --git a/src/pokerth_server.cpp b/src/pokerth_server.cpp
124 index 3b93d46..450a47e 100644
125 --- a/src/pokerth_server.cpp
126 +++ b/src/pokerth_server.cpp
127 @@ -161,7 +161,7 @@ main(int argc, char *argv[])
128 pidFile = tmpPidPath.directory_string();
131 - ofstream pidStream(pidFile.c_str(), ios_base::out | ios_base::trunc);
132 + std::ofstream pidStream(pidFile.c_str(), ios_base::out | ios_base::trunc);
133 if (!pidStream.fail())
134 pidStream << getpid();
136 diff --git a/src/zlib_compress.cpp b/src/zlib_compress.cpp
137 index e3fd72d..4b04817 100644
138 --- a/src/zlib_compress.cpp
139 +++ b/src/zlib_compress.cpp
140 @@ -59,8 +59,8 @@ main(int argc, char *argv[])
144 - ifstream inFile(inputFilePath.directory_string().c_str(), ios_base::in);
145 - ofstream outFile(outputFilePath.directory_string().c_str(), ios_base::out | ios_base::binary);
146 + std::ifstream inFile(inputFilePath.directory_string().c_str(), ios_base::in);
147 + std::ofstream outFile(outputFilePath.directory_string().c_str(), ios_base::out | ios_base::binary);
148 boost::iostreams::filtering_streambuf<boost::iostreams::output> out;
149 out.push(boost::iostreams::zlib_compressor());