From 622decbe3b2478496295e57d59f9cf16a9f70a13 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Wed, 28 Feb 2018 16:09:09 +0200 Subject: Silence GCC 8 warnings in qpodvector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/qml/qml/ftw/qpodvector_p.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qml/qml/ftw/qpodvector_p.h b/src/qml/qml/ftw/qpodvector_p.h index d0e4f89741..5255c1f617 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(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(m_data + idx + 1), static_cast(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(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(m_data + idx + count), static_cast(m_data + idx), moveCount * sizeof(T)); m_count = newSize; } -- cgit v1.2.3