Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.14.1
-
None
-
x64 Desktop
-
-
c0c2efc3c62432b4ae159b911018682f573b54e4 (qt/qtbase/5.14)
Description
When compiling application against 5.14.1 I receive this warning on msvc compiler:
'return': conversion from 'qsizetype' to 'int', possible loss of data C:\Qt\5.14.1\msvc2017_64\include\QtCore/qstring.h 1125
The code in question:
int QStringView::toWCharArray(wchar_t *array) const { if (sizeof(wchar_t) == sizeof(QChar)) { if (auto src = data()) memcpy(array, src, sizeof(QChar) * size()); return size(); } else { return QString::toUcs4_helper(reinterpret_cast<const ushort *>(data()), int(size()), reinterpret_cast<uint *>(array)); } }
return size();
in this case size() returns a qsizetype, but toWCharArray is expects to return an int. I believe qsizetype is typedefd as size_t. Types therefore mismatch.