QStringConverter: make a narrowing conversion explicit
Int variables are a code smell these days, so make the narrowing conversion (from ptrdiff_t to int) explicit and add a comment. Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-105105 Change-Id: Ia4e14f1cc132ca36d15e9684bfcb4605d7b9251f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
42fbd063e2
commit
eb55e2980e
@ -1218,7 +1218,7 @@ static QString convertToUnicodeCharByChar(QByteArrayView in, QStringConverter::S
|
||||
QString s;
|
||||
while ((next = CharNextExA(CP_ACP, mb, 0)) != mb) {
|
||||
wchar_t wc[2] ={0};
|
||||
int charlength = next - mb;
|
||||
int charlength = int(next - mb); // always just a few bytes
|
||||
int len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, mb, charlength, wc, 2);
|
||||
if (len>0) {
|
||||
s.append(QChar(wc[0]));
|
||||
|
Loading…
Reference in New Issue
Block a user