diff options
Diffstat (limited to 'src/projections/lsat.cpp')
| -rw-r--r-- | src/projections/lsat.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/projections/lsat.cpp b/src/projections/lsat.cpp index a811a3a6..ad056da5 100644 --- a/src/projections/lsat.cpp +++ b/src/projections/lsat.cpp @@ -136,7 +136,7 @@ static PJ_LP lsat_e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inverse sppsq = spp * spp; const double denom = 1. - sppsq * (1. + Q->u); if( denom == 0.0 ) { - proj_errno_set(P, PJD_ERR_INVALID_X_OR_Y); + proj_errno_set(P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); return proj_coord_error().lp; } lamt = atan(((1. - sppsq * P->rone_es) * tan(lamdp) * @@ -160,16 +160,23 @@ PJ *PROJECTION(lsat) { double lam, alf, esc, ess; struct pj_opaque *Q = static_cast<struct pj_opaque*>(calloc (1, sizeof (struct pj_opaque))); if (nullptr==Q) - return pj_default_destructor(P, ENOMEM); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP /*ENOMEM*/); P->opaque = Q; land = pj_param(P->ctx, P->params, "ilsat").i; if (land <= 0 || land > 5) - return pj_default_destructor(P, PJD_ERR_LSAT_NOT_IN_RANGE); + { + proj_log_error(P, _("Invalid value for lsat: lsat should be in [1, 5] range")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); + } path = pj_param(P->ctx, P->params, "ipath").i; - if (path <= 0 || path > (land <= 3 ? 251 : 233)) - return pj_default_destructor(P, PJD_ERR_PATH_NOT_IN_RANGE); + const int maxPathVal = (land <= 3 ? 251 : 233); + if (path <= 0 || path > maxPathVal) + { + proj_log_error(P, _("Invalid value for path: path should be in [1, %d] range"), maxPathVal); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); + } if (land <= 3) { P->lam0 = DEG_TO_RAD * 128.87 - M_TWOPI / 251. * path; |
