aboutsummaryrefslogtreecommitdiff
path: root/src/fwd.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/fwd.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/fwd.cpp')
-rw-r--r--src/fwd.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/fwd.cpp b/src/fwd.cpp
index 8583a6e7..c267dfca 100644
--- a/src/fwd.cpp
+++ b/src/fwd.cpp
@@ -193,9 +193,15 @@ PJ_XY pj_fwd(PJ_LP lp, PJ *P) {
/* Do the transformation, using the lowest dimensional transformer available */
if (P->fwd)
- coo.xy = P->fwd(coo.lp, P);
+ {
+ const auto xy = P->fwd(coo.lp, P);
+ coo.xy = xy;
+ }
else if (P->fwd3d)
- coo.xyz = P->fwd3d (coo.lpz, P);
+ {
+ const auto xyz = P->fwd3d (coo.lpz, P);
+ coo.xyz = xyz;
+ }
else if (P->fwd4d)
coo = P->fwd4d (coo, P);
else {
@@ -227,11 +233,17 @@ PJ_XYZ pj_fwd3d(PJ_LPZ lpz, PJ *P) {
/* Do the transformation, using the lowest dimensional transformer feasible */
if (P->fwd3d)
- coo.xyz = P->fwd3d(coo.lpz, P);
+ {
+ const auto xyz = P->fwd3d(coo.lpz, P);
+ coo.xyz = xyz;
+ }
else if (P->fwd4d)
coo = P->fwd4d (coo, P);
else if (P->fwd)
- coo.xy = P->fwd (coo.lp, P);
+ {
+ const auto xy = P->fwd (coo.lp, P);
+ coo.xy = xy;
+ }
else {
proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP);
return proj_coord_error ().xyz;
@@ -261,9 +273,15 @@ PJ_COORD pj_fwd4d (PJ_COORD coo, PJ *P) {
if (P->fwd4d)
coo = P->fwd4d (coo, P);
else if (P->fwd3d)
- coo.xyz = P->fwd3d (coo.lpz, P);
+ {
+ const auto xyz = P->fwd3d (coo.lpz, P);
+ coo.xyz = xyz;
+ }
else if (P->fwd)
- coo.xy = P->fwd (coo.lp, P);
+ {
+ const auto xy = P->fwd (coo.lp, P);
+ coo.xy = xy;
+ }
else {
proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP);
return proj_coord_error ();