summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2019-09-25 18:02:25 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2019-09-25 19:07:31 +0200
commit505698ad479085ed969b355c243fe457d07fea4c (patch)
treee21e35d1cc2e207929c7e947496658d3127372c5
parent5e66324654b7d70d7c28793491a4edfe6d8a0d85 (diff)
downloadlibgee-505698ad479085ed969b355c243fe457d07fea4c.tar.gz
Fix "Access to possible `null'" warnings and use unsafe casts
-rw-r--r--gee/readonlybidirsortedmap.vala10
-rw-r--r--gee/readonlybidirsortedset.vala10
-rw-r--r--gee/readonlysortedmap.vala10
-rw-r--r--gee/readonlysortedset.vala20
-rw-r--r--tests/testbidirsortedmap.vala4
5 files changed, 27 insertions, 27 deletions
diff --git a/gee/readonlybidirsortedmap.vala b/gee/readonlybidirsortedmap.vala
index 66f32ba..54d9749 100644
--- a/gee/readonlybidirsortedmap.vala
+++ b/gee/readonlybidirsortedmap.vala
@@ -43,7 +43,7 @@ internal class Gee.ReadOnlyBidirSortedMap<K,V> : ReadOnlySortedMap<K,V>, BidirSo
* {@inheritDoc}
*/
public Gee.BidirMapIterator<K,V> bidir_map_iterator () {
- return new BidirMapIterator<K,V> ((_map as BidirSortedMap<K,V>).bidir_map_iterator ());
+ return new BidirMapIterator<K,V> (((BidirSortedMap<K,V>) _map).bidir_map_iterator ());
}
/**
@@ -61,19 +61,19 @@ internal class Gee.ReadOnlyBidirSortedMap<K,V> : ReadOnlySortedMap<K,V>, BidirSo
}
public bool first () {
- return (_iter as Gee.BidirMapIterator<K,V>).first ();
+ return ((Gee.BidirMapIterator<K,V>) _iter).first ();
}
public bool previous () {
- return (_iter as Gee.BidirMapIterator<K,V>).previous ();
+ return ((Gee.BidirMapIterator<K,V>) _iter).previous ();
}
public bool has_previous () {
- return (_iter as Gee.BidirMapIterator<K,V>).has_previous ();
+ return ((Gee.BidirMapIterator<K,V>) _iter).has_previous ();
}
public bool last () {
- return (_iter as Gee.BidirMapIterator<K,V>).last ();
+ return ((Gee.BidirMapIterator<K,V>) _iter).last ();
}
}
}
diff --git a/gee/readonlybidirsortedset.vala b/gee/readonlybidirsortedset.vala
index 460ebbe..2a0c9c3 100644
--- a/gee/readonlybidirsortedset.vala
+++ b/gee/readonlybidirsortedset.vala
@@ -43,7 +43,7 @@ internal class Gee.ReadOnlyBidirSortedSet<G> : ReadOnlySortedSet<G>, BidirSorted
* {@inheritDoc}
*/
public Gee.BidirIterator<G> bidir_iterator () {
- return new BidirIterator<G> ((_collection as BidirSortedSet<G>).bidir_iterator ());
+ return new BidirIterator<G> (((BidirSortedSet<G>) _collection).bidir_iterator ());
}
protected class BidirIterator<G> : Gee.ReadOnlyCollection.Iterator<G>, Gee.BidirIterator<G> {
@@ -52,19 +52,19 @@ internal class Gee.ReadOnlyBidirSortedSet<G> : ReadOnlySortedSet<G>, BidirSorted
}
public bool first () {
- return (_iter as Gee.BidirIterator<G>).first ();
+ return ((Gee.BidirIterator<G>) _iter).first ();
}
public bool previous () {
- return (_iter as Gee.BidirIterator<G>).previous ();
+ return ((Gee.BidirIterator<G>) _iter).previous ();
}
public bool has_previous () {
- return (_iter as Gee.BidirIterator<G>).has_previous ();
+ return ((Gee.BidirIterator<G>) _iter).has_previous ();
}
public bool last () {
- return (_iter as Gee.BidirIterator<G>).last ();
+ return ((Gee.BidirIterator<G>) _iter).last ();
}
}
}
diff --git a/gee/readonlysortedmap.vala b/gee/readonlysortedmap.vala
index 136022f..244f166 100644
--- a/gee/readonlysortedmap.vala
+++ b/gee/readonlysortedmap.vala
@@ -43,21 +43,21 @@ internal class Gee.ReadOnlySortedMap<K,V> : ReadOnlyMap<K,V>, SortedMap<K,V> {
* {@inheritDoc}
*/
public SortedMap<K,V> head_map (K before) {
- return (_map as SortedMap<K,V>).head_map (before).read_only_view;
+ return ((SortedMap<K,V>) _map).head_map (before).read_only_view;
}
/**
* {@inheritDoc}
*/
public SortedMap<K,V> tail_map (K after) {
- return (_map as SortedMap<K,V>).tail_map (after).read_only_view;
+ return ((SortedMap<K,V>) _map).tail_map (after).read_only_view;
}
/**
* {@inheritDoc}
*/
public SortedMap<K,V> sub_map (K from, K to) {
- return (_map as SortedMap<K,V>).sub_map (from, to).read_only_view;
+ return ((SortedMap<K,V>) _map).sub_map (from, to).read_only_view;
}
/**
@@ -65,7 +65,7 @@ internal class Gee.ReadOnlySortedMap<K,V> : ReadOnlyMap<K,V>, SortedMap<K,V> {
*/
public SortedSet<K> ascending_keys {
owned get {
- return (_map as SortedMap<K,V>).ascending_keys.read_only_view;
+ return ((SortedMap<K,V>) _map).ascending_keys.read_only_view;
}
}
@@ -74,7 +74,7 @@ internal class Gee.ReadOnlySortedMap<K,V> : ReadOnlyMap<K,V>, SortedMap<K,V> {
*/
public SortedSet<Map.Entry<K,V>> ascending_entries {
owned get {
- return (_map as SortedMap<K,V>).ascending_entries.read_only_view;
+ return ((SortedMap<K,V>) _map).ascending_entries.read_only_view;
}
}
diff --git a/gee/readonlysortedset.vala b/gee/readonlysortedset.vala
index de60b4c..1f8d67f 100644
--- a/gee/readonlysortedset.vala
+++ b/gee/readonlysortedset.vala
@@ -44,21 +44,21 @@ internal class Gee.ReadOnlySortedSet<G> : ReadOnlySet<G>, SortedSet<G> {
* {@inheritDoc}
*/
public G first () {
- return (_collection as SortedSet<G>).first ();
+ return ((SortedSet<G>) _collection).first ();
}
/**
* {@inheritDoc}
*/
public G last () {
- return (_collection as SortedSet<G>).last ();
+ return ((SortedSet<G>) _collection).last ();
}
/**
* {@inheritDoc}
*/
public Gee.Iterator<G>? iterator_at (G element) {
- var iter = (_collection as SortedSet<G>).iterator_at (element);
+ var iter = ((SortedSet<G>) _collection).iterator_at (element);
return (iter != null) ? new Iterator<G> (iter) : null;
}
@@ -66,49 +66,49 @@ internal class Gee.ReadOnlySortedSet<G> : ReadOnlySet<G>, SortedSet<G> {
* {@inheritDoc}
*/
public G? lower (G element) {
- return (_collection as SortedSet<G>).lower (element);
+ return ((SortedSet<G>) _collection).lower (element);
}
/**
* {@inheritDoc}
*/
public G? higher (G element) {
- return (_collection as SortedSet<G>).higher (element);
+ return ((SortedSet<G>) _collection).higher (element);
}
/**
* {@inheritDoc}
*/
public G? floor (G element) {
- return (_collection as SortedSet<G>).floor (element);
+ return ((SortedSet<G>) _collection).floor (element);
}
/**
* {@inheritDoc}
*/
public G? ceil (G element) {
- return (_collection as SortedSet<G>).ceil (element);
+ return ((SortedSet<G>) _collection).ceil (element);
}
/**
* {@inheritDoc}
*/
public SortedSet<G> head_set (G before) {
- return (_collection as SortedSet<G>).head_set (before).read_only_view;
+ return ((SortedSet<G>) _collection).head_set (before).read_only_view;
}
/**
* {@inheritDoc}
*/
public SortedSet<G> tail_set (G after) {
- return(_collection as SortedSet<G>).tail_set (after).read_only_view;
+ return((SortedSet<G>) _collection).tail_set (after).read_only_view;
}
/**
* {@inheritDoc}
*/
public SortedSet<G> sub_set (G from, G to) {
- return (_collection as SortedSet<G>).sub_set (from, to).read_only_view;
+ return ((SortedSet<G>) _collection).sub_set (from, to).read_only_view;
}
/**
diff --git a/tests/testbidirsortedmap.vala b/tests/testbidirsortedmap.vala
index 7bbadf3..7773eb6 100644
--- a/tests/testbidirsortedmap.vala
+++ b/tests/testbidirsortedmap.vala
@@ -330,8 +330,8 @@ public abstract class BidirSortedMapTests : SortedMapTests {
}
assert (i == contains.length);
- var keys_iter = ((submap.ascending_keys) as BidirSortedSet<string>).bidir_iterator ();
- var entries_iter = ((submap.ascending_entries) as BidirSortedSet<Map.Entry<string,string>>).bidir_iterator ();
+ var keys_iter = ((BidirSortedSet<string>) submap.ascending_keys).bidir_iterator ();
+ var entries_iter = ((BidirSortedSet<Map.Entry<string,string>>) submap.ascending_entries).bidir_iterator ();
var map_iter = submap.bidir_map_iterator ();
if (type != SortedMapTests.SubMapTests.Type.EMPTY) {
assert (map_iter.last ());