Author: spouliot
Date: 2007-03-28 13:37:40 -0500 (Wed, 28 Mar 2007)
New Revision: 75096

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: Make workaround (#81254) permanent and return correct
        values on big endian architectures.



Modified: trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog     
2007-03-28 18:35:49 UTC (rev 75095)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog     
2007-03-28 18:37:40 UTC (rev 75096)
@@ -1,3 +1,8 @@
+2007-03-28  Sebastien Pouliot  <[EMAIL PROTECTED]>  
+
+       * MetaHeader.cs: Make workaround (#81254) permanent and return correct
+       values on big endian architectures.
+
 2007-03-28  Sebastien Pouliot  <[EMAIL PROTECTED]> 
 
        * MetaHeader.cs: Workaround bug #81254 where the SPARC architecture 

Modified: trunk/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs 
2007-03-28 18:35:49 UTC (rev 75095)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Imaging/MetaHeader.cs 
2007-03-28 18:37:40 UTC (rev 75096)
@@ -41,10 +41,10 @@
                public short file_type;
                public short header_size;
                public short version;
-               // this is unaligned and fails on the SPARC architecture - 
http://bugzilla.ximian.com/show_bug.cgi?id=81254
+               // this is unaligned and fails on the SPARC architecture (see 
bug #81254 for details)
                // public int file_size;
                public ushort file_size_low;
-               public short file_size_high;
+               public ushort file_size_high;
                public short num_of_objects;
                public int max_record_size;
                public short num_of_params;
@@ -93,10 +93,20 @@
                }
                
                public int Size {
-                       get { return (wmf.file_size_high << 16) | 
wmf.file_size_low; }
+                       get {
+                               if (BitConverter.IsLittleEndian)
+                                       return (wmf.file_size_high << 16) | 
wmf.file_size_low;
+                               else
+                                       return (wmf.file_size_low << 16) | 
wmf.file_size_high;
+                       }
                        set {
-                               wmf.file_size_high = (short)(value >> 16);
-                               wmf.file_size_low = (ushort)value;
+                               if (BitConverter.IsLittleEndian) {
+                                       wmf.file_size_high = (ushort)(value >> 
16);
+                                       wmf.file_size_low = (ushort)value;
+                               } else {
+                                       wmf.file_size_high = (ushort)value;
+                                       wmf.file_size_low = (ushort)(value >> 
16);
+                               }
                        }
                }
 

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

Reply via email to