Mon Dec 20 15:28:54 CET 2004 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Mon, 20 Dec 2004 14:28:59 +0000 (14:28 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Mon, 20 Dec 2004 14:28:59 +0000 (14:28 -0000)
* reflection.c: sort the constant table (bug #70693).

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

mono/metadata/ChangeLog
mono/metadata/reflection.c

index 2187efd478fed0731cde57d28541fb56c1233117..91017cae08f420553ebc5b0b2b2edb7e1e16400e 100644 (file)
@@ -1,4 +1,8 @@
 
+Mon Dec 20 15:28:54 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+       * reflection.c: sort the constant table (bug #70693).
+
 Mon Dec 20 12:19:37 CET 2004 Paolo Molaro <lupus@ximian.com>
 
        * object-internals.h, threads.c, domain.c: add accessors for
index f528acd529908b119fdef2a878c043aea6d2a471..b24c6e8028d4e1bdb9ba07cd28ab0e274727452f 100644 (file)
@@ -3188,6 +3188,14 @@ mono_image_fill_export_table_from_module (MonoDomain *domain, MonoReflectionModu
 
 static int
 compare_semantics (const void *a, const void *b)
+{
+       const guint32 *a_values = a;
+       const guint32 *b_values = b;
+       return a_values [MONO_CONSTANT_PARENT] - b_values [MONO_CONSTANT_PARENT];
+}
+
+static int
+compare_constants (const void *a, const void *b)
 {
        const guint32 *a_values = a;
        const guint32 *b_values = b;
@@ -3429,6 +3437,9 @@ build_compressed_metadata (MonoDynamicImage *assembly)
        p = (unsigned char*)int32val;
 
        /* sort the tables that still need sorting */
+       table = &assembly->tables [MONO_TABLE_CONSTANT];
+       if (table->rows)
+               qsort (table->values + MONO_CONSTANT_SIZE, table->rows, sizeof (guint32) * MONO_CONSTANT_SIZE, compare_constants);
        table = &assembly->tables [MONO_TABLE_METHODSEMANTICS];
        if (table->rows)
                qsort (table->values + MONO_METHOD_SEMA_SIZE, table->rows, sizeof (guint32) * MONO_METHOD_SEMA_SIZE, compare_semantics);