diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-05-22 15:51:25 -0300 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-05-23 14:39:09 +0000 |
commit | 1fb1695cdb8eb20a1ab6df0223a32e7de7421c55 (patch) | |
tree | 4b964f4cdeff80dabf20799c1608628098e033b9 | |
parent | 94c0dcb59641188291efe3b11fa0bcb59ace8184 (diff) |
Fix GCC 8 warning about memcpying non-trivial class
Follow what the compiler suggests and just use std::copy_n. Code
generation may not be as good as memcpy for large-ish m_queuedCount
values as sizeof(GlCommand) = 40 or 48 bytes.
glcommandqueue.cpp:181:75: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘class
QtCanvas3D::GlCommand’; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
Change-Id: I052407b777ec43f78378fffd15310ca2d996e9a3
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/imports/qtcanvas3d/glcommandqueue.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/imports/qtcanvas3d/glcommandqueue.cpp b/src/imports/qtcanvas3d/glcommandqueue.cpp index 929d7f8..9eaf928 100644 --- a/src/imports/qtcanvas3d/glcommandqueue.cpp +++ b/src/imports/qtcanvas3d/glcommandqueue.cpp @@ -178,7 +178,7 @@ GlCommand &CanvasGlCommandQueue::queueCommand(CanvasGlCommandQueue::GlCommandId */ void CanvasGlCommandQueue::transferCommands(GlCommand executeQueue[]) { - memcpy(executeQueue, m_queue.data(), m_queuedCount * sizeof(GlCommand)); + std::copy_n(m_queue.constData(), m_queuedCount, executeQueue); m_queuedCount = 0; |