6 Commits

Author SHA1 Message Date
Lucie Gérard
c052ee9032 Change license for tests files
According to QUIP-18 [1], all tests file should be
LicenseRef-Qt-Commercial OR GPL-3.0-only

[1]: https://contribute.qt-project.org/quips/18

Task-number: QTBUG-121787
Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit ff1039c217fb1ae03b701557a5a50c2112555991)
2024-02-09 10:50:13 +01:00
Ivan Solovev
7ccd63fd89 QDataStream: use SizeLimitExceeded status in write operations
Set this status when the stream tries to write more data than the
current serialization format supports.

Update the methods that write containers to return early if they fail
to write the container size, and do not try to serialize the elements.

Convert the manual tst_manualqdatastream test into a data-driven
test, allowing us to specify various stream versions. Adjust the test
code to check that the SizeLimitExceeded status is set when the
stream version is <= Qt_6_6.

Amends fd48ce0b73c74dafd5db27bc1f2752ef665df7ef

Found in 6.7 API review

Change-Id: If4c62ea53ac9bccd423f00f0f03afd6ba6bdc4f5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit dd514160ce169734e23a146a2c115fed55a69260)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-07 15:10:29 +00:00
Ivan Solovev
635be3cdf1 Fix QDataStream::operator<<(const char *) to handle 64-bit length
The operator was not converted to using a new streaming version, so it
supported only 32-bit length.

Fix it and add a manual test for serialization/deserialization of
large c-style strings.

Amends fd48ce0b73c74dafd5db27bc1f2752ef665df7ef

Change-Id: I83704edec021d400b992de810feba5da52d5ffe1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0aaf7092cd077eb07e62d3742293f146c65c9630)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-02-07 15:10:29 +00:00
Ivan Solovev
5073c581af tst_manualqdatastream.cpp: update the license
The file was added in fd48ce0b73c74dafd5db27bc1f2752ef665df7ef
by a TQtC employee, so the header should mention The Qt Company Ltd.

Change-Id: Ib191d2d63656c42f783db87de489814d387dfbca
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit beebf6450c3720029ba5038b46c6db883504a142)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-29 08:52:00 +00:00
Ivan Solovev
06eac4ebc8 tst_manualqdatastream: fix gcc error
GCC has a bug [1] that does not allow to specialize templates
outside of a namespace.
An attempt to build the test results in the following error:

 tst_manualqdatastream.cpp:18:15: error: explicit specialization in
 non-namespace scope ‘class tst_QDataStream’

Fix it by converting the template specializations into simple function
overloads.

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282

Change-Id: I7803cce1687ca8ae992f1a57394346eb6fc90c8b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b9c8c57e3f8f2a07c22059d9c8e7210469198200)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-29 08:51:57 +00:00
Øystein Heskestad
fd48ce0b73 Add support for containers > 4 Gi elements in QDataStream
The format is changed from 6.7 to support more than UINT32_MAX - 1
elements. The format used to have a quint32 size. Now if the size is
larger or equal to 0xfffffffe (2^32 -2) the old size is an extend
value 0xfffffffe followed by one quint64 with the actual value. The
32 bit size with all bits set is still used as null value.

Fixes: QTBUG-105034
Change-Id: I62188be170fe779022ad58ab84a54b1eaf46e5d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-23 15:10:28 +02:00