From 426115b95a3e05cf3e6d40287623957fec9a6547 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 11 Jan 2022 14:19:26 +0100 Subject: 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 Reviewed-by: Ivan Solovev (cherry picked from commit 218dcb1a2e7a6d290f53cc9bdc6b20a20579aea9) Reviewed-by: Qt Cherry-pick Bot --- src/bluetooth/qbluetoothserviceinfo_winrt.cpp | 10 ++++------ 1 file 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 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 uuid = attribute.value(); - 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 bufferFromAttribute(const QVariant &attribute) } else if (attribute.userType() == qMetaTypeId()) { 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 buffer; hr = writer->DetachBuffer(&buffer); -- cgit v1.2.1