diff options
Diffstat (limited to 'cpp/src/IcePatch2/FileServerI.cpp')
-rw-r--r-- | cpp/src/IcePatch2/FileServerI.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
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<off_t>(pos), SEEK_SET) != static_cast<off_t>(pos)) + if( +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + _lseek(fd, static_cast<off_t>(pos), SEEK_SET) +#else + lseek(fd, static_cast<off_t>(pos), SEEK_SET) +#endif + != static_cast<off_t>(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<Byte> bytes(new Byte[num]); #ifdef _WIN32 int r; - if((r = read(fd, bytes.get(), static_cast<unsigned int>(num))) == -1) + if((r = +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + _read(fd, bytes.get(), static_cast<unsigned int>(num)) +#else + read(fd, bytes.get(), static_cast<unsigned int>(num)) +#endif + ) == -1) #else ssize_t r; if((r = read(fd, bytes.get(), static_cast<size_t>(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; |