qt5base-lts/tests/auto/corelib/tools/qstring
João Abecasis 75286739de Fix and simplify QString::mid
'position' was being used to initialize 'n' before being fully
validated. To compensate for this, the code attempted to fix 'n' once
'position' was found to be invalid (negative). This would, however, also
attempt to "fix" a perfectly valid value of 'n'.

By fully validating 'position' beforehand we avoid this trap and can
safely use it to validate and reset 'n', as needed.

Arithmetic for boundary conditions of 'n' was rearranged to avoid
triggering integer overflow.

Removed explicit check for shared_null, as the same behaviour can be
supported without it.

Change-Id: Ie9bff7b8137a74f55c7dcfe629bd569045e28f3c
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-02-14 12:50:14 +01:00
..
.gitignore Moving relevant tests to corelib/tools 2011-09-01 13:07:23 +02:00
double_data.h Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qstring.pro Cleanup corelib autotests 2011-11-11 02:45:05 +01:00
tst_qstring.cpp Fix and simplify QString::mid 2012-02-14 12:50:14 +01:00