Merge pull request #5303 from lambdageek/cattr-bcheck
[mono.git] / mono / metadata / metadata.c
index 133310e69216ef965510445729d7c4cc7ff13861..b41dbf4e8186eff36f490f2a4d4844b032c73295 100644 (file)
@@ -836,21 +836,11 @@ mono_metadata_compute_size (MonoImage *meta, int tableindex, guint32 *result_bit
                        break;
 
                        /*
-                        * CustomAttributeType: TypeDef, TypeRef, MethodDef, 
-                        * MemberRef and String.  
+                        * CustomAttributeType: MethodDef, MemberRef.
                         */
                case MONO_MT_CAT_IDX:
-                       /* String is a heap, if it is wide, we know the size */
-                       /* See above, nope. 
-                       if (meta->idx_string_wide){
-                               field_size = 4;
-                               break;
-                       }*/
-                       
-                       n = MAX (get_nrows (meta, MONO_TABLE_TYPEREF),
-                                get_nrows (meta, MONO_TABLE_TYPEDEF));
-                       n = MAX (n, get_nrows (meta, MONO_TABLE_METHOD));
-                       n = MAX (n, get_nrows (meta, MONO_TABLE_MEMBERREF));
+                       n = MAX (get_nrows (meta, MONO_TABLE_METHOD),
+                                        get_nrows (meta, MONO_TABLE_MEMBERREF));
 
                        /* 3 bits to encode */
                        field_size = rtsize (meta, n, 16-3);
@@ -1190,7 +1180,7 @@ mono_metadata_decode_row_col (const MonoTableInfo *t, int idx, guint col)
  * \param ptr pointer to a blob object
  * \param rptr the new position of the pointer
  *
- * This decodes a compressed size as described by 23.1.4 (a blob or user string object)
+ * This decodes a compressed size as described by 24.2.4 (#US and #Blob a blob or user string object)
  *
  * \returns the size of the blob object
  */
@@ -1532,7 +1522,7 @@ builtin_types[] = {
 #define NBUILTIN_TYPES() (sizeof (builtin_types) / sizeof (builtin_types [0]))
 
 static GHashTable *type_cache = NULL;
-static int next_generic_inst_id = 0;
+static gint32 next_generic_inst_id = 0;
 
 /* Protected by image_sets_mutex */
 static MonoImageSet *mscorlib_image_set;
@@ -3170,7 +3160,7 @@ mono_metadata_get_canonical_generic_inst (MonoGenericInst *candidate)
                int size = MONO_SIZEOF_GENERIC_INST + type_argc * sizeof (MonoType *);
                ginst = (MonoGenericInst *)mono_image_set_alloc0 (set, size);
 #ifndef MONO_SMALL_CONFIG
-               ginst->id = ++next_generic_inst_id;
+               ginst->id = InterlockedIncrement (&next_generic_inst_id);
 #endif
                ginst->is_open = is_open;
                ginst->type_argc = type_argc;