}
public static string? get_ccode_array_length_type (CodeNode node) {
- return get_ccode_attribute(node).array_length_type;
+ if (node is ArrayType) {
+ return get_ccode_name (((ArrayType) node).length_type);
+ } else {
+ return get_ccode_attribute(node).array_length_type;
+ }
}
public static bool get_ccode_array_null_terminated (CodeNode node) {
}
if (!array_type.fixed_length && get_ccode_array_length (param)) {
- string length_ctype = "int";
- if (get_ccode_array_length_type (param) != null) {
- length_ctype = get_ccode_array_length_type (param);
- }
+ var length_ctype = get_ccode_array_length_type (array_type);
if (param.direction != ParameterDirection.IN) {
length_ctype = "%s*".printf (length_ctype);
}
var array_type = (ArrayType) f.variable_type;
if (!array_type.fixed_length) {
- for (int dim = 1; dim <= array_type.rank; dim++) {
- var len_type = int_type.copy ();
+ var length_ctype = get_ccode_array_length_type (array_type);
- cdecl = new CCodeDeclaration (get_ccode_name (len_type));
+ for (int dim = 1; dim <= array_type.rank; dim++) {
+ cdecl = new CCodeDeclaration (length_ctype);
cdecl.add_declarator (new CCodeVariableDeclarator (get_array_length_cname (get_ccode_name (f), dim)));
if (f.is_private_symbol ()) {
cdecl.modifiers = CCodeModifiers.STATIC;
var array_type = (ArrayType) f.variable_type;
if (!array_type.fixed_length) {
- for (int dim = 1; dim <= array_type.rank; dim++) {
- var len_type = int_type.copy ();
+ var length_ctype = get_ccode_array_length_type (array_type);
- var len_def = new CCodeDeclaration (get_ccode_name (len_type));
+ for (int dim = 1; dim <= array_type.rank; dim++) {
+ var len_def = new CCodeDeclaration (length_ctype);
len_def.add_declarator (new CCodeVariableDeclarator (get_array_length_cname (get_ccode_name (f), dim), new CCodeConstant ("0")));
if (!f.is_private_symbol ()) {
len_def.modifiers = CCodeModifiers.EXTERN;
}
if (array_type.rank == 1 && f.is_internal_symbol ()) {
- var len_type = int_type.copy ();
-
- var cdecl = new CCodeDeclaration (get_ccode_name (len_type));
+ var cdecl = new CCodeDeclaration (length_ctype);
cdecl.add_declarator (new CCodeVariableDeclarator (get_array_size_cname (get_ccode_name (f)), new CCodeConstant ("0")));
cdecl.modifiers = CCodeModifiers.STATIC;
cfile.add_type_member_declaration (cdecl);
if (acc.value_type is ArrayType) {
var array_type = (ArrayType) acc.value_type;
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), acc.readable ? "int*" : "int"));
+ function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), acc.readable ? length_ctype + "*" : length_ctype));
}
} else if ((acc.value_type is DelegateType) && ((DelegateType) acc.value_type).delegate_symbol.has_target) {
function.add_parameter (new CCodeParameter (get_delegate_target_cname (acc.readable ? "result" : "value"), acc.readable ? "gpointer*" : "gpointer"));
if (acc.value_type is ArrayType) {
var array_type = (ArrayType) acc.value_type;
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), acc.readable ? "int*" : "int"));
+ function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), acc.readable ? length_ctype + "*": length_ctype));
}
} else if ((acc.value_type is DelegateType) && ((DelegateType) acc.value_type).delegate_symbol.has_target) {
function.add_parameter (new CCodeParameter (get_delegate_target_cname (acc.readable ? "result" : "value"), acc.readable ? "gpointer*" : "gpointer"));
if (acc.value_type is ArrayType) {
var array_type = (ArrayType) acc.value_type;
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), acc.readable ? "int*" : "int"));
+ function.add_parameter (new CCodeParameter (get_array_length_cname (acc.readable ? "result" : "value", dim), acc.readable ? length_ctype + "*" : length_ctype));
}
} else if ((acc.value_type is DelegateType) && ((DelegateType) acc.value_type).delegate_symbol.has_target) {
function.add_parameter (new CCodeParameter (get_delegate_target_cname (acc.readable ? "result" : "value"), acc.readable ? "gpointer*" : "gpointer"));
get_call.add_argument (new CCodeIdentifier (is_virtual ? "base" : "self"));
if (property_type is ArrayType) {
- ccode.add_declaration ("int", new CCodeVariableDeclarator ("old_value_length"));
+ ccode.add_declaration (get_ccode_array_length_type (property_type), new CCodeVariableDeclarator ("old_value_length"));
get_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("old_value_length")));
ccode.open_if (new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, get_call, new CCodeIdentifier ("value")));
} else if (property_type.compatible (string_type)) {
var deleg_type = param.variable_type as DelegateType;
if (array_type != null && get_ccode_array_length (param)) {
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- data.add_field ("gint", get_parameter_array_length_cname (param, dim));
+ data.add_field (length_ctype, get_parameter_array_length_cname (param, dim));
}
} else if (deleg_type != null && deleg_type.delegate_symbol.has_target) {
data.add_field ("gpointer", get_ccode_delegate_target_name (param));
if (local.variable_type is ArrayType && !((ArrayType) local.variable_type).fixed_length) {
var array_type = (ArrayType) local.variable_type;
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- data.add_field ("gint", get_array_length_cname (get_local_cname (local), dim));
+ data.add_field (length_ctype, get_array_length_cname (get_local_cname (local), dim));
}
- data.add_field ("gint", get_array_size_cname (get_local_cname (local)));
+ data.add_field (length_ctype, get_array_size_cname (get_local_cname (local)));
} else if (local.variable_type is DelegateType && ((DelegateType) local.variable_type).delegate_symbol.has_target) {
data.add_field ("gpointer", get_delegate_target_cname (get_local_cname (local)));
if (local.variable_type.is_disposable ()) {
if (!array_type.fixed_length) {
for (int dim = 1; dim <= array_type.rank; dim++) {
- var len_var = new LocalVariable (int_type.copy (), get_array_length_cname (get_local_cname (local), dim));
+ var len_var = new LocalVariable (array_type.length_type.copy (), get_array_length_cname (get_local_cname (local), dim));
len_var.init = local.initializer == null;
emit_temp_var (len_var);
}
if (array_type.rank == 1) {
- var size_var = new LocalVariable (int_type.copy (), get_array_size_cname (get_local_cname (local)));
+ var size_var = new LocalVariable (array_type.length_type.copy (), get_array_size_cname (get_local_cname (local)));
size_var.init = local.initializer == null;
emit_temp_var (size_var);
}
emit_temp_var (local);
if (array_type != null) {
for (int dim = 1; dim <= array_type.rank; dim++) {
- var len_var = new LocalVariable (int_type.copy (), get_array_length_cname (local.name, dim), null, node_reference.source_reference);
+ var len_var = new LocalVariable (array_type.length_type.copy (), get_array_length_cname (local.name, dim), null, node_reference.source_reference);
len_var.init = init;
emit_temp_var (len_var);
}
// return array length if appropriate
// tmp = _variant_get (variant, &tmp_length);
var array_type = (ArrayType) to;
-
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_array_length_cvalue (result, dim)));
- cfunc.add_parameter (new CCodeParameter (get_array_length_cname ("result", dim), "int*"));
+ cfunc.add_parameter (new CCodeParameter (get_array_length_cname ("result", dim), length_ctype + "*"));
}
}
if (type is ArrayType) {
// return array length if appropriate
var array_type = (ArrayType) type;
-
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
ccall.add_argument (get_array_length_cvalue (value, dim));
- cfunc.add_parameter (new CCodeParameter (get_array_length_cname ("value", dim), "gint"));
+ cfunc.add_parameter (new CCodeParameter (get_array_length_cname ("value", dim), length_ctype));
}
}
if (get_ccode_array_length (param) && param.variable_type is ArrayType) {
var array_type = (ArrayType) param.variable_type;
- var length_ctype = "int";
+ var length_ctype = get_ccode_array_length_type (array_type);
if (param.direction != ParameterDirection.IN) {
- length_ctype = "int*";
+ length_ctype += "*";
}
for (int dim = 1; dim <= array_type.rank; dim++) {
if (get_ccode_array_length (d) && d.return_type is ArrayType) {
// return array length if appropriate
var array_type = (ArrayType) d.return_type;
- var array_length_type = get_ccode_array_length_type (d) != null ? get_ccode_array_length_type (d) : "int";
- array_length_type += "*";
+ var length_ctype = get_ccode_array_length_type (array_type) + "*";
for (int dim = 1; dim <= array_type.rank; dim++) {
- var cparam = new CCodeParameter (get_array_length_cname ("result", dim), array_length_type);
+ var cparam = new CCodeParameter (get_array_length_cname ("result", dim), length_ctype);
cfundecl.add_parameter (cparam);
}
} else if (d.return_type is DelegateType) {
if (get_ccode_array_length (d) && d.return_type is ArrayType) {
// return array length if appropriate
var array_type = (ArrayType) d.return_type;
- var array_length_type = get_ccode_array_length_type (d) != null ? get_ccode_array_length_type (d) : "int";
- array_length_type += "*";
+ var length_ctype = get_ccode_array_length_type (array_type) + "*";
for (int dim = 1; dim <= array_type.rank; dim++) {
- var cparam = new CCodeParameter (get_array_length_cname ("result", dim), array_length_type);
+ var cparam = new CCodeParameter (get_array_length_cname ("result", dim), length_ctype);
cparam_map.set (get_param_pos (get_ccode_array_length_pos (d) + 0.01 * dim), cparam);
}
} else if (d.return_type is DelegateType) {
result.append_array_length_cvalue (new CCodeConstant ("-1"));
}
result.lvalue = false;
- } else if (get_ccode_array_length_type (variable) != null) {
+ } else if (get_ccode_array_length_type (variable.variable_type) != get_ccode_array_length_type (array_type)) {
for (int dim = 1; dim <= array_type.rank; dim++) {
// cast if variable does not use int for array length
- result.array_length_cvalues[dim - 1] = new CCodeCastExpression (result.array_length_cvalues[dim - 1], "gint");
+ result.array_length_cvalues[dim - 1] = new CCodeCastExpression (result.array_length_cvalues[dim - 1], get_ccode_array_length_type (array_type));
}
result.lvalue = false;
}
if (unary == null || unary.operator != UnaryOperator.OUT) {
if (get_ccode_array_length (param) && param.variable_type is ArrayType && !((ArrayType) param.variable_type).fixed_length) {
var array_type = (ArrayType) param.variable_type;
+ var length_ctype = get_ccode_array_length_type (array_type);
+ if (unary != null && unary.operator == UnaryOperator.REF) {
+ length_ctype = "%s*".printf (length_ctype);
+ }
for (int dim = 1; dim <= array_type.rank; dim++) {
- CCodeExpression? array_length_expr = null;
- if (get_ccode_array_length_type (param) != null) {
- string length_ctype = get_ccode_array_length_type (param);
- if (unary != null && unary.operator == UnaryOperator.REF) {
- length_ctype = "%s*".printf (length_ctype);
- }
- array_length_expr = new CCodeCastExpression (get_array_length_cexpression (arg, dim), length_ctype);
- } else {
- array_length_expr = get_array_length_cexpression (arg, dim);
- }
+ var array_length_expr = new CCodeCastExpression (get_array_length_cexpression (arg, dim), length_ctype);
carg_map.set (get_param_pos (get_ccode_array_length_pos (param) + 0.01 * dim), array_length_expr);
}
} else if (param.variable_type is DelegateType) {
if (get_ccode_array_length (param) && param.variable_type is ArrayType && !((ArrayType) param.variable_type).fixed_length) {
var array_type = (ArrayType) param.variable_type;
- var array_length_type = int_type;
- if (get_ccode_array_length_type (param) != null) {
- array_length_type = new CType (get_ccode_array_length_type (param));
- }
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- var temp_array_length = get_temp_variable (array_length_type);
+ var temp_array_length = get_temp_variable (new CType (length_ctype));
emit_temp_var (temp_array_length);
append_array_length (arg, get_variable_cexpression (temp_array_length.name));
carg_map.set (get_param_pos (get_ccode_array_length_pos (param) + 0.01 * dim), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_array_lengths (arg).get (dim - 1)));
append_array_length (expr, len_call);
} else if (get_ccode_array_length (m)) {
- LocalVariable temp_var;
-
- if (get_ccode_array_length_type (m) == null) {
- temp_var = get_temp_variable (int_type, true, null, true);
- } else {
- temp_var = get_temp_variable (new CType (get_ccode_array_length_type (m)), true, null, true);
- }
+ var length_ctype = get_ccode_array_length_type (array_type);
+ var temp_var = get_temp_variable (new CType (length_ctype), true, null, true);
var temp_ref = get_variable_cexpression (temp_var.name);
emit_temp_var (temp_var);
append_array_length (expr, len_call);
} else if (get_ccode_array_length (deleg)) {
- var temp_var = get_temp_variable (int_type, true, null, true);
+ var temp_var = get_temp_variable (new CType (get_ccode_array_length_type (array_type)), true, null, true);
var temp_ref = get_variable_cexpression (temp_var.name);
emit_temp_var (temp_var);
} else if (get_ccode_array_length (m) && m.return_type is ArrayType) {
// return array length if appropriate
var array_type = (ArrayType) m.return_type;
- var array_length_type = get_ccode_array_length_type (m) != null ? get_ccode_array_length_type (m) : "int";
- array_length_type += "*";
+ var length_ctype = get_ccode_array_length_type (array_type) + "*";
for (int dim = 1; dim <= array_type.rank; dim++) {
- var cparam = new CCodeParameter (get_array_length_cname ("result", dim), array_length_type);
+ var cparam = new CCodeParameter (get_array_length_cname ("result", dim), length_ctype);
cparam_map.set (get_param_pos (get_ccode_array_length_pos (m) + 0.01 * dim), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (get_ccode_array_length_pos (m) + 0.01 * dim), get_variable_cexpression (cparam.name));
var array_type = (ArrayType) param.variable_type;
if (!array_type.fixed_length) {
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
vardecl = new CCodeVariableDeclarator.zero (get_array_length_cname (get_variable_cname ("_vala_%s".printf (param.name)), dim), new CCodeConstant ("0"));
- ccode.add_declaration ("int", vardecl);
+ ccode.add_declaration (length_ctype, vardecl);
}
}
} else if (param.variable_type is DelegateType) {
var array_type = (ArrayType) f.variable_type;
if (!array_type.fixed_length) {
- var len_type = int_type.copy ();
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
string length_cname;
} else {
length_cname = get_array_length_cname (get_ccode_name (f), dim);
}
- instance_struct.add_field (get_ccode_name (len_type), length_cname);
+ instance_struct.add_field (length_ctype, length_cname);
}
if (array_type.rank == 1 && f.is_internal_symbol ()) {
- instance_struct.add_field (get_ccode_name (len_type), get_array_size_cname (get_ccode_name (f)));
+ instance_struct.add_field (length_ctype, get_array_size_cname (get_ccode_name (f)));
}
}
} else if (f.variable_type is DelegateType && get_ccode_delegate_target (f)) {
if (param.variable_type is ArrayType) {
var array_type = (ArrayType) param.variable_type;
if (get_ccode_array_length (param)) {
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- data.add_field ("gint", get_parameter_array_length_cname (param, dim));
+ data.add_field (length_ctype, get_parameter_array_length_cname (param, dim));
}
}
} else if (param.variable_type is DelegateType) {
if (m.return_type is ArrayType) {
var array_type = (ArrayType) m.return_type;
if (get_ccode_array_length (m)) {
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- data.add_field ("gint", get_array_length_cname ("result", dim));
+ data.add_field (length_ctype, get_array_length_cname ("result", dim));
}
}
} else if (m.return_type is DelegateType) {
callback_decl.add_parameter (new CCodeParameter ("arg_%d".printf (n_params), get_value_type_name_from_parameter (p)));
n_params++;
if (p.variable_type is ArrayType) {
- for (var j = 0; j < ((ArrayType) p.variable_type).rank; j++) {
- callback_decl.add_parameter (new CCodeParameter ("arg_%d".printf (n_params), "gint"));
+ var array_type = (ArrayType) p.variable_type;
+ //FIXME Only int length-type
+ //var length_ctype = get_ccode_array_length_type (array_type);
+ var length_ctype = get_ccode_name (int_type);
+ for (var j = 0; j < array_type.rank; j++) {
+ callback_decl.add_parameter (new CCodeParameter ("arg_%d".printf (n_params), length_ctype));
n_params++;
}
}
fc.add_argument (inner_fc);
i++;
if (p.variable_type is ArrayType) {
- for (var j = 0; j < ((ArrayType) p.variable_type).rank; j++) {
+ var array_type = (ArrayType) p.variable_type;
+ for (var j = 0; j < array_type.rank; j++) {
+ //FIXME Only int length-type
inner_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_get_int"));
inner_fc.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier ("param_values"), new CCodeIdentifier (i.to_string ())));
fc.add_argument (inner_fc);
var array_type = prop.property_type as ArrayType;
if (array_type != null) {
+ var length_ctype = get_ccode_array_length_type (array_type) + "*";
for (int dim = 1; dim <= array_type.rank; dim++) {
- vdeclarator.add_parameter (new CCodeParameter (get_array_length_cname ("result", dim), "int*"));
+ vdeclarator.add_parameter (new CCodeParameter (get_array_length_cname ("result", dim), length_ctype));
}
} else if ((prop.property_type is DelegateType) && ((DelegateType) prop.property_type).delegate_symbol.has_target) {
vdeclarator.add_parameter (new CCodeParameter (get_delegate_target_cname ("result"), "gpointer*"));
var array_type = prop.property_type as ArrayType;
if (array_type != null) {
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- vdeclarator.add_parameter (new CCodeParameter (get_array_length_cname ("value", dim), "int"));
+ vdeclarator.add_parameter (new CCodeParameter (get_array_length_cname ("value", dim), length_ctype));
}
} else if ((prop.property_type is DelegateType) && ((DelegateType) prop.property_type).delegate_symbol.has_target) {
vdeclarator.add_parameter (new CCodeParameter (get_delegate_target_cname ("value"), "gpointer"));
var array_type = (ArrayType) f.variable_type;
if (!array_type.fixed_length) {
- var len_type = int_type.copy ();
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
string length_cname;
} else {
length_cname = get_array_length_cname (get_ccode_name (f), dim);
}
- instance_struct.add_field (get_ccode_name (len_type), length_cname);
+ instance_struct.add_field (length_ctype, length_cname);
}
if (array_type.rank == 1 && f.is_internal_symbol ()) {
- instance_struct.add_field (get_ccode_name (len_type), get_array_size_cname (get_ccode_name (f)));
+ instance_struct.add_field (length_ctype, get_array_size_cname (get_ccode_name (f)));
}
}
} else if (f.variable_type is DelegateType && get_ccode_delegate_target (f)) {
if (f.variable_type is ArrayType && get_ccode_array_length (f)) {
// create fields to store array dimensions
var array_type = (ArrayType) f.variable_type;
- var len_type = int_type.copy ();
if (!array_type.fixed_length) {
+ var length_ctype = get_ccode_array_length_type (array_type);
+
for (int dim = 1; dim <= array_type.rank; dim++) {
string length_cname;
if (get_ccode_array_length_name (f) != null) {
} else {
length_cname = get_array_length_cname (get_ccode_name (f), dim);
}
- instance_priv_struct.add_field (get_ccode_name (len_type), length_cname);
+ instance_priv_struct.add_field (length_ctype, length_cname);
}
if (array_type.rank == 1 && f.is_internal_symbol ()) {
- instance_priv_struct.add_field (get_ccode_name (len_type), get_array_size_cname (get_ccode_name (f)));
+ instance_priv_struct.add_field (length_ctype, get_array_size_cname (get_ccode_name (f)));
}
}
} else if (f.variable_type is DelegateType && get_ccode_delegate_target (f)) {
var array_type = prop.property_type as ArrayType;
if (array_type != null) {
+ var length_ctype = get_ccode_array_length_type (array_type) + "*";
for (int dim = 1; dim <= array_type.rank; dim++) {
- vdeclarator.add_parameter (new CCodeParameter (get_array_length_cname ("result", dim), "int*"));
+ vdeclarator.add_parameter (new CCodeParameter (get_array_length_cname ("result", dim), length_ctype));
}
}
var array_type = prop.property_type as ArrayType;
if (array_type != null) {
+ var length_ctype = get_ccode_array_length_type (array_type);
for (int dim = 1; dim <= array_type.rank; dim++) {
- vdeclarator.add_parameter (new CCodeParameter (get_array_length_cname ("value", dim), "int"));
+ vdeclarator.add_parameter (new CCodeParameter (get_array_length_cname ("value", dim), length_ctype));
}
}
// add one extra element for NULL-termination
new_call.add_argument (new CCodeConstant ("5"));
+ var length_ctype = get_ccode_array_length_type (array_type);
ccode.add_declaration (get_ccode_name (array_type), new CCodeVariableDeclarator (temp_name, new_call));
- ccode.add_declaration ("int", new CCodeVariableDeclarator (temp_name + "_length", new CCodeConstant ("0")));
- ccode.add_declaration ("int", new CCodeVariableDeclarator (temp_name + "_size", new CCodeConstant ("4")));
+ ccode.add_declaration (length_ctype, new CCodeVariableDeclarator (temp_name + "_length", new CCodeConstant ("0")));
+ ccode.add_declaration (length_ctype, new CCodeVariableDeclarator (temp_name + "_size", new CCodeConstant ("4")));
deserialize_array_dim (array_type, 1, temp_name, variant_expr, expr);
string subiter_name = "_tmp%d_".printf (next_temp_var_id++);
string element_name = "_tmp%d_".printf (next_temp_var_id++);
- ccode.add_declaration ("int", new CCodeVariableDeclarator ("%s_length%d".printf (temp_name, dim), new CCodeConstant ("0")));
+ ccode.add_declaration (get_ccode_array_length_type (array_type), new CCodeVariableDeclarator ("%s_length%d".printf (temp_name, dim), new CCodeConstant ("0")));
ccode.add_declaration ("GVariantIter", new CCodeVariableDeclarator (subiter_name));
ccode.add_declaration ("GVariant*", new CCodeVariableDeclarator (element_name));
string index_name = "_tmp%d_".printf (next_temp_var_id++);
ccode.add_declaration ("GVariantBuilder", new CCodeVariableDeclarator (builder_name));
- ccode.add_declaration ("int", new CCodeVariableDeclarator (index_name));
+ ccode.add_declaration (get_ccode_array_length_type (array_type), new CCodeVariableDeclarator (index_name));
var gvariant_type = new CCodeFunctionCall (new CCodeIdentifier ("G_VARIANT_TYPE"));
ArrayType array_type_copy = (ArrayType) array_type.copy ();