QLocal8Bit::convertFromUnicode[win]: Drop UsedDefaultChar argument

We don't use the value, and the docs[0] say that we get the best
performance if we don't pass the argument.

[0] https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte#remarks
See table

Pick-to: 6.6 6.5
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I3eb5e023a936fe3def5169e3fb492a62708bbf44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Mårten Nordheim 2023-10-20 15:46:13 +02:00
parent ab009f2f03
commit 36a6522b48
1 changed files with 5 additions and 5 deletions

View File

@ -1396,15 +1396,15 @@ QByteArray QLocal8Bit::convertFromUnicode_sys(QStringView in, quint32 codePage,
return QByteArray();
if (uclen == 0)
return QByteArray("");
BOOL used_def;
QByteArray mb(4096, 0);
int len;
while (!(len = WideCharToMultiByte(codePage, 0, ch, uclen, mb.data(), mb.size() - 1, 0,
&used_def))) {
while (!(len = WideCharToMultiByte(codePage, 0, ch, uclen, mb.data(), mb.size() - 1, nullptr,
nullptr))) {
int r = GetLastError();
if (r == ERROR_INSUFFICIENT_BUFFER) {
mb.resize(1+WideCharToMultiByte(codePage, 0, ch, uclen, 0, 0, 0, &used_def));
// and try again...
mb.resize(1
+ WideCharToMultiByte(codePage, 0, ch, uclen, nullptr, 0, nullptr, nullptr));
// and try again...
} else {
// Fail. Probably can't happen in fact (dwFlags is 0).
#ifndef QT_NO_DEBUG