summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2009-08-04 00:09:36 +0200
committerJose <jose@zeroc.com>2009-08-04 00:09:36 +0200
commit06edd41f4521d79844e4012c3e1630a0cadb49f3 (patch)
tree4ab5e789489431748c1582f206e6240e5c7ea14d
parentinitialize integer members of Slice::Unit (diff)
downloadice-06edd41f4521d79844e4012c3e1630a0cadb49f3.tar.bz2
ice-06edd41f4521d79844e4012c3e1630a0cadb49f3.tar.xz
ice-06edd41f4521d79844e4012c3e1630a0cadb49f3.zip
4171 - Global namespace pollution
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp7
-rw-r--r--cpp/src/Ice/Initialize.cpp9
-rw-r--r--cpp/src/IcePatch2/Calc.cpp2
-rw-r--r--cpp/src/IcePatch2/ClientUtil.cpp8
-rw-r--r--cpp/src/IcePatch2/FileServerI.cpp2
-rw-r--r--cpp/src/IcePatch2/OS.cpp30
-rw-r--r--cpp/src/IcePatch2/OS.h5
-rw-r--r--cpp/src/IcePatch2/Server.cpp2
-rw-r--r--cpp/src/IcePatch2/Util.cpp36
9 files changed, 58 insertions, 43 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index ecce6f07866..84de59104d2 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -1345,6 +1345,9 @@ IceInternal::IncomingConnectionFactory::read(BasicStream&)
return false;
}
+namespace IceInternal
+{
+
class PromoteFollower
{
public:
@@ -1364,6 +1367,8 @@ private:
const ThreadPoolPtr _threadPool;
};
+}
+
void
IceInternal::IncomingConnectionFactory::message(BasicStream&, const ThreadPoolPtr& threadPool)
{
@@ -1380,7 +1385,7 @@ IceInternal::IncomingConnectionFactory::message(BasicStream&, const ThreadPoolPt
// If _threadPool is null, then this class doesn't do
// anything.
//
- PromoteFollower promote(threadPool);
+ IceInternal::PromoteFollower promote(threadPool);
if(_state != StateActive)
{
diff --git a/cpp/src/Ice/Initialize.cpp b/cpp/src/Ice/Initialize.cpp
index da9027b5061..ad9462dba2c 100644
--- a/cpp/src/Ice/Initialize.cpp
+++ b/cpp/src/Ice/Initialize.cpp
@@ -137,6 +137,9 @@ Ice::createProperties(int& argc, char* argv[], const PropertiesPtr& defaults, co
return properties;
}
+namespace IceInternal
+{
+
inline void checkIceVersion(Int version)
{
#ifndef ICE_IGNORE_VERSION
@@ -180,10 +183,12 @@ inline void checkIceVersion(Int version)
#endif
}
+}
+
CommunicatorPtr
Ice::initialize(int& argc, char* argv[], const InitializationData& initializationData, Int version)
{
- checkIceVersion(version);
+ IceInternal::checkIceVersion(version);
InitializationData initData = initializationData;
initData.properties = createProperties(argc, argv, initData.properties, initData.stringConverter);
@@ -211,7 +216,7 @@ Ice::initialize(const InitializationData& initData, Int version)
// We can't simply call the other initialize() because this one does NOT read
// the config file, while the other one always does.
//
- checkIceVersion(version);
+ IceInternal::checkIceVersion(version);
CommunicatorI* communicatorI = new CommunicatorI(initData);
CommunicatorPtr result = communicatorI; // For exception safety.
diff --git a/cpp/src/IcePatch2/Calc.cpp b/cpp/src/IcePatch2/Calc.cpp
index 525657e6f7a..b9a857c4b78 100644
--- a/cpp/src/IcePatch2/Calc.cpp
+++ b/cpp/src/IcePatch2/Calc.cpp
@@ -197,7 +197,7 @@ mainInternal(const Ice::StringSeq& args)
string absDataDir = dataDir;
string cwd;
- if(OS::getcwd(cwd) != 0)
+ if(IceInternal::OS::getcwd(cwd) != 0)
{
throw "cannot get the current directory:\n" + IceUtilInternal::lastErrorToString();
}
diff --git a/cpp/src/IcePatch2/ClientUtil.cpp b/cpp/src/IcePatch2/ClientUtil.cpp
index d2198c5d5ba..ede41b15399 100644
--- a/cpp/src/IcePatch2/ClientUtil.cpp
+++ b/cpp/src/IcePatch2/ClientUtil.cpp
@@ -454,7 +454,7 @@ IcePatch2::Patcher::prepare()
sort(_updateFlags.begin(), _updateFlags.end(), FileInfoLess());
string pathLog = simplify(_dataDir + '/' + logFile);
- _log = OS::fopen(pathLog, "w");
+ _log = IceInternal::OS::fopen(pathLog, "w");
if(!_log)
{
throw "cannot open `" + pathLog + "' for writing:\n" + IceUtilInternal::lastErrorToString();
@@ -615,7 +615,7 @@ IcePatch2::Patcher::init(const FileServerPrx& server)
if(!IceUtilInternal::isAbsolutePath(_dataDir))
{
string cwd;
- if(OS::getcwd(cwd) != 0)
+ if(IceInternal::OS::getcwd(cwd) != 0)
{
throw "cannot get the current directory:\n" + IceUtilInternal::lastErrorToString();
}
@@ -813,7 +813,7 @@ IcePatch2::Patcher::updateFilesInternal(const FileInfoSeq& files, const Decompre
if(p->size == 0)
{
string path = simplify(_dataDir + '/' + p->path);
- FILE* fp = OS::fopen(path, "wb");
+ FILE* fp = IceInternal::OS::fopen(path, "wb");
if(fp == 0)
{
throw "cannot open `" + path +"' for writing:\n" + IceUtilInternal::lastErrorToString();
@@ -838,7 +838,7 @@ IcePatch2::Patcher::updateFilesInternal(const FileInfoSeq& files, const Decompre
{
}
- FILE* fileBZ2 = OS::fopen(pathBZ2, "wb");
+ FILE* fileBZ2 = IceInternal::OS::fopen(pathBZ2, "wb");
if(fileBZ2 == 0)
{
throw "cannot open `" + pathBZ2 + "' for writing:\n" + IceUtilInternal::lastErrorToString();
diff --git a/cpp/src/IcePatch2/FileServerI.cpp b/cpp/src/IcePatch2/FileServerI.cpp
index 3e14b22e048..7d2c735d174 100644
--- a/cpp/src/IcePatch2/FileServerI.cpp
+++ b/cpp/src/IcePatch2/FileServerI.cpp
@@ -92,7 +92,7 @@ IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileComp
return;
}
- int fd = OS::open(_dataDir + '/' + path + ".bz2", O_RDONLY|O_BINARY);
+ int fd = IceInternal::OS::open(_dataDir + '/' + path + ".bz2", O_RDONLY|O_BINARY);
if(fd == -1)
{
FileAccessException ex;
diff --git a/cpp/src/IcePatch2/OS.cpp b/cpp/src/IcePatch2/OS.cpp
index b4944d5bdc4..0985459d2c7 100644
--- a/cpp/src/IcePatch2/OS.cpp
+++ b/cpp/src/IcePatch2/OS.cpp
@@ -19,48 +19,48 @@
#endif
using namespace std;
-using namespace OS;
+using namespace IceInternal::OS;
#ifdef _WIN32
int
-OS::remove(const string& path)
+IceInternal::OS::remove(const string& path)
{
return ::_wremove(IceUtil::stringToWstring(path).c_str());
}
int
-OS::rename(const string& from, const string& to)
+IceInternal::OS::rename(const string& from, const string& to)
{
return ::_wrename(IceUtil::stringToWstring(from).c_str(), IceUtil::stringToWstring(to).c_str());
}
int
-OS::rmdir(const string& path)
+IceInternal::OS::rmdir(const string& path)
{
return ::_wrmdir(IceUtil::stringToWstring(path).c_str());
}
int
-OS::mkdir(const string& path, int)
+IceInternal::OS::mkdir(const string& path, int)
{
return ::_wmkdir(IceUtil::stringToWstring(path).c_str());
}
FILE*
-OS::fopen(const string& path, const string& mode)
+IceInternal::OS::fopen(const string& path, const string& mode)
{
return ::_wfopen(IceUtil::stringToWstring(path).c_str(), IceUtil::stringToWstring(mode).c_str());
}
int
-OS::open(const string& path, int flags)
+IceInternal::OS::open(const string& path, int flags)
{
return ::_wopen(IceUtil::stringToWstring(path).c_str(), flags);
}
int
-OS::getcwd(string& cwd)
+IceInternal::OS::getcwd(string& cwd)
{
wchar_t cwdbuf[_MAX_PATH];
if(_wgetcwd(cwdbuf, _MAX_PATH) == NULL)
@@ -74,43 +74,43 @@ OS::getcwd(string& cwd)
#else
int
-OS::remove(const string& path)
+IceInternal::OS::remove(const string& path)
{
return ::remove(path.c_str());
}
int
-OS::rename(const string& from, const string& to)
+IceInternal::OS::rename(const string& from, const string& to)
{
return ::rename(from.c_str(), to.c_str());
}
int
-OS::rmdir(const string& path)
+IceInternal::OS::rmdir(const string& path)
{
return ::rmdir(path.c_str());
}
int
-OS::mkdir(const string& path, int perm)
+IceInternal::OS::mkdir(const string& path, int perm)
{
return ::mkdir(path.c_str(), perm);
}
FILE*
-OS::fopen(const string& path, const string& mode)
+IceInternal::OS::fopen(const string& path, const string& mode)
{
return ::fopen(path.c_str(), mode.c_str());
}
int
-OS::open(const string& path, int flags)
+IceInternal::OS::open(const string& path, int flags)
{
return ::open(path.c_str(), flags);
}
int
-OS::getcwd(string& cwd)
+IceInternal::OS::getcwd(string& cwd)
{
char cwdbuf[PATH_MAX];
if(::getcwd(cwdbuf, PATH_MAX) == NULL)
diff --git a/cpp/src/IcePatch2/OS.h b/cpp/src/IcePatch2/OS.h
index 7f4e1e1bd1e..828d182ac78 100644
--- a/cpp/src/IcePatch2/OS.h
+++ b/cpp/src/IcePatch2/OS.h
@@ -22,6 +22,9 @@
# endif
#endif
+namespace IceInternal
+{
+
namespace OS
{
@@ -36,4 +39,6 @@ ICE_PATCH2_API int getcwd(std::string&);
}
+}
+
#endif
diff --git a/cpp/src/IcePatch2/Server.cpp b/cpp/src/IcePatch2/Server.cpp
index 75d28cef865..db2be034db0 100644
--- a/cpp/src/IcePatch2/Server.cpp
+++ b/cpp/src/IcePatch2/Server.cpp
@@ -125,7 +125,7 @@ IcePatch2::PatcherService::start(int argc, char* argv[])
if(!IceUtilInternal::isAbsolutePath(dataDir))
{
string cwd;
- if(OS::getcwd(cwd) != 0)
+ if(IceInternal::OS::getcwd(cwd) != 0)
{
throw "cannot get the current directory:\n" + IceUtilInternal::lastErrorToString();
}
diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp
index 8e5c63dba4c..a46a94b68be 100644
--- a/cpp/src/IcePatch2/Util.cpp
+++ b/cpp/src/IcePatch2/Util.cpp
@@ -404,9 +404,9 @@ IcePatch2::rename(const string& fromPa, const string& toPa)
const string fromPath = simplify(fromPa);
const string toPath = simplify(toPa);
- OS::remove(toPath); // We ignore errors, as the file we are renaming to might not exist.
+ IceInternal::OS::remove(toPath); // We ignore errors, as the file we are renaming to might not exist.
- if(OS::rename(fromPath ,toPath) == -1)
+ if(IceInternal::OS::rename(fromPath ,toPath) == -1)
{
throw "cannot rename `" + fromPath + "' to `" + toPath + "': " + IceUtilInternal::lastErrorToString();
}
@@ -425,7 +425,7 @@ IcePatch2::remove(const string& pa)
if(S_ISDIR(buf.st_mode))
{
- if(OS::rmdir(path) == -1)
+ if(IceInternal::OS::rmdir(path) == -1)
{
if(errno == EACCES)
{
@@ -436,7 +436,7 @@ IcePatch2::remove(const string& pa)
}
else
{
- if(OS::remove(path) == -1)
+ if(IceInternal::OS::remove(path) == -1)
{
throw "cannot remove file `" + path + "':\n" + IceUtilInternal::lastErrorToString();
}
@@ -464,7 +464,7 @@ IcePatch2::removeRecursive(const string& pa)
if(!isRoot(path))
{
- if(OS::rmdir(path) == -1)
+ if(IceInternal::OS::rmdir(path) == -1)
{
throw "cannot remove directory `" + path + "':\n" + IceUtilInternal::lastErrorToString();
}
@@ -472,7 +472,7 @@ IcePatch2::removeRecursive(const string& pa)
}
else
{
- if(OS::remove(path) == -1)
+ if(IceInternal::OS::remove(path) == -1)
{
throw "cannot remove file `" + path + "':\n" + IceUtilInternal::lastErrorToString();
}
@@ -608,7 +608,7 @@ IcePatch2::createDirectory(const string& pa)
{
const string path = simplify(pa);
- if(OS::mkdir(path, 0777) == -1)
+ if(IceInternal::OS::mkdir(path, 0777) == -1)
{
if(errno != EEXIST)
{
@@ -639,7 +639,7 @@ IcePatch2::createDirectoryRecursive(const string& pa)
}
}
- if(OS::mkdir(path, 0777) == -1)
+ if(IceInternal::OS::mkdir(path, 0777) == -1)
{
if(errno != EEXIST)
{
@@ -654,7 +654,7 @@ IcePatch2::compressBytesToFile(const string& pa, const ByteSeq& bytes, Int pos)
{
const string path = simplify(pa);
- FILE* stdioFile = OS::fopen(path, "wb");
+ FILE* stdioFile = IceInternal::OS::fopen(path, "wb");
if(!stdioFile)
{
throw "cannot open `" + path + "' for writing:\n" + IceUtilInternal::lastErrorToString();
@@ -714,13 +714,13 @@ IcePatch2::decompressFile(const string& pa)
try
{
- fp = OS::fopen(path, "wb");
+ fp = IceInternal::OS::fopen(path, "wb");
if(!fp)
{
throw "cannot open `" + path + "' for writing:\n" + IceUtilInternal::lastErrorToString();
}
- stdioFileBZ2 = OS::fopen(pathBZ2, "rb");
+ stdioFileBZ2 = IceInternal::OS::fopen(pathBZ2, "rb");
if(!stdioFileBZ2)
{
throw "cannot open `" + pathBZ2 + "' for reading:\n" + IceUtilInternal::lastErrorToString();
@@ -1024,7 +1024,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G
//
if(doCompress)
{
- int fd = OS::open(path.c_str(), O_BINARY|O_RDONLY);
+ int fd = IceInternal::OS::open(path.c_str(), O_BINARY|O_RDONLY);
if(fd == -1)
{
throw "cannot open `" + path + "' for reading:\n" + IceUtilInternal::lastErrorToString();
@@ -1056,7 +1056,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G
close(fd);
const string pathBZ2Temp = path + ".bz2temp";
- FILE* stdioFile = OS::fopen(pathBZ2Temp, "wb");
+ FILE* stdioFile = IceInternal::OS::fopen(pathBZ2Temp, "wb");
if(fwrite(&compressedBytes[0], compressedLen, 1, stdioFile) != 1)
{
fclose(stdioFile);
@@ -1070,7 +1070,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G
}
#endif
- int fd = OS::open(path.c_str(), O_BINARY|O_RDONLY);
+ int fd = IceInternal::OS::open(path.c_str(), O_BINARY|O_RDONLY);
if(fd == -1)
{
throw "cannot open `" + path + "' for reading:\n" + IceUtilInternal::lastErrorToString();
@@ -1083,7 +1083,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G
BZFILE* bzFile = 0;
if(doCompress)
{
- stdioFile = OS::fopen(simplify(pathBZ2Temp), "wb");
+ stdioFile = IceInternal::OS::fopen(simplify(pathBZ2Temp), "wb");
if(!stdioFile)
{
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
@@ -1245,7 +1245,7 @@ IcePatch2::saveFileInfoSeq(const string& pa, const FileInfoSeq& infoSeq)
{
const string path = simplify(pa + '/' + checksumFile);
- FILE* fp = OS::fopen(path, "w");
+ FILE* fp = IceInternal::OS::fopen(path, "w");
if(!fp)
{
throw "cannot open `" + path + "' for writing:\n" + IceUtilInternal::lastErrorToString();
@@ -1287,7 +1287,7 @@ IcePatch2::loadFileInfoSeq(const string& pa, FileInfoSeq& infoSeq)
{
const string path = simplify(pa + '/' + checksumFile);
- FILE* fp = OS::fopen(path, "r");
+ FILE* fp = IceInternal::OS::fopen(path, "r");
if(!fp)
{
throw "cannot open `" + path + "' for reading:\n" + IceUtilInternal::lastErrorToString();
@@ -1314,7 +1314,7 @@ IcePatch2::loadFileInfoSeq(const string& pa, FileInfoSeq& infoSeq)
{
const string pathLog = simplify(pa + '/' + logFile);
- FILE* fp = OS::fopen(pathLog, "r");
+ FILE* fp = IceInternal::OS::fopen(pathLog, "r");
if(fp != 0)
{
FileInfoSeq remove;