summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qvector.h')
-rw-r--r--src/corelib/tools/qvector.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index c2cdcba41d..b502a86442 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -710,8 +710,10 @@ int QVector<T>::lastIndexOf(const T &t, int from) const noexcept
template <typename T>
inline QVector<T> QVector<T>::mid(int pos, int len) const
{
+ qsizetype p = pos;
+ qsizetype l = len;
using namespace QtPrivate;
- switch (QContainerImplHelper::mid(d.size, &pos, &len)) {
+ switch (QContainerImplHelper::mid(d.size, &p, &l)) {
case QContainerImplHelper::Null:
case QContainerImplHelper::Empty:
return QVector();
@@ -722,8 +724,8 @@ inline QVector<T> QVector<T>::mid(int pos, int len) const
}
// Allocate memory
- DataPointer copied(Data::allocate(len));
- copied->copyAppend(constBegin() + pos, constBegin() + pos + len);
+ DataPointer copied(Data::allocate(l));
+ copied->copyAppend(constBegin() + p, constBegin() + p + l);
return copied;
}