diff options
| -rw-r--r-- | src/4D_api.cpp | 1 | ||||
| -rw-r--r-- | src/apps/proj_strtod.cpp | 2 | ||||
| -rw-r--r-- | src/apps/projinfo.cpp | 3 | ||||
| -rw-r--r-- | src/initcache.cpp | 6 | ||||
| -rw-r--r-- | src/iso19111/c_api.cpp | 4 | ||||
| -rw-r--r-- | src/projections/aea.cpp | 7 | ||||
| -rw-r--r-- | src/projections/poly.cpp | 13 |
7 files changed, 20 insertions, 16 deletions
diff --git a/src/4D_api.cpp b/src/4D_api.cpp index 69790dde..52bd7f4f 100644 --- a/src/4D_api.cpp +++ b/src/4D_api.cpp @@ -107,6 +107,7 @@ PJ_COORD proj_geod (const PJ *P, PJ_COORD a, PJ_COORD b) { c.v, c.v+1, c.v+2 ); + // cppcheck-suppress uninitvar return c; } diff --git a/src/apps/proj_strtod.cpp b/src/apps/proj_strtod.cpp index d4674705..226dfdb9 100644 --- a/src/apps/proj_strtod.cpp +++ b/src/apps/proj_strtod.cpp @@ -263,7 +263,7 @@ double proj_strtod(const char *str, char **endptr) { if ('+'==*p) sign = +1; if (0==sign) { - if (!isdigit(*p) && *p!='_') { + if (!(isdigit(*p) || *p=='_')) { if (endptr) *endptr = p; return HUGE_VAL; diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp index 41a95237..1e58cfb0 100644 --- a/src/apps/projinfo.cpp +++ b/src/apps/projinfo.cpp @@ -329,9 +329,6 @@ static void outputObject( if (projStringExportable) { if (outputOpt.PROJ5) { try { - if (alreadyOutputed) { - std::cout << std::endl; - } auto crs = nn_dynamic_pointer_cast<CRS>(obj); if (!outputOpt.quiet) { if (crs) { diff --git a/src/initcache.cpp b/src/initcache.cpp index 6120a406..af20fb82 100644 --- a/src/initcache.cpp +++ b/src/initcache.cpp @@ -54,10 +54,10 @@ paralist *pj_clone_paralist( const paralist *list) newitem->next = nullptr; strcpy( newitem->param, list->param ); - if( list_copy == nullptr ) - list_copy = newitem; - else + if( next_copy ) next_copy->next = newitem; + else + list_copy = newitem; next_copy = newitem; } diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index bb01889b..d5f299c2 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -6620,7 +6620,7 @@ int proj_coordoperation_is_instantiable(PJ_CONTEXT *ctx, auto dbContext = getDBcontextNoException(ctx, __FUNCTION__); try { auto ret = op->isPROJInstantiable( - dbContext, proj_context_is_network_enabled(ctx) != false) + dbContext, proj_context_is_network_enabled(ctx) != FALSE) ? 1 : 0; if (ctx->cpp_context) { @@ -6935,7 +6935,7 @@ int proj_coordoperation_get_grid_used_count(PJ_CONTEXT *ctx, if (!coordoperation->gridsNeededAsked) { coordoperation->gridsNeededAsked = true; const auto gridsNeeded = co->gridsNeeded( - dbContext, proj_context_is_network_enabled(ctx) != false); + dbContext, proj_context_is_network_enabled(ctx) != FALSE); for (const auto &gridDesc : gridsNeeded) { coordoperation->gridsNeeded.emplace_back(gridDesc); } diff --git a/src/projections/aea.cpp b/src/projections/aea.cpp index 7b5c0fb5..c9d24245 100644 --- a/src/projections/aea.cpp +++ b/src/projections/aea.cpp @@ -62,8 +62,11 @@ static double phi1_(double qs, double Te, double Tone_es) { sinpi / com + .5 / Te * log ((1. - con) / (1. + con))); Phi += dphi; - } while (fabs(dphi) > TOL && --i); - return( i ? Phi : HUGE_VAL ); + if( !(fabs(dphi) > TOL) ) + return Phi; + --i; + } while (i >= 0); + return HUGE_VAL; } diff --git a/src/projections/poly.cpp b/src/projections/poly.cpp index 08a4aaad..fc7fc8bd 100644 --- a/src/projections/poly.cpp +++ b/src/projections/poly.cpp @@ -116,15 +116,18 @@ static PJ_LP poly_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inverse lp.phi = xy.y; B = xy.x * xy.x + xy.y * xy.y; i = N_ITER; - do { + while(true) { tp = tan(lp.phi); lp.phi -= (dphi = (xy.y * (lp.phi * tp + 1.) - lp.phi - .5 * ( lp.phi * lp.phi + B) * tp) / ((lp.phi - xy.y) / tp - 1.)); - } while (fabs(dphi) > CONV && --i); - if (! i) { - proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION); - return lp; + if( !(fabs(dphi) > CONV) ) + break; + --i; + if( i == 0 ) { + proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION); + return lp; + } } lp.lam = asin(xy.x * tan(lp.phi)) / sin(lp.phi); } |
