diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2020-08-11 14:42:44 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2020-08-13 20:37:50 +0300 |
commit | 707d29d5d7824063c6dd84295cc82636444e6d6a (patch) | |
tree | 455ba92175276c88f2ec490c5f85dfef8aa6f24c /src/corelib/io | |
parent | 1df02b5f980b01a4e42f32061f1cba696b6a22e9 (diff) |
De-inline QIODevice::write(const QByteArray &)
Since QRingBuffer is used as a temporary store for data to be written
to a buffered device, we can implement a "zero-copy" strategy between
the user-space code and QIODevice's internal write buffer. As a first
step, we should have an entry point, where we can implement a possible
solution.
Change-Id: I1c658c13accc98c65a802be943688359cc9f9917
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 8 | ||||
-rw-r--r-- | src/corelib/io/qiodevice.h | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 21718fede2..c29501404b 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1739,8 +1739,7 @@ qint64 QIODevice::write(const char *data) return write(data, qstrlen(data)); } -/*! \fn qint64 QIODevice::write(const QByteArray &byteArray) - +/*! \overload Writes the content of \a byteArray to the device. Returns the number of @@ -1749,6 +1748,11 @@ qint64 QIODevice::write(const char *data) \sa read(), writeData() */ +qint64 QIODevice::write(const QByteArray &data) +{ + return write(data.constData(), data.size()); +} + /*! Puts the character \a c back into the device, and decrements the current position unless the position is 0. This function is diff --git a/src/corelib/io/qiodevice.h b/src/corelib/io/qiodevice.h index e8c8dc11bf..7012bbacba 100644 --- a/src/corelib/io/qiodevice.h +++ b/src/corelib/io/qiodevice.h @@ -133,8 +133,7 @@ public: qint64 write(const char *data, qint64 len); qint64 write(const char *data); - inline qint64 write(const QByteArray &data) - { return write(data.constData(), data.size()); } + qint64 write(const QByteArray &data); qint64 peek(char *data, qint64 maxlen); QByteArray peek(qint64 maxlen); |