# HG changeset patch # User Sebastien Jodogne # Date 1607504868 -3600 # Node ID 1382c908d67c9432d01317ef51d5054f3108b644 # Parent 88be8b67b2d71d7a84d72c9234f08a44eb5cc0a8 trying to fix msvc build errors for plugins while compiling ZipReader.cpp diff -r 88be8b67b2d7 -r 1382c908d67c OrthancFramework/Sources/Compression/ZipReader.cpp --- a/OrthancFramework/Sources/Compression/ZipReader.cpp Tue Dec 08 20:22:24 2020 +0100 +++ b/OrthancFramework/Sources/Compression/ZipReader.cpp Wed Dec 09 10:07:48 2020 +0100 @@ -35,9 +35,20 @@ # include "../SystemToolbox.h" #endif + +/** + * I have not been able to correctly define "ssize_t" on all versions + * of Visual Studio. As a consequence, I prefered to switch "ssize_t" + * to "SSIZE_T", that is properly defined on both MSVC 2008 and 2015. + * I define the macro "SSIZE_T" as an alias to "ssize_t" on + * POSIX-compliant platforms that wouldn't have "SSIZE_T" defined. + **/ #if defined(_MSC_VER) # include // Definition of SSIZE_T -// typedef SSIZE_T ssize_t; +#else +# if !defined(SSIZE_T) +typedef ssize_t SSIZE_T; +# endif #endif #include @@ -104,20 +115,20 @@ long Seek(ZPOS64_T offset, int origin) { - ssize_t next; + SSIZE_T next; switch (origin) { case ZLIB_FILEFUNC_SEEK_CUR: - next = static_cast(offset) + static_cast(pos_); + next = static_cast(offset) + static_cast(pos_); break; case ZLIB_FILEFUNC_SEEK_SET: - next = static_cast(offset); + next = static_cast(offset); break; case ZLIB_FILEFUNC_SEEK_END: - next = static_cast(offset) + static_cast(size_); + next = static_cast(offset) + static_cast(size_); break; default: // Should never occur