summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-04 14:04:58 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-04 14:04:58 +0100
commit6adc3a97491b8aef64ac00a5efa5685fc5f2c6b7 (patch)
treea80ac591a17d588f535296f8f1830286be6dd1d7
parent9efb9966e3d7425d15ac1038584aadc8e81ac56c (diff)
parenteefe5a1fc22c4ac9911a2fc7f16299c454ecebea (diff)
downloadtelepathy-glib-6adc3a97491b8aef64ac00a5efa5685fc5f2c6b7.tar.gz
Merge branch 'telepathy-glib-0.20'
Conflicts: NEWS
-rw-r--r--NEWS3
-rw-r--r--telepathy-glib/heap.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index a226dffa4..051b7ad20 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ Fixes:
• Fix documentation for tp_connection_get_self_handle (Emilio)
+• Make TpHeap work correctly with GComparator functions that return
+ values outside {-1, 0, 1} (fd.o #68932, Debarshi Ray)
+
telepathy-glib 0.21.1 (2013-06-20)
==================================
diff --git a/telepathy-glib/heap.c b/telepathy-glib/heap.c
index 92d7b7bdc..318f16107 100644
--- a/telepathy-glib/heap.c
+++ b/telepathy-glib/heap.c
@@ -143,7 +143,7 @@ tp_heap_add (TpHeap *heap, gpointer element)
{
gpointer parent = HEAP_INDEX (heap, m / 2);
- if (heap->comparator (element, parent) == -1)
+ if (heap->comparator (element, parent) < 0)
{
HEAP_INDEX (heap, m / 2) = element;
HEAP_INDEX (heap, m) = parent;
@@ -204,13 +204,13 @@ extract_element (TpHeap * heap, int index)
if ((i * 2 + 1 <= m)
&& (heap->
comparator (HEAP_INDEX (heap, i * 2),
- HEAP_INDEX (heap, i * 2 + 1)) == 1))
+ HEAP_INDEX (heap, i * 2 + 1)) > 0))
j = i * 2 + 1;
else
j = i * 2;
- if (heap->comparator (HEAP_INDEX (heap, i), HEAP_INDEX (heap, j)) ==
- 1)
+ if (heap->comparator (HEAP_INDEX (heap, i), HEAP_INDEX (heap, j)) >
+ 0)
{
gpointer tmp = HEAP_INDEX (heap, i);
HEAP_INDEX (heap, i) = HEAP_INDEX (heap, j);