From 5e0f2f8129c88e8a889861d6a84b6843d801501a Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 27 Feb 2018 10:17:46 -0500 Subject: [PATCH] Fix windows build (#290) * Remove 'static inline' declaration incompatible with older VS toolchains * Use _snprintf instead of snprintf on MS toolchain versions prior to VS2015 --- srtcore/srt_compat.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/srtcore/srt_compat.c b/srtcore/srt_compat.c index c8463c46e..9e14e58b2 100644 --- a/srtcore/srt_compat.c +++ b/srtcore/srt_compat.c @@ -40,9 +40,14 @@ written by #endif -static inline const char* SysStrError_Fallback(int errnum, char* buf, size_t buflen) +static const char* SysStrError_Fallback(int errnum, char* buf, size_t buflen) { +#if defined(_MSC_VER) && _MSC_VER < 1900 + _snprintf(buf, buflen - 1, "ERROR CODE %d", errnum); + buf[buflen - 1] = '\0'; +#else snprintf(buf, buflen, "ERROR CODE %d", errnum); +#endif return buf; }