Author: toshok
Date: 2007-06-21 22:35:40 -0400 (Thu, 21 Jun 2007)
New Revision: 80518
Modified:
trunk/olive/class/agclr/Mono/ChangeLog
trunk/olive/class/agclr/Mono/Value.cs
trunk/olive/class/agclr/System.Windows/ChangeLog
trunk/olive/class/agclr/System.Windows/DependencyObject.cs
Log:
In Mono:
2007-06-21 Chris Toshok <[EMAIL PROTECTED]>
* Value.cs: 64 bit work with grendel.
In System.Windows:
2007-06-21 Chris Toshok <[EMAIL PROTECTED]>
* DependencyObject.cs: 64 bit work with grendel.
Modified: trunk/olive/class/agclr/Mono/ChangeLog
===================================================================
--- trunk/olive/class/agclr/Mono/ChangeLog 2007-06-21 23:21:26 UTC (rev
80517)
+++ trunk/olive/class/agclr/Mono/ChangeLog 2007-06-22 02:35:40 UTC (rev
80518)
@@ -1,3 +1,7 @@
+2007-06-21 Chris Toshok <[EMAIL PROTECTED]>
+
+ * Value.cs: 64 bit work with grendel.
+
2007-06-21 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
* Kind.cs, NativeMethods.cs: Update.
Modified: trunk/olive/class/agclr/Mono/Value.cs
===================================================================
--- trunk/olive/class/agclr/Mono/Value.cs 2007-06-21 23:21:26 UTC (rev
80517)
+++ trunk/olive/class/agclr/Mono/Value.cs 2007-06-22 02:35:40 UTC (rev
80518)
@@ -37,7 +37,16 @@
[FieldOffset (0)]
public Kind k;
- [FieldOffset (4)]
+ // this needs to be 8 (so don't change it) so that the
+ // overall structure is large enough on 64 bit
+ // systems. alternatively we could have just used
+ // another int field here to pad it
+ // correctly.. regardless, since we never use this
+ // field in the C# code, and we advance by IntPtr.Size
+ // to give us the proper padding, this should work,
+ // even for 32 bit systems.
+
+ [FieldOffset (8)]
public long vlong; // The biggest size
}
}
Modified: trunk/olive/class/agclr/System.Windows/ChangeLog
===================================================================
--- trunk/olive/class/agclr/System.Windows/ChangeLog 2007-06-21 23:21:26 UTC
(rev 80517)
+++ trunk/olive/class/agclr/System.Windows/ChangeLog 2007-06-22 02:35:40 UTC
(rev 80518)
@@ -1,3 +1,7 @@
+2007-06-21 Chris Toshok <[EMAIL PROTECTED]>
+
+ * DependencyObject.cs: 64 bit work with grendel.
+
2007-06-21 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
* DependencyObject.cs: Implement KeyTime marshalling.
Modified: trunk/olive/class/agclr/System.Windows/DependencyObject.cs
===================================================================
--- trunk/olive/class/agclr/System.Windows/DependencyObject.cs 2007-06-21
23:21:26 UTC (rev 80517)
+++ trunk/olive/class/agclr/System.Windows/DependencyObject.cs 2007-06-22
02:35:40 UTC (rev 80518)
@@ -352,7 +352,7 @@
byte *px = (byte *) x;
k = (Kind) (*((int *)px));
- px += 4;
+ px += IntPtr.Size;
switch (k) {
case Kind.INVALID:
@@ -449,7 +449,7 @@
return Duration.Automatic;
int kind = Marshal.ReadInt32 (vptr);
- long ticks = Marshal.ReadInt64
((IntPtr) ((byte*) vptr + 4));
+ long ticks = Marshal.ReadInt64
((IntPtr) ((byte*) vptr + IntPtr.Size));
return new Duration (kind, new TimeSpan
(ticks));
}
@@ -463,8 +463,8 @@
return KeyTime.Uniform;
int kind = * (int*) (bptr);
- double percent = * (double*) (bptr + 4);
- long ticks = * (long*) (bptr + 12);
+ double percent = * (double*) (bptr +
IntPtr.Size);
+ long ticks = * (long*) (bptr +
IntPtr.Size + 8);
return new KeyTime ((KeyTimeType) kind,
percent, new TimeSpan (ticks));
}
@@ -503,7 +503,7 @@
unsafe {
void *vp = &value;
byte *p = (byte *) vp;
- p += 4;
+ p += IntPtr.Size;
if (v is DependencyObject){
DependencyObject dov =
(DependencyObject) v;
@@ -592,7 +592,14 @@
Marshal.StructureToPtr (pnt, result,
false);
*((IntPtr *) p) = result;
} else if (v is Color){
- value =
NativeMethods.value_color_from_argb (((Color) v).argb);
+ Color c = (Color) v;
+ value.k = Kind.COLOR;
+ double * result = (double*)
Marshal.AllocHGlobal (sizeof (double) * 4);
+ result [0] = c.ScR;
+ result [1] = c.ScG;
+ result [2] = c.ScB;
+ result [3] = c.ScA;
+ *((IntPtr *) p) = (IntPtr)result;
} else if (v is Matrix) {
Matrix mat = (Matrix) v;
value.k = Kind.MATRIX;
@@ -609,7 +616,7 @@
value.k = Kind.DURATION;
IntPtr result = Marshal.AllocHGlobal
(sizeof (Duration));
Marshal.WriteInt32 (result,
d.KindInternal);
- Marshal.WriteInt64 ((IntPtr) ((byte*)
result + 4), d.TimeSpanInternal.Ticks);
+ Marshal.WriteInt64 ((IntPtr) ((byte*)
result + IntPtr.Size), d.TimeSpanInternal.Ticks);
*((IntPtr *) p) = result;
} else if (v is KeyTime) {
KeyTime k = (KeyTime) v;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches