Diff between 8c2cfd344aa9a98ea3a1629a3642820134e94d6b and eba0b1b4677f4e20ed4227160f363b0359afaac4

Changed Files

File Additions Deletions Status
obexd/plugins/pbap.c +8 -11 modified

Full Patch

diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index efa2445..25d5e24 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -282,27 +282,24 @@ static int alpha_sort(gconstpointer a, gconstpointer b)
 	return g_strcmp0(e1->name, e2->name);
 }
 
-static int phonetical_sort(gconstpointer a, gconstpointer b)
+static int indexed_sort(gconstpointer a, gconstpointer b)
 {
 	const struct cache_entry *e1 = a;
 	const struct cache_entry *e2 = b;
 
-	/*
-	 * SOUND attribute is optinal. Keep the order
-	 * when this attribute is not available.
-	 */
-	if (!e1->sound)
-		return 1;
-
-	return g_strcmp0(e1->sound, e2->sound);
+	return (e1->handle - e2->handle);
 }
 
-static int indexed_sort(gconstpointer a, gconstpointer b)
+static int phonetical_sort(gconstpointer a, gconstpointer b)
 {
 	const struct cache_entry *e1 = a;
 	const struct cache_entry *e2 = b;
 
-	return (e1->handle - e2->handle);
+	/* SOUND attribute is optional. Use Indexed sort if not present. */
+	if (!e1->sound || !e2->sound)
+		return indexed_sort(a, b);
+
+	return g_strcmp0(e1->sound, e2->sound);
 }
 
 static GSList *sort_entries(GSList *l, uint8_t order, uint8_t search_attrib,