From f51051bb6b9047eae5a59e28b13935542a4e1266 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 17 Oct 2023 22:14:26 +0200 Subject: [PATCH] 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 (cherry picked from commit c8feef0bb5825102a397787366df74990cfdbf6e) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qstringconverter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp index 67c75d708e1..a960899e59d 100644 --- a/src/corelib/text/qstringconverter.cpp +++ b/src/corelib/text/qstringconverter.cpp @@ -2247,7 +2247,7 @@ std::optional 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; }