mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42:55 +00:00
de-inline QBuffer::setData() overload for performance reasons
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
82907043ec
commit
2f18658551
2 changed files with 12 additions and 6 deletions
|
@ -294,7 +294,7 @@ const QByteArray &QBuffer::data() const
|
|||
*/
|
||||
void QBuffer::setData(const QByteArray &data)
|
||||
{
|
||||
if (isOpen()) {
|
||||
if (Q_UNLIKELY(isOpen())) {
|
||||
qWarning("QBuffer::setData: Buffer is open");
|
||||
return;
|
||||
}
|
||||
|
@ -303,13 +303,20 @@ void QBuffer::setData(const QByteArray &data)
|
|||
}
|
||||
|
||||
/*!
|
||||
\fn void QBuffer::setData(const char *data, int size)
|
||||
|
||||
\overload
|
||||
|
||||
Sets the contents of the internal buffer to be the first \a size
|
||||
bytes of \a data.
|
||||
bytes of \a data, does not copy the data.
|
||||
*/
|
||||
void QBuffer::setData(const char *data, const int len)
|
||||
{
|
||||
if (Q_UNLIKELY(isOpen())) {
|
||||
qWarning("QBuffer::setData: Buffer is open");
|
||||
return;
|
||||
}
|
||||
Q_D(QBuffer);
|
||||
d->buf->setRawData(data, len);
|
||||
}
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
|
|
|
@ -63,8 +63,7 @@ public:
|
|||
void setBuffer(QByteArray *a);
|
||||
|
||||
void setData(const QByteArray &data);
|
||||
inline void setData(const char *data, const int len)
|
||||
{ setData(QByteArray::fromRawData(data, len)); }
|
||||
void setData(const char *data, const int len);
|
||||
const QByteArray &data() const;
|
||||
|
||||
bool open(OpenMode openMode);
|
||||
|
|
Loading…
Add table
Reference in a new issue