diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-04-12 10:09:50 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-05-10 10:17:12 +0000 |
commit | 89a1489edab2c4702830e78009c6405b1ed13f81 (patch) | |
tree | 5690598436cb54476f1415d96759678c20824284 /src | |
parent | 932b22338e76c520402f2d4db09967d48d8c51ff (diff) |
Assorted int/qsizetype fixes
Pick-to: 6.3 6.2
Fixes: QTBUG-102463
Change-Id: I270ef1d3f50d9393b0850e27adca077acffc8511
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/bluetooth/android/devicediscoverybroadcastreceiver.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/bluez/bluetoothmanagement.cpp | 6 | ||||
-rw-r--r-- | src/bluetooth/bluez/bluetoothmanagement_p.h | 2 | ||||
-rw-r--r-- | src/bluetooth/bluez/bluez5_helper.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothserviceinfo_winrt.cpp | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp b/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp index 9b468ab7..1fec7f81 100644 --- a/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp +++ b/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp @@ -64,7 +64,7 @@ Q_GLOBAL_STATIC(JCachedMinorTypes, cachedMinorTypes) static QBitArray initializeMinorCaches() { - const int numberOfMajorDeviceClasses = 11; // count QBluetoothDeviceInfo::MajorDeviceClass values + const qsizetype numberOfMajorDeviceClasses = 11; // count QBluetoothDeviceInfo::MajorDeviceClass values // switch below used to ensure that we notice additions to MajorDeviceClass enum const QBluetoothDeviceInfo::MajorDeviceClass classes = QBluetoothDeviceInfo::ComputerDevice; diff --git a/src/bluetooth/bluez/bluetoothmanagement.cpp b/src/bluetooth/bluez/bluetoothmanagement.cpp index 87f71f32..8c7edc02 100644 --- a/src/bluetooth/bluez/bluetoothmanagement.cpp +++ b/src/bluetooth/bluez/bluetoothmanagement.cpp @@ -224,10 +224,10 @@ void BluetoothManagement::_q_readNotifier() break; const MgmtHdr *hdr = reinterpret_cast<const MgmtHdr*>(data.constData()); - const int nextPackageSize = qFromLittleEndian(hdr->length) + sizeof(MgmtHdr); - const int remainingPackageSize = data.length() - nextPackageSize; + const auto nextPackageSize = qsizetype(qFromLittleEndian(hdr->length) + sizeof(MgmtHdr)); + const qsizetype remainingPackageSize = data.size() - nextPackageSize; - if (data.length() < nextPackageSize) + if (data.size() < nextPackageSize) break; // not a complete event header -> wait for next notifier switch (static_cast<EventCode>(qFromLittleEndian(hdr->cmdCode))) { diff --git a/src/bluetooth/bluez/bluetoothmanagement_p.h b/src/bluetooth/bluez/bluetoothmanagement_p.h index b6a1278d..10a23b3d 100644 --- a/src/bluetooth/bluez/bluetoothmanagement_p.h +++ b/src/bluetooth/bluez/bluetoothmanagement_p.h @@ -58,7 +58,7 @@ #include <QtBluetooth/qbluetoothaddress.h> #ifndef QPRIVATELINEARBUFFER_BUFFERSIZE -#define QPRIVATELINEARBUFFER_BUFFERSIZE Q_INT64_C(16384) +#define QPRIVATELINEARBUFFER_BUFFERSIZE qsizetype(16384) #endif #include "../qprivatelinearbuffer_p.h" diff --git a/src/bluetooth/bluez/bluez5_helper.cpp b/src/bluetooth/bluez/bluez5_helper.cpp index fb01f6cb..4c961b58 100644 --- a/src/bluetooth/bluez/bluez5_helper.cpp +++ b/src/bluetooth/bluez/bluez5_helper.cpp @@ -555,7 +555,7 @@ QString findAdapterForAddress(const QBluetoothAddress &wantedAddress, bool *ok = QString sanitizeNameForDBus(const QString &text) { QString appName = text; - for (int i = 0; i < appName.length(); i++) { + for (qsizetype i = 0; i < appName.size(); ++i) { ushort us = appName[i].unicode(); bool valid = (us >= 'a' && us <= 'z') || (us >= 'A' && us <= 'Z') diff --git a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp index e2be5104..e0067153 100644 --- a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp +++ b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp @@ -130,7 +130,7 @@ qint64 getLengthForBaseType(unsigned char type, ComPtr<IDataReader> &reader) bool writeStringHelper(const QString &string, ComPtr<IDataWriter> writer) { HRESULT hr; - const int stringLength = string.length(); + const qsizetype stringLength = string.size(); unsigned char type = TYPE_STRING_BASE; if (stringLength < 0) { qCWarning(QT_BT_WINDOWS) << "Can not write invalid string value to buffer"; |