[vala/switch-to-gir: 15/34] girparser: Guess array length type for arrays
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/switch-to-gir: 15/34] girparser: Guess array length type for arrays
- Date: Sun, 26 Dec 2010 10:49:36 +0000 (UTC)
commit c2f70477e0e43108f91fee03dae6652d814c5077
Author: Luca Bruno <lucabru src gnome org>
Date: Wed Nov 17 22:00:52 2010 +0100
girparser: Guess array length type for arrays
vala/valagirparser.vala | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 2e9b8c5..5b999c7 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1794,13 +1794,13 @@ public class Vala.GirParser : CodeVisitor {
} else if (type_name == "guint") {
type_name = "uint";
} else if (type_name == "glong") {
- if (ctype == "gssize") {
+ if (ctype != null && ctype.has_prefix ("gssize")) {
type_name = "ssize_t";
} else {
type_name = "long";
}
} else if (type_name == "gulong") {
- if (ctype == "gsize") {
+ if (ctype != null && ctype.has_prefix ("gsize")) {
type_name = "size_t";
} else {
type_name = "ulong";
@@ -2391,7 +2391,15 @@ public class Vala.GirParser : CodeVisitor {
continue;
}
info.param.carray_length_parameter_position = parameters[info.array_length_idx].vala_idx;
+ var length_param = parameters[info.array_length_idx].param;
info.param.set_array_length_cname (parameters[info.array_length_idx].param.name);
+ if (length_param.variable_type.to_qualified_string () != "int") {
+ var unresolved_type = (UnresolvedType) length_param.variable_type;
+ var resolved_struct = resolve_symbol (glib_ns.scope, unresolved_type.unresolved_symbol) as Struct;
+ if (resolved_struct != null) {
+ info.param.array_length_type = resolved_struct.get_cname ();
+ }
+ }
}
if (info.param.variable_type is ArrayType && info.array_length_idx == -1) {
info.param.no_array_length = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]