From 53c75860a73068a4f51305aeb36762e409a1a63b Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 26 Sep 2016 19:54:42 +0200 Subject: [PATCH] Add some workarounds for the msvc compiler. --- src/suunto_eonsteel_parser.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/suunto_eonsteel_parser.c b/src/suunto_eonsteel_parser.c index 64a01ca..5bc2590 100644 --- a/src/suunto_eonsteel_parser.c +++ b/src/suunto_eonsteel_parser.c @@ -30,6 +30,16 @@ #include "parser-private.h" #include "array.h" +#ifdef _MSC_VER +#define strcasecmp _stricmp +#if _MSC_VER < 1800 +// The rint() function is only available in MSVC 2013 and later +// versions. Our replacement macro isn't entirely correct, because the +// rounding rules for halfway cases are slightly different (away from +// zero vs to even). But for our use-case, that's not a problem. +#define rint(x) ((x) >= 0.0 ? floor((x) + 0.5): ceil((x) - 0.5)) +#endif +#endif #define C_ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))