+2004-11-01 Zoltan Varga <vargaz@freemail.hu>
+
+ * string-icalls.c (ves_icall_System_String_ctor_encoding):
+ Implement this. Fixes #67264.
+
+ * debug-helpers.h debug-helpers.c marshal.c: Move
+ mono_find_method_by_name to debug-helpers.c.
+
2004-10-31 Zoltan Varga <vargaz@freemail.hu>
* object.c (mono_release_type_locks): type_initialization_hash is
return res;
}
+MonoMethod *
+mono_find_method_by_name (MonoClass *klass, const char *name, int param_count)
+{
+ MonoMethod *res = NULL;
+ int i;
+
+ mono_class_init (klass);
+
+ for (i = 0; i < klass->method.count; ++i) {
+ if (klass->methods [i]->name[0] == name [0] &&
+ !strcmp (name, klass->methods [i]->name) &&
+ klass->methods [i]->signature->param_count == param_count) {
+ res = klass->methods [i];
+ break;
+ }
+ }
+ return res;
+}
char* mono_method_full_name (MonoMethod *method, gboolean signature);
+MonoMethod * mono_find_method_by_name (MonoClass *klass, const char *name, int param_count);
+
#endif /* __MONO_DEBUG_HELPERS_H__ */
static void
emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object);
-static MonoMethod *
-mono_find_method_by_name (MonoClass *klass, const char *name, int param_count)
-{
- MonoMethod *res = NULL;
- int i;
-
- mono_class_init (klass);
-
- for (i = 0; i < klass->method.count; ++i) {
- if (klass->methods [i]->name[0] == name [0] &&
- !strcmp (name, klass->methods [i]->name) &&
- klass->methods [i]->signature->param_count == param_count) {
- res = klass->methods [i];
- break;
- }
- }
- return res;
-}
-
#ifdef DEBUG_RUNTIME_CODE
static char*
indenter (MonoDisHelper *dh, MonoMethod *method, guint32 ip_offset)
#include <signal.h>
#include <string.h>
#include <mono/metadata/string-icalls.h>
+#include <mono/metadata/class-internals.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/tabledefs.h>
#include <mono/metadata/loader.h>
#include <mono/metadata/object.h>
#include <mono/metadata/unicode.h>
#include <mono/metadata/exception.h>
+#include <mono/metadata/debug-helpers.h>
/* Internal helper methods */
gint32 length, MonoObject *enc)
{
MONO_ARCH_SAVE_REGS;
+ MonoArray *arr;
+ MonoString *s;
+ MonoObject *exc;
+ MonoDomain *domain = mono_domain_get ();
+ MonoMethod *get_string;
+ gpointer args [1];
+
+ if ((value == NULL) || (length == 0))
+ return mono_string_new_size (mono_domain_get (), 0);
+ if (enc == NULL)
+ mono_raise_exception (mono_get_exception_argument_null ("enc"));
+ if (sindex < 0)
+ mono_raise_exception (mono_get_exception_argument_out_of_range ("startIndex"));
+ if (length < 0)
+ mono_raise_exception (mono_get_exception_argument_out_of_range ("length"));
+
+ arr = mono_array_new (domain, mono_defaults.byte_class, length);
+ memcpy (mono_array_addr (arr, guint8*, 0), value + sindex, length);
+
+ get_string = mono_find_method_by_name (enc->vtable->klass, "GetString", 1);
+ args [0] = arr;
+ s = (MonoString*)mono_runtime_invoke (get_string, enc, args, &exc);
+ if (!s || exc)
+ mono_raise_exception (mono_get_exception_argument ("", "Unable to decode the array into a valid string."));
- g_warning("string.ctor with encoding obj unimplemented");
- g_assert_not_reached ();
- return NULL;
+ return s;
}
MonoString *