+2009-09-23 Miguel de Icaza <miguel@novell.com>
+
+ * verify.c: when comparing culture strings, use g_ascii_strcmp
+
+ * assembly.c (mono_public_tokens_are_equal): Change g_strcasecmp
+ when comparing public key tokens to use memcmp on 16 bytes. I do
+ not believe this ever worked as advertised in the past.
+
+ The standard Public Key is 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00
+ which would have always failed earlier.
+
2009-06-25 Miguel de Icaza <miguel@novell.com>
* gc.c: Raise a NullArgumentException if the object passed is
gboolean
mono_public_tokens_are_equal (const unsigned char *pubt1, const unsigned char *pubt2)
{
- return g_strcasecmp ((char*)pubt1, (char*)pubt2) == 0;
+ return memcmp (pubt1, pubt2, 16) == 0;
}
static void
#include <mono/metadata/verify-internals.h>
#include <mono/metadata/mono-debug.h>
#include <mono/utils/mono-counters.h>
+#include <mono/utils/mono-string.h>
MonoStats mono_stats;
char *name = (char*)key;
FindUserData *data = (FindUserData*)user_data;
- if (!data->value && (g_strcasecmp (name, (char*)data->key) == 0))
+ if (!data->value && (mono_utf8_strcasecmp (name, (char*)data->key) == 0))
data->value = value;
}
continue;
n = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAME]);
nspace = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAMESPACE]);
- if (g_strcasecmp (n, name) == 0 && g_strcasecmp (nspace, name_space) == 0)
+ if (mono_utf8_strcasecmp (n, name) == 0 && mono_utf8_strcasecmp (nspace, name_space) == 0)
return mono_class_get (image, MONO_TOKEN_TYPE_DEF | i);
}
return NULL;
#include <mono/utils/monobitset.h>
#include <mono/utils/mono-time.h>
#include <mono/utils/mono-proclib.h>
+#include <mono/utils/mono-string.h>
#if defined (PLATFORM_WIN32)
#include <windows.h>
if (type->type->byref)
return NULL;
- compare_func = (bflags & BFLAGS_IgnoreCase) ? g_strcasecmp : strcmp;
+ compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
handle_parent:
if (klass->exception_type != MONO_EXCEPTION_NONE)
len = 0;
if (name != NULL) {
mname = mono_string_to_utf8 (name);
- compare_func = (ignore_case) ? g_strcasecmp : strcmp;
+ compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
}
/* An optimization for calls made from Delegate:CreateDelegate () */
klass = startklass = mono_class_from_mono_type (type->type);
if (name != NULL) {
propname = mono_string_to_utf8 (name);
- compare_func = (ignore_case) ? g_strcasecmp : strcmp;
+ compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
}
mono_class_setup_vtable (klass);
(attribute_names [0] != NULL) &&
(strcmp (attribute_names [0], "enabled") == 0)) {
if ((strcmp (attribute_values [0], "1") == 0) ||
- (g_strcasecmp (attribute_values [0], "true") == 0)) {
+ (g_ascii_strcasecmp (attribute_values [0], "true") == 0)) {
mono_runtime_unhandled_exception_policy_set (MONO_UNHANDLED_POLICY_LEGACY);
}
}
#include <mono/metadata/mempool-internals.h>
#include <mono/metadata/security-core-clr.h>
#include <mono/metadata/debug-helpers.h>
+#include <mono/utils/mono-string.h>
#if HAVE_SGEN_GC
static void* reflection_info_desc = NULL;
while ((klass = mono_class_get_nested_types (parent, &iter))) {
if (ignorecase) {
- if (g_strcasecmp (klass->name, mod->data) == 0)
+ if (mono_utf8_strcasecmp (klass->name, mod->data) == 0)
break;
} else {
if (strcmp (klass->name, mod->data) == 0)
found = *cname == 0;
for (i = 0; i < G_N_ELEMENTS (valid_cultures); ++i) {
- if (g_strcasecmp (valid_cultures [i], cname)) {
+ if (g_ascii_strcasecmp (valid_cultures [i], cname)) {
found = 1;
break;
}
mono-mmap.h \
mono-proclib.c \
mono-proclib.h \
+ mono-string.h \
mono-time.c \
mono-time.h \
strtod.h \
--- /dev/null
+#ifndef __UTILS_MONO_STRING_H__
+#define __UTILS_MONO_STRING_H__
+#include <glib.h>
+/*
+ * This definition is used to we remember later to implement this properly
+ *
+ * Currently we merely call into the ascii comparison, but we should be
+ * instead doing case folding and comparing the result.
+ */
+#define mono_utf8_strcasecmp g_ascii_strcasecmp
+
+#endif /* __UTILS_MONO_STRING_H__ */