]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Fix parsing arrays in metadata types
authorLuca Bruno <lucabru@src.gnome.org>
Wed, 17 Nov 2010 20:59:46 +0000 (21:59 +0100)
committerLuca Bruno <lucabru@src.gnome.org>
Mon, 4 Apr 2011 13:14:42 +0000 (15:14 +0200)
vala/valagirparser.vala

index 0135204537b015b667826902bf62d40f3c356baa..31cc0216d776dcceb8de5104cb4ac6195c67bd63 100644 (file)
@@ -1066,7 +1066,7 @@ public class Vala.GirParser : CodeVisitor {
        DataType? parse_type_from_string (string type_string, bool owned_by_default, SourceReference? source_reference = null) {
                if (type_from_string_regex == null) {
                        try {
-                               type_from_string_regex = new GLib.Regex ("^(?:(owned|unowned|weak) +)?([0-9a-zA-Z_\\.]+)(?:<(.+)>)?(\\*+)?(\\[(,*)?\\])?(\\?)?$", GLib.RegexCompileFlags.ANCHORED | GLib.RegexCompileFlags.DOLLAR_ENDONLY | GLib.RegexCompileFlags.OPTIMIZE);
+                               type_from_string_regex = new GLib.Regex ("^(?:(owned|unowned|weak) +)?([0-9a-zA-Z_\\.]+)(?:<(.+)>)?(\\*+)?(\\[,*\\])?(\\?)?$", GLib.RegexCompileFlags.ANCHORED | GLib.RegexCompileFlags.DOLLAR_ENDONLY | GLib.RegexCompileFlags.OPTIMIZE);
                        } catch (GLib.RegexError e) {
                                GLib.error ("Unable to compile regex: %s", e.message);
                        }
@@ -1140,7 +1140,7 @@ public class Vala.GirParser : CodeVisitor {
                }
 
                if (array_data != null) {
-                       type = new ArrayType (type, (int) array_data.length + 1, source_reference);
+                       type = new ArrayType (type, (int) array_data.length - 1, source_reference);
                }
 
                type.nullable = nullable;