diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/corelib/compat/removed_api.cpp | 14 | ||||
| -rw-r--r-- | src/corelib/global/qtdeprecationmarkers.h | 14 | ||||
| -rw-r--r-- | src/corelib/serialization/qdatastream.cpp | 22 | ||||
| -rw-r--r-- | src/corelib/serialization/qdatastream.h | 5 |
4 files changed, 40 insertions, 15 deletions
diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index 1aeff6970d8..1031b2a6093 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -706,20 +706,6 @@ bool QDateTime::precedes(const QDateTime &other) const #include "qdatastream.h" -QDataStream &QDataStream::readBytes(char *&s, uint &l) -{ - qint64 length = 0; - (void)readBytes(s, length); - if (length != qint64(uint(length))) { - setStatus(ReadCorruptData); // Cannot store length in l - delete[] s; - l = 0; - return *this; - } - l = uint(length); - return *this; -} - QDataStream &QDataStream::writeBytes(const char *s, uint len) { return writeBytes(s, qint64(len)); diff --git a/src/corelib/global/qtdeprecationmarkers.h b/src/corelib/global/qtdeprecationmarkers.h index a480a18eaec..6df5ebce6d2 100644 --- a/src/corelib/global/qtdeprecationmarkers.h +++ b/src/corelib/global/qtdeprecationmarkers.h @@ -211,6 +211,14 @@ QT_BEGIN_NAMESPACE # define QT_DEPRECATED_VERSION_6_10 #endif +#if QT_WARN_DEPRECATED_UP_TO >= QT_VERSION_CHECK(6, 11, 0) +# define QT_DEPRECATED_VERSION_X_6_11(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_11 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_11(text) +# define QT_DEPRECATED_VERSION_6_11 +#endif + #define QT_DEPRECATED_VERSION_X_5(minor, text) QT_DEPRECATED_VERSION_X_5_##minor(text) #define QT_DEPRECATED_VERSION_X(major, minor, text) QT_DEPRECATED_VERSION_X_##major##_##minor(text) @@ -313,6 +321,12 @@ QT_BEGIN_NAMESPACE # define QT_IF_DEPRECATED_SINCE_6_10(whenTrue, whenFalse) whenTrue #endif +#if QT_DEPRECATED_SINCE(6, 11) +# define QT_IF_DEPRECATED_SINCE_6_11(whenTrue, whenFalse) whenFalse +#else +# define QT_IF_DEPRECATED_SINCE_6_11(whenTrue, whenFalse) whenTrue +#endif + #ifdef __cplusplus // A tag to help mark stuff deprecated (cf. QStringViewLiteral) namespace QtPrivate { diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp index dcfa292f154..7d25a04978f 100644 --- a/src/corelib/serialization/qdatastream.cpp +++ b/src/corelib/serialization/qdatastream.cpp @@ -1037,7 +1037,29 @@ QDataStream &QDataStream::operator>>(char32_t &c) return *this; } +#if QT_DEPRECATED_SINCE(6, 11) + +/* + \deprecated [6.11] Use an overload that takes qint64 length instead. +*/ +QDataStream &QDataStream::readBytes(char *&s, uint &l) +{ + qint64 length = 0; + (void)readBytes(s, length); + if (length != qint64(uint(length))) { + setStatus(SizeLimitExceeded); // Cannot store length in l + delete[] s; + l = 0; + return *this; + } + l = uint(length); + return *this; +} + +#endif // QT_DEPRECATED_SINCE(6, 11) + /*! + \since 6.7 Reads the buffer \a s from the stream and returns a reference to the stream. diff --git a/src/corelib/serialization/qdatastream.h b/src/corelib/serialization/qdatastream.h index 217bdab7d34..e5b87cb76eb 100644 --- a/src/corelib/serialization/qdatastream.h +++ b/src/corelib/serialization/qdatastream.h @@ -177,8 +177,11 @@ public: QDataStream &operator<<(char32_t c); QDataStream &operator<<(const volatile void *) = delete; -#if QT_CORE_REMOVED_SINCE(6, 7) +#if QT_DEPRECATED_SINCE(6, 11) + QT_DEPRECATED_VERSION_X_6_11("Use an overload that takes qint64 length.") QDataStream &readBytes(char *&, uint &len); +#endif +#if QT_CORE_REMOVED_SINCE(6, 7) QDataStream &writeBytes(const char *, uint len); int skipRawData(int len); int readRawData(char *, int len); |
