]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Special case array of ctype GStrv as a null terminated array
authorLuca Bruno <lucabru@src.gnome.org>
Thu, 26 May 2011 18:41:28 +0000 (20:41 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Thu, 26 May 2011 18:41:28 +0000 (20:41 +0200)
Fixes bug 645139.

vala/valagirparser.vala

index dc7cfe79650384964d5dcccc351c352f76d80e73..683ed4d4cd363830c27822cc4d4a95cbf86cc8f5 100644 (file)
@@ -848,7 +848,6 @@ public class Vala.GirParser : CodeVisitor {
                                }
                        }
 
-                       var ns = symbol as Namespace;
                        if (!(new_symbol && merged) && is_container (symbol)) {
                                foreach (var node in members) {
                                        if (node.new_symbol && !node.merged && !metadata.get_bool (ArgumentType.HIDDEN)) {
@@ -1956,6 +1955,8 @@ public class Vala.GirParser : CodeVisitor {
                        is_array = true;
                        start_element ("array");
 
+                       var src = get_current_src ();
+
                        if (type_name == null) {
                                if (reader.get_attribute ("length") != null) {
                                        array_length_idx = int.parse (reader.get_attribute ("length"));
@@ -1965,10 +1966,14 @@ public class Vala.GirParser : CodeVisitor {
                                if (reader.get_attribute ("fixed-size") != null) {
                                        array_null_terminated = false;
                                }
+                               if (reader.get_attribute ("c:type") == "GStrv") {
+                                       no_array_length = true;
+                                       array_null_terminated = true;
+                               }
                                next ();
                                var element_type = parse_type ();
                                end_element ("array");
-                               return new ArrayType (element_type, 1, null);
+                               return new ArrayType (element_type, 1, src);
                        }
                } else if (reader.name == "callback"){
                        parse_callback ();