diff options
author | Ville Voutilainen <ville.voutilainen@qt.io> | 2018-02-28 16:09:09 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-11-19 20:12:04 +0000 |
commit | 6626572f8604b2789da9253ccd7aa92d3f6013e9 (patch) | |
tree | ec6560c6e8d88a5913c5d8ae0cf4bac09fd5eb28 | |
parent | 10bef7aa883cab99cfcb526d6f996f033b3f1fc0 (diff) |
Silence GCC 8 warnings in qpodvector
qpodvector_p.h:90:34: error: ‘void* realloc(void*, size_t)’ moving an object of non-trivially copyable type ‘class QQuickBasePositioner::PositionedItem’; use ‘new’ and ‘delete’ instead [-Werror=class-memaccess]
m_data = (T *)realloc(m_data, m_capacity * sizeof(T));
qpodvector_p.h:94:22: error: ‘void* memmove(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘class QQuickBasePositioner::PositionedItem’; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
::memmove(m_data + idx + 1, m_data + idx, moveCount * sizeof(T));
Change-Id: I37088986a0f8613152a355ed6f3f9572316fa607
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit 622decbe3b2478496295e57d59f9cf16a9f70a13)
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
-rw-r--r-- | src/qml/qml/ftw/qpodvector_p.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/qml/ftw/qpodvector_p.h b/src/qml/qml/ftw/qpodvector_p.h index cafe3367de..6d04c181c0 100644 --- a/src/qml/qml/ftw/qpodvector_p.h +++ b/src/qml/qml/ftw/qpodvector_p.h @@ -87,11 +87,11 @@ public: void insert(int idx, const T &v) { if (m_count == m_capacity) { m_capacity += Increment; - m_data = (T *)realloc(m_data, m_capacity * sizeof(T)); + m_data = (T *)realloc(static_cast<void *>(m_data), m_capacity * sizeof(T)); } int moveCount = m_count - idx; if (moveCount) - ::memmove(m_data + idx + 1, m_data + idx, moveCount * sizeof(T)); + ::memmove(static_cast<void *>(m_data + idx + 1), static_cast<const void *>(m_data + idx), moveCount * sizeof(T)); m_count++; m_data[idx] = v; } @@ -99,7 +99,7 @@ public: void reserve(int count) { if (count >= m_capacity) { m_capacity = (count + (Increment-1)) & (0xFFFFFFFF - Increment + 1); - m_data = (T *)realloc(m_data, m_capacity * sizeof(T)); + m_data = (T *)realloc(static_cast<void *>(m_data), m_capacity * sizeof(T)); } } @@ -108,7 +108,7 @@ public: reserve(newSize); int moveCount = m_count - idx; if (moveCount) - ::memmove(m_data + idx + count, m_data + idx, + ::memmove(static_cast<void *>(m_data + idx + count), static_cast<const void *>(m_data + idx), moveCount * sizeof(T)); m_count = newSize; } |