From 0a0e5363ad015e6d33cf6a9598a6b79686e1f663 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Mon, 4 Jan 2016 10:28:49 +1100 Subject: [PATCH] libFLAC: Tweak MSVC support Visual Studio 2013 and newer has better support for C99. Patch-from: lvqcl --- include/share/compat.h | 4 +++- src/libFLAC/lpc.c | 13 ++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/share/compat.h b/include/share/compat.h index 671b1107..faf96887 100644 --- a/include/share/compat.h +++ b/include/share/compat.h @@ -117,7 +117,9 @@ #endif #if defined _MSC_VER -# if _MSC_VER >= 1600 +# if _MSC_VER >= 1800 +# include +# elif _MSC_VER >= 1600 /* Visual Studio 2010 has decent C99 support */ # include # define PRIu64 "llu" diff --git a/src/libFLAC/lpc.c b/src/libFLAC/lpc.c index 882862c7..e5900ef0 100644 --- a/src/libFLAC/lpc.c +++ b/src/libFLAC/lpc.c @@ -51,15 +51,14 @@ #ifndef FLAC__INTEGER_ONLY_LIBRARY -#if !defined(HAVE_LROUND) -#if defined(_MSC_VER) +#if defined(_MSC_VER) && (_MSC_VER < 1800) #include -#define copysign _copysign -#elif defined(__GNUC__) -#define copysign __builtin_copysign -#endif static inline long int lround(double x) { - return (long)(x + copysign (0.5, x)); + return (long)(x + _copysign(0.5, x)); +} +#elif !defined(HAVE_LROUND) && defined(__GNUC__) +static inline long int lround(double x) { + return (long)(x + __builtin_copysign(0.5, x)); } /* If this fails, we are in the presence of a mid 90's compiler, move along... */ #endif