qt5base-lts/tests/auto
Marc Mutz cce7e35253 Q(Static)ByteArrayMatcher: manage indexIn() overloads
Unlike QString and QStringView, QByteArrayView and QByteArray don't
overload well.

Solve the overload issue the usual way: by making the QByteArray one a
Q_WEAK_OVERLOAD. This is trivial for QStaticByteArrayMatcher, which
isn't exported, but require QT_REMOVED_SINCE magic for
QByteArrayMatcher, which is.

The additional const char* overload has shielded us from the worst
fall-out so far, it seems, but it makes for a truly horrible overload
set:

    matcher.indexIn(str, 3);

Q: Is the 3 here the length of the haystack or the value of the from
parameter?

A: It depends on decltype(str)!

If the (const char*, qsizetype, qsizetype=0) overload is the better
match, then 3 limits the haystack's length.

If, otoh, the (QByteArray(View), qsizetype) overload is the better
match, then it's the value of the from parameter.

As if this wasn't bad enough, QByteArray implcitly converts to const
char* by default!

A follow-up patch will therefore deprecate the (ptr, size) overloads,
so we de-inline the QByteArrayView ones to avoid having to touch the
implementation once more.

Found during 6.3 API review.

Pick-to: 6.3
Change-Id: I9640e0bdd298d651511adebcc85f314db9221d34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-23 09:48:28 +01:00
..
bic/data Add BC files for 6.2.0 2022-01-07 13:31:38 +00:00
cmake Fix dependency chain that collects the metatype json files 2021-12-02 16:34:23 +01:00
concurrent QtConcurrent::run crashes on program exit 2021-12-20 13:18:26 +01:00
corelib Q(Static)ByteArrayMatcher: manage indexIn() overloads 2022-01-23 09:48:28 +01:00
dbus tests: Remove unused SRCDIR defines 2021-08-17 12:41:57 +00:00
gui Remove unused .qrc files 2022-01-17 23:17:01 +01:00
guiapplauncher Move QStateMachine from QtCore to QtScxml 2020-08-24 20:10:25 +02:00
network Remove unused .qrc files 2022-01-17 23:17:01 +01:00
opengl Remove the qmake project files 2021-01-07 15:32:28 +01:00
other QIODevice: use QVLA to hold the ring buffers, not QList 2021-12-15 17:35:13 +00:00
printsupport QtBase: replace windows.h with qt_windows.h 2021-11-23 12:53:46 +08:00
shared Remove false Q_UNREACHABLE from shaping code 2021-02-03 09:44:44 +01:00
sql Adapt SQL drivers to Qt 6 change of QVariant::isNull 2022-01-12 17:41:07 +01:00
testlib Tidy up tst_Warnings: comments and #if-ery 2022-01-21 16:17:48 +01:00
tools Remove unused .qrc files 2022-01-17 23:17:01 +01:00
widgets Remove flaky and duplicate animateClick tests 2022-01-21 18:53:34 +01:00
xml QDomDocument::setContent: Open device if necessary 2021-11-09 18:33:39 +01:00
CMakeLists.txt Don't build tests/auto/tools when cross-compiling 2021-10-07 08:03:40 +02:00
network-settings.h Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00