From 42a22af78b068bd934123ae7e1d6eee1544282f6 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 24 Oct 2019 15:19:05 -0700 Subject: [PATCH] fix zlibWrapper for Visual Studio As per https://github.com/facebook/zstd/issues/1800#issuecomment-545945050, Visual does not support `ssize_t` type, which is an issue for `gzread.c`. Added a work around, suggested by @bluenlive Note : I have not been able to confirm the problem, so this is a blind fix. This seems safe outside of Visual, since it is gated by _MSC_VER macro. --- zlibWrapper/gzread.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zlibWrapper/gzread.c b/zlibWrapper/gzread.c index bcac9700d..359d17889 100644 --- a/zlibWrapper/gzread.c +++ b/zlibWrapper/gzread.c @@ -8,6 +8,14 @@ #include "gzguts.h" +/* fix for Visual Studio, which doesn't support ssize_t type. + * see https://github.com/facebook/zstd/issues/1800#issuecomment-545945050 */ +#if defined(_MSC_VER) && !defined(ssize_t) +# include + typedef SSIZE_T ssize_t; +#endif + + /* Local functions */ local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); local int gz_avail OF((gz_statep));