QStringConverter: use nameMatch only in one direction

Always pass the fixed strings on the LHS, and whatever the user
supplied on the RHS.

The old code is not wrong, and the new code is equivalent, for now,
but keeping the same order will simplify an eventual port of
nameMatch()/encodingForName() to QAnyStringView.

Pick-to: 6.7 6.5
Change-Id: I9aa338a9c497764d2ad5d97bbd8b36710186b3af
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit c8feef0bb5825102a397787366df74990cfdbf6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2023-10-17 22:14:26 +02:00 committed by Qt Cherry-pick Bot
parent d05985d229
commit f51051bb6b

View File

@ -2247,7 +2247,7 @@ std::optional<QStringConverter::Encoding> QStringConverter::encodingForName(cons
if (nameMatch(encodingInterfaces[i].name, name))
return QStringConverter::Encoding(i);
}
if (nameMatch(name, "latin1"))
if (nameMatch("latin1", name))
return QStringConverter::Latin1;
return std::nullopt;
}