summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2019-11-13 18:59:09 +0100
committerLars Knoll <lars.knoll@qt.io>2019-12-08 21:51:27 +0100
commit8e34d49201b46b1e16cd3a8c99236f03a8250ff9 (patch)
tree8dd1761408f0f2fc6663d8d45d2df50b7efa1891 /src
parent8da5d35ae8ef0342adddf11705cad8ed60f871ad (diff)
Use the QByteArray::DataPointer typedef instead of QByteArrayData
The goal here is to move things over to QArrayDataPointer. This prepares for it. Change-Id: I32f54a47594274799600c618f7341c200ceaa306 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qobjectdefs.h1
-rw-r--r--src/corelib/text/qbytearray.cpp6
-rw-r--r--src/corelib/text/qbytearray.h11
-rw-r--r--src/corelib/text/qbytearray_p.h2
-rw-r--r--src/corelib/text/qstring.cpp2
-rw-r--r--src/corelib/tools/qbitarray.h2
6 files changed, 12 insertions, 12 deletions
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 229c97236e..657cb9940b 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -53,7 +53,6 @@ QT_BEGIN_NAMESPACE
class QByteArray;
struct QArrayData;
-struct QByteArrayData;
class QString;
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index 95f6e2a860..feeb0409b4 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -746,7 +746,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
case Z_OK: {
Q_ASSERT(len <= alloc);
Q_UNUSED(alloc);
- QByteArrayData dataPtr = { d.take(), pair.second, uint(len) };
+ QByteArray::DataPointer dataPtr = { d.take(), pair.second, uint(len) };
pair.second[len] = '\0';
return QByteArray(dataPtr);
}
@@ -3101,7 +3101,7 @@ QByteArray QByteArray::mid(int pos, int len) const
case QContainerImplHelper::Empty:
{
auto alloc = Data::allocate(0);
- QByteArrayData empty = { alloc.first, alloc.second, 0 };
+ QByteArray::DataPointer empty = { alloc.first, alloc.second, 0 };
return QByteArray(empty);
}
case QContainerImplHelper::Full:
@@ -4416,7 +4416,7 @@ QByteArray QByteArray::number(double n, char f, int prec)
QByteArray QByteArray::fromRawData(const char *data, int size)
{
- QByteArrayData x;
+ QByteArray::DataPointer x;
if (!data) {
x.d = Data::sharedNull();
x.b = Data::sharedNullData();
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index e4291eae4e..19bf4fa1e5 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -136,10 +136,14 @@ struct QByteArrayData
class Q_CORE_EXPORT QByteArray
{
+public:
+ using DataPointer = QByteArrayData;
private:
typedef QTypedArrayData<char> Data;
+ DataPointer d;
public:
+
enum Base64Option {
Base64Encoding = 0,
Base64UrlEncoding = 1,
@@ -417,14 +421,14 @@ public:
int length() const { return int(d.size); }
bool isNull() const;
- explicit inline QByteArray(const QByteArrayData &dd)
+ inline DataPointer &data_ptr() { return d; }
+ explicit inline QByteArray(const DataPointer &dd)
: d(dd)
{
}
private:
operator QNoImplicitBoolCast() const;
- QByteArrayData d;
void reallocData(uint alloc, Data::ArrayOptions options);
void expand(int i);
QByteArray nulTerminated() const;
@@ -440,9 +444,6 @@ private:
friend class QString;
friend Q_CORE_EXPORT QByteArray qUncompress(const uchar *data, int nbytes);
-public:
- typedef QByteArrayData DataPtr;
- inline DataPtr &data_ptr() { return d; }
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QByteArray::Base64Options)
diff --git a/src/corelib/text/qbytearray_p.h b/src/corelib/text/qbytearray_p.h
index 3c6257f786..d6a5e277b3 100644
--- a/src/corelib/text/qbytearray_p.h
+++ b/src/corelib/text/qbytearray_p.h
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
enum {
// Define as enum to force inlining. Don't expose MaxAllocSize in a public header.
- MaxByteArraySize = MaxAllocSize - sizeof(std::remove_pointer<QByteArray::DataPtr>::type)
+ MaxByteArraySize = MaxAllocSize - sizeof(std::remove_pointer<QByteArray::DataPointer>::type)
};
QT_END_NAMESPACE
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index d2d7104cd5..cb83a31df1 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -5148,7 +5148,7 @@ QByteArray QString::toLatin1_helper_inplace(QString &s)
// Swap the d pointers.
// Kids, avert your eyes. Don't try this at home.
- QByteArrayData ba_d = {
+ QByteArray::DataPointer ba_d = {
s.d.d,
reinterpret_cast<char *>(s.d.b),
length
diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h
index 9b0e931aca..4ea613a442 100644
--- a/src/corelib/tools/qbitarray.h
+++ b/src/corelib/tools/qbitarray.h
@@ -106,7 +106,7 @@ public:
static QBitArray fromBits(const char *data, qsizetype len);
public:
- typedef QByteArray::DataPtr DataPtr;
+ typedef QByteArray::DataPointer DataPtr;
inline DataPtr &data_ptr() { return d.data_ptr(); }
};