diff options
author | Michi Henning <michi@zeroc.com> | 2005-11-18 22:59:46 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-11-18 22:59:46 +0000 |
commit | 1995b4af86f8edbb2f12405d05bce2b6e47459b1 (patch) | |
tree | fa5813ff5b05ea5f8d316515b394ee520aacd288 /cpp/src/Ice/Instance.cpp | |
parent | Added note about iceboxd (diff) | |
download | ice-1995b4af86f8edbb2f12405d05bce2b6e47459b1.tar.bz2 ice-1995b4af86f8edbb2f12405d05bce2b6e47459b1.tar.xz ice-1995b4af86f8edbb2f12405d05bce2b6e47459b1.zip |
Moved VS 8 warning suppression into IceUtil/DisableWarnings.h
Diffstat (limited to 'cpp/src/Ice/Instance.cpp')
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 45129677459..b1b276fd985 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Ice/Instance.h> #include <Ice/TraceLevels.h> #include <Ice/DefaultsAndOverrides.h> @@ -413,34 +414,6 @@ IceInternal::Instance::getDefaultContext() const return _defaultContext; } -static FILE* -freopenP(const char* path, const char* mode, FILE* stream) -{ - FILE* file; - -#if _WIN32 && _MSC_VER >= 1400 - ::freopen_s(&file, path, mode, stream); - if(file == 0) - { - FileException ex(__FILE__, __LINE__); - ex.path = path; - char buf[1024]; - ex.error = _strerror_s(buf, sizeof(buf), "freopen_s failed"); - throw ex; - } -#else - file = ::freopen(path, mode, stream); - if(file == 0) - { - FileException ex(__FILE__, __LINE__); - ex.path = path; - ex.error = getSystemErrno(); - throw ex; - } -#endif - - return file; -} IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const PropertiesPtr& properties, const LoggerPtr& logger) : @@ -470,12 +443,26 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope if(stdOutFilename != "") { - freopenP(stdOutFilename.c_str(), "a", stdout); + FILE* file = freopen(stdOutFilename.c_str(), "a", stdout); + if(file == 0) + { + FileException ex(__FILE__, __LINE__); + ex.path = stdOutFilename; + ex.error = getSystemErrno(); + throw ex; + } } if(stdErrFilename != "") { - freopenP(stdErrFilename.c_str(), "a", stderr); + FILE* file = freopen(stdErrFilename.c_str(), "a", stderr); + if(file == 0) + { + FileException ex(__FILE__, __LINE__); + ex.path = stdErrFilename; + ex.error = getSystemErrno(); + throw ex; + } } unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds()); |