Merge pull request #350 from Photonios/master

Fixes for MSVC 2015 (Python 3.5)
This commit is contained in:
Federico Di Gregorio 2015-09-23 11:50:25 +02:00
commit 4e92322d74

View File

@ -129,28 +129,33 @@ static int pthread_mutex_init(pthread_mutex_t *mutex, void* fake)
/* remove the inline keyword, since it doesn't work unless C++ file */ /* remove the inline keyword, since it doesn't work unless C++ file */
#define inline #define inline
/* Hmmm, MSVC doesn't have a isnan/isinf function, but has _isnan function */ /* Hmmm, MSVC <2015 doesn't have a isnan/isinf function, but has _isnan function */
#if defined (_MSC_VER) #if defined (_MSC_VER)
#if !defined(isnan)
#define isnan(x) (_isnan(x)) #define isnan(x) (_isnan(x))
/* The following line was hacked together from simliar code by Bjorn Reese /* The following line was hacked together from simliar code by Bjorn Reese
* in libxml2 code */ * in libxml2 code */
#define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) ? 1 \ #define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) ? 1 \
: ((_fpclass(x) == _FPCLASS_NINF) ? -1 : 0)) : ((_fpclass(x) == _FPCLASS_NINF) ? -1 : 0))
#endif
#define strcasecmp(x, y) lstrcmpi(x, y) #define strcasecmp(x, y) lstrcmpi(x, y)
#endif #endif
#endif #endif
/* what's this, we have no round function either? */
#if (defined(__FreeBSD__) && __FreeBSD_version < 503000) \ #if (defined(__FreeBSD__) && __FreeBSD_version < 503000) \
|| (defined(_WIN32) && !defined(__GNUC__)) \ || (defined(_WIN32) && !defined(__GNUC__)) \
|| (defined(sun) || defined(__sun__)) \ || (defined(sun) || defined(__sun__)) \
&& (defined(__SunOS_5_8) || defined(__SunOS_5_9)) && (defined(__SunOS_5_8) || defined(__SunOS_5_9))
/* what's this, we have no round function either? */
/* round has been added in the standard library with MSVC 2015 */
#if _MSC_VER < 1900
static double round(double num) static double round(double num)
{ {
return (num >= 0) ? floor(num + 0.5) : ceil(num - 0.5); return (num >= 0) ? floor(num + 0.5) : ceil(num - 0.5);
} }
#endif #endif
#endif
/* resolve missing isinf() function for Solaris */ /* resolve missing isinf() function for Solaris */
#if defined (__SVR4) && defined (__sun) #if defined (__SVR4) && defined (__sun)