Author: atsushi
Date: 2005-12-08 07:51:32 -0500 (Thu, 08 Dec 2005)
New Revision: 54111

Modified:
   trunk/mcs/class/corlib/System.Text/ChangeLog
   trunk/mcs/class/corlib/System.Text/UTF8Encoding.cs
Log:
2005-12-08  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * UTF8Encoding.cs : (GetChars) let ABCREM work effectively.



Modified: trunk/mcs/class/corlib/System.Text/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Text/ChangeLog        2005-12-08 12:32:18 UTC 
(rev 54110)
+++ trunk/mcs/class/corlib/System.Text/ChangeLog        2005-12-08 12:51:32 UTC 
(rev 54111)
@@ -1,5 +1,9 @@
 2005-12-08  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * UTF8Encoding.cs : (GetChars) let ABCREM work effectively.
+
+2005-12-08  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * Encoding.cs : now under 2.0 GetBytes(string,...) dispatches to
          byte*-based GetBytes().
        * UTF8Encoding.cs : avoid extraneous DecoderFallbackBuffer creation

Modified: trunk/mcs/class/corlib/System.Text/UTF8Encoding.cs
===================================================================
--- trunk/mcs/class/corlib/System.Text/UTF8Encoding.cs  2005-12-08 12:32:18 UTC 
(rev 54110)
+++ trunk/mcs/class/corlib/System.Text/UTF8Encoding.cs  2005-12-08 12:51:32 UTC 
(rev 54111)
@@ -603,10 +603,14 @@
                uint leftBits = leftOverBits;
                uint leftSoFar = (leftOverCount & (uint)0x0F);
                uint leftSize = ((leftOverCount >> 4) & (uint)0x0F);
-               while (byteCount > 0) {
+
+               int byteEnd = byteIndex + byteCount;
+               if (byteEnd < 0 || byteEnd > bytes.Length)
+                       throw new SystemException (String.Format ("INTERNAL 
ERROR: should not happen: {0} {1} {2}", byteIndex, byteCount, byteEnd));
+
+               for(; byteIndex < byteEnd; byteIndex++) {
                        // Fetch the next character from the byte buffer.
-                       ch = (uint)(bytes[byteIndex++]);
-                       --byteCount;
+                       ch = (uint)(bytes[byteIndex]);
                        if (leftSize == 0) {
                                // Process a UTF-8 start character.
                                if (ch < (uint)0x0080) {
@@ -720,7 +724,6 @@
 #endif
                                        leftSize = 0;
                                        --byteIndex;
-                                       ++byteCount;
                                }
                        }
                }

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

Reply via email to