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. Task-number: QTBUG-105105 Change-Id: Ia4e14f1cc132ca36d15e9684bfcb4605d7b9251f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit eb55e2980efc435f8728838910272e32287a841d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d31b750f4d
commit
f26c254feb
@ -1219,7 +1219,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…
x
Reference in New Issue
Block a user