aboutsummaryrefslogtreecommitdiff
path: root/src/inv.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-09-05 15:41:40 +0200
committerGitHub <noreply@github.com>2021-09-05 15:41:40 +0200
commit71b372e6f08b2f40fbd043c80b56bdb8d2c0b5a0 (patch)
treeeaae225629ae6101db6094b046f319df4f6aba7a /src/inv.cpp
parent09367628bfe698d6a73a1b928bcf611ea675103d (diff)
parentb91af0075a7e8a189e2cd443a823a0798e0b9ed9 (diff)
downloadPROJ-71b372e6f08b2f40fbd043c80b56bdb8d2c0b5a0.tar.gz
PROJ-71b372e6f08b2f40fbd043c80b56bdb8d2c0b5a0.zip
Merge pull request #2841 from rouault/cppcheck_fixes
Cppcheck fixes
Diffstat (limited to 'src/inv.cpp')
-rw-r--r--src/inv.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/inv.cpp b/src/inv.cpp
index 8925f0e9..92b3c1d6 100644
--- a/src/inv.cpp
+++ b/src/inv.cpp
@@ -151,9 +151,15 @@ PJ_LP pj_inv(PJ_XY xy, PJ *P) {
/* Do the transformation, using the lowest dimensional transformer available */
if (P->inv)
- coo.lp = P->inv(coo.xy, P);
+ {
+ const auto lp = P->inv(coo.xy, P);
+ coo.lp = lp;
+ }
else if (P->inv3d)
- coo.lpz = P->inv3d (coo.xyz, P);
+ {
+ const auto lpz = P->inv3d (coo.xyz, P);
+ coo.lpz = lpz;
+ }
else if (P->inv4d)
coo = P->inv4d (coo, P);
else {
@@ -185,11 +191,17 @@ PJ_LPZ pj_inv3d (PJ_XYZ xyz, PJ *P) {
/* Do the transformation, using the lowest dimensional transformer feasible */
if (P->inv3d)
- coo.lpz = P->inv3d (coo.xyz, P);
+ {
+ const auto lpz = P->inv3d (coo.xyz, P);
+ coo.lpz = lpz;
+ }
else if (P->inv4d)
coo = P->inv4d (coo, P);
else if (P->inv)
- coo.lp = P->inv (coo.xy, P);
+ {
+ const auto lp = P->inv (coo.xy, P);
+ coo.lp = lp;
+ }
else {
proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP);
return proj_coord_error ().lpz;
@@ -219,9 +231,15 @@ PJ_COORD pj_inv4d (PJ_COORD coo, PJ *P) {
if (P->inv4d)
coo = P->inv4d (coo, P);
else if (P->inv3d)
- coo.lpz = P->inv3d (coo.xyz, P);
+ {
+ const auto lpz = P->inv3d (coo.xyz, P);
+ coo.lpz = lpz;
+ }
else if (P->inv)
- coo.lp = P->inv (coo.xy, P);
+ {
+ const auto lp = P->inv (coo.xy, P);
+ coo.lp = lp;
+ }
else {
proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP);
return proj_coord_error ();