Replace QByteArrayData class by typedef.

QByteArrayData was binary compatible with QArrayData, but we do not
need a separate class, QArrayData should be sufficient. Preferably we
would use QTypedArrayData<char> but it is not POD, therefore it can
not be initialized with {} syntax.

Change-Id: I1edd7b4f236b06d8f2dbfd8a37a3f5699b6a2c07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
Jędrzej Nowacki 2012-04-24 12:25:07 +02:00 committed by Qt by Nokia
parent 9a140d6521
commit dcdd837a56
2 changed files with 3 additions and 21 deletions

View File

@ -52,7 +52,8 @@ QT_BEGIN_NAMESPACE
class QByteArray;
struct QByteArrayData;
class QArrayData;
typedef QArrayData QByteArrayData;
class QString;

View File

@ -120,26 +120,7 @@ class QString;
class QDataStream;
template <typename T> class QList;
struct QByteArrayData
{
// Keep in sync with QArrayData
QtPrivate::RefCount ref;
int size;
uint alloc : 31;
uint capacityReserved : 1;
qptrdiff offset;
inline char *data() { return reinterpret_cast<char *>(this) + offset; }
inline const char *data() const { return reinterpret_cast<const char *>(this) + offset; }
};
Q_STATIC_ASSERT(sizeof(QArrayData) == sizeof(QByteArrayData));
Q_STATIC_ASSERT(offsetof(QArrayData, ref) == offsetof(QByteArrayData, ref));
Q_STATIC_ASSERT(offsetof(QArrayData, size) == offsetof(QByteArrayData, size));
// Can't use offsetof on bitfield members alloc, capacityReserved
Q_STATIC_ASSERT(offsetof(QArrayData, offset) == offsetof(QByteArrayData, offset));
typedef QArrayData QByteArrayData;
template<int N> struct QStaticByteArrayData
{