[vala/switch-to-gir: 6/24] girparser: Fix mapping gsize to size_t and gssize to ssize_t.



commit be06ecf6bb4bdb0fb3c9433d1711b007bab71fb1
Author: Luca Bruno <lucabru src gnome org>
Date:   Tue Nov 9 11:54:13 2010 +0100

    girparser: Fix mapping gsize to size_t and gssize to ssize_t.

 vala/valagirparser.vala |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 7503999..884a81c 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1727,7 +1727,7 @@ public class Vala.GirParser : CodeVisitor {
 			type_name = "GLib.GenericArray";
 		}
 
-		DataType type = parse_type_from_gir_name (type_name, out no_array_length, out array_null_terminated);
+		DataType type = parse_type_from_gir_name (type_name, out no_array_length, out array_null_terminated, ctype);
 
 		// type arguments / element types
 		while (current_token == MarkupTokenType.START_ELEMENT) {
@@ -1740,7 +1740,7 @@ public class Vala.GirParser : CodeVisitor {
 		return type;
 	}
 
-	DataType parse_type_from_gir_name (string type_name, out bool no_array_length = null, out bool array_null_terminated = null) {
+	DataType parse_type_from_gir_name (string type_name, out bool no_array_length = null, out bool array_null_terminated = null, string? ctype = null) {
 		if (&no_array_length != null) {
 			no_array_length = false;
 		}
@@ -1778,9 +1778,17 @@ public class Vala.GirParser : CodeVisitor {
 			} else if (type_name == "guint") {
 				type_name = "uint";
 			} else if (type_name == "glong") {
-				type_name = "long";
+				if (ctype == "gssize") {
+					type_name = "ssize_t";
+				} else {
+					type_name = "long";
+				}
 			} else if (type_name == "gulong") {
-				type_name = "ulong";
+				if (ctype == "gsize") {
+					type_name = "size_t";
+				} else {
+					type_name = "ulong";
+				}
 			} else if (type_name == "gint8") {
 				type_name = "int8";
 			} else if (type_name == "guint8") {



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