qt5base-lts/tests/auto/corelib
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
..
animation tst_qanimationgroup: fix memleaks 2022-01-05 08:22:00 +01:00
global tst_qglobalstatic is halted on INTEGRITY device 2021-12-20 10:14:38 +02:00
io Remove unused .qrc files 2022-01-17 23:17:01 +01:00
itemmodels tst_QItemModel: fix memleaks 2022-01-05 08:22:00 +01:00
kernel tst_QMetaType: remove call to pthread_yield() 2022-01-19 20:57:19 -08:00
mimetypes Remove unused .qrc files 2022-01-17 23:17:01 +01:00
platform Android: Add runOnMainAndroidThread() under QNativeInterface 2021-05-26 23:24:11 +00:00
plugin QFactoryLoader: add setExtraSearchPath() (for QPA plugins' use) 2022-01-20 15:53:48 -08:00
serialization JSON: Further improve the duplicate handling in the parser 2022-01-21 00:53:49 +01:00
text Q(Static)ByteArrayMatcher: manage indexIn() overloads 2022-01-23 09:48:28 +01:00
thread Fix memory leaks when capturing a QFuture in its continuation 2022-01-21 01:51:20 +01:00
time Use Q_INT64_C() to express qint64 constants 2022-01-21 21:45:11 +01:00
tools QVersionNumber: port fromString() to QAnyStringView 2022-01-18 01:31:33 +01:00
CMakeLists.txt Add tests for QAndroidApplication's sdkVersion and activity 2021-05-13 01:41:36 +03:00