Author: spouliot
Date: 2007-03-28 08:22:49 -0500 (Wed, 28 Mar 2007)
New Revision: 75072

Modified:
   trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
   trunk/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs
Log:
2007-03-28  Sebastien Pouliot  <[EMAIL PROTECTED]> 

        * MetaHeader.cs: Workaround bug #81254 where the SPARC architecture 
        can't use the misaligned integer in the structure (with Pack=2).



Modified: trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog     
2007-03-28 13:15:56 UTC (rev 75071)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog     
2007-03-28 13:22:49 UTC (rev 75072)
@@ -1,3 +1,8 @@
+2007-03-28  Sebastien Pouliot  <[EMAIL PROTECTED]> 
+
+       * MetaHeader.cs: Workaround bug #81254 where the SPARC architecture 
+       can't use the misaligned integer in the structure (with Pack=2).
+
 2007-03-14  Sebastien Pouliot  <[EMAIL PROTECTED]> 
 
        * MetafileHeader.cs: WmfHeader is available on non-placeable WMF too.

Modified: trunk/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs 
2007-03-28 13:15:56 UTC (rev 75071)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs 
2007-03-28 13:22:49 UTC (rev 75072)
@@ -8,7 +8,7 @@
 //   Sebastien Pouliot  <[EMAIL PROTECTED]>
 //
 // (C) 2002 Ximian, Inc.  http://www.ximian.com
-// Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004, 2006-2007 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -41,7 +41,10 @@
                public short file_type;
                public short header_size;
                public short version;
-               public int file_size;
+               // this is unaligned and fails on the SPARC architecture - 
http://bugzilla.ximian.com/show_bug.cgi?id=81254
+               // public int file_size;
+               public ushort file_size_low;
+               public short file_size_high;
                public short num_of_objects;
                public int max_record_size;
                public short num_of_params;
@@ -61,7 +64,8 @@
                        wmf.file_type = header.file_type;
                        wmf.header_size = header.header_size;
                        wmf.version = header.version;
-                       wmf.file_size = header.file_size;
+                       wmf.file_size_low = header.file_size_low;
+                       wmf.file_size_high = header.file_size_high;
                        wmf.num_of_objects = header.num_of_objects;
                        wmf.max_record_size = header.max_record_size;
                        wmf.num_of_params = header.num_of_params;
@@ -89,8 +93,11 @@
                }
                
                public int Size {
-                       get { return wmf.file_size; }
-                       set { wmf.file_size = value; }
+                       get { return (wmf.file_size_high << 16) | 
wmf.file_size_low; }
+                       set {
+                               wmf.file_size_high = (short)(value >> 16);
+                               wmf.file_size_low = (ushort)value;
+                       }
                }
 
                public short Type {

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

Reply via email to