[vala] GVariant: Fix serialization of empty hash tables



commit 5044648dc44326fb004e39e6a556027d320070a2
Author: Jürg Billeter <j bitron ch>
Date:   Wed Dec 29 19:36:05 2010 +0100

    GVariant: Fix serialization of empty hash tables

 codegen/valagvariantmodule.vala |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valagvariantmodule.vala b/codegen/valagvariantmodule.vala
index 2b968aa..2844e1e 100644
--- a/codegen/valagvariantmodule.vala
+++ b/codegen/valagvariantmodule.vala
@@ -680,9 +680,12 @@ public class Vala.GVariantModule : GAsyncModule {
 		iter_init_call.add_argument (hash_table_expr);
 		ccode.add_expression (iter_init_call);
 
+		var gvariant_type = new CCodeFunctionCall (new CCodeIdentifier ("G_VARIANT_TYPE"));
+		gvariant_type.add_argument (new CCodeConstant ("\"%s\"".printf (get_type_signature (type))));
+
 		var iter_call = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_builder_init"));
 		iter_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (subiter_name)));
-		iter_call.add_argument (new CCodeIdentifier ("G_VARIANT_TYPE_DICTIONARY"));
+		iter_call.add_argument (gvariant_type);
 		ccode.add_expression (iter_call);
 
 		var iter_next_call = new CCodeFunctionCall (new CCodeIdentifier ("g_hash_table_iter_next"));



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