diff options
Diffstat (limited to 'src/pj_ell_set.c')
| -rw-r--r-- | src/pj_ell_set.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/pj_ell_set.c b/src/pj_ell_set.c index 1f9bbd91..fc655289 100644 --- a/src/pj_ell_set.c +++ b/src/pj_ell_set.c @@ -630,7 +630,10 @@ int pj_ell_set (projCtx ctx, paralist *pl, double *a, double *es) { for (start = pl; start && start->next ; start = start->next) ; for (i = 0; (s = pj_ellps[i].id) && strcmp(name, s) ; ++i) ; - if (!s) { pj_ctx_set_errno( ctx, -9); return 1; } + if (!s) { + pj_ctx_set_errno( ctx, PJD_ERR_UNKNOWN_ELLP_PARAM); + return 1; + } start->next = pj_mkparam(pj_ellps[i].major); start->next->next = pj_mkparam(pj_ellps[i].ell); } @@ -645,7 +648,7 @@ int pj_ell_set (projCtx ctx, paralist *pl, double *a, double *es) { } else if (pj_param(ctx,pl, "trf").i) { /* recip flattening */ *es = pj_param(ctx,pl, "drf").f; if (*es == 0.0) { - pj_ctx_set_errno( ctx, -10); + pj_ctx_set_errno(ctx, PJD_ERR_REV_FLATTENING_IS_ZERO); goto bomb; } *es = 1./ *es; @@ -676,7 +679,7 @@ int pj_ell_set (projCtx ctx, paralist *pl, double *a, double *es) { *es = 0.; } else if (pj_param(ctx,pl, "bR_h").i) { /* sphere--harmonic mean */ if ( (*a + b) == 0.0) { - pj_ctx_set_errno(ctx, -20); + pj_ctx_set_errno(ctx, PJD_ERR_TOLERANCE_CONDITION); goto bomb; } *a = 2. * *a * b / (*a + b); @@ -687,7 +690,7 @@ int pj_ell_set (projCtx ctx, paralist *pl, double *a, double *es) { tmp = sin(pj_param(ctx,pl, i ? "rR_lat_a" : "rR_lat_g").f); if (fabs(tmp) > M_HALFPI) { - pj_ctx_set_errno(ctx,-11); + pj_ctx_set_errno(ctx, PJD_ERR_REF_RAD_LARGER_THAN_90); goto bomb; } tmp = 1. - *es * tmp * tmp; @@ -705,10 +708,14 @@ bomb: return 1; } /* some remaining checks */ - if (*es < 0.) - { pj_ctx_set_errno( ctx, -12); return 1; } - if (*a <= 0.) - { pj_ctx_set_errno( ctx, -13); return 1; } + if (*es < 0.) { + pj_ctx_set_errno(ctx, PJD_ERR_ES_LESS_THAN_ZERO); + return 1; + } + if (*a <= 0.) { + pj_ctx_set_errno(ctx, PJD_ERR_MAJOR_AXIS_NOT_GIVEN); + return 1; + } return 0; } #endif |
