[libgee] Fix build with vala master



commit a86abd4240622ec377bbc5773850a4593e13f7eb
Author: Jürg Billeter <j bitron ch>
Date:   Sun Mar 21 19:49:28 2010 +0100

    Fix build with vala master

 gee/functions.vala                |    6 +-----
 gee/linkedlist.vala               |    4 ++--
 gee/treeset.vala                  |   18 +++++++++---------
 tests/testreadonlycollection.vala |    4 ++--
 tests/testreadonlymap.vala        |    4 ++--
 5 files changed, 16 insertions(+), 20 deletions(-)
---
diff --git a/gee/functions.vala b/gee/functions.vala
index 6c7a138..b7ee46b 100644
--- a/gee/functions.vala
+++ b/gee/functions.vala
@@ -80,17 +80,13 @@ namespace Gee {
 			if (t == typeof (string)) {
 				return (CompareFunc) strcmp;
 			} else if (t.is_a (typeof (Comparable))) {
-				return (CompareFunc) comparable_compare;
+				return (CompareFunc) Comparable.compare_to;
 			} else {
 				return (CompareFunc) direct_compare;
 			}
 		}
 	}
 
-	internal static int comparable_compare (void* a, void* b) {
-		return ((Comparable) a).compare_to ((Comparable) b);
-	}
-
 	/**
 	 * Compares two arbitrary elements together.
 	 *
diff --git a/gee/linkedlist.vala b/gee/linkedlist.vala
index 68b7840..020ef77 100644
--- a/gee/linkedlist.vala
+++ b/gee/linkedlist.vala
@@ -35,8 +35,8 @@
 public class Gee.LinkedList<G> : AbstractList<G>, Queue<G>, Deque<G> {
 	private int _size = 0;
 	private int _stamp = 0;
-	private Node? _head = null;
-	private Node? _tail = null;
+	private Node<G>? _head = null;
+	private Node<G>? _tail = null;
 
 	/**
 	 * The elements' equality testing function.
diff --git a/gee/treeset.vala b/gee/treeset.vala
index 53a7848..62ff8f3 100644
--- a/gee/treeset.vala
+++ b/gee/treeset.vala
@@ -243,7 +243,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
 		fix_up (ref node);
 	}
 
-	private bool remove_from_node (ref Node<G>? node, G item, out weak Node<G>? prev = null, out weak Node<G>? next = null) {
+	private bool remove_from_node (ref Node<G>? node, G item, out unowned Node<G>? prev = null, out unowned Node<G>? next = null) {
 #if DEBUG
 		stdout.printf ("Removing %s from %s\n", (string)item, node != null ? (string)node.key : null);
 #endif
@@ -375,7 +375,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
 		return new SubSet<G> (this, after, before);
 	}
 
-	private inline weak Node<G>? find_node (G item) {
+	private inline unowned Node<G>? find_node (G item) {
 		weak Node<G>? cur = root;
 		while (cur != null) {
 			int res = compare_func (item, cur.key);
@@ -398,7 +398,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
 		return node != null ? new Iterator<G>.pointing (this, node) : null;
 	}
 
-	private inline weak Node<G>? find_nearest (G item) {
+	private inline unowned Node<G>? find_nearest (G item) {
 		weak Node<G>? cur = root;
 		while (cur != null) {
 			int res = compare_func (item, cur.key);
@@ -417,28 +417,28 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
 		return null;
 	}
 
-	private inline weak Node<G>? find_lower (G item) {
+	private inline unowned Node<G>? find_lower (G item) {
 		weak Node<G>? node = find_nearest (item);
 		if (node == null)
 			return null;
 		return compare_func (item, node.key) <= 0 ? node.prev : node;
 	}
 
-	private inline weak Node<G>? find_higher (G item) {
+	private inline unowned Node<G>? find_higher (G item) {
 		weak Node<G>? node = find_nearest (item);
 		if (node == null)
 			return null;
 		return compare_func (item, node.key) >= 0 ? node.next : node;
 	}
 
-	private inline weak Node<G>? find_floor (G item) {
+	private inline unowned Node<G>? find_floor (G item) {
 		weak Node<G>? node = find_nearest (item);
 		if (node == null)
 			return null;
 		return compare_func (item, node.key) < 0 ? node.prev : node;
 	}
 
-	private inline weak Node<G>? find_ceil (G item) {
+	private inline unowned Node<G>? find_ceil (G item) {
 		weak Node<G>? node = find_nearest (item);
 		if (node == null)
 			return null;
@@ -803,7 +803,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
 			}
 		}
 
-		public weak Node<G>? first () {
+		public unowned Node<G>? first () {
 			switch (type) {
 			case RangeType.EMPTY:
 				return null;
@@ -814,7 +814,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
 			}
 		}
 
-		public weak Node<G>? last () {
+		public unowned Node<G>? last () {
 			switch (type) {
 			case RangeType.EMPTY:
 				return null;
diff --git a/tests/testreadonlycollection.vala b/tests/testreadonlycollection.vala
index 6c09f86..7ee6417 100644
--- a/tests/testreadonlycollection.vala
+++ b/tests/testreadonlycollection.vala
@@ -61,13 +61,13 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
 		assert (ro_collection == another_ro_collection);
 
 		ro_collection.set_data ("marker", new Object ());
-		assert (another_ro_collection.get_data ("marker") != null);
+		assert (another_ro_collection.get_data<Object> ("marker") != null);
 
 		another_ro_collection = null;
 		ro_collection = null;
 
 		another_ro_collection = get_ro_view (test_collection);
-		assert (another_ro_collection.get_data ("marker") == null);
+		assert (another_ro_collection.get_data<Object> ("marker") == null);
 
 		// Check that the read-only view of the view is itself
 		assert (another_ro_collection == get_ro_view (another_ro_collection));
diff --git a/tests/testreadonlymap.vala b/tests/testreadonlymap.vala
index 217079e..e33b509 100644
--- a/tests/testreadonlymap.vala
+++ b/tests/testreadonlymap.vala
@@ -52,13 +52,13 @@ public class ReadOnlyMapTests : Gee.TestCase {
 		assert (ro_map == another_ro_map);
 
 		ro_map.set_data ("marker", new Object ());
-		assert (another_ro_map.get_data ("marker") != null);
+		assert (another_ro_map.get_data<Object> ("marker") != null);
 
 		another_ro_map = null;
 		ro_map = null;
 
 		another_ro_map = test_map.read_only_view;
-		assert (another_ro_map.get_data ("marker") == null);
+		assert (another_ro_map.get_data<Object> ("marker") == null);
 
 		// Check that the read-only view of the view is itself
 		assert (another_ro_map == another_ro_map.read_only_view);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]