From a767ae5d14063f3df1a3af994f26915f973de408 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 4 Sep 2021 18:00:20 +0200 Subject: Workaround 'Overlapping read/write of union is undefined behavior' cppcheck warning (but really fixing them would be more involved) --- src/conversions/cart.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/conversions/cart.cpp') 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; } -- cgit v1.2.3