2004-09-01 Dick Porter <dick@ximian.com>
authorDick Porter <dick@acm.org>
Wed, 1 Sep 2004 12:34:23 +0000 (12:34 -0000)
committerDick Porter <dick@acm.org>
Wed, 1 Sep 2004 12:34:23 +0000 (12:34 -0000)
* icall.c (ves_icall_System_Reflection_Assembly_get_location): Use
mono_image_get_filename() to get the assembly location.

* icall.c:
* metadata.h: Fix compile warnings

svn path=/trunk/mono/; revision=33154

mono/metadata/ChangeLog
mono/metadata/icall.c
mono/metadata/metadata.h

index 3cacecb5697108444606a01fd4d3e66be599e17e..5347b2ac708c569823271419369178e729eb298d 100644 (file)
@@ -1,3 +1,11 @@
+2004-09-01  Dick Porter  <dick@ximian.com>
+
+       * icall.c (ves_icall_System_Reflection_Assembly_get_location): Use
+       mono_image_get_filename() to get the assembly location.
+
+       * icall.c:
+       * metadata.h: Fix compile warnings
+
 2004-09-01  Zoltan Varga  <vargaz@freemail.hu>
 
        * class.c (class_compute_field_layout): System.Object is blittable.
index 88450a296f7565b298ead01394d832762b733ba7..db5f12e6f0fc3b4c532d90b66c776fe26f93ed1f 100644 (file)
@@ -950,12 +950,15 @@ type_from_name (const char *str, MonoBoolean ignoreCase)
        MonoType *type = NULL;
        MonoAssembly *assembly;
        MonoTypeNameParse info;
+       char *temp_str = g_strdup (str);
 
        MONO_ARCH_SAVE_REGS;
 
-       if (!mono_reflection_parse_type (str, &info)) {
+       /* mono_reflection_parse_type() mangles the string */
+       if (!mono_reflection_parse_type (temp_str, &info)) {
                g_list_free (info.modifiers);
                g_list_free (info.nested);
+               g_free (temp_str);
                return NULL;
        }
 
@@ -976,12 +979,15 @@ type_from_name (const char *str, MonoBoolean ignoreCase)
 
        g_list_free (info.modifiers);
        g_list_free (info.nested);
+       g_free (temp_str);
+
        if (!type) 
                return NULL;
 
        return mono_type_get_object (mono_domain_get (), type);
 }
 
+#ifdef UNUSED
 MonoReflectionType *
 mono_type_get (const char *str)
 {
@@ -991,6 +997,7 @@ mono_type_get (const char *str)
        g_free (copy);
        return type;
 }
+#endif
 
 static MonoReflectionType*
 ves_icall_type_from_name (MonoString *name,
@@ -3144,14 +3151,11 @@ ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssembly *assem
 {
        MonoDomain *domain = mono_object_domain (assembly); 
        MonoString *res;
-       char *name = g_build_filename (
-               assembly->assembly->basedir,
-               assembly->assembly->image->module_name, NULL);
 
        MONO_ARCH_SAVE_REGS;
 
-       res = mono_string_new (domain, name);
-       g_free (name);
+       res = mono_string_new (domain, mono_image_get_filename (assembly->assembly->image));
+
        return res;
 }
 
@@ -4619,7 +4623,8 @@ static MonoString*
 ves_icall_System_Text_Encoding_InternalCodePage (gint32 *int_code_page) 
 {
        const char *cset;
-       char *p;
+       const char *p;
+       char *c;
        char *codepage = NULL;
        int code;
        int want_name = *int_code_page;
@@ -4629,12 +4634,12 @@ ves_icall_System_Text_Encoding_InternalCodePage (gint32 *int_code_page)
        MONO_ARCH_SAVE_REGS;
 
        g_get_charset (&cset);
-       p = codepage = strdup (cset);
-       for (p = codepage; *p; p++){
-               if (isascii (*p) && isalpha (*p))
-                       *p = tolower (*p);
-               if (*p == '-')
-                       *p = '_';
+       c = codepage = strdup (cset);
+       for (c = codepage; *c; c++){
+               if (isascii (*c) && isalpha (*c))
+                       *c = tolower (*c);
+               if (*c == '-')
+                       *c = '_';
        }
        /* g_print ("charset: %s\n", cset); */
        
@@ -5039,11 +5044,15 @@ ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionType
                prelink_method (klass->methods [i]);
 }
 
+/* These parameters are "readonly" in corlib/System/Char.cs */
 static void
-ves_icall_System_Char_GetDataTablePointers (guint8 **category_data, guint8 **numeric_data,
-               gdouble **numeric_data_values, guint16 **to_lower_data_low,
-               guint16 **to_lower_data_high, guint16 **to_upper_data_low,
-               guint16 **to_upper_data_high)
+ves_icall_System_Char_GetDataTablePointers (guint8 const **category_data,
+                                           guint8 const **numeric_data,
+                                           gdouble const **numeric_data_values,
+                                           guint16 const **to_lower_data_low,
+                                           guint16 const **to_lower_data_high,
+                                           guint16 const **to_upper_data_low,
+                                           guint16 const **to_upper_data_high)
 {
        *category_data = CategoryData;
        *numeric_data = NumericData;
@@ -6099,7 +6108,7 @@ mono_lookup_internal_call (MonoMethod *method)
 static MonoType*
 type_from_typename (char *typename)
 {
-       MonoClass *klass;
+       MonoClass *klass = NULL;        /* assignment to shut GCC warning up */
 
        if (!strcmp (typename, "int"))
                klass = mono_defaults.int_class;
index 93215d141a56035eb7a45892e0c97dc0f6cef515..febd4bf864e38f0646ec273adce5e3b345d7729c 100644 (file)
 #define MONO_TYPE_ISSTRUCT(t) (!(t)->byref && (((t)->type == MONO_TYPE_VALUETYPE && !(t)->data.klass->enumtype) || ((t)->type == MONO_TYPE_TYPEDBYREF) || (((t)->type == MONO_TYPE_GENERICINST) && mono_metadata_generic_inst_is_valuetype ((t)->data.generic_inst))))
 #define MONO_TYPE_IS_VOID(t) ((t) && ((t)->type == MONO_TYPE_VOID) && !(t)->byref)
 #define MONO_TYPE_IS_POINTER(t) ((t) && (((t)->byref || ((t)->type == MONO_TYPE_I) || (t)->type == MONO_TYPE_STRING) || ((t)->type == MONO_TYPE_SZARRAY) || ((t)->type == MONO_TYPE_CLASS) || ((t)->type == MONO_TYPE_CLASS) || ((t)->type == MONO_TYPE_OBJECT) || ((t)->type == MONO_TYPE_ARRAY) || ((t)->type == MONO_TYPE_PTR)))
-#define MONO_TYPE_IS_REFERENCE(t) ((t) && (((t)->type == MONO_TYPE_STRING) || ((t)->type == MONO_TYPE_SZARRAY) || ((t)->type == MONO_TYPE_CLASS) || ((t)->type == MONO_TYPE_OBJECT) || ((t)->type == MONO_TYPE_ARRAY)) || (((t)->type == MONO_TYPE_GENERICINST) && !mono_metadata_generic_inst_is_valuetype ((t)->data.generic_inst)))
+
+#define MONO_TYPE_IS_REFERENCE(t) ((t) &&                                      \
+                                  ((((t)->type == MONO_TYPE_STRING) ||         \
+                                    ((t)->type == MONO_TYPE_SZARRAY) ||        \
+                                    ((t)->type == MONO_TYPE_CLASS) ||          \
+                                    ((t)->type == MONO_TYPE_OBJECT) ||         \
+                                    ((t)->type == MONO_TYPE_ARRAY)) ||         \
+                                   (((t)->type == MONO_TYPE_GENERICINST) &&    \
+                                    !mono_metadata_generic_inst_is_valuetype ((t)->data.generic_inst))))
+
 #define MONO_CLASS_IS_INTERFACE(c) ((c->flags & TYPE_ATTRIBUTE_INTERFACE) || (c->byval_arg.type == MONO_TYPE_VAR) || (c->byval_arg.type == MONO_TYPE_MVAR))
 
 typedef struct _MonoClass MonoClass;