From: Jürg Billeter Date: Mon, 16 Jul 2012 19:21:05 +0000 (+0200) Subject: codegen: Fix conversion from generic pointer to long integer X-Git-Tag: 0.17.3~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6bc0cc06f920a40faf778d5a622093ebf06ec05;p=thirdparty%2Fvala.git codegen: Fix conversion from generic pointer to long integer Fixes bug 660621. --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 9102e70a9..59888f394 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -5323,13 +5323,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { if (is_reference_type_argument (actual_type) || is_nullable_value_type_argument (actual_type)) { result = new CCodeCastExpression (cexpr, get_ccode_name (actual_type)); } else if (is_signed_integer_type_argument (actual_type)) { - var cconv = new CCodeFunctionCall (new CCodeIdentifier ("GPOINTER_TO_INT")); - cconv.add_argument (cexpr); - result = cconv; + result = new CCodeCastExpression (new CCodeCastExpression (cexpr, "gintptr"), get_ccode_name (actual_type)); } else if (is_unsigned_integer_type_argument (actual_type)) { - var cconv = new CCodeFunctionCall (new CCodeIdentifier ("GPOINTER_TO_UINT")); - cconv.add_argument (cexpr); - result = cconv; + result = new CCodeCastExpression (new CCodeCastExpression (cexpr, "guintptr"), get_ccode_name (actual_type)); } return result; } @@ -5337,13 +5333,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { public CCodeExpression convert_to_generic_pointer (CCodeExpression cexpr, DataType actual_type) { var result = cexpr; if (is_signed_integer_type_argument (actual_type)) { - var cconv = new CCodeFunctionCall (new CCodeIdentifier ("GINT_TO_POINTER")); - cconv.add_argument (cexpr); - result = cconv; + result = new CCodeCastExpression (new CCodeCastExpression (cexpr, "gintptr"), "gpointer"); } else if (is_unsigned_integer_type_argument (actual_type)) { - var cconv = new CCodeFunctionCall (new CCodeIdentifier ("GUINT_TO_POINTER")); - cconv.add_argument (cexpr); - result = cconv; + result = new CCodeCastExpression (new CCodeCastExpression (cexpr, "guintptr"), "gpointer"); } return result; }