2
0
Эх сурвалжийг харах

* PEAPI.cs: Add a method to set the fields list. This is needed so
that sequentially laid out fields are laid out in the right
order. When building custom attribute tables actually emit the
custom attribute data. When writing the .sdata section make sure
to pad to its size. The constants itself will not make up the
entire section because it is aligned on 512 byte blocks.

svn path=/trunk/mcs/; revision=30458

Jackson Harper 21 жил өмнө
parent
commit
54c716697c

+ 9 - 0
mcs/class/PEAPI/ChangeLog

@@ -1,3 +1,12 @@
+2004-06-26  Jackson Harper  <[email protected]>
+
+	* PEAPI.cs: Add a method to set the fields list. This is needed so
+	that sequentially laid out fields are laid out in the right
+	order. When building custom attribute tables actually emit the
+	custom attribute data. When writing the .sdata section make sure
+	to pad to its size. The constants itself will not make up the
+	entire section because it is aligned on 512 byte blocks.
+	
 2004-06-19  Jackson Harper  <[email protected]>
 
 	* PEAPI.cs: Make sure the sentinel is placed properly for vararg

+ 12 - 3
mcs/class/PEAPI/PEAPI.cs

@@ -1821,7 +1821,12 @@ namespace PEAPI
       fields.Add(field);
       return field;
     }
-
+
+    public void SetFieldOrder (ArrayList fields)
+    {
+            this.fields = fields;
+    }
+
     /// <summary>
     /// Add a method to this class
     /// </summary>
@@ -2646,7 +2651,7 @@ namespace PEAPI
 
     internal sealed override void BuildTables(MetaData md) {
       BinaryWriter bw = new BinaryWriter(new MemoryStream());
-      bw.Write((ushort)1);
+      bw.Write(byteVal);
       md.AddToTable(MDTable.CustomAttribute, this);
       MemoryStream str = (MemoryStream)bw.BaseStream;
       valIx = md.AddToBlobHeap(str.ToArray());
@@ -3482,9 +3487,13 @@ if (rsrc != null)
      }
 
     private void WriteSDataSection() {
+      long size = sdata.Size ();
+      long start = BaseStream.Position;
       for (int i=0; i < data.Count; i++) {
         ((DataConstant)data[i]).Write(this);
-      }
+      }
+      while (BaseStream.Position < (start + size))
+              Write ((byte) 0);
     }
 
                 private void WriteRsrcSection() {