From cdd2a72f647c12211f278e7fa3c647772fa85d9f Mon Sep 17 00:00:00 2001 From: Charles Karney Date: Tue, 1 Oct 2019 18:17:03 -0400 Subject: Fix some Cppcheck complaints in geodesic routines --- src/geodesic.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/geodesic.c') diff --git a/src/geodesic.c b/src/geodesic.c index 02887e10..7d612d3f 100644 --- a/src/geodesic.c +++ b/src/geodesic.c @@ -90,12 +90,16 @@ static void Init() { degree = pi/180; #if defined(NAN) NaN = NAN; /* NAN is defined in C99 */ +#else +#if HAVE_C99_MATH + NaN = nan("0"); #else { real minus1 = -1; /* cppcheck-suppress wrongmathcall */ NaN = sqrt(minus1); } +#endif #endif init = 1; } @@ -546,7 +550,7 @@ real geod_genposition(const struct geod_geodesicline* l, (pS12 ? GEOD_AREA : GEOD_NONE); outmask &= l->caps & OUT_ALL; - if (!( TRUE /*Init()*/ && + if (!( /*Init() &&*/ (flags & GEOD_ARCMODE || (l->caps & (GEOD_DISTANCE_IN & OUT_ALL))) )) /* Uninitialized or impossible distance calculation requested */ return NaN; -- cgit v1.2.3