Author: zoltan
Date: 2005-03-01 07:18:05 -0500 (Tue, 01 Mar 2005)
New Revision: 41315
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 UnmanagedMarshal.cs: Allow sizeConst and
sizeParamIndex to be -1, which means they are not given.
Modified: trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog 2005-03-01
10:00:26 UTC (rev 41314)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog 2005-03-01
12:18:05 UTC (rev 41315)
@@ -1,5 +1,8 @@
2005-03-01 Zoltan Varga <[EMAIL PROTECTED]>
+ * CustomAttributeBuilder.cs UnmanagedMarshal.cs: Allow sizeConst and
+ sizeParamIndex to be -1, which means they are not given.
+
* CustomAttributeBuilder.cs (get_umarshal): Only call the internal
LPArray creation method if sizeConst of sizeParamIndex is given.
Modified:
trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
2005-03-01 10:00:26 UTC (rev 41314)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
2005-03-01 12:18:05 UTC (rev 41315)
@@ -209,8 +209,8 @@
internal static UnmanagedMarshal get_umarshal
(CustomAttributeBuilder customBuilder, bool is_field) {
byte[] data = customBuilder.Data;
UnmanagedType subtype = (UnmanagedType)0x50; /*
NATIVE_MAX */
- int sizeConst = 0;
- int sizeParamIndex = 0;
+ int sizeConst = -1;
+ int sizeParamIndex = -1;
bool hasSize = false;
int value;
int utype; /* the (stupid) ctor takes a short or an
enum ... */
Modified: trunk/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
2005-03-01 10:00:26 UTC (rev 41314)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
2005-03-01 12:18:05 UTC (rev 41315)
@@ -113,6 +113,7 @@
return res;
}
+ // sizeConst and sizeParamIndex can be -1 meaning they are not
specified
internal static UnmanagedMarshal DefineLPArrayInternal
(UnmanagedType elemType, int sizeConst, int sizeParamIndex) {
UnmanagedMarshal res = new UnmanagedMarshal
(UnmanagedType.LPArray, elemType);
res.count = sizeConst;
@@ -128,8 +129,14 @@
attr.MarshalCookie = mcookie;
attr.MarshalType = marshaltype;
attr.MarshalTypeRef = marshaltyperef;
- attr.SizeConst = count;
- attr.SizeParamIndex = (short)param_num;
+ if (count == -1)
+ attr.SizeConst = 0;
+ else
+ attr.SizeConst = count;
+ if (param_num == -1)
+ attr.SizeParamIndex = 0;
+ else
+ attr.SizeParamIndex = (short)param_num;
return attr;
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches