[vala] girparser: Fix parsing arrays in metadata types



commit fceb1ff5cb49d5a68463286f6bcaccc0f64c098b
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed Nov 17 21:59:46 2010 +0100

    girparser: Fix parsing arrays in metadata types

 vala/valagirparser.vala |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 0135204..31cc021 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;



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