QLocal8Bit::convertToUnicode[win]: Fix order of growth and saturate
The order was wrong so we could have ended up saturating a 0 before we grew to 1. Since this has never been in a release it is of no concern, and it was already an edge-case anyway. Amends 1090d5dd4ae5be898d4566314eda43b0283709d9 Pick-to: 6.7 6.6 6.5 Change-Id: I4b70f9018c3049697495a58313af148f8366c8bb Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
f4f70c3e85
commit
0d6b64bec6
@ -1365,10 +1365,10 @@ QString QLocal8Bit::convertToUnicode_sys(QByteArrayView in, quint32 codePage,
|
||||
// encounter an error
|
||||
int nextIn = qt_saturate<int>(mblen);
|
||||
while (mblen > 0) {
|
||||
const int nextOut = qt_saturate<int>(outlen);
|
||||
std::tie(out, outlen) = growOut(1); // Need space for at least one character
|
||||
if (!out)
|
||||
return {};
|
||||
const int nextOut = qt_saturate<int>(outlen);
|
||||
len = MultiByteToWideChar(codePage, MB_ERR_INVALID_CHARS, mb, nextIn, out, nextOut);
|
||||
if (len) {
|
||||
mb += nextIn;
|
||||
|
Loading…
x
Reference in New Issue
Block a user