aboutsummaryrefslogtreecommitdiff
path: root/src/internal.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-09-04 18:00:20 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-09-04 18:01:11 +0200
commita767ae5d14063f3df1a3af994f26915f973de408 (patch)
treeacd84b4c078ac55cb587297737f57b92c9baf9c9 /src/internal.cpp
parent49c0ef87bad8de7d3351b99eeae0e437adc60f0b (diff)
downloadPROJ-a767ae5d14063f3df1a3af994f26915f973de408.tar.gz
PROJ-a767ae5d14063f3df1a3af994f26915f973de408.zip
Workaround 'Overlapping read/write of union is undefined behavior' cppcheck warning (but really fixing them would be more involved)
Diffstat (limited to 'src/internal.cpp')
-rw-r--r--src/internal.cpp20
1 files changed, 16 insertions, 4 deletions
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;
}