Author: zoltan
Date: 2005-02-28 09:12:50 -0500 (Mon, 28 Feb 2005)
New Revision: 41282

Modified:
   trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
   trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
   trunk/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
Log:
2005-02-28  Zoltan Varga  <[EMAIL PROTECTED]>

        * CustomAttributeBuilder.cs (get_umarshal): Marshal sizeConst and
        sizeParamIndex fields as well.

        * UnmanagedMarshal.cs: Add param_num field and a new internal creation
        method which sets it.


Modified: trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog     2005-02-28 
13:31:36 UTC (rev 41281)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog     2005-02-28 
14:12:50 UTC (rev 41282)
@@ -1,3 +1,11 @@
+2005-02-28  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * CustomAttributeBuilder.cs (get_umarshal): Marshal sizeConst and
+       sizeParamIndex fields as well.
+
+       * UnmanagedMarshal.cs: Add param_num field and a new internal creation
+       method which sets it.
+
 2005-02-11  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * TypeBuilder.cs (IsAssignableTo): New helper method. Fixes #70838.

Modified: 
trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs     
2005-02-28 13:31:36 UTC (rev 41281)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs     
2005-02-28 14:12:50 UTC (rev 41282)
@@ -208,8 +208,9 @@
 
                internal static UnmanagedMarshal get_umarshal 
(CustomAttributeBuilder customBuilder, bool is_field) {
                        byte[] data = customBuilder.Data;
-                       UnmanagedType subtype = UnmanagedType.I4;
+                       UnmanagedType subtype = (UnmanagedType)0x50; /* 
NATIVE_MAX */
                        int sizeConst = 0;
+                       int sizeParamIndex = 0;
                        int value;
                        int utype; /* the (stupid) ctor takes a short or an 
enum ... */
                        Type marshalTypeRef = null;
@@ -247,6 +248,11 @@
                                        value |= ((int)data [pos++]) << 24;
                                        sizeConst = value;
                                        break;
+                               case "SizeSizeParamIndex":
+                                       value = (int)data [pos++];
+                                       value |= ((int)data [pos++]) << 8;
+                                       sizeParamIndex = value;
+                                       break;
                                case "MarshalTypeRef":
                                case "MarshalType":
                                        len = decode_len (data, pos, out pos);
@@ -268,7 +274,7 @@
 
                        switch ((UnmanagedType)utype) {
                        case UnmanagedType.LPArray:
-                               return UnmanagedMarshal.DefineLPArray (subtype);
+                               return UnmanagedMarshal.DefineLPArrayInternal 
(subtype, sizeConst, sizeParamIndex);
                        case UnmanagedType.SafeArray:
                                return UnmanagedMarshal.DefineSafeArray 
(subtype);
                        case UnmanagedType.ByValArray:

Modified: trunk/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs   
2005-02-28 13:31:36 UTC (rev 41281)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs   
2005-02-28 14:12:50 UTC (rev 41282)
@@ -46,6 +46,7 @@
                string mcookie;
                string marshaltype;
                Type marshaltyperef;
+               private int param_num;
                
                private UnmanagedMarshal (UnmanagedType maint, int cnt) {
                        count = cnt;
@@ -111,6 +112,14 @@
                        return res;
                }
 
+               internal static UnmanagedMarshal DefineLPArrayInternal 
(UnmanagedType elemType, int sizeConst, int sizeParamIndex) {
+                       UnmanagedMarshal res = new UnmanagedMarshal 
(UnmanagedType.LPArray, elemType);
+                       res.count = sizeConst;
+                       res.param_num = sizeParamIndex;
+
+                       return res;
+               }
+
                internal MarshalAsAttribute ToMarshalAsAttribute () {
                        MarshalAsAttribute attr = new MarshalAsAttribute (t);
                        attr.ArraySubType = tbase;
@@ -118,6 +127,7 @@
                        attr.MarshalType = marshaltype;
                        attr.MarshalTypeRef = marshaltyperef;
                        attr.SizeConst = count;
+                       attr.SizeParamIndex = (short)param_num;
                        return attr;
                }
        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to