Fix some signed/unsigned mismatches

In jni_android.cpp, the qstrlen() function returns size_t, the
QByteArray ctor takes qsizetype, so int was wrong for both.

In QBluetoothserviceInfo/WinRT, compare quint32 to size_t, not
qsizetype.

Pick-to: 6.3
Change-Id: I4922d3c678d539b5f0ef9c80b50bf10b04e9f32d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2022-04-12 15:38:25 +02:00
parent 5abc1f3547
commit 0e93245c20
2 changed files with 4 additions and 4 deletions

View File

@ -132,9 +132,9 @@ QJniObject valueForStaticField(JavaNames javaName, JavaNames javaFieldName)
return QJniObject();
}
int offset_class = qstrlen(className);
int offset_field = qstrlen(fieldName);
QByteArray key(offset_class + offset_field, Qt::Uninitialized);
const size_t offset_class = qstrlen(className);
const size_t offset_field = qstrlen(fieldName);
QByteArray key(qsizetype(offset_class + offset_field), Qt::Uninitialized);
memcpy(key.data(), className, offset_class);
memcpy(key.data()+offset_class, fieldName, offset_field);

View File

@ -158,7 +158,7 @@ bool writeStringHelper(const QString &string, ComPtr<IDataWriter> writer)
quint32 bytesWritten;
hr = writer->WriteString(stringRef.Get(), &bytesWritten);
RETURN_FALSE_IF_FAILED("Could not write string to buffer.");
if (bytesWritten != string.length()) {
if (bytesWritten != size_t(string.size())) {
qCWarning(QT_BT_WINDOWS) << "Did not write full value to buffer";
return false;
}