Ensure QTypedArrayData is just a shim over QArrayData
Change-Id: I6f41ca054d0e0a0c4642f0b841b3b3df9559f818 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit is contained in:
parent
7c9e345551
commit
99e7ad660f
@ -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));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user