Author: zoltan
Date: 2005-03-01 04:56:21 -0500 (Tue, 01 Mar 2005)
New Revision: 41312

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-03-01  Zoltan Varga  <[EMAIL PROTECTED]>

        * CustomAttributeBuilder.cs (get_umarshal): Only call the internal
        LPArray creation method if sizeConst of sizeParamIndex is given.

        * UnmanagedMarshal.cs: Add has_size field.


Modified: trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog     2005-03-01 
09:52:47 UTC (rev 41311)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog     2005-03-01 
09:56:21 UTC (rev 41312)
@@ -1,3 +1,10 @@
+2005-03-01  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * CustomAttributeBuilder.cs (get_umarshal): Only call the internal
+       LPArray creation method if sizeConst of sizeParamIndex is given.
+
+       * UnmanagedMarshal.cs: Add has_size field.
+
 2005-02-28  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * CustomAttributeBuilder.cs (get_umarshal): Marshal sizeConst and

Modified: 
trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs     
2005-03-01 09:52:47 UTC (rev 41311)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs     
2005-03-01 09:56:21 UTC (rev 41312)
@@ -211,6 +211,7 @@
                        UnmanagedType subtype = (UnmanagedType)0x50; /* 
NATIVE_MAX */
                        int sizeConst = 0;
                        int sizeParamIndex = 0;
+                       bool hasSize = false;
                        int value;
                        int utype; /* the (stupid) ctor takes a short or an 
enum ... */
                        Type marshalTypeRef = null;
@@ -247,11 +248,13 @@
                                        value |= ((int)data [pos++]) << 16;
                                        value |= ((int)data [pos++]) << 24;
                                        sizeConst = value;
+                                       hasSize = true;
                                        break;
                                case "SizeSizeParamIndex":
                                        value = (int)data [pos++];
                                        value |= ((int)data [pos++]) << 8;
                                        sizeParamIndex = value;
+                                       hasSize = true;
                                        break;
                                case "MarshalTypeRef":
                                case "MarshalType":
@@ -274,7 +277,10 @@
 
                        switch ((UnmanagedType)utype) {
                        case UnmanagedType.LPArray:
-                               return UnmanagedMarshal.DefineLPArrayInternal 
(subtype, sizeConst, sizeParamIndex);
+                               if (hasSize)
+                                       return 
UnmanagedMarshal.DefineLPArrayInternal (subtype, sizeConst, sizeParamIndex);
+                               else
+                                       return UnmanagedMarshal.DefineLPArray 
(subtype);
                        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-03-01 09:52:47 UTC (rev 41311)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs   
2005-03-01 09:56:21 UTC (rev 41312)
@@ -47,6 +47,7 @@
                string marshaltype;
                Type marshaltyperef;
                private int param_num;
+               private bool has_size;
                
                private UnmanagedMarshal (UnmanagedType maint, int cnt) {
                        count = cnt;
@@ -116,6 +117,7 @@
                        UnmanagedMarshal res = new UnmanagedMarshal 
(UnmanagedType.LPArray, elemType);
                        res.count = sizeConst;
                        res.param_num = sizeParamIndex;
+                       res.has_size = true;
 
                        return res;
                }

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

Reply via email to