aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/apps/proj.cpp3
-rw-r--r--src/conversions/cart.cpp6
-rw-r--r--src/conversions/unitconvert.cpp6
-rw-r--r--src/fwd.cpp30
-rw-r--r--src/internal.cpp20
-rw-r--r--src/inv.cpp30
-rw-r--r--src/transformations/helmert.cpp12
-rw-r--r--src/transformations/molodensky.cpp12
8 files changed, 90 insertions, 29 deletions
diff --git a/src/apps/proj.cpp b/src/apps/proj.cpp
index 93f1ce7b..6368ef2c 100644
--- a/src/apps/proj.cpp
+++ b/src/apps/proj.cpp
@@ -115,7 +115,8 @@ static void process(FILE *fid) {
facs_bad = proj_errno(Proj);
}
- data.xy = (*proj.fwd)(data.lp, Proj);
+ const auto xy = (*proj.fwd)(data.lp, Proj);
+ data.xy = xy;
if (dofactors && inverse) {
facs = proj_factors(Proj, coord);
diff --git a/src/conversions/cart.cpp b/src/conversions/cart.cpp
index 5175599a..a134bc6a 100644
--- a/src/conversions/cart.cpp
+++ b/src/conversions/cart.cpp
@@ -212,7 +212,8 @@ static PJ_XY cart_forward (PJ_LP lp, PJ *P) {
point.lp = lp;
point.lpz.z = 0;
- point.xyz = cartesian (point.lpz, P);
+ const auto xyz = cartesian (point.lpz, P);
+ point.xyz = xyz;
return point.xy;
}
@@ -222,7 +223,8 @@ static PJ_LP cart_reverse (PJ_XY xy, PJ *P) {
point.xy = xy;
point.xyz.z = 0;
- point.lpz = geodetic (point.xyz, P);
+ const auto lpz = geodetic (point.xyz, P);
+ point.lpz = lpz;
return point.lp;
}
diff --git a/src/conversions/unitconvert.cpp b/src/conversions/unitconvert.cpp
index 187acf17..d584d93f 100644
--- a/src/conversions/unitconvert.cpp
+++ b/src/conversions/unitconvert.cpp
@@ -322,7 +322,8 @@ static PJ_XYZ forward_3d(PJ_LPZ lpz, PJ *P) {
point.lpz = lpz;
/* take care of the horizontal components in the 2D function */
- point.xy = forward_2d(point.lp, P);
+ const auto xy = forward_2d(point.lp, P);
+ point.xy = xy;
point.xyz.z *= Q->z_factor;
@@ -339,7 +340,8 @@ static PJ_LPZ reverse_3d(PJ_XYZ xyz, PJ *P) {
point.xyz = xyz;
/* take care of the horizontal components in the 2D function */
- point.lp = reverse_2d(point.xy, P);
+ const auto lp = reverse_2d(point.xy, P);
+ point.lp = lp;
point.xyz.z /= Q->z_factor;
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 ();
diff --git a/src/internal.cpp b/src/internal.cpp
index b96e2160..e934069f 100644
--- a/src/internal.cpp
+++ b/src/internal.cpp
@@ -83,11 +83,17 @@ chained calls starting out with a call to its 2D interface.
direction = static_cast<PJ_DIRECTION>(-direction);
switch (direction) {
case PJ_FWD:
- coo.xy = pj_fwd (coo.lp, P);
+ {
+ const auto xy = pj_fwd (coo.lp, P);
+ coo.xy = xy;
return coo;
+ }
case PJ_INV:
- coo.lp = pj_inv (coo.xy, P);
+ {
+ const auto lp = pj_inv (coo.xy, P);
+ coo.lp = lp;
return coo;
+ }
case PJ_IDENT:
break;
}
@@ -110,11 +116,17 @@ chained calls starting out with a call to its 3D interface.
direction = static_cast<PJ_DIRECTION>(-direction);
switch (direction) {
case PJ_FWD:
- coo.xyz = pj_fwd3d (coo.lpz, P);
+ {
+ const auto xyz = pj_fwd3d (coo.lpz, P);
+ coo.xyz = xyz;
return coo;
+ }
case PJ_INV:
- coo.lpz = pj_inv3d (coo.xyz, P);
+ {
+ const auto lpz = pj_inv3d (coo.xyz, P);
+ coo.lpz = lpz;
return coo;
+ }
case PJ_IDENT:
break;
}
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 ();
diff --git a/src/transformations/helmert.cpp b/src/transformations/helmert.cpp
index f9bb45e0..253dc2f6 100644
--- a/src/transformations/helmert.cpp
+++ b/src/transformations/helmert.cpp
@@ -369,7 +369,8 @@ static PJ_XYZ helmert_forward_3d (PJ_LPZ lpz, PJ *P) {
point.lpz = lpz;
if (Q->fourparam) {
- point.xy = helmert_forward(point.lp, P);
+ const auto xy = helmert_forward(point.lp, P);
+ point.xy = xy;
return point.xyz;
}
@@ -409,7 +410,8 @@ static PJ_LPZ helmert_reverse_3d (PJ_XYZ xyz, PJ *P) {
point.xyz = xyz;
if (Q->fourparam) {
- point.lp = helmert_reverse(point.xy, P);
+ const auto lp = helmert_reverse(point.xy, P);
+ point.lp = lp;
return point.lpz;
}
@@ -448,7 +450,8 @@ static PJ_COORD helmert_forward_4d (PJ_COORD point, PJ *P) {
build_rot_matrix(P);
}
- point.xyz = helmert_forward_3d (point.lpz, P);
+ const auto xyz = helmert_forward_3d (point.lpz, P);
+ point.xyz = xyz;
return point;
}
@@ -466,7 +469,8 @@ static PJ_COORD helmert_reverse_4d (PJ_COORD point, PJ *P) {
build_rot_matrix(P);
}
- point.lpz = helmert_reverse_3d (point.xyz, P);
+ const auto lpz = helmert_reverse_3d (point.xyz, P);
+ point.lpz = lpz;
return point;
}
diff --git a/src/transformations/molodensky.cpp b/src/transformations/molodensky.cpp
index 29c51b55..3901fce9 100644
--- a/src/transformations/molodensky.cpp
+++ b/src/transformations/molodensky.cpp
@@ -215,7 +215,8 @@ static PJ_XY forward_2d(PJ_LP lp, PJ *P) {
PJ_COORD point = {{0,0,0,0}};
point.lp = lp;
- point.xyz = forward_3d(point.lpz, P);
+ const auto xyz = forward_3d(point.lpz, P);
+ point.xyz = xyz;
return point.xy;
}
@@ -226,7 +227,8 @@ static PJ_LP reverse_2d(PJ_XY xy, PJ *P) {
point.xy = xy;
point.xyz.z = 0;
- point.lpz = reverse_3d(point.xyz, P);
+ const auto lpz = reverse_3d(point.xyz, P);
+ point.lpz = lpz;
return point.lp;
}
@@ -259,7 +261,8 @@ static PJ_XYZ forward_3d(PJ_LPZ lpz, PJ *P) {
static PJ_COORD forward_4d(PJ_COORD obs, PJ *P) {
- obs.xyz = forward_3d(obs.lpz, P);
+ const auto xyz = forward_3d(obs.lpz, P);
+ obs.xyz = xyz;
return obs;
}
@@ -291,7 +294,8 @@ static PJ_LPZ reverse_3d(PJ_XYZ xyz, PJ *P) {
static PJ_COORD reverse_4d(PJ_COORD obs, PJ *P) {
- obs.lpz = reverse_3d(obs.xyz, P);
+ const auto lpz = reverse_3d(obs.xyz, P);
+ obs.lpz = lpz;
return obs;
}