summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-06-19 15:14:45 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2020-06-19 19:37:51 +0200
commit5b686e208ffc68f9f660d36c468280d50a40e3ad (patch)
tree5f88adfd32419a4d08db4c1c4dc44f0752718690
parent96065b722711d5cf42542bef65d80b25a627f23c (diff)
Don't truncate parameters passed to QStringView::{first/last/from/slice}
QStringView doesn't need to convert qsizetype parameters to int. Change-Id: Iba8b5259ab3ed7a24a57bb6748446fd3e45bb182 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/text/qstringview.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h
index 67c4825413..8047050b8c 100644
--- a/src/corelib/text/qstringview.h
+++ b/src/corelib/text/qstringview.h
@@ -277,13 +277,13 @@ public:
}
Q_REQUIRED_RESULT constexpr QStringView first(qsizetype n) const
- { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data, int(n)); }
+ { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data, n); }
Q_REQUIRED_RESULT constexpr QStringView last(qsizetype n) const
- { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data + size() - n, int(n)); }
+ { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data + size() - n, n); }
Q_REQUIRED_RESULT constexpr QStringView from(qsizetype pos) const
- { Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QStringView(m_data + pos, size() - int(pos)); }
+ { Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QStringView(m_data + pos, size() - pos); }
Q_REQUIRED_RESULT constexpr QStringView sliced(qsizetype pos, qsizetype n) const
- { Q_ASSERT(pos >= 0); Q_ASSERT(n >= 0); Q_ASSERT(size_t(pos) + size_t(n) <= size_t(size())); return QStringView(m_data + pos, int(n)); }
+ { Q_ASSERT(pos >= 0); Q_ASSERT(n >= 0); Q_ASSERT(size_t(pos) + size_t(n) <= size_t(size())); return QStringView(m_data + pos, n); }
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView chopped(qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data, m_size - n); }