Skip to content

Commit

Permalink
Fix warnings of latest cppcheck master
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Feb 27, 2020
1 parent f3561e5 commit fb87c67
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/4D_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/apps/proj_strtod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions src/apps/projinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/initcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/iso19111/c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 5 additions & 2 deletions src/projections/aea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down
13 changes: 8 additions & 5 deletions src/projections/poly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit fb87c67

Please sign in to comment.