diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-12-15 00:51:46 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-12-15 01:13:43 +0100 |
| commit | 244a24104ded3a4573aeffa32160af21f76cbce6 (patch) | |
| tree | f3a11529172719657cf7576e062e45e0f9452db5 /src/conversions/axisswap.cpp | |
| parent | 1e9894b0e2b161e61546672bccb85a9ef21df541 (diff) | |
| download | PROJ-244a24104ded3a4573aeffa32160af21f76cbce6.tar.gz PROJ-244a24104ded3a4573aeffa32160af21f76cbce6.zip | |
Revise error codes to have a reduced set exposed in the public API.
Fixes #2482
And also add proj_context_errno_string()
Revise gie 'expect failure errno XXXX' strings
Diffstat (limited to 'src/conversions/axisswap.cpp')
| -rw-r--r-- | src/conversions/axisswap.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/conversions/axisswap.cpp b/src/conversions/axisswap.cpp index 1aa339c3..c02bd4e5 100644 --- a/src/conversions/axisswap.cpp +++ b/src/conversions/axisswap.cpp @@ -174,13 +174,16 @@ PJ *CONVERSION(axisswap,0) { unsigned int i, j, n = 0; if (nullptr==Q) - return pj_default_destructor (P, ENOMEM); + return pj_default_destructor (P, PROJ_ERR_INVALID_OP /*ENOMEM*/); P->opaque = (void *) Q; /* +order and +axis are mutually exclusive */ if ( !pj_param_exists(P->params, "order") == !pj_param_exists(P->params, "axis") ) - return pj_default_destructor(P, PJD_ERR_AXIS); + { + proj_log_error(P, _("order and axis parameters are mutually exclusive.")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_MUTUALLY_EXCLUSIVE_ARGS); + } /* fill axis list with indices from 4-7 to simplify duplicate search further down */ for (i=0; i<4; i++) { @@ -196,8 +199,8 @@ PJ *CONVERSION(axisswap,0) { /* check that all characters are valid */ for (i=0; i<strlen(order); i++) if (strchr("1234-,", order[i]) == nullptr) { - proj_log_error(P, "axisswap: unknown axis '%c'", order[i]); - return pj_default_destructor(P, PJD_ERR_AXIS); + proj_log_error(P, _("axisswap: unknown axis '%c'"), order[i]); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } /* read axes numbers and signs */ @@ -206,8 +209,8 @@ PJ *CONVERSION(axisswap,0) { while ( *s != '\0' && n < 4 ) { Q->axis[n] = abs(atoi(s))-1; if (Q->axis[n] > 3) { - proj_log_error(P, "axisswap: invalid axis '%d'", Q->axis[n]); - return pj_default_destructor(P, PJD_ERR_AXIS); + proj_log_error(P, _("axisswap: invalid axis '%d'"), Q->axis[n]); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } Q->sign[n++] = sign(atoi(s)); while ( *s != '\0' && *s != ',' ) @@ -247,8 +250,8 @@ PJ *CONVERSION(axisswap,0) { Q->axis[i] = 2; break; default: - proj_log_error(P, "axisswap: unknown axis '%c'", P->axis[i]); - return pj_default_destructor(P, PJD_ERR_AXIS); + proj_log_error(P, _("axisswap: unknown axis '%c'"), P->axis[i]); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } } n = 3; @@ -260,8 +263,8 @@ PJ *CONVERSION(axisswap,0) { if (i==j) continue; if (Q->axis[i] == Q->axis[j]) { - proj_log_error(P, "swapaxis: duplicate axes specified"); - return pj_default_destructor(P, PJD_ERR_AXIS); + proj_log_error(P, _("swapaxis: duplicate axes specified")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } } @@ -282,8 +285,8 @@ PJ *CONVERSION(axisswap,0) { if (P->fwd4d == nullptr && P->fwd3d == nullptr && P->fwd == nullptr) { - proj_log_error(P, "swapaxis: bad axis order"); - return pj_default_destructor(P, PJD_ERR_AXIS); + proj_log_error(P, _("swapaxis: bad axis order")); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } if (pj_param(P->ctx, P->params, "tangularunits").i) { |
