[libgee/0.10] Fix to_array for boxed values



commit 1b0f696f3d2868c4704ad16f1615c52945fd4ebd
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Fri Aug 2 17:04:51 2013 +0200

    Fix to_array for boxed values

 gee/collection.vala |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/gee/collection.vala b/gee/collection.vala
index a6dfb4f..0ac7f3c 100644
--- a/gee/collection.vala
+++ b/gee/collection.vala
@@ -171,7 +171,7 @@ public interface Gee.Collection<G> : Iterable<G> {
                        G[] array = new G[size];
                        int index = 0;
                        foreach (G element in this) {
-                               array[index++] = element;
+                               array[index++] = (owned)element;
                        }
                        return array;
                }
@@ -278,20 +278,20 @@ public interface Gee.Collection<G> : Iterable<G> {
                return array;
        }
 
-       private static int64[] to_int64_array (Collection<int64?> coll) {
-               int64[] array = new int64[coll.size];
+       private static int64?[] to_int64_array (Collection<int64?> coll) {
+               int64?[] array = new int64?[coll.size];
                int index = 0;
-               foreach (int64 element in coll) {
-                       array[index++] = element;
+               foreach (int64? element in coll) {
+                       array[index++] = (owned)element;
                }
                return array;
        }
 
-       private static uint64[] to_uint64_array (Collection<uint64?> coll) {
-               uint64[] array = new uint64[coll.size];
+       private static uint64?[] to_uint64_array (Collection<uint64?> coll) {
+               uint64?[] array = new uint64?[coll.size];
                int index = 0;
-               foreach (uint64 element in coll) {
-                       array[index++] = element;
+               foreach (uint64? element in coll) {
+                       array[index++] = (owned)element;
                }
                return array;
        }
@@ -317,8 +317,8 @@ public interface Gee.Collection<G> : Iterable<G> {
        private static float?[] to_float_array (Collection<float?> coll) {
                float?[] array = new float?[coll.size];
                int index = 0;
-               foreach (float element in coll) {
-                       array[index++] = element;
+               foreach (float? element in coll) {
+                       array[index++] = (owned)element;
                }
                return array;
        }
@@ -326,8 +326,8 @@ public interface Gee.Collection<G> : Iterable<G> {
        private static double?[] to_double_array (Collection<double?> coll) {
                double?[] array = new double?[coll.size];
                int index = 0;
-               foreach (double element in coll) {
-                       array[index++] = element;
+               foreach (double? element in coll) {
+                       array[index++] = (owned)element;
                }
                return array;
        }


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