From ca8c43f556eb598c22e9a2ed03c7ab1bb814c5a8 Mon Sep 17 00:00:00 2001 From: Kurt Schwehr Date: Mon, 4 Jun 2018 02:55:18 -0700 Subject: pj_transform.c: Use errno symbols, not numeric literals (#1029) --- src/pj_transform.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/pj_transform.c b/src/pj_transform.c index 93094f01..84ebe2d9 100644 --- a/src/pj_transform.c +++ b/src/pj_transform.c @@ -27,6 +27,7 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ +#include #include #include @@ -206,12 +207,14 @@ static int geographic_to_projected (PJ *P, long n, int dist, double *x, double * projected_loc = pj_fwd3d( geodetic_loc, P); if( P->ctx->last_errno != 0 ) { - if( (P->ctx->last_errno != 33 /*EDOM*/ - && P->ctx->last_errno != 34 /*ERANGE*/ ) + if( (P->ctx->last_errno != EDOM + && P->ctx->last_errno != ERANGE) && (P->ctx->last_errno > 0 || P->ctx->last_errno < -44 || n == 1 || transient_error[-P->ctx->last_errno] == 0 ) ) + { return P->ctx->last_errno; + } else { projected_loc.u = HUGE_VAL; @@ -242,12 +245,14 @@ static int geographic_to_projected (PJ *P, long n, int dist, double *x, double * projected_loc = pj_fwd( geodetic_loc, P ); if( P->ctx->last_errno != 0 ) { - if( (P->ctx->last_errno != 33 /*EDOM*/ - && P->ctx->last_errno != 34 /*ERANGE*/ ) + if( (P->ctx->last_errno != EDOM + && P->ctx->last_errno != ERANGE) && (P->ctx->last_errno > 0 || P->ctx->last_errno < -44 || n == 1 || transient_error[-P->ctx->last_errno] == 0 ) ) + { return P->ctx->last_errno; + } else { projected_loc.u = HUGE_VAL; @@ -310,12 +315,14 @@ static int projected_to_geographic (PJ *P, long n, int dist, double *x, double * geodetic_loc = pj_inv3d(projected_loc, P); if( P->ctx->last_errno != 0 ) { - if( (P->ctx->last_errno != 33 /*EDOM*/ - && P->ctx->last_errno != 34 /*ERANGE*/ ) + if( (P->ctx->last_errno != EDOM + && P->ctx->last_errno != ERANGE) && (P->ctx->last_errno > 0 || P->ctx->last_errno < -44 || n == 1 || transient_error[-P->ctx->last_errno] == 0 ) ) + { return P->ctx->last_errno; + } else { geodetic_loc.u = HUGE_VAL; @@ -347,12 +354,14 @@ static int projected_to_geographic (PJ *P, long n, int dist, double *x, double * geodetic_loc = pj_inv( projected_loc, P ); if( P->ctx->last_errno != 0 ) { - if( (P->ctx->last_errno != 33 /*EDOM*/ - && P->ctx->last_errno != 34 /*ERANGE*/ ) + if( (P->ctx->last_errno != EDOM + && P->ctx->last_errno != ERANGE) && (P->ctx->last_errno > 0 || P->ctx->last_errno < -44 || n == 1 || transient_error[-P->ctx->last_errno] == 0 ) ) + { return P->ctx->last_errno; + } else { geodetic_loc.u = HUGE_VAL; -- cgit v1.2.3