From: Luca Bruno Date: Wed, 17 Nov 2010 20:59:46 +0000 (+0100) Subject: girparser: Fix parsing arrays in metadata types X-Git-Tag: 0.13.0~301 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fceb1ff5cb49d5a68463286f6bcaccc0f64c098b;p=thirdparty%2Fvala.git girparser: Fix parsing arrays in metadata types --- diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala index 013520453..31cc0216d 100644 --- a/vala/valagirparser.vala +++ b/vala/valagirparser.vala @@ -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;