6 Commits

Author SHA1 Message Date
Ivan Solovev
0aaf7092cd 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

Pick-to: 6.7
Change-Id: I83704edec021d400b992de810feba5da52d5ffe1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-02-07 15:02:19 +01:00
Ivan Solovev
dd514160ce 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

Pick-to: 6.7
Change-Id: If4c62ea53ac9bccd423f00f0f03afd6ba6bdc4f5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-07 15:02:19 +01:00
Lucie Gérard
ff1039c217 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

Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2024-02-04 09:56:42 +01:00
Ivan Solovev
b9c8c57e3f 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

Pick-to: 6.7
Change-Id: I7803cce1687ca8ae992f1a57394346eb6fc90c8b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-26 15:10:22 +01:00
Ivan Solovev
beebf6450c 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.

Pick-to: 6.7
Change-Id: Ib191d2d63656c42f783db87de489814d387dfbca
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-26 15:10:19 +01: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