qt6-bb10/tests/auto/corelib/tools
Edward Welbourne e21bf5e6b3 QString::replace(): protect sought text and replacement
When replacing each copy of one text with a copy of another, we do so
in batches of 1024; if we get more than one batch, we need to keep a
copy of the sought text and replacement if they're part of the string
we're modifying, for use in later batches.

Also do the replacements in full batches of 1024, not 1023 (which left
the last entry in an array unused); marked some related tests as
(un)likely; and move some repeated code out into a pair of little
local functions to save duplcation.

Those new functions can also serve replace_helper(); and it can shed a
const_cast and some conditioning of free() by using them the same way
replace() now does.  (There was also one place it still used the raw
after, rather than the replacement copy; which could have produced
errors if memcpy were to exercise its right to assume no overlap in
arrays.  This error is what prompted me to notice all of the above.)

Added tests.  The last error proved untestable as my memcpy is in fact
as fussy as memmove.  The first two tests added were attempts to get a
failure out of it.  The third did get a failure, but also tripped over
the problem in replace() itself.  Added to an existing test function
and renamed it to generally cover extra tests for replace.

Change-Id: I9ba6928c84ece266dbbe52b91e333ea54ab6d95e
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-07-12 10:22:25 +00:00
..
collections tst_collections: "explicit instantiation of 'NS::QList' must occur in namespace 'NS'" 2015-12-23 08:35:49 +00:00
qalgorithms Purge extraneous execute permissions. 2015-09-30 18:26:21 +00:00
qarraydata Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTS 2016-05-08 04:25:27 +00:00
qarraydata_strictiterators
qbitarray Update copyright headers 2015-02-11 06:49:51 +00:00
qbytearray QByteArray: add {const_,reverse_iterator}, {c,}r{begin,end}() 2015-07-07 05:22:08 +00:00
qbytearraylist Update copyright headers 2015-02-11 06:49:51 +00:00
qbytearraymatcher Update copyright headers 2015-02-11 06:49:51 +00:00
qbytedatabuffer Update copyright headers 2015-02-11 06:49:51 +00:00
qcache Update copyright headers 2015-02-11 06:49:51 +00:00
qchar Update Unicode data & algorithms up to v8.0 2015-11-05 08:25:02 +00:00
qcollator Replace MAC OS X with OS X 2015-06-30 07:33:31 +00:00
qcommandlineparser QCommandLineOption: optimize ctors 2015-06-19 16:29:50 +00:00
qcontiguouscache Fix compilation of QContiguousCache::operator= 2015-05-20 17:23:33 +00:00
qcryptographichash Update copyright headers 2015-02-11 06:49:51 +00:00
qdate QDate: fix calculation of the week number for the last days of 2020 2016-01-09 09:13:44 +00:00
qdatetime Remove a mis-placed QSKIP(). 2016-02-26 09:22:35 +00:00
qeasingcurve Remove the tests for Ubuntu Oneiric (11.10) 2015-03-17 01:26:13 +00:00
qelapsedtimer Update copyright headers 2015-02-11 06:49:51 +00:00
qexplicitlyshareddatapointer Update copyright headers 2015-02-11 06:49:51 +00:00
qfreelist Update copyright headers 2015-02-11 06:49:51 +00:00
qhash Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTS 2016-05-08 04:25:27 +00:00
qhash_strictiterators
qhashfunctions QHashFunctions: test for hash equality of null and empty string types 2016-07-11 20:02:15 +00:00
qlatin1string Use correct test to add C++14 to the project configuration 2015-12-01 15:46:31 +00:00
qline Update copyright headers 2015-02-11 06:49:51 +00:00
qlinkedlist Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTS 2016-05-08 04:25:27 +00:00
qlist Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTS 2016-05-08 04:25:27 +00:00
qlist_strictiterators
qlocale Cleanup testcase for platforms without QProcess support. 2016-02-09 15:45:17 +00:00
qmap Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTS 2016-05-08 04:25:27 +00:00
qmap_strictiterators
qmargins Update copyright headers 2015-02-11 06:49:51 +00:00
qmessageauthenticationcode Update copyright headers 2015-02-11 06:49:51 +00:00
qpair QPair: add test for pair of references 2016-07-11 20:02:41 +00:00
qpoint Update copyright headers 2015-02-11 06:49:51 +00:00
qpointf Fix build of tests on QNX. 2015-03-14 07:05:34 +00:00
qqueue Update copyright headers 2015-02-11 06:49:51 +00:00
qrect QRect: fix UB (int overflow) in center() 2016-03-15 11:23:46 +00:00
qregexp Add qHash(QRegExp) and qHash(QRegularExpression) 2015-05-05 13:59:31 +00:00
qregularexpression Merge remote-tracking branch 'origin/5.5' into 5.6 2015-08-26 20:06:57 +02:00
qringbuffer Q_(U)INT64_C is not a type, so don't use it as if it was 2016-07-06 10:34:38 +00:00
qscopedpointer Update copyright headers 2015-02-11 06:49:51 +00:00
qscopedvaluerollback Update copyright headers 2015-02-11 06:49:51 +00:00
qset QLinkedList/QSet: add {const_,}reverse_iterator, {c,}r{begin,end}() 2015-10-13 18:07:20 +00:00
qsharedpointer Merge remote-tracking branch 'origin/5.5' into 5.6 2016-01-19 10:03:01 +01:00
qsize Update copyright headers 2015-02-11 06:49:51 +00:00
qsizef Update copyright headers 2015-02-11 06:49:51 +00:00
qstl Update copyright headers 2015-02-11 06:49:51 +00:00
qstring QString::replace(): protect sought text and replacement 2016-07-12 10:22:25 +00:00
qstring_no_cast_from_bytearray Update copyright headers 2015-02-11 06:49:51 +00:00
qstringbuilder tst_QStringBuilder: add a check for self-assignment 2016-04-07 07:02:38 +00:00
qstringiterator Update copyright headers 2015-02-11 06:49:51 +00:00
qstringlist Update copyright headers 2015-02-11 06:49:51 +00:00
qstringmatcher Update copyright headers 2015-02-11 06:49:51 +00:00
qstringref QStringRef: add truncate() 2015-06-19 05:41:41 +00:00
qtextboundaryfinder Update Unicode data files to v8.0 2015-11-05 08:24:58 +00:00
qtime Avoid overflow in QTime::addSecs with too big a number of seconds 2015-08-19 22:13:40 +00:00
qtimeline Improve tst_qtimeline::setPaused resilience 2016-05-04 09:26:57 +00:00
qtimezone Fix parsing of tzfile(5) POSIX rule zone names with bracket quotes 2016-05-24 19:31:40 +00:00
qvarlengtharray Merge remote-tracking branch 'origin/5.5' into HEAD 2015-07-17 16:35:42 +02:00
qvector Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTS 2016-05-08 04:25:27 +00:00
qvector_strictiterators
qversionnumber Use correct test to add C++14 to the project configuration 2015-12-01 15:46:31 +00:00
tools.pro QLatin1String: add test 2015-10-19 15:55:21 +00:00