diff options
author | Jose <jose@zeroc.com> | 2012-08-08 18:52:08 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2012-08-08 18:52:08 +0200 |
commit | 0dd3bcb062c3aaf9ffb8ca56b58c13d5dc714545 (patch) | |
tree | 8067c6695cc5e9672582a904409846e38ffba593 /cpp/src/IceUtil/FileUtil.cpp | |
parent | Fixed python & ruby compilation error caused by OutputStream::format removal (diff) | |
download | ice-0dd3bcb062c3aaf9ffb8ca56b58c13d5dc714545.tar.bz2 ice-0dd3bcb062c3aaf9ffb8ca56b58c13d5dc714545.tar.xz ice-0dd3bcb062c3aaf9ffb8ca56b58c13d5dc714545.zip |
remove VC6 support
Diffstat (limited to 'cpp/src/IceUtil/FileUtil.cpp')
-rw-r--r-- | cpp/src/IceUtil/FileUtil.cpp | 135 |
1 files changed, 1 insertions, 134 deletions
diff --git a/cpp/src/IceUtil/FileUtil.cpp b/cpp/src/IceUtil/FileUtil.cpp index b69e8d6b20a..58e321c5d63 100644 --- a/cpp/src/IceUtil/FileUtil.cpp +++ b/cpp/src/IceUtil/FileUtil.cpp @@ -170,7 +170,7 @@ IceUtilInternal::unlink(const string& path) int IceUtilInternal::close(int fd) { -#if defined(_MSC_VER) && (_MSC_VER >= 1400) || defined(__MINGW32__) +#ifdef __MINGW32__ return _close(fd); #else return ::close(fd); @@ -228,95 +228,10 @@ IceUtilInternal::FileLock::~FileLock() unlink(_path); } -#ifdef _STLP_BEGIN_NAMESPACE -namespace -{ -int -toFileFlags(ios_base::openmode mode) -{ - int flags = 0; - if(mode & ios_base::app) - { - flags |= _O_APPEND; - } - if(mode & ios_base::trunc) - { - flags |= _O_TRUNC; - } - if(mode & ios_base::binary) - { - flags |= _O_BINARY; - } - if((mode & ios_base::in) && !(mode & ios_base::out)) - { - flags |= _O_RDONLY; - } - else if((mode & ios_base::out) && !(mode & ios_base::in)) - { - flags |= _O_WRONLY | _O_CREAT; - } - else - { - flags |= _O_RDWR; - if(mode & ios_base::trunc) - { - flags |= _O_CREAT; - } - } - return flags; -} -} -#endif - IceUtilInternal::ifstream::ifstream() -#ifdef _STLP_BEGIN_NAMESPACE - : _fd(-1) -#endif -{ -} - -#ifdef _STLP_BEGIN_NAMESPACE - -IceUtilInternal::ifstream::ifstream(const string& path, ios_base::openmode mode) : _fd(-1) { - open(path, mode); } -IceUtilInternal::ifstream::~ifstream() -{ - close(); -} - -void -IceUtilInternal::ifstream::close() -{ - if(!rdbuf()->close()) - { - setstate(ios_base::failbit); - } - if(_fd >= 0) - { - _close(_fd); - } -} - -void -IceUtilInternal::ifstream::open(const string& path, ios_base::openmode mode) -{ - mode |= ifstream::in; - _fd = IceUtilInternal::open(path, toFileFlags(mode)); - if(_fd < 0 || !rdbuf()->open(_fd, mode)) - { - setstate(ios_base::failbit); - } - if(mode & (ios_base::ate || ios_base::app)) - { - seekg(ios_base::end); - } -} - -#else - IceUtilInternal::ifstream::ifstream(const string& path, ios_base::openmode mode) : #ifdef __MINGW32__ std::ifstream(path.c_str(), mode) @@ -336,57 +251,10 @@ IceUtilInternal::ifstream::open(const string& path, ios_base::openmode mode) #endif } -#endif - IceUtilInternal::ofstream::ofstream() -#ifdef _STLP_BEGIN_NAMESPACE - : _fd(-1) -#endif -{ -} - -#ifdef _STLP_BEGIN_NAMESPACE - -IceUtilInternal::ofstream::ofstream(const string& path, ios_base::openmode mode) : _fd(-1) -{ - open(path, mode); -} - -IceUtilInternal::ofstream::~ofstream() -{ - close(); -} - -void -IceUtilInternal::ofstream::close() { - if(!rdbuf()->close()) - { - setstate(ios_base::failbit); - } - if(_fd >= 0) - { - _close(_fd); - } } -void -IceUtilInternal::ofstream::open(const string& path, ios_base::openmode mode) -{ - mode |= ofstream::out; - _fd = IceUtilInternal::open(path, toFileFlags(mode)); - if(_fd < 0 || !rdbuf()->open(_fd, mode)) - { - setstate(ios_base::failbit); - } - if(mode & (ios_base::ate || ios_base::app)) - { - seekp(ios_base::end); - } -} - -#else - IceUtilInternal::ofstream::ofstream(const string& path, ios_base::openmode mode) : #ifdef __MINGW32__ std::ofstream(path.c_str(), mode) @@ -406,7 +274,6 @@ IceUtilInternal::ofstream::open(const string& path, ios_base::openmode mode) #endif } -#endif #else |