From 9e3172cb0464df904f5f08ea2a795ea87c6d1b33 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 9 Oct 2013 12:26:29 +0200 Subject: [PATCH] Another attempt to make MSVC happy! C89 requires variable declarations upfront. --- simgear/nasal/mathlib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/simgear/nasal/mathlib.c b/simgear/nasal/mathlib.c index b12bc830..f2434b3c 100644 --- a/simgear/nasal/mathlib.c +++ b/simgear/nasal/mathlib.c @@ -155,14 +155,17 @@ static naRef f_round(naContext c, naRef me, int argc, naRef* args) { naRef a = naNumValue(argc > 0 ? args[0] : naNil()); naRef b = naNumValue(argc > 1 ? args[1] : naNil()); +#ifdef _MSC_VER + double x,y; +#endif if(naIsNil(a)) naRuntimeError(c, "non numeric arguments to round()"); if (naIsNil(b)) b.num = 1.0; #ifdef _MSC_VER // MSVC is not C99-compatible, no round() in math.h - double y = a.num / b.num; - double x = floor(y + 0.5); + y = a.num / b.num; + x = floor(y + 0.5); #else double x = round(a.num / b.num); #endif -- 2.39.5