Fix QLocale's findLocaleDataById(): skip likely sub-tag look-up

It was always called in pairs, first with likely sub-tags added, then
with the base that started from. So doing a likely sub-tag lookup
inside the function was redundant for the former while making the
latter redundant - and it's needed.

Task-number: QTBUG-84669
Pick-to: 5.15
Change-Id: I18bf1d4976a51d9436efd20d1a84a36cfc60f618
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2020-10-12 17:28:03 +02:00
parent 78b58d4de1
commit 55e16b25f5

View File

@ -359,10 +359,8 @@ QByteArray QLocalePrivate::rawName(char separator) const
return parts.join(separator);
}
static const QLocaleData *findLocaleDataById(const QLocaleId &lid)
static const QLocaleData *findLocaleDataById(const QLocaleId &localeId)
{
QLocaleId localeId = lid.withLikelySubtagsAdded();
const uint idx = locale_index[localeId.language_id];
if (idx == 0) // default language has no associated script or country
return locale_data;