QStringBuilder: DRY: simplify the if constexpr conditionals a bit
Both sides of it were calling the same appendTo(), so we can avoid repeating ourselves. This MAY fix a warning with VS2019. Fixes: QTBUG-124117 Change-Id: I40526efc4e93413794c3fffd17c4f9c96ee187f9 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit 2e8c6d467fa245e8bcb81cff63d2d9628e1ee81e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
249b8ff3ff
commit
5edb9a6a0f
@ -109,18 +109,17 @@ private:
|
|||||||
// both QString and QByteArray's data() and constData(). The result is
|
// both QString and QByteArray's data() and constData(). The result is
|
||||||
// the same if len != 0.
|
// the same if len != 0.
|
||||||
auto d = reinterpret_cast<typename T::iterator>(s.data_ptr().data());
|
auto d = reinterpret_cast<typename T::iterator>(s.data_ptr().data());
|
||||||
|
const auto start = d;
|
||||||
|
QConcatenable<QStringBuilder<A, B>>::appendTo(*this, d);
|
||||||
|
|
||||||
if constexpr (QConcatenable<QStringBuilder<A, B>>::ExactSize) {
|
if constexpr (QConcatenable<QStringBuilder<A, B>>::ExactSize) {
|
||||||
QConcatenable<QStringBuilder<A, B>>::appendTo(*this, d);
|
Q_UNUSED(start)
|
||||||
return s;
|
} else {
|
||||||
}
|
if (len != d - start) {
|
||||||
|
// this resize is necessary since we allocate a bit too much
|
||||||
typename T::const_iterator const start = d;
|
// when dealing with variable sized 8-bit encodings
|
||||||
QConcatenable<QStringBuilder<A, B>>::appendTo(*this, d);
|
s.resize(d - start);
|
||||||
if (len != d - start) {
|
}
|
||||||
// this resize is necessary since we allocate a bit too much
|
|
||||||
// when dealing with variable sized 8-bit encodings
|
|
||||||
s.resize(d - start);
|
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user