X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fverify.c;h=4c8a8ed54614739d1bccf35c80197d38d044b60d;hb=f33e2fece0b056ea82643f7c3074aaadf07c67a4;hp=1952eb4ed7f3fadc482ad3e7587b3030ea0c51a8;hpb=98a86ecd4ba2d3b4631d98ac5a4abf23f4e6c3e3;p=mono.git diff --git a/mono/metadata/verify.c b/mono/metadata/verify.c index 1952eb4ed7f..4c8a8ed5461 100644 --- a/mono/metadata/verify.c +++ b/mono/metadata/verify.c @@ -56,8 +56,8 @@ mono_free_verify_list (GSList *list) (list) = g_slist_prepend ((list), vinfo); \ } while (0) -static const char* const -valid_cultures[] = { +static const char +valid_cultures[][9] = { "ar-SA", "ar-IQ", "ar-EG", "ar-LY", "ar-DZ", "ar-MA", "ar-TN", "ar-OM", "ar-YE", "ar-SY", "ar-JO", "ar-LB", @@ -92,8 +92,7 @@ valid_cultures[] = { "Lt-uz-UZ", "Cy-uz-UZ", "tt-TA", "pa-IN", "gu-IN", "ta-IN", "te-IN", "kn-IN", "mr-IN", "sa-IN", "mn-MN", "gl-ES", - "kok-IN", "syr-SY", "div-MV", - NULL + "kok-IN", "syr-SY", "div-MV" }; static int @@ -103,9 +102,11 @@ is_valid_culture (const char *cname) int found; found = *cname == 0; - for (i = 0; !found && valid_cultures [i]; ++i) { - if (g_strcasecmp (valid_cultures [i], cname)) + for (i = 0; i < G_N_ELEMENTS (valid_cultures); ++i) { + if (g_strcasecmp (valid_cultures [i], cname)) { found = 1; + break; + } } return found; } @@ -686,7 +687,7 @@ enum { TYPE_MAX = 8 }; -static const char* +static const char* const arg_name [TYPE_MAX] = { "Invalid", "Int32", @@ -1145,9 +1146,9 @@ mono_method_verify (MonoMethod *method, int level) ILStackDesc *stack; register const unsigned char *ip; register const unsigned char *end; - const unsigned char *target; /* branch target */ + const unsigned char *target = NULL; /* branch target */ int max_args, max_stack, cur_stack, i, n, need_merge, start; - guint32 token, ip_offset; + guint32 token, ip_offset = 0; char *local_state = NULL; GSList *list = NULL; guint prefix = 0; @@ -1157,8 +1158,8 @@ mono_method_verify (MonoMethod *method, int level) (method->flags & (METHOD_ATTRIBUTE_PINVOKE_IMPL | METHOD_ATTRIBUTE_ABSTRACT))) { return NULL; } - signature = method->signature; - header = ((MonoMethodNormal *)method)->header; + signature = mono_method_signature (method); + header = mono_method_get_header (method); ip = header->code; end = ip + header->code_size; max_args = signature->param_count + signature->hasthis; @@ -1176,7 +1177,7 @@ mono_method_verify (MonoMethod *method, int level) params = signature->params; } - if (method->signature->is_inflated) + if (signature->is_inflated) generic_context = ((MonoMethodInflated *) method)->context; if (header->num_locals) { @@ -1396,8 +1397,8 @@ mono_method_verify (MonoMethod *method, int level) cmethod = mono_get_method_full (image, token, NULL, generic_context); if (!cmethod) ADD_INVALID (list, g_strdup_printf ("Method 0x%08x not found at 0x%04x", token, ip_offset)); - if (cmethod->signature->pinvoke) { - csig = cmethod->signature; + if (mono_method_signature (cmethod)) { + csig = mono_method_signature (cmethod); } else { csig = mono_method_get_signature (cmethod, image, token); } @@ -1638,7 +1639,7 @@ mono_method_verify (MonoMethod *method, int level) cmethod = mono_get_method_full (image, token, NULL, generic_context); if (!cmethod) ADD_INVALID (list, g_strdup_printf ("Constructor 0x%08x not found at 0x%04x", token, ip_offset)); - csig = cmethod->signature; + csig = mono_method_signature (cmethod); CHECK_STACK_UNDERFLOW (csig->param_count); cur_stack -= csig->param_count; CHECK_STACK_OVERFLOW (); @@ -1826,8 +1827,8 @@ mono_method_verify (MonoMethod *method, int level) cur_stack -= 3; ++ip; break; - case CEE_LDELEM: - case CEE_STELEM: + case CEE_LDELEM_ANY: + case CEE_STELEM_ANY: case CEE_UNBOX_ANY: case CEE_UNUSED5: case CEE_UNUSED6: @@ -2225,7 +2226,8 @@ methodbuilder_fields[] = { {"pinfo", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, pinfo)}, {"pi_dll", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, dll)}, {"pi_entry", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, dllentry)}, - {"ncharset", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, charset)}, + {"charset", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, charset)}, + {"extra_flags", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, extra_flags)}, {"native_cc", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, native_cc)}, {"call_conv", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, call_conv)}, {NULL, 0} @@ -2504,7 +2506,6 @@ wait_handle_fields[] = { static FieldDesc thread_fields[] = { {"system_thread_handle", G_STRUCT_OFFSET (MonoThread, handle)}, - {"current_culture", G_STRUCT_OFFSET (MonoThread, culture_info)}, {"threadpool_thread", G_STRUCT_OFFSET (MonoThread, threadpool_thread)}, {"state", G_STRUCT_OFFSET (MonoThread, state)}, {"abort_exc", G_STRUCT_OFFSET (MonoThread, abort_exc)}, @@ -2539,10 +2540,10 @@ cinfo_fields[] = { static const FieldDesc dtfinfo_fields[] = { - {"_AMDesignator", G_STRUCT_OFFSET (MonoDateTimeFormatInfo, AMDesignator)}, - {"_PMDesignator", G_STRUCT_OFFSET (MonoDateTimeFormatInfo, PMDesignator)}, - {"_DayNames", G_STRUCT_OFFSET (MonoDateTimeFormatInfo, DayNames)}, - {"_MonthNames", G_STRUCT_OFFSET (MonoDateTimeFormatInfo, MonthNames)}, + {"amDesignator", G_STRUCT_OFFSET (MonoDateTimeFormatInfo, AMDesignator)}, + {"pmDesignator", G_STRUCT_OFFSET (MonoDateTimeFormatInfo, PMDesignator)}, + {"dayNames", G_STRUCT_OFFSET (MonoDateTimeFormatInfo, DayNames)}, + {"monthNames", G_STRUCT_OFFSET (MonoDateTimeFormatInfo, MonthNames)}, {NULL, 0} };