diff options
| author | Ivan Solovev <ivan.solovev@qt.io> | 2024-01-23 16:39:38 +0100 |
|---|---|---|
| committer | Ivan Solovev <ivan.solovev@qt.io> | 2024-01-26 15:10:16 +0100 |
| commit | 36cc9fc54a1b581e5fd9377e0ddbcd1670ab447f (patch) | |
| tree | 973b913490aa1eb3f4c852bf5d19068992ca8ba2 /src/corelib/serialization/qdatastream.cpp | |
| parent | 61130d73d47249fb1106ed86f8da908c96fe11c7 (diff) | |
QDataStream: add a new SizeLimitExceeded status code
This status is supposed to be used when the stream tries to read
or write more data than it is supported by the current platform.
For example, reading more than 2 GiB of data on a 32-bit platform will
result into this status, but it will work fine on a 64-bit platform.
This patch uses the new status in read operations.
Amends fd48ce0b73c74dafd5db27bc1f2752ef665df7ef
Found in 6.7 API review
Pick-to: 6.7
Change-Id: I675b1ee25fafba174ce8f94c3470dbb7893d6d9e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/serialization/qdatastream.cpp')
| -rw-r--r-- | src/corelib/serialization/qdatastream.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp index 0c2174b9723..8d509c13863 100644 --- a/src/corelib/serialization/qdatastream.cpp +++ b/src/corelib/serialization/qdatastream.cpp @@ -222,6 +222,11 @@ QT_BEGIN_NAMESPACE data in the underlying device. \value ReadCorruptData The data stream has read corrupt data. \value WriteFailed The data stream cannot write to the underlying device. + \value [since 6.7] SizeLimitExceeded The data stream cannot read or write + the data because its size is larger than supported + by the current platform. This can happen, for + example, when trying to read more that 2 GiB of + data on a 32-bit platform. */ /***************************************************************************** @@ -1065,7 +1070,7 @@ QDataStream &QDataStream::readBytes(char *&s, qsizetype &l) qsizetype len = qsizetype(length); if (length != len || length < 0) { - setStatus(ReadCorruptData); // Cannot store len in l + setStatus(SizeLimitExceeded); // Cannot store len in l return *this; } |
