summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydata.h
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-03-27 12:49:00 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-28 09:37:27 +0200
commit99e7ad660f23dce51ccd68438adae7528013d23c (patch)
treedce19770bcb1f4ae617b511d93bf22efaa958031 /src/corelib/tools/qarraydata.h
parent7c9e3455514576a48008d5150ffde45871716fe0 (diff)
Ensure QTypedArrayData is just a shim over QArrayData
Change-Id: I6f41ca054d0e0a0c4642f0b841b3b3df9559f818 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/tools/qarraydata.h')
-rw-r--r--src/corelib/tools/qarraydata.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index 351a75aade..b4cefe6729 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -140,18 +140,21 @@ struct QTypedArrayData
static QTypedArrayData *allocate(size_t capacity,
AllocationOptions options = Default) Q_REQUIRED_RESULT
{
+ Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData));
return static_cast<QTypedArrayData *>(QArrayData::allocate(sizeof(T),
Q_ALIGNOF(AlignmentDummy), capacity, options));
}
static void deallocate(QArrayData *data)
{
+ Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData));
QArrayData::deallocate(data, sizeof(T), Q_ALIGNOF(AlignmentDummy));
}
static QTypedArrayData *fromRawData(const T *data, size_t n,
AllocationOptions options = Default)
{
+ Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData));
QTypedArrayData *result = allocate(0, options | RawData);
if (result) {
Q_ASSERT(!result->ref.isShared()); // No shared empty, please!
@@ -165,6 +168,7 @@ struct QTypedArrayData
static QTypedArrayData *sharedNull()
{
+ Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData));
return static_cast<QTypedArrayData *>(
const_cast<QArrayData *>(&QArrayData::shared_null));
}