diff options
-rw-r--r-- | Mono.Cecil.Metadata/TableHeap.cs | 10 | ||||
-rw-r--r-- | Mono.Cecil.PE/ImageReader.cs | 11 |
2 files changed, 7 insertions, 14 deletions
diff --git a/Mono.Cecil.Metadata/TableHeap.cs b/Mono.Cecil.Metadata/TableHeap.cs index 2705c51..37a1948 100644 --- a/Mono.Cecil.Metadata/TableHeap.cs +++ b/Mono.Cecil.Metadata/TableHeap.cs @@ -90,15 +90,9 @@ namespace Mono.Cecil.Metadata { public long Valid; public long Sorted; - public static readonly Table [] TableIdentifiers; - public readonly TableInformation [] Tables = new TableInformation [45]; + public const int TableCount = 45; - static TableHeap () - { - TableIdentifiers = new Table [45]; - for (int i = 0; i < TableIdentifiers.Length; i++) - TableIdentifiers [i] = (Table) i; - } + public readonly TableInformation [] Tables = new TableInformation [TableCount]; public TableInformation this [Table table] { get { return Tables [(int) table]; } diff --git a/Mono.Cecil.PE/ImageReader.cs b/Mono.Cecil.PE/ImageReader.cs index 4a15d1c..be13ab3 100644 --- a/Mono.Cecil.PE/ImageReader.cs +++ b/Mono.Cecil.PE/ImageReader.cs @@ -416,12 +416,11 @@ namespace Mono.Cecil.PE { // Sorted 8 heap.Sorted = ReadInt64 (); - for (int i = 0; i < TableHeap.TableIdentifiers.Length; i++) { - var table = TableHeap.TableIdentifiers [i]; - if (!heap.HasTable (table)) + for (int i = 0; i < TableHeap.TableCount; i++) { + if (!heap.HasTable ((Table) i)) continue; - heap.Tables [(int) table].Length = ReadUInt32 (); + heap.Tables [i].Length = ReadUInt32 (); } SetIndexSize (image.StringHeap, sizes, 0x1); @@ -459,8 +458,8 @@ namespace Mono.Cecil.PE { var heap = image.TableHeap; var tables = heap.Tables; - for (int i = 0; i < TableHeap.TableIdentifiers.Length; i++) { - var table = TableHeap.TableIdentifiers [i]; + for (int i = 0; i < TableHeap.TableCount; i++) { + var table = (Table) i; if (!heap.HasTable (table)) continue; |