Fix checking records returned by bt_search_service on headset.c.
sdp_uuid128_to_uuid may not convert the uuid to 16 bit version, to fix
this it uses recently introduced sdp_uuid_cmp which takes care of
any possible conversion.
diff --git a/audio/headset.c b/audio/headset.c
index 2c852d1..149ae0a 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -1387,6 +1387,7 @@
struct pending_connect *p = hs->pending;
sdp_record_t *record = NULL;
sdp_list_t *r;
+ uuid_t uuid;
assert(hs->pending != NULL);
@@ -1403,9 +1404,11 @@
goto failed_not_supported;
}
+ sdp_uuid16_create(&uuid, p->svclass);
+
for (r = recs; r != NULL; r = r->next) {
sdp_list_t *classes;
- uuid_t uuid;
+ uuid_t class;
record = r->data;
@@ -1414,16 +1417,12 @@
continue;
}
- memcpy(&uuid, classes->data, sizeof(uuid));
+ memcpy(&class, classes->data, sizeof(uuid));
sdp_list_free(classes, free);
- if (!sdp_uuid128_to_uuid(&uuid) || uuid.type != SDP_UUID16) {
- error("Not a 16 bit UUID");
- continue;
- }
- if (uuid.value.uuid16 == p->svclass)
+ if (sdp_uuid_cmp(&class, &uuid) == 0)
break;
}