QBuffer: fix the setData() API re: int/qsizetype
The setData(ptr, n) overload was still taking the size as int. Widen it. Task-number: QTBUG-103525 Change-Id: If1d6d6404d62bbae5e0defea9a2115648c1fd5da Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This commit is contained in:
parent
3be99799a6
commit
817e47fbcd
@ -285,6 +285,8 @@ QT_WARNING_POP
|
||||
|
||||
#if QT_CORE_REMOVED_SINCE(6, 5)
|
||||
|
||||
#include "qbuffer.h" // inline removed API
|
||||
|
||||
#include "qenvironmentvariables.h"
|
||||
|
||||
bool qputenv(const char *varName, const QByteArray &value)
|
||||
|
@ -267,12 +267,15 @@ void QBuffer::setData(const QByteArray &data)
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void QBuffer::setData(const char *data, int size)
|
||||
\fn void QBuffer::setData(const char *data, qsizetype size)
|
||||
|
||||
\overload
|
||||
|
||||
Sets the contents of the internal buffer to be the first \a size
|
||||
bytes of \a data.
|
||||
|
||||
\note In Qt versions prior to 6.5, this function took the length as
|
||||
an \c{int} parameter, potentially truncating sizes.
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -33,7 +33,11 @@ public:
|
||||
void setBuffer(QByteArray *a);
|
||||
|
||||
void setData(const QByteArray &data);
|
||||
inline void setData(const char *data, int len);
|
||||
#if QT_CORE_REMOVED_SINCE(6, 5) && QT_POINTER_SIZE != 4
|
||||
void setData(const char *data, int len) { setData(data, qsizetype(len)); }
|
||||
#endif
|
||||
void setData(const char *data, qsizetype len)
|
||||
{ setData(QByteArray(data, len)); }
|
||||
const QByteArray &data() const;
|
||||
|
||||
bool open(OpenMode openMode) override;
|
||||
@ -60,9 +64,6 @@ private:
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_emitSignals())
|
||||
};
|
||||
|
||||
inline void QBuffer::setData(const char *adata, int alen)
|
||||
{ setData(QByteArray(adata, alen)); }
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBUFFER_H
|
||||
|
Loading…
Reference in New Issue
Block a user