Commit 70feef1d authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use reinterpret_cast<void+> for memcpy to show gcc memory access by design

gcc otherwise with -Wclass-memaccess is triggered to warn about writing
into memory of a class with non-trivial data structure (given defined
constructors/assignement operators).
parent f322936f
......@@ -94,8 +94,8 @@ struct IndexedStringRepositoryItemRequest
{
item->length = m_length;
item->refCount = 0;
++item;
memcpy(item, m_text, m_length);
void* itemText = reinterpret_cast<void*>(item + 1);
memcpy(itemText, m_text, m_length);
}
static void destroy(IndexedStringData* item, AbstractItemRepository&)
......
......@@ -81,8 +81,8 @@ struct StringRepositoryItemRequest
void createItem(StringData* item) const
{
item->length = m_length;
++item;
memcpy(item, m_text, m_length);
void* itemText = reinterpret_cast<void*>(item + 1);
memcpy(itemText, m_text, m_length);
}
static void destroy(StringData*, KDevelop::AbstractItemRepository&)
......
......@@ -68,7 +68,7 @@ struct TestItemRequest
void createItem(TestItem* item) const
{
memcpy(item, &m_item, m_item.itemSize());
memcpy(reinterpret_cast<void*>(item), &m_item, m_item.itemSize());
}
static void destroy(TestItem* /*item*/, AbstractItemRepository&)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment