From 481d47f38938040721b2ba8546d5f2bd1e399852 Mon Sep 17 00:00:00 2001 From: sezero Date: Sat, 3 Nov 2018 09:50:53 +0000 Subject: [PATCH] handle ssize_t issues with MSVC better git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1600 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/MacOSX/codecs/include/mpg123.h | 7 +++++++ quakespasm/Quake/q_stdinc.h | 10 +++------- quakespasm/Quake/snd_mpg123.c | 2 ++ quakespasm/Windows/codecs/include/mpg123.h | 7 +++++++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/quakespasm/MacOSX/codecs/include/mpg123.h b/quakespasm/MacOSX/codecs/include/mpg123.h index 61efcf1f..15019b8c 100644 --- a/quakespasm/MacOSX/codecs/include/mpg123.h +++ b/quakespasm/MacOSX/codecs/include/mpg123.h @@ -28,6 +28,13 @@ #endif #endif +/* This is for Visual Studio, so this header works as distributed in the binary downloads */ +#if defined(_MSC_VER) && !defined(MPG123_DEF_SSIZE_T) +#define MPG123_DEF_SSIZE_T +#include +typedef ptrdiff_t ssize_t; +#endif + #ifndef MPG123_NO_CONFIGURE /* Enable use of this file without configure. */ #include #include diff --git a/quakespasm/Quake/q_stdinc.h b/quakespasm/Quake/q_stdinc.h index 84e423d3..269b1606 100644 --- a/quakespasm/Quake/q_stdinc.h +++ b/quakespasm/Quake/q_stdinc.h @@ -173,14 +173,10 @@ typedef int fixed16_t; /*==========================================================================*/ -/* missing types */ +/* missing types: */ #if defined(_MSC_VER) -#if defined(_WIN64) -#define ssize_t SSIZE_T -#else -typedef int ssize_t; -#endif /* _WIN64 */ -#endif /* _MSC_VER */ +typedef ptrdiff_t ssize_t; +#endif /*==========================================================================*/ diff --git a/quakespasm/Quake/snd_mpg123.c b/quakespasm/Quake/snd_mpg123.c index 7b866ca8..85c65e16 100644 --- a/quakespasm/Quake/snd_mpg123.c +++ b/quakespasm/Quake/snd_mpg123.c @@ -27,6 +27,8 @@ #include "snd_codeci.h" #include "snd_mp3.h" #include + +#define MPG123_DEF_SSIZE_T /* we do define ssize_t in our stdinc.h */ #include #if !defined(MPG123_API_VERSION) || (MPG123_API_VERSION < 24) diff --git a/quakespasm/Windows/codecs/include/mpg123.h b/quakespasm/Windows/codecs/include/mpg123.h index 61efcf1f..15019b8c 100644 --- a/quakespasm/Windows/codecs/include/mpg123.h +++ b/quakespasm/Windows/codecs/include/mpg123.h @@ -28,6 +28,13 @@ #endif #endif +/* This is for Visual Studio, so this header works as distributed in the binary downloads */ +#if defined(_MSC_VER) && !defined(MPG123_DEF_SSIZE_T) +#define MPG123_DEF_SSIZE_T +#include +typedef ptrdiff_t ssize_t; +#endif + #ifndef MPG123_NO_CONFIGURE /* Enable use of this file without configure. */ #include #include