Commit Graph

10 Commits

Author SHA1 Message Date
Qt Forward Merge Bot
bef74b6c3a Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia24cc8b86def0d9d9c17d6775cc519e491b860b1
2019-12-09 10:16:01 +01:00
Lars Knoll
20041afe3b Use QArrayDataPointer to implement QByteArray
Change-Id: I2ee28023c2dea9fc3160400112c59a47566a4868
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-12-08 21:51:33 +01:00
Lars Knoll
8e34d49201 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>
2019-12-08 21:51:27 +01:00
Lars Knoll
063e39df13 Get rid of QCharRef and QByteRef
We already detach immediately since change
c2d2757bcc. That basically removes
the main purpose of having QChar/ByteRef, and we can just as well
get rid of those classes for Qt 6.

Change-Id: I8dc566a1948ddc29c0cb8a77ec7310654a7219a4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-12-08 18:20:38 +01:00
Thiago Macieira
00fbc087dd Inline the size and data pointers in QByteArray
Change-Id: I82feeb2c9bd2900f421fc0c8d78698b1e83db043
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-12-08 18:20:04 +01:00
Thiago Macieira
62c673ccc6 Add reference-count manipulation functions to QArrayData and hide ref
The next change will stop using some values in the reference counter as
settings from the data.

Change-Id: I94df1fe643896373fac2f000fff55bc7708fc807
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-12-08 10:29:09 +01:00
Thiago Macieira
a3aa2fcfa7 Introduce the Mutable flag and move QArrayDataPointer::needsDetach
The Mutable flag now contains the information on whether the data this
QArrayData points to is mutable. This decouples the mutability /
immutability setting from the allocation and from the type of data,
opening the way for mutable raw or foreign data.

There are still plenty of places in the source code that check the
size of the allocation when it actually wants d->isMutable(). Fixing
this will require reviewing all the code, so is left for later.

The needsDetach() function is moved to QArrayData and
de-constified. It returns true when a reallocation is necessary if the
data is to be modified.

Change-Id: I17e2bc5a3f6ef1f3eba8a205acd9852b95524f57
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-12-08 10:29:01 +01:00
Lars Knoll
a07925576a Fix qChecksum test
The test passed mostly by accident so far, as the created QByteArray
was shorter than what the test assumed.

Change-Id: I06858801d83a504eadc73ec2be281c88f8ffad5d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-07 14:17:16 +01:00
Giuseppe D'Angelo
b19220d17f QByteArray: add a strict mode to fromBase64
QByteArray::fromBase64 was liberal in its input, simply skipping
over invalid characters. As a side-effect of this, it had
no error reporting, meaning it could not be used to convert
fromBase64 _and_ validate the input in one go.

Add more option flags to make fromBase64 strictly validate
its input. Since we want to know whether it has succeeded
or not, and the existing fromBase64 overloads do not
allow for that, introduce a new function that returns
an optional-like datatype.

While at it: base64 decoding can be done in-place; add an
rvalue overload to enable this use case.

[ChangeLog][QtCore][QByteArray] Added the new fromBase64Encoding
function.

[ChangeLog][QtCore][QByteArray] Added new flags to make
fromBase64 / fromBase64Encoding strictly validate their input,
instead of skipping over invalid characters.

Change-Id: I99cd5f2230f3d62970b28b4cb102913301da6ccd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-05 21:04:50 +01:00
Edward Welbourne
a9aa206b7b Move text-related code out of corelib/tools/ to corelib/text/
This includes byte array, string, char, unicode, locale, collation and
regular expressions.

Change-Id: I8b125fa52c8c513eb57a0f1298b91910e5a0d786
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-10 17:05:30 +02:00