diff options
| author | Kurt Schwehr <schwehr@gmail.com> | 2018-06-04 02:55:18 -0700 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-06-04 11:55:18 +0200 |
| commit | ca8c43f556eb598c22e9a2ed03c7ab1bb814c5a8 (patch) | |
| tree | 9205dbfb821a432f42d6067ade3c9cc078e130e4 | |
| parent | b357bf6b9df93efb860bbd472ec1aaed401bb8e2 (diff) | |
| download | PROJ-ca8c43f556eb598c22e9a2ed03c7ab1bb814c5a8.tar.gz PROJ-ca8c43f556eb598c22e9a2ed03c7ab1bb814c5a8.zip | |
pj_transform.c: Use errno symbols, not numeric literals (#1029)
| -rw-r--r-- | src/pj_transform.c | 25 |
1 files changed, 17 insertions, 8 deletions
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 <errno.h> #include <math.h> #include <string.h> @@ -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; |
