[vala/switch-to-gir: 13/47] girparser: Fix parsing arrays in metadata types



commit 3ea29c437a7453fb5936768cfbfd88b15b76e1bb
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 24ff9ba..1407ff7 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]