* NAMED_ARG_INFO will contain information about the named arguments.
*/
void
-mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoArray **typed_args, MonoArray **named_args, CattrNamedArg **named_arg_info, MonoError *error)
+mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoArray **typed_args_out, MonoArray **named_args_out, CattrNamedArg **named_arg_info, MonoError *error)
{
- MonoArray *typedargs, *namedargs;
+ MonoArray *typed_args, *named_args;
MonoClass *attrklass;
MonoDomain *domain;
const char *p = (const char*)data;
guint32 i, j, num_named;
CattrNamedArg *arginfo = NULL;
- *typed_args = NULL;
- *named_args = NULL;
+ *typed_args_out = NULL;
+ *named_args_out = NULL;
*named_arg_info = NULL;
+ typed_args = NULL;
+ named_args = NULL;
+
error_init (error);
if (!mono_verifier_verify_cattr_content (image, method, data, len, error))
p += 2;
/* Parse each argument corresponding to the signature's parameters from
- * the blob and store in typedargs.
+ * the blob and store in typed_args.
*/
- typedargs = mono_array_new_checked (domain, mono_get_object_class (), mono_method_signature_internal (method)->param_count, error);
+ typed_args = mono_array_new_checked (domain, mono_get_object_class (), mono_method_signature_internal (method)->param_count, error);
return_if_nok (error);
for (i = 0; i < mono_method_signature_internal (method)->param_count; ++i) {
obj = load_cattr_value_boxed (domain, image, mono_method_signature_internal (method)->params [i], p, data_end, &p, error);
return_if_nok (error);
- mono_array_setref_internal (typedargs, i, obj);
+ mono_array_setref_internal (typed_args, i, obj);
}
named = p;
if (!bcheck_blob (named, 1, data_end, error))
return;
num_named = read16 (named);
- namedargs = mono_array_new_checked (domain, mono_get_object_class (), num_named, error);
+ named_args = mono_array_new_checked (domain, mono_get_object_class (), num_named, error);
return_if_nok (error);
named += 2;
attrklass = method->klass;
g_free (name);
return;
}
- mono_array_setref_internal (namedargs, j, obj);
+ mono_array_setref_internal (named_args, j, obj);
} else if (named_type == CATTR_TYPE_PROPERTY) {
/* Named arg is a property */
g_free (name);
return;
}
- mono_array_setref_internal (namedargs, j, obj);
+ mono_array_setref_internal (named_args, j, obj);
}
g_free (name);
}
- *typed_args = typedargs;
- *named_args = namedargs;
+ *typed_args_out = typed_args;
+ *named_args_out = named_args;
return;
fail:
mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
*/
void
mono_reflection_create_custom_attr_data_args_noalloc (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len,
- gpointer **typed_args, gpointer **named_args, int *num_named_args,
+ gpointer **typed_args_out, gpointer **named_args_out, int *num_named_args,
CattrNamedArg **named_arg_info, MonoError *error)
{
- gpointer *typedargs, *namedargs;
+ gpointer *typed_args, *named_args;
MonoClass *attrklass;
const char *p = (const char*)data;
const char *data_end = p + len;
CattrNamedArg *arginfo = NULL;
MonoMethodSignature *sig = mono_method_signature_internal (method);
- *typed_args = NULL;
- *named_args = NULL;
+ *typed_args_out = NULL;
+ *named_args_out = NULL;
*named_arg_info = NULL;
+ typed_args = NULL;
+ named_args = NULL;
+
error_init (error);
if (!mono_verifier_verify_cattr_content (image, method, data, len, error))
/* skip prolog */
p += 2;
- typedargs = g_new0 (gpointer, sig->param_count);
+ typed_args = g_new0 (gpointer, sig->param_count);
for (i = 0; i < sig->param_count; ++i) {
- typedargs [i] = load_cattr_value (image, sig->params [i], NULL, p, data_end, &p, error);
+ typed_args [i] = load_cattr_value (image, sig->params [i], NULL, p, data_end, &p, error);
return_if_nok (error);
}
if (!bcheck_blob (named, 1, data_end, error))
goto fail;
num_named = read16 (named);
- namedargs = g_new0 (gpointer, num_named);
+ named_args = g_new0 (gpointer, num_named);
return_if_nok (error);
named += 2;
attrklass = method->klass;
arginfo [j].type = field->type;
arginfo [j].field = field;
- namedargs [j] = load_cattr_value (image, field->type, NULL, named, data_end, &named, error);
+ named_args [j] = load_cattr_value (image, field->type, NULL, named, data_end, &named, error);
if (!is_ok (error)) {
g_free (name);
- return;
+ goto fail;
}
} else if (named_type == CATTR_TYPE_PROPERTY) {
/* Named arg is a property */
arginfo [j].type = prop_type;
arginfo [j].prop = prop;
- namedargs [j] = load_cattr_value (image, prop_type, NULL, named, data_end, &named, error);
+ named_args [j] = load_cattr_value (image, prop_type, NULL, named, data_end, &named, error);
if (!is_ok (error)) {
g_free (name);
- return;
+ goto fail;
}
}
g_free (name);
}
- *typed_args = typedargs;
- *named_args = namedargs;
+ *typed_args_out = typed_args;
+ *named_args_out = named_args;
return;
fail:
mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
+ g_free (typed_args);
+ g_free (named_args);
g_free (arginfo);
*named_arg_info = NULL;
}
static gboolean
-reflection_resolve_custom_attribute_data (MonoReflectionMethod *ref_method, MonoReflectionAssembly *assembly, gpointer data, guint32 len, MonoArray **ctor_args, MonoArray **named_args, MonoError *error)
+reflection_resolve_custom_attribute_data (MonoReflectionMethod *ref_method, MonoReflectionAssembly *assembly, gpointer data, guint32 len, MonoArray **ctor_args, MonoArray **named_args_out, MonoError *error)
{
MonoDomain *domain;
- MonoArray *typedargs, *namedargs;
+ MonoArray *typed_args, *named_args;
MonoImage *image;
MonoMethod *method;
CattrNamedArg *arginfo = NULL;
error_init (error);
*ctor_args = NULL;
- *named_args = NULL;
+ *named_args_out = NULL;
+
+ typed_args = NULL;
+ named_args = NULL;
if (len == 0)
return TRUE;
goto leave;
}
- mono_reflection_create_custom_attr_data_args (image, method, (const guchar *)data, len, &typedargs, &namedargs, &arginfo, error);
+ mono_reflection_create_custom_attr_data_args (image, method, (const guchar *)data, len, &typed_args, &named_args, &arginfo, error);
goto_if_nok (error, leave);
- if (!typedargs || !namedargs)
+ if (!typed_args || !named_args)
goto leave;
for (i = 0; i < mono_method_signature_internal (method)->param_count; ++i) {
- MonoObject *obj = mono_array_get_internal (typedargs, MonoObject*, i);
+ MonoObject *obj = mono_array_get_internal (typed_args, MonoObject*, i);
MonoObject *typedarg;
MonoType *t;
typedarg = create_cattr_typed_arg (t, obj, error);
goto_if_nok (error, leave);
- mono_array_setref_internal (typedargs, i, typedarg);
+ mono_array_setref_internal (typed_args, i, typedarg);
}
- for (i = 0; i < mono_array_length_internal (namedargs); ++i) {
- MonoObject *obj = mono_array_get_internal (namedargs, MonoObject*, i);
+ for (i = 0; i < mono_array_length_internal (named_args); ++i) {
+ MonoObject *obj = mono_array_get_internal (named_args, MonoObject*, i);
MonoObject *namedarg, *minfo;
if (arginfo [i].prop) {
#endif
goto_if_nok (error, leave);
- mono_array_setref_internal (namedargs, i, namedarg);
+ mono_array_setref_internal (named_args, i, namedarg);
}
- *ctor_args = typedargs;
- *named_args = namedargs;
+ *ctor_args = typed_args;
+ *named_args_out = named_args;
leave:
g_free (arginfo);