QLocale/Win: fix truncation bug in winIso639LangName()
The qstrtoull() function returns ulonglong, not int, so we'd be incorrectly detecting 0x1'0000'0814 as NyNorsk. Paranoia? Sure. Fix by using auto to hold the result. As a drive-by, make the QByteArray const so .data() doesn't attempt to detach(), and shorten a long variable name to stay within line-length limitations. Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-103531 Change-Id: I740d0c5934e54c9f716688fa9c00de0ac4029936 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
1a40bc37d4
commit
87fabf3e4b
@ -1075,8 +1075,8 @@ static QString winIso639LangName(LCID id)
|
||||
if (!lang_code.isEmpty()) {
|
||||
const char *endptr;
|
||||
bool ok;
|
||||
QByteArray latin1_lang_code = std::move(lang_code).toLatin1();
|
||||
int i = qstrntoull(latin1_lang_code.data(), latin1_lang_code.size(), &endptr, 16, &ok);
|
||||
const QByteArray latin1 = std::move(lang_code).toLatin1();
|
||||
const auto i = qstrntoull(latin1.data(), latin1.size(), &endptr, 16, &ok);
|
||||
if (ok && *endptr == '\0') {
|
||||
switch (i) {
|
||||
case 0x814:
|
||||
|
Loading…
Reference in New Issue
Block a user