From f27cee4065b4282b2028ff97180eca12c67d870b Mon Sep 17 00:00:00 2001 From: Jose Date: Thu, 19 Feb 2009 20:44:56 +0100 Subject: Bug 3650 - Stop using POSIX functions under Windows --- cpp/src/IcePatch2/FileServerI.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'cpp/src/IcePatch2/FileServerI.cpp') diff --git a/cpp/src/IcePatch2/FileServerI.cpp b/cpp/src/IcePatch2/FileServerI.cpp index 46c22513ded..3e14b22e048 100644 --- a/cpp/src/IcePatch2/FileServerI.cpp +++ b/cpp/src/IcePatch2/FileServerI.cpp @@ -101,9 +101,19 @@ IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileComp return; } - if(lseek(fd, static_cast(pos), SEEK_SET) != static_cast(pos)) + if( +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + _lseek(fd, static_cast(pos), SEEK_SET) +#else + lseek(fd, static_cast(pos), SEEK_SET) +#endif + != static_cast(pos)) { +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + _close(fd); +#else close(fd); +#endif ostringstream posStr; posStr << pos; @@ -117,13 +127,23 @@ IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileComp IceUtilInternal::ScopedArray bytes(new Byte[num]); #ifdef _WIN32 int r; - if((r = read(fd, bytes.get(), static_cast(num))) == -1) + if((r = +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + _read(fd, bytes.get(), static_cast(num)) +#else + read(fd, bytes.get(), static_cast(num)) +#endif + ) == -1) #else ssize_t r; if((r = read(fd, bytes.get(), static_cast(num))) == -1) #endif { +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + _close(fd); +#else close(fd); +#endif FileAccessException ex; ex.reason = "cannot read `" + path + "': " + strerror(errno); @@ -131,7 +151,11 @@ IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileComp return; } +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + _close(fd); +#else close(fd); +#endif ret.first = bytes.get(); ret.second = ret.first + r; -- cgit v1.2.3