From 2b78ba17498eb160a4344db98bfff895a4f7ee31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferenc=20G=C3=A9czi?= Date: Thu, 19 Dec 2024 00:00:00 +0000 Subject: [PATCH] [drape_frontend] Fix `memcpy` of non-trivial GLM type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following GCC warning: ```` drape_frontend/arrow3d.cpp:503:11: warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘glm::mat4’ {aka ‘struct glm::mat<4, 4, float, glm::packed_highp>’} from an array of ‘const struct math::Matrix’ [-Wclass-memaccess] 503 | memcpy(&pTo3dView, &m, sizeof(pTo3dView)); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```` Signed-off-by: Ferenc Géczi --- drape_frontend/arrow3d.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drape_frontend/arrow3d.cpp b/drape_frontend/arrow3d.cpp index 80b6a81c25..bd935eec98 100644 --- a/drape_frontend/arrow3d.cpp +++ b/drape_frontend/arrow3d.cpp @@ -497,10 +497,7 @@ std::pair Arrow3d::CalculateTransform(ScreenBase const & if (screen.isPerspective()) { - glm::mat4 pTo3dView; - auto const m = math::Matrix(screen.Pto3dMatrix()); - static_assert(sizeof(m) == sizeof(pTo3dView)); - memcpy(&pTo3dView, &m, sizeof(pTo3dView)); + glm::mat4 pTo3dView = glm::make_mat4x4(screen.Pto3dMatrix().m_data); auto postProjectionPerspective = pTo3dView * modelTransform; return std::make_pair(postProjectionPerspective, normalMatrix); }