summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2022-01-11 14:19:26 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-21 12:59:30 +0000
commit426115b95a3e05cf3e6d40287623957fec9a6547 (patch)
tree810883e1734f5beb1e2287e93365a006bfe00a79
parent774b4484352f2cb59a800967bc73d5397ae754ca (diff)
Windows: Fix bufferFromAttribute for QBluetoothUuids
In the past a QVariant's typeId was QMetaType::UserType if it contained a QBluetoothUuid. This is no longer the case, so handling of QBluetoothUuid and co has to happen inside the "default" condition of the switch statement. As a flyby an unused variable was removed. Fixes: QTBUG-99617 Change-Id: I3e338dd3e43c57a0f8355ccb4fc6fe3ea808f91c Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 218dcb1a2e7a6d290f53cc9bdc6b20a20579aea9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_winrt.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
index e914a968..f56687b0 100644
--- a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
@@ -321,10 +321,9 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
qCWarning(QT_BT_WINDOWS) << "Don't know how to register QMetaType::QUrl";
return nullptr;
break;
- case QMetaType::User:
+ default:
if (attribute.userType() == qMetaTypeId<QBluetoothUuid>()) {
QBluetoothUuid uuid = attribute.value<QBluetoothUuid>();
- const int minimumSize = uuid.minimumSize();
switch (uuid.minimumSize()) {
case 0:
qCWarning(QT_BT_WINDOWS) << "Don't know how to register Uuid of length 0";
@@ -407,11 +406,10 @@ static ComPtr<IBuffer> bufferFromAttribute(const QVariant &attribute)
} else if (attribute.userType() == qMetaTypeId<QBluetoothServiceInfo::Alternative>()) {
qCWarning(QT_BT_WINDOWS) << "Don't know how to register user type Alternative";
return nullptr;
+ } else {
+ qCWarning(QT_BT_WINDOWS) << "Unknown variant type" << attribute.userType();
+ return nullptr;
}
- break;
- default:
- qCWarning(QT_BT_WINDOWS) << "Unknown variant type" << attribute.userType();
- return nullptr;
}
ComPtr<IBuffer> buffer;
hr = writer->DetachBuffer(&buffer);