[libgee] Fix various warnings



commit 5cdd8edbeff52480768d4dd6d42310438426a92d
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Mon Dec 16 00:37:34 2013 +0100

    Fix various warnings

 gee/collection.vala             |    1 -
 gee/concurrentset.vala          |    2 ++
 gee/hashmap.vala                |   37 -------------------------------------
 gee/lazy.vala                   |    1 +
 gee/lightmapfuture.vala         |    1 +
 gee/promise.vala                |    1 +
 gee/readonlybidirsortedmap.vala |    2 +-
 gee/readonlysortedmap.vala      |    2 +-
 gee/traversable.vala            |    4 ++++
 gee/treemap.vala                |    2 +-
 10 files changed, 12 insertions(+), 41 deletions(-)
---
diff --git a/gee/collection.vala b/gee/collection.vala
index f748504..a67f944 100644
--- a/gee/collection.vala
+++ b/gee/collection.vala
@@ -342,7 +342,6 @@ public interface Gee.Collection<G> : Iterable<G> {
                        changed |= remove (val);
                        return true;
                });
-               return changed;
        }
 
        /**
diff --git a/gee/concurrentset.vala b/gee/concurrentset.vala
index 747e579..c0b7b80 100644
--- a/gee/concurrentset.vala
+++ b/gee/concurrentset.vala
@@ -897,6 +897,7 @@ public class Gee.ConcurrentSet<G> : AbstractSortedSet<G> {
 
                public static void improve_bookmark<G> (Range<G> range, out Tower<G>? out_curr = null, out 
TowerIter<G> prev = null) {
                        prev = TowerIter<G>();
+                       out_curr = null;
                        switch (range._type) {
                        case RangeType.HEAD:
                                if (&out_curr != null) {
@@ -1098,6 +1099,7 @@ public class Gee.ConcurrentSet<G> : AbstractSortedSet<G> {
 
                public static inline bool search_from_bookmark<G> (CompareDataFunc<G>? cmp, G key, ref 
TowerIter<G> prev, out TowerIter<G> next = null, uint8 to_level = 0, uint8 from_level = (uint8)_MAX_HEIGHT - 
1) {
                        assert (from_level >= to_level);
+                       next = TowerIter<G>();
                        bool res = false;
                        for (int i = from_level; i >= to_level; i--) {
                                unowned Tower<G> tmp_prev = prev._iter[i]; // Should be treated as NULL-like 
value
diff --git a/gee/hashmap.vala b/gee/hashmap.vala
index 805d075..b66a2f4 100644
--- a/gee/hashmap.vala
+++ b/gee/hashmap.vala
@@ -403,19 +403,6 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
                public override bool contains (K key) {
                        return _map.has_key (key);
                }
-
-               public bool add_all (Collection<K> collection) {
-                       assert_not_reached ();
-               }
-
-               public bool remove_all (Collection<K> collection) {
-                       assert_not_reached ();
-               }
-
-               public bool retain_all (Collection<K> collection) {
-                       assert_not_reached ();
-               }
-
        }
 
        private class ValueCollection<K,V> : AbstractCollection<V> {
@@ -458,18 +445,6 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
                        }
                        return false;
                }
-
-               public bool add_all (Collection<V> collection) {
-                       assert_not_reached ();
-               }
-
-               public bool remove_all (Collection<V> collection) {
-                       assert_not_reached ();
-               }
-
-               public bool retain_all (Collection<V> collection) {
-                       assert_not_reached ();
-               }
        }
 
        private class EntrySet<K,V> : AbstractSet<Map.Entry<K, V>> {
@@ -506,18 +481,6 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
                public override bool contains (Map.Entry<K, V> entry) {
                        return _map.has (entry.key, entry.value);
                }
-
-               public bool add_all (Collection<Map.Entry<K, V>> entries) {
-                       assert_not_reached ();
-               }
-
-               public bool remove_all (Collection<Map.Entry<K, V>> entries) {
-                       assert_not_reached ();
-               }
-
-               public bool retain_all (Collection<Map.Entry<K, V>> entries) {
-                       assert_not_reached ();
-               }
        }
 
        private abstract class NodeIterator<K,V> : Object {
diff --git a/gee/lazy.vala b/gee/lazy.vala
index fde93bd..00c34ba 100644
--- a/gee/lazy.vala
+++ b/gee/lazy.vala
@@ -110,6 +110,7 @@ public class Gee.Lazy<G> {
                                        bool res = _eval.wait_until (_mutex, end_time);
                                        _mutex.unlock ();
                                        if (!res) {
+                                               value = null;
                                                return false;
                                        }
                                } else {
diff --git a/gee/lightmapfuture.vala b/gee/lightmapfuture.vala
index 60c888b..86daf5e 100644
--- a/gee/lightmapfuture.vala
+++ b/gee/lightmapfuture.vala
@@ -44,6 +44,7 @@ internal class Gee.LightMapFuture<A, G> : Object, Future<A> {
        public bool wait_until (int64 end_time, out unowned G? value = null) throws Gee.FutureError {
                unowned A arg;
                bool result;
+               value = null;
                if ((result = _base.wait_until (end_time, out arg))) {
                        value = _func (arg);
                }
diff --git a/gee/promise.vala b/gee/promise.vala
index cb92196..74d4de0 100644
--- a/gee/promise.vala
+++ b/gee/promise.vala
@@ -112,6 +112,7 @@ public class Gee.Promise<G> {
                        _mutex.unlock ();
                        switch (state) {
                        case State.INIT:
+                               value = null;
                                return false;
                        case State.ABANDON:
                                throw new FutureError.ABANDON_PROMISE ("Promise has been abandon");
diff --git a/gee/readonlybidirsortedmap.vala b/gee/readonlybidirsortedmap.vala
index e621ee6..66f32ba 100644
--- a/gee/readonlybidirsortedmap.vala
+++ b/gee/readonlybidirsortedmap.vala
@@ -49,7 +49,7 @@ internal class Gee.ReadOnlyBidirSortedMap<K,V> : ReadOnlySortedMap<K,V>, BidirSo
        /**
         * { inheritDoc}
         */
-       public BidirSortedMap<K,V> read_only_view {
+       public new BidirSortedMap<K,V> read_only_view {
                owned get {
                        return this;
                }
diff --git a/gee/readonlysortedmap.vala b/gee/readonlysortedmap.vala
index d6e7b2b..136022f 100644
--- a/gee/readonlysortedmap.vala
+++ b/gee/readonlysortedmap.vala
@@ -81,7 +81,7 @@ internal class Gee.ReadOnlySortedMap<K,V> : ReadOnlyMap<K,V>, SortedMap<K,V> {
        /**
         * { inheritDoc}
         */
-       public SortedMap<K, V> read_only_view {
+       public new SortedMap<K, V> read_only_view {
                owned get {
                        return this;
                }
diff --git a/gee/traversable.vala b/gee/traversable.vala
index f98e933..58aba5a 100644
--- a/gee/traversable.vala
+++ b/gee/traversable.vala
@@ -356,6 +356,7 @@ public interface Gee.Traversable<G> : Object {
                        switch (state) {
                        case Stream.YIELD:
                                if (current == null || !current.next ()) {
+                                       val = null;
                                        return Stream.CONTINUE;
                                } else {
                                        val = new Lazy<A> (() => {return current.get ();});
@@ -367,6 +368,7 @@ public interface Gee.Traversable<G> : Object {
                                        val = new Lazy<A> (() => {return current.get ();});
                                        return Stream.YIELD;
                                } else {
+                                       val = null;
                                        return Stream.WAIT;
                                }
                        case Stream.WAIT:
@@ -374,9 +376,11 @@ public interface Gee.Traversable<G> : Object {
                                        val = new Lazy<A> (() => {return current.get ();});
                                        return Stream.YIELD;
                                } else {
+                                       val = null;
                                        return Stream.CONTINUE;
                                }
                        case Stream.END:
+                               val = null;
                                return Stream.END;
                        default:
                                assert_not_reached ();
diff --git a/gee/treemap.vala b/gee/treemap.vala
index c3ef896..bd67adb 100644
--- a/gee/treemap.vala
+++ b/gee/treemap.vala
@@ -280,7 +280,7 @@ public class Gee.TreeMap<K,V> : Gee.AbstractBidirSortedMap<K,V> {
                }
        }
 
-       private void fix_removal (ref Node<K,V> node, out K? key = null, out V? value) {
+       private void fix_removal (ref Node<K,V> node, out K? key = null, out V? value = null) {
                Node<K,V> n = (owned) node;
                key = (owned) n.key;
                value = (owned) n.value;


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