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. 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> (cherry picked from commit 87fabf3e4b7a5ccc00a7b76b4098e2174e4514d8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
2e1699d3b0
commit
5f56cff243
@ -1072,8 +1072,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…
x
Reference in New Issue
Block a user