diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-07-09 21:04:57 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-08-27 18:58:21 +0200 |
commit | 3964ece5a566d1ed517406f0ff713f6f184628ae (patch) | |
tree | 2ca04d8fd7e1913b9bb73acd8b10fe836cac3837 /src | |
parent | 03a09377548792aa042c67aabd6874f5c3d6ef25 (diff) | |
download | qtbase-3964ece5a566d1ed517406f0ff713f6f184628ae.tar.gz |
Pass QByteArrayView by value
Change-Id: I65df03e7781bac63d98b8d3b59568841601d8f25
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/text/qbytearray.cpp | 4 | ||||
-rw-r--r-- | src/corelib/text/qbytearray.h | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 16672683e9..b5894da8bb 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -2538,7 +2538,7 @@ qsizetype QtPrivate::count(QByteArrayView haystack, QByteArrayView needle) noexc return num; } -/*! \fn qsizetype QByteArray::count(QByteArrayView &bv) const +/*! \fn qsizetype QByteArray::count(QByteArrayView bv) const \since 6.0 Returns the number of (potentially overlapping) occurrences of the @@ -2568,7 +2568,7 @@ qsizetype QByteArray::count(char ch) const */ /*! - \fn int QByteArray::compare(const QByteArrayView &bv, Qt::CaseSensitivity cs = Qt::CaseSensitive) const + \fn int QByteArray::compare(QByteArrayView bv, Qt::CaseSensitivity cs = Qt::CaseSensitive) const \since 6.0 Returns an integer less than, equal to, or greater than zero depending on diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index 6ba078f329..36719aafd7 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -210,10 +210,10 @@ public: inline bool contains(char c) const; inline bool contains(QByteArrayView bv) const; qsizetype count(char c) const; - qsizetype count(const QByteArrayView &bv) const + qsizetype count(QByteArrayView bv) const { return QtPrivate::count(qToByteArrayViewIgnoringNull(*this), bv); } - inline int compare(const QByteArrayView &a, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + inline int compare(QByteArrayView a, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; Q_REQUIRED_RESULT QByteArray left(qsizetype len) const; Q_REQUIRED_RESULT QByteArray right(qsizetype len) const; @@ -552,7 +552,7 @@ inline bool QByteArray::contains(char c) const { return indexOf(c) != -1; } inline bool QByteArray::contains(QByteArrayView bv) const { return indexOf(bv) != -1; } -inline int QByteArray::compare(const QByteArrayView &a, Qt::CaseSensitivity cs) const noexcept +inline int QByteArray::compare(QByteArrayView a, Qt::CaseSensitivity cs) const noexcept { return cs == Qt::CaseSensitive ? QtPrivate::compareMemory(*this, a) : qstrnicmp(data(), size(), a.data(), a.size()); |