aboutsummaryrefslogtreecommitdiff
path: root/src/geodesic.c
diff options
context:
space:
mode:
authorCharles Karney <charles@karney.com>2018-03-17 19:35:29 -0400
committerCharles Karney <charles@karney.com>2018-03-17 19:35:29 -0400
commit945c9501a60bf08aeee7454cb9e779e9835462db (patch)
tree3f4496fb168dff2d2a9c587a12296ee90d7f7bef /src/geodesic.c
parentca880f497aa9eeff9eccea7ab0168a4fed73d411 (diff)
downloadPROJ-945c9501a60bf08aeee7454cb9e779e9835462db.tar.gz
PROJ-945c9501a60bf08aeee7454cb9e779e9835462db.zip
Fix comments in geodesic.c. Better invocation of AX_CHECK_COMPILE_FLAG,
but I doubt this will fix the build failures on the CI machines.
Diffstat (limited to 'src/geodesic.c')
-rw-r--r--src/geodesic.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/src/geodesic.c b/src/geodesic.c
index fc0b5aea..91af23f9 100644
--- a/src/geodesic.c
+++ b/src/geodesic.c
@@ -193,12 +193,12 @@ static real AngNormalize(real x) {
real y = fmod(x, (real)(360));
#if defined(_MSC_VER) && _MSC_VER < 1900
/*
- Before version 14 (2015), Visual Studio had problems dealing
- with -0.0. Specifically
- VC 10,11,12 and 32-bit compile: fmod(-0.0, 360.0) -> +0.0
- sincosdx has a similar fix.
- python 2.7 on Windows 32-bit machines has the same problem.
- */
+ * Before version 14 (2015), Visual Studio had problems dealing
+ * with -0.0. Specifically
+ * VC 10,11,12 and 32-bit compile: fmod(-0.0, 360.0) -> +0.0
+ * sincosdx has a similar fix.
+ * python 2.7 on Windows 32-bit machines has the same problem.
+ */
if (x == 0) y = x;
#endif
return y <= -180 ? y + 360 : (y <= 180 ? y : y - 360);
@@ -249,13 +249,13 @@ static void sincosdx(real x, real* sinx, real* cosx) {
s = sin(r); c = cos(r);
#if defined(_MSC_VER) && _MSC_VER < 1900
/*
- Before version 14 (2015), Visual Studio had problems dealing
- with -0.0. Specifically
- VC 10,11,12 and 32-bit compile: fmod(-0.0, 360.0) -> +0.0
- VC 12 and 64-bit compile: sin(-0.0) -> +0.0
- AngNormalize has a similar fix.
- python 2.7 on Windows 32-bit machines has the same problem.
- */
+ * Before version 14 (2015), Visual Studio had problems dealing
+ * with -0.0. Specifically
+ * VC 10,11,12 and 32-bit compile: fmod(-0.0, 360.0) -> +0.0
+ * VC 12 and 64-bit compile: sin(-0.0) -> +0.0
+ * AngNormalize has a similar fix.
+ * python 2.7 on Windows 32-bit machines has the same problem.
+ */
if (x == 0) s = x;
#endif
switch ((unsigned)q & 3U) {
@@ -659,21 +659,29 @@ real geod_genposition(const struct geod_geodesicline* l,
S12 = l->c2 * atan2(salp12, calp12) + l->A4 * (B42 - l->B41);
}
- if ((outmask & GEOD_LATITUDE) && plat2) /* plat2 check redundant */
+ /* In the pattern
+ *
+ * if ((outmask & GEOD_XX) && pYY)
+ * *pYY = YY;
+ *
+ * the second check "&& pYY" is redundant. It's there to make the CLang
+ * static analyzer happy.
+ */
+ if ((outmask & GEOD_LATITUDE) && plat2)
*plat2 = lat2;
- if ((outmask & GEOD_LONGITUDE) && plon2) /* plon2 check redundant */
+ if ((outmask & GEOD_LONGITUDE) && plon2)
*plon2 = lon2;
- if ((outmask & GEOD_AZIMUTH) && pazi2) /* pazi2 check redundant */
+ if ((outmask & GEOD_AZIMUTH) && pazi2)
*pazi2 = azi2;
- if ((outmask & GEOD_DISTANCE) && ps12) /* ps12 check redundant */
+ if ((outmask & GEOD_DISTANCE) && ps12)
*ps12 = s12;
- if ((outmask & GEOD_REDUCEDLENGTH) && pm12) /* pm12 check redundant */
+ if ((outmask & GEOD_REDUCEDLENGTH) && pm12)
*pm12 = m12;
if (outmask & GEOD_GEODESICSCALE) {
if (pM12) *pM12 = M12;
if (pM21) *pM21 = M21;
}
- if ((outmask & GEOD_AREA) && pS12) /* pS12 check redundant */
+ if ((outmask & GEOD_AREA) && pS12)
*pS12 = S12;
return (flags & GEOD_ARCMODE) ? s12_a12 : sig12 / degree;
@@ -1896,7 +1904,7 @@ void geod_polygon_addedge(const struct geod_geodesic* g,
real azi, real s) {
if (p->num) { /* Do nothing is num is zero */
/* Initialize S12 to stop Visual Studio warning. Initialization of lat and
- lon is to make CLang static analyzer happy. */
+ * lon is to make CLang static analyzer happy. */
real lat = 0, lon = 0, S12 = 0;
geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s,
&lat, &lon, 0,