Commit 944081e0 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

deep copy GLists if necessary, patch by Mathias Hasselmann fix some printf

2007-03-21  Jürg Billeter  <j@bitron.ch>

	* vala/valacodegenerator.vala: deep copy GLists if necessary, patch by
	  Mathias Hasselmann
	* vapi/glib-2.0.vala: fix some printf format strings to work on ILP32
	  and LP64 platforms

svn path=/trunk/; revision=252
parent 6589c1ac
2007-03-21 Jürg Billeter <j@bitron.ch>
* vala/valacodegenerator.vala: deep copy GLists if necessary, patch by
Mathias Hasselmann
* vapi/glib-2.0.vala: fix some printf format strings to work on ILP32
and LP64 platforms
2007-03-21 Jürg Billeter <j@bitron.ch>
* vapi/glib-2.0.vala: improve support for numeric types, patch by
......
......@@ -3392,6 +3392,29 @@ public class Vala.CodeGenerator : CodeVisitor {
var ccomma = new CCodeCommaExpression ();
ccomma.append_expression (new CCodeAssignment (ctemp, (CCodeExpression) expr.ccodenode));
if (ref_function == "g_list_copy") {
bool is_ref = false;
bool is_class = false;
bool is_interface = false;
foreach (TypeReference type_arg in expr.static_type.get_type_arguments ()) {
is_ref |= type_arg.takes_ownership;
is_class |= type_arg.data_type is Class;
is_interface |= type_arg.data_type is Interface;
}
if (is_ref && (is_class || is_interface)) {
var crefcall = new CCodeFunctionCall (new CCodeIdentifier ("g_list_foreach"));
crefcall.add_argument (ctemp);
crefcall.add_argument (new CCodeIdentifier ("(GFunc) g_object_ref"));
crefcall.add_argument (new CCodeConstant ("NULL"));
ccomma.append_expression (crefcall);
}
}
ccomma.append_expression (new CCodeConditionalExpression (cisnull, new CCodeConstant ("NULL"), ccall));
return ccomma;
......
......@@ -136,7 +136,7 @@ public struct int8 {
public static int8 MAX;
[CCode (cname = "g_strdup_printf"), InstanceLast]
public string! to_string (string! format = "%i");
public string! to_string (string! format = "%hhi");
}
[CCode (cname = "guint8", cheader_filename = "glib.h")]
......@@ -148,7 +148,7 @@ public struct uint8 {
public static uint8 MAX;
[CCode (cname = "g_strdup_printf"), InstanceLast]
public ref string! to_string (string! format = "%u");
public ref string! to_string (string! format = "%hhu");
}
[CCode (cname = "gint16", cheader_filename = "glib.h")]
......@@ -160,7 +160,7 @@ public struct int16 {
public static int16 MAX;
[CCode (cname = "g_strdup_printf"), InstanceLast]
public ref string! to_string (string! format = "%i");
public ref string! to_string (string! format = "%hi");
}
[CCode (cname = "guint16", cheader_filename = "glib.h")]
......@@ -172,7 +172,7 @@ public struct uint16 {
public static uint16 MAX;
[CCode (cname = "g_strdup_printf"), InstanceLast]
public ref string! to_string (string! format = "%u");
public ref string! to_string (string! format = "%hu");
}
[CCode (cname = "gint32", cheader_filename = "glib.h")]
......@@ -184,7 +184,7 @@ public struct int32 {
public static int32 MAX;
[CCode (cname = "g_strdup_printf"), InstanceLast]
public ref string! to_string (string! format = "%li");
public ref string! to_string (string! format = "%i");
}
[CCode (cname = "guint32", cheader_filename = "glib.h")]
......@@ -197,7 +197,7 @@ public struct uint32 {
[InstanceLast ()]
[CCode (cname = "g_strdup_printf")]
public ref string! to_string (string! format = "%lu");
public ref string! to_string (string! format = "%u");
}
[CCode (cname = "gint64", cheader_filename = "glib.h", type_id = "G_TYPE_INT64", marshaller_type_name = "INT64", get_value_function = "g_value_get_int64", set_value_function = "g_value_set_int64")]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment