From 71fb3633e8d909e9a91e1bee6eaf53c146f25998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Fri, 14 Feb 2014 16:32:31 +0100 Subject: Unify all mid() functions in QtBase. Up to now, Qt had at least 3 different implementations of the mid(). Only QString::mid implementation was not crashing on edge cases and was protected against overflows, therefore I picked that one as the base implementation, even if it has weird semantics for an invalid input. As a side effect QVector::mid was slightly optimized to not detach in all cases (which follows current QList behavior). Documentation of QVector::mid and QList::mid was updated to not mention "copy of data" which could suggest that the mid() result is detached. QStringRef::mid was fixed and now it follows general Qt behavior, by returning a null value for a null input. Change-Id: Ie9ff5d98372bd193d66508e6dd92b6ed1180ad9b Reviewed-by: Thiago Macieira --- src/corelib/tools/qlist.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib/tools/qlist.cpp') diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index 0811c3793e..db49fe9802 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -491,11 +491,11 @@ void **QListData::erase(void **xi) /*! \fn QList QList::mid(int pos, int length) const - Returns a list whose elements are copied from this list, + Returns a sub-list which includes elements from this list, starting at position \a pos. If \a length is -1 (the default), all - elements from \a pos are copied; otherwise \a length elements (or + elements from \a pos are included; otherwise \a length elements (or all remaining elements if there are less than \a length elements) - are copied. + are included. */ /*! \fn QList::QList() -- cgit v1.2.3