diff options
author | Matthew Newhook <matthew@zeroc.com> | 2009-08-07 11:10:37 +0800 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2009-08-07 11:10:37 +0800 |
commit | 3af793bd59430b2adaa2f89d8867f46010dd0080 (patch) | |
tree | 95d538d5a6c2f74210d2ed2d34d147dcbbb8a733 /cpp | |
parent | Revert "4071 - Global namespace pollution" (diff) | |
download | ice-3af793bd59430b2adaa2f89d8867f46010dd0080.tar.bz2 ice-3af793bd59430b2adaa2f89d8867f46010dd0080.tar.xz ice-3af793bd59430b2adaa2f89d8867f46010dd0080.zip |
Revert "4171 - Global namespace pollution"
This reverts commit 2f63dafe080ad36656d23bfe9c581e45d714be18.
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/ConnectionFactory.cpp | 7 | ||||
-rw-r--r-- | cpp/src/Ice/Initialize.cpp | 9 | ||||
-rw-r--r-- | cpp/src/IcePatch2/Calc.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IcePatch2/ClientUtil.cpp | 8 | ||||
-rw-r--r-- | cpp/src/IcePatch2/FileServerI.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IcePatch2/OS.cpp | 30 | ||||
-rw-r--r-- | cpp/src/IcePatch2/OS.h | 5 | ||||
-rw-r--r-- | cpp/src/IcePatch2/Server.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IcePatch2/Util.cpp | 36 |
9 files changed, 43 insertions, 58 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 84de59104d2..ecce6f07866 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -1345,9 +1345,6 @@ IceInternal::IncomingConnectionFactory::read(BasicStream&) return false; } -namespace IceInternal -{ - class PromoteFollower { public: @@ -1367,8 +1364,6 @@ private: const ThreadPoolPtr _threadPool; }; -} - void IceInternal::IncomingConnectionFactory::message(BasicStream&, const ThreadPoolPtr& threadPool) { @@ -1385,7 +1380,7 @@ IceInternal::IncomingConnectionFactory::message(BasicStream&, const ThreadPoolPt // If _threadPool is null, then this class doesn't do // anything. // - IceInternal::PromoteFollower promote(threadPool); + PromoteFollower promote(threadPool); if(_state != StateActive) { diff --git a/cpp/src/Ice/Initialize.cpp b/cpp/src/Ice/Initialize.cpp index ad9462dba2c..da9027b5061 100644 --- a/cpp/src/Ice/Initialize.cpp +++ b/cpp/src/Ice/Initialize.cpp @@ -137,9 +137,6 @@ Ice::createProperties(int& argc, char* argv[], const PropertiesPtr& defaults, co return properties; } -namespace IceInternal -{ - inline void checkIceVersion(Int version) { #ifndef ICE_IGNORE_VERSION @@ -183,12 +180,10 @@ inline void checkIceVersion(Int version) #endif } -} - CommunicatorPtr Ice::initialize(int& argc, char* argv[], const InitializationData& initializationData, Int version) { - IceInternal::checkIceVersion(version); + checkIceVersion(version); InitializationData initData = initializationData; initData.properties = createProperties(argc, argv, initData.properties, initData.stringConverter); @@ -216,7 +211,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. // - IceInternal::checkIceVersion(version); + 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 b9a857c4b78..525657e6f7a 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(IceInternal::OS::getcwd(cwd) != 0) + if(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 ede41b15399..d2198c5d5ba 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 = IceInternal::OS::fopen(pathLog, "w"); + _log = 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(IceInternal::OS::getcwd(cwd) != 0) + if(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 = IceInternal::OS::fopen(path, "wb"); + FILE* fp = 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 = IceInternal::OS::fopen(pathBZ2, "wb"); + FILE* fileBZ2 = 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 7d2c735d174..3e14b22e048 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 = IceInternal::OS::open(_dataDir + '/' + path + ".bz2", O_RDONLY|O_BINARY); + int fd = 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 0985459d2c7..b4944d5bdc4 100644 --- a/cpp/src/IcePatch2/OS.cpp +++ b/cpp/src/IcePatch2/OS.cpp @@ -19,48 +19,48 @@ #endif using namespace std; -using namespace IceInternal::OS; +using namespace OS; #ifdef _WIN32 int -IceInternal::OS::remove(const string& path) +OS::remove(const string& path) { return ::_wremove(IceUtil::stringToWstring(path).c_str()); } int -IceInternal::OS::rename(const string& from, const string& to) +OS::rename(const string& from, const string& to) { return ::_wrename(IceUtil::stringToWstring(from).c_str(), IceUtil::stringToWstring(to).c_str()); } int -IceInternal::OS::rmdir(const string& path) +OS::rmdir(const string& path) { return ::_wrmdir(IceUtil::stringToWstring(path).c_str()); } int -IceInternal::OS::mkdir(const string& path, int) +OS::mkdir(const string& path, int) { return ::_wmkdir(IceUtil::stringToWstring(path).c_str()); } FILE* -IceInternal::OS::fopen(const string& path, const string& mode) +OS::fopen(const string& path, const string& mode) { return ::_wfopen(IceUtil::stringToWstring(path).c_str(), IceUtil::stringToWstring(mode).c_str()); } int -IceInternal::OS::open(const string& path, int flags) +OS::open(const string& path, int flags) { return ::_wopen(IceUtil::stringToWstring(path).c_str(), flags); } int -IceInternal::OS::getcwd(string& cwd) +OS::getcwd(string& cwd) { wchar_t cwdbuf[_MAX_PATH]; if(_wgetcwd(cwdbuf, _MAX_PATH) == NULL) @@ -74,43 +74,43 @@ IceInternal::OS::getcwd(string& cwd) #else int -IceInternal::OS::remove(const string& path) +OS::remove(const string& path) { return ::remove(path.c_str()); } int -IceInternal::OS::rename(const string& from, const string& to) +OS::rename(const string& from, const string& to) { return ::rename(from.c_str(), to.c_str()); } int -IceInternal::OS::rmdir(const string& path) +OS::rmdir(const string& path) { return ::rmdir(path.c_str()); } int -IceInternal::OS::mkdir(const string& path, int perm) +OS::mkdir(const string& path, int perm) { return ::mkdir(path.c_str(), perm); } FILE* -IceInternal::OS::fopen(const string& path, const string& mode) +OS::fopen(const string& path, const string& mode) { return ::fopen(path.c_str(), mode.c_str()); } int -IceInternal::OS::open(const string& path, int flags) +OS::open(const string& path, int flags) { return ::open(path.c_str(), flags); } int -IceInternal::OS::getcwd(string& cwd) +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 828d182ac78..7f4e1e1bd1e 100644 --- a/cpp/src/IcePatch2/OS.h +++ b/cpp/src/IcePatch2/OS.h @@ -22,9 +22,6 @@ # endif #endif -namespace IceInternal -{ - namespace OS { @@ -39,6 +36,4 @@ ICE_PATCH2_API int getcwd(std::string&); } -} - #endif diff --git a/cpp/src/IcePatch2/Server.cpp b/cpp/src/IcePatch2/Server.cpp index db2be034db0..75d28cef865 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(IceInternal::OS::getcwd(cwd) != 0) + if(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 a46a94b68be..8e5c63dba4c 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); - IceInternal::OS::remove(toPath); // We ignore errors, as the file we are renaming to might not exist. + OS::remove(toPath); // We ignore errors, as the file we are renaming to might not exist. - if(IceInternal::OS::rename(fromPath ,toPath) == -1) + if(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(IceInternal::OS::rmdir(path) == -1) + if(OS::rmdir(path) == -1) { if(errno == EACCES) { @@ -436,7 +436,7 @@ IcePatch2::remove(const string& pa) } else { - if(IceInternal::OS::remove(path) == -1) + if(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(IceInternal::OS::rmdir(path) == -1) + if(OS::rmdir(path) == -1) { throw "cannot remove directory `" + path + "':\n" + IceUtilInternal::lastErrorToString(); } @@ -472,7 +472,7 @@ IcePatch2::removeRecursive(const string& pa) } else { - if(IceInternal::OS::remove(path) == -1) + if(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(IceInternal::OS::mkdir(path, 0777) == -1) + if(OS::mkdir(path, 0777) == -1) { if(errno != EEXIST) { @@ -639,7 +639,7 @@ IcePatch2::createDirectoryRecursive(const string& pa) } } - if(IceInternal::OS::mkdir(path, 0777) == -1) + if(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 = IceInternal::OS::fopen(path, "wb"); + FILE* stdioFile = 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 = IceInternal::OS::fopen(path, "wb"); + fp = OS::fopen(path, "wb"); if(!fp) { throw "cannot open `" + path + "' for writing:\n" + IceUtilInternal::lastErrorToString(); } - stdioFileBZ2 = IceInternal::OS::fopen(pathBZ2, "rb"); + stdioFileBZ2 = 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 = IceInternal::OS::open(path.c_str(), O_BINARY|O_RDONLY); + int fd = 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 = IceInternal::OS::fopen(pathBZ2Temp, "wb"); + FILE* stdioFile = 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 = IceInternal::OS::open(path.c_str(), O_BINARY|O_RDONLY); + int fd = 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 = IceInternal::OS::fopen(simplify(pathBZ2Temp), "wb"); + stdioFile = 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 = IceInternal::OS::fopen(path, "w"); + FILE* fp = 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 = IceInternal::OS::fopen(path, "r"); + FILE* fp = 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 = IceInternal::OS::fopen(pathLog, "r"); + FILE* fp = OS::fopen(pathLog, "r"); if(fp != 0) { FileInfoSeq remove; |