Skip to content

Commit

Permalink
2005-12-08 Atsushi Enomoto <atsushi@ximian.com>
Browse files Browse the repository at this point in the history
	* UTF8Encoding.cs : (GetChars) let ABCREM work effectively.


svn path=/trunk/mcs/; revision=54111
  • Loading branch information
atsushieno committed Dec 8, 2005
1 parent 2a67cdf commit a64ccb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions mcs/class/corlib/System.Text/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2005-12-08 Atsushi Enomoto <atsushi@ximian.com>

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

2005-12-08 Atsushi Enomoto <atsushi@ximian.com>

* Encoding.cs : now under 2.0 GetBytes(string,...) dispatches to
Expand Down
11 changes: 7 additions & 4 deletions mcs/class/corlib/System.Text/UTF8Encoding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,14 @@ private static int InternalGetChars (
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) {
Expand Down Expand Up @@ -720,7 +724,6 @@ private static int InternalGetChars (
#endif
leftSize = 0;
--byteIndex;
++byteCount;
}
}
}
Expand Down

0 comments on commit a64ccb6

Please sign in to comment.