summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-13 16:48:22 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-13 16:48:22 +0100
commita50ee4acc378016103438a9c03069112dab07dce (patch)
tree35d46edf5efe2fdb3c505544ba5c1c489ce52fb4
parent0da3fcc0a95df68ed5fa28de084c14f4fa37ed23 (diff)
parent6adc3a97491b8aef64ac00a5efa5685fc5f2c6b7 (diff)
-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);