summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-05-08 21:57:07 -0700
committerThiago Macieira <thiago.macieira@intel.com>2018-05-09 05:43:26 +0000
commita2df0ef57add82ccfb3bc3bcfaccc7510d709d98 (patch)
tree3043fa7d11ae14f4642bfa49f36453e0c4d9c50a
parentb32c0ecc4c6df97134d3a27927abc9dc0be3a13b (diff)
Fix build with GCC 8: memset/memcpy/memmove of non-trivials
qarraydataops.h:73:17: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct TCBPoint’; use assignment or value-initialization instead [-Werror=class-memaccess] Change-Id: I5d0ee9389a794d80983efffd152ce10eb557341f Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
-rw-r--r--src/corelib/tools/qarraydataops.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h
index d0f83d2b6a..7e1b43f9b1 100644
--- a/src/corelib/tools/qarraydataops.h
+++ b/src/corelib/tools/qarraydataops.h
@@ -65,7 +65,7 @@ struct QPodArrayOps
Q_ASSERT(newSize > uint(this->size));
Q_ASSERT(newSize <= this->alloc);
- ::memset(this->end(), 0, (newSize - this->size) * sizeof(T));
+ ::memset(static_cast<void *>(this->end()), 0, (newSize - this->size) * sizeof(T));
this->size = int(newSize);
}
@@ -121,8 +121,9 @@ struct QPodArrayOps
Q_ASSERT(e <= where || b > this->end()); // No overlap
Q_ASSERT(size_t(e - b) <= this->alloc - uint(this->size));
- ::memmove(where + (e - b), where, (static_cast<const T*>(this->end()) - where) * sizeof(T));
- ::memcpy(where, b, (e - b) * sizeof(T));
+ ::memmove(static_cast<void *>(where + (e - b)), static_cast<void *>(where),
+ (static_cast<const T*>(this->end()) - where) * sizeof(T));
+ ::memcpy(static_cast<void *>(where), static_cast<const void *>(b), (e - b) * sizeof(T));
this->size += (e - b);
}
@@ -133,7 +134,8 @@ struct QPodArrayOps
Q_ASSERT(b >= this->begin() && b < this->end());
Q_ASSERT(e > this->begin() && e < this->end());
- ::memmove(b, e, (static_cast<T *>(this->end()) - e) * sizeof(T));
+ ::memmove(static_cast<void *>(b), static_cast<void *>(e),
+ (static_cast<T *>(this->end()) - e) * sizeof(T));
this->size -= (e - b);
}
};