From da6f8e532c4562979aeff211588cea1810dc0808 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Sun, 12 Jan 2014 18:45:24 +0100 Subject: [PATCH] android/bluetooth: Fix compare function when finding devices Elements on list are struct device not bdaddr_t so make comparing function use proper types. This was working so far only due to bdaddr_t being first element in struct device. --- android/bluetooth.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/android/bluetooth.c b/android/bluetooth.c index d71e81fde..f1e54581d 100644 --- a/android/bluetooth.c +++ b/android/bluetooth.c @@ -270,19 +270,19 @@ done: g_strfreev(uuids); } -static int bdaddr_cmp(gconstpointer a, gconstpointer b) +static int device_match(gconstpointer a, gconstpointer b) { - const bdaddr_t *bda = a; - const bdaddr_t *bdb = b; + const struct device *dev = a; + const bdaddr_t *bdaddr = b; - return bacmp(bdb, bda); + return bacmp(&dev->bdaddr, bdaddr); } static struct device *find_device(const bdaddr_t *bdaddr) { GSList *l; - l = g_slist_find_custom(devices, bdaddr, bdaddr_cmp); + l = g_slist_find_custom(devices, bdaddr, device_match); if (l) return l->data; -- 2.47.3