[vala/0.40] girwriter: Fix ctype of out/ref and array parameters



commit c436e566dc1ef88f132f0fa60159a7b2d39bf9d4
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Oct 19 17:21:39 2018 +0200

    girwriter: Fix ctype of out/ref and array parameters

 codegen/valagirwriter.vala | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 791ebc2f2..ace8b7122 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1312,6 +1312,7 @@ public class Vala.GIRWriter : CodeVisitor {
                        } else if (index != -1) {
                                buffer.append_printf (" length=\"%i\"", index);
                        }
+                       buffer.append_printf (" c:type=\"%s%s\"", get_ccode_name (array_type.element_type), 
direction == ParameterDirection.IN ? "*" : "**");
                        buffer.append_printf (">\n");
                        indent++;
 
@@ -1325,7 +1326,7 @@ public class Vala.GIRWriter : CodeVisitor {
                        buffer.append_printf ("<type name=\"none\"/>\n");
                } else if (type is PointerType) {
                        write_indent ();
-                       buffer.append_printf ("<type name=\"gpointer\" c:type=\"%s\"/>\n", get_ccode_name 
(type));
+                       buffer.append_printf ("<type name=\"gpointer\" c:type=\"%s%s\"/>\n", get_ccode_name 
(type), direction == ParameterDirection.IN ? "" : "*");
                } else if (type.data_type != null) {
                        write_indent ();
                        string type_name = gi_type_name (type.data_type);
@@ -1353,7 +1354,7 @@ public class Vala.GIRWriter : CodeVisitor {
                } else if (type is DelegateType) {
                        var deleg_type = (DelegateType) type;
                        write_indent ();
-                       buffer.append_printf ("<type name=\"%s\" c:type=\"%s\"/>\n", gi_type_name 
(deleg_type.delegate_symbol), get_ccode_name (type));
+                       buffer.append_printf ("<type name=\"%s\" c:type=\"%s%s\"/>\n", gi_type_name 
(deleg_type.delegate_symbol), get_ccode_name (type), direction == ParameterDirection.IN ? "" : "*");
                } else if (type is GenericType) {
                        // generic type parameters not supported in GIR
                        write_indent ();


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