diff options
author | Mikko Korkalo <mikko@korkalo.fi> | 2013-02-11 11:26:26 +0400 |
---|---|---|
committer | Mikko Korkalo <mikko@korkalo.fi> | 2013-02-11 11:26:26 +0400 |
commit | 1ed1fcdde699607e36a6484e1e62017faec73816 (patch) | |
tree | 9b5f44863689fa4f4b3fe1acaa0e2b7b6674c456 /mcs/class/I18N | |
parent | 66a26049aa5417e9c6e0135b98c502471f669034 (diff) |
re-generated codepages with new ucm2cp.c: removed dotnet 1.0 support for cleaner code
Diffstat (limited to 'mcs/class/I18N')
67 files changed, 536 insertions, 1273 deletions
diff --git a/mcs/class/I18N/MidEast/CP1254.cs b/mcs/class/I18N/MidEast/CP1254.cs index 5ac185b6e12..47184ed3d00 100644 --- a/mcs/class/I18N/MidEast/CP1254.cs +++ b/mcs/class/I18N/MidEast/CP1254.cs @@ -138,15 +138,16 @@ public class CP1254 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x0081: @@ -286,29 +287,17 @@ public class CP1254 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/MidEast/CP1255.cs b/mcs/class/I18N/MidEast/CP1255.cs index fa0b052c200..afe51e63298 100644 --- a/mcs/class/I18N/MidEast/CP1255.cs +++ b/mcs/class/I18N/MidEast/CP1255.cs @@ -138,15 +138,16 @@ public class CP1255 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x0081: @@ -283,29 +284,17 @@ public class CP1255 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/MidEast/CP1256.cs b/mcs/class/I18N/MidEast/CP1256.cs index 9cdf422ba4b..e712919f5ba 100644 --- a/mcs/class/I18N/MidEast/CP1256.cs +++ b/mcs/class/I18N/MidEast/CP1256.cs @@ -138,15 +138,16 @@ public class CP1256 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x00A0: @@ -472,29 +473,17 @@ public class CP1256 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/MidEast/CP28596.cs b/mcs/class/I18N/MidEast/CP28596.cs index 332553331e4..175d518b05b 100644 --- a/mcs/class/I18N/MidEast/CP28596.cs +++ b/mcs/class/I18N/MidEast/CP28596.cs @@ -138,15 +138,16 @@ public class CP28596 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 161) switch(ch) { case 0x00A4: @@ -630,26 +631,14 @@ public class CP28596 : ByteEncoding ch -= 0xFEE0; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/MidEast/CP28598.cs b/mcs/class/I18N/MidEast/CP28598.cs index 20671c542f8..a08abbcad00 100644 --- a/mcs/class/I18N/MidEast/CP28598.cs +++ b/mcs/class/I18N/MidEast/CP28598.cs @@ -138,15 +138,16 @@ public class CP28598 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 161) switch(ch) { case 0x00A2: @@ -217,29 +218,17 @@ public class CP28598 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/MidEast/CP28599.cs b/mcs/class/I18N/MidEast/CP28599.cs index 5c67c35ded6..b9b3ee44f9a 100644 --- a/mcs/class/I18N/MidEast/CP28599.cs +++ b/mcs/class/I18N/MidEast/CP28599.cs @@ -138,15 +138,16 @@ public class CP28599 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 208) switch(ch) { case 0x00D1: @@ -207,29 +208,17 @@ public class CP28599 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/MidEast/CP38598.cs b/mcs/class/I18N/MidEast/CP38598.cs index ab2af575476..2963b3a6113 100644 --- a/mcs/class/I18N/MidEast/CP38598.cs +++ b/mcs/class/I18N/MidEast/CP38598.cs @@ -138,15 +138,16 @@ public class CP38598 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 161) switch(ch) { case 0x00A2: @@ -217,29 +218,17 @@ public class CP38598 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Other/CP1251.cs b/mcs/class/I18N/Other/CP1251.cs index f4b18dc43cf..c0e4ca355ad 100644 --- a/mcs/class/I18N/Other/CP1251.cs +++ b/mcs/class/I18N/Other/CP1251.cs @@ -138,15 +138,16 @@ public class CP1251 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x0098: @@ -288,29 +289,17 @@ public class CP1251 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Other/CP1257.cs b/mcs/class/I18N/Other/CP1257.cs index f7e905b280e..3c1ff9cba7b 100644 --- a/mcs/class/I18N/Other/CP1257.cs +++ b/mcs/class/I18N/Other/CP1257.cs @@ -138,15 +138,16 @@ public class CP1257 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x0081: @@ -284,29 +285,17 @@ public class CP1257 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Other/CP1258.cs b/mcs/class/I18N/Other/CP1258.cs index 1537bfcd0b1..ddbc447f6fc 100644 --- a/mcs/class/I18N/Other/CP1258.cs +++ b/mcs/class/I18N/Other/CP1258.cs @@ -138,15 +138,16 @@ public class CP1258 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x0081: @@ -286,29 +287,17 @@ public class CP1258 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Other/CP20866.cs b/mcs/class/I18N/Other/CP20866.cs index e19125a61fa..fd2cbd0ddcf 100644 --- a/mcs/class/I18N/Other/CP20866.cs +++ b/mcs/class/I18N/Other/CP20866.cs @@ -138,15 +138,16 @@ public class CP20866 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x00A0: ch = 0x9A; break; @@ -301,29 +302,17 @@ public class CP20866 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Other/CP21866.cs b/mcs/class/I18N/Other/CP21866.cs index b9a2828caec..21a10034bd1 100644 --- a/mcs/class/I18N/Other/CP21866.cs +++ b/mcs/class/I18N/Other/CP21866.cs @@ -138,15 +138,16 @@ public class CP21866 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x00A0: ch = 0x9A; break; @@ -301,29 +302,17 @@ public class CP21866 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Other/CP28594.cs b/mcs/class/I18N/Other/CP28594.cs index 86f015d4198..ec50370a21f 100644 --- a/mcs/class/I18N/Other/CP28594.cs +++ b/mcs/class/I18N/Other/CP28594.cs @@ -138,15 +138,16 @@ public class CP28594 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 161) switch(ch) { case 0x00A4: @@ -253,29 +254,17 @@ public class CP28594 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Other/CP28595.cs b/mcs/class/I18N/Other/CP28595.cs index 70fa345de25..a959f860e21 100644 --- a/mcs/class/I18N/Other/CP28595.cs +++ b/mcs/class/I18N/Other/CP28595.cs @@ -138,15 +138,16 @@ public class CP28595 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 161) switch(ch) { case 0x00AD: @@ -259,29 +260,17 @@ public class CP28595 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Other/CP874.cs b/mcs/class/I18N/Other/CP874.cs index 7a5913699a0..63d74cfffc9 100644 --- a/mcs/class/I18N/Other/CP874.cs +++ b/mcs/class/I18N/Other/CP874.cs @@ -138,15 +138,16 @@ public class CP874 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -355,29 +356,17 @@ public class CP874 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1026.cs b/mcs/class/I18N/Rare/CP1026.cs index 579f2ad5423..a9a90feb6d7 100644 --- a/mcs/class/I18N/Rare/CP1026.cs +++ b/mcs/class/I18N/Rare/CP1026.cs @@ -138,15 +138,16 @@ public class CP1026 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1026 : ByteEncoding case 0xFF5D: ch = 0x8C; break; case 0xFF5E: ch = 0xCC; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1047.cs b/mcs/class/I18N/Rare/CP1047.cs index 95fa1fda9b5..8c64055fc7b 100644 --- a/mcs/class/I18N/Rare/CP1047.cs +++ b/mcs/class/I18N/Rare/CP1047.cs @@ -138,15 +138,16 @@ public class CP1047 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1047 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xA1; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1140.cs b/mcs/class/I18N/Rare/CP1140.cs index 8d050ce3d08..72f5b0a27a6 100644 --- a/mcs/class/I18N/Rare/CP1140.cs +++ b/mcs/class/I18N/Rare/CP1140.cs @@ -138,15 +138,16 @@ public class CP1140 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1140 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xA1; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1141.cs b/mcs/class/I18N/Rare/CP1141.cs index e197bbccdf9..daec8c4e279 100644 --- a/mcs/class/I18N/Rare/CP1141.cs +++ b/mcs/class/I18N/Rare/CP1141.cs @@ -138,15 +138,16 @@ public class CP1141 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1141 : ByteEncoding case 0xFF5D: ch = 0xDC; break; case 0xFF5E: ch = 0x59; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1142.cs b/mcs/class/I18N/Rare/CP1142.cs index 797616127ab..b82fd5cd12d 100644 --- a/mcs/class/I18N/Rare/CP1142.cs +++ b/mcs/class/I18N/Rare/CP1142.cs @@ -138,15 +138,16 @@ public class CP1142 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1142 : ByteEncoding case 0xFF5D: ch = 0x47; break; case 0xFF5E: ch = 0xDC; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1143.cs b/mcs/class/I18N/Rare/CP1143.cs index c4bcc93526c..01bd42b7c59 100644 --- a/mcs/class/I18N/Rare/CP1143.cs +++ b/mcs/class/I18N/Rare/CP1143.cs @@ -138,15 +138,16 @@ public class CP1143 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1143 : ByteEncoding case 0xFF5D: ch = 0x47; break; case 0xFF5E: ch = 0xDC; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1144.cs b/mcs/class/I18N/Rare/CP1144.cs index c09c4c4fd9a..9b36ab5ebac 100644 --- a/mcs/class/I18N/Rare/CP1144.cs +++ b/mcs/class/I18N/Rare/CP1144.cs @@ -138,15 +138,16 @@ public class CP1144 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1144 : ByteEncoding case 0xFF5D: ch = 0x54; break; case 0xFF5E: ch = 0x58; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1145.cs b/mcs/class/I18N/Rare/CP1145.cs index 149c06d42a9..1b5e04c38fb 100644 --- a/mcs/class/I18N/Rare/CP1145.cs +++ b/mcs/class/I18N/Rare/CP1145.cs @@ -138,15 +138,16 @@ public class CP1145 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1145 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xBD; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1146.cs b/mcs/class/I18N/Rare/CP1146.cs index f3749ad6fd8..eeadeb4629e 100644 --- a/mcs/class/I18N/Rare/CP1146.cs +++ b/mcs/class/I18N/Rare/CP1146.cs @@ -138,15 +138,16 @@ public class CP1146 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1146 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xBC; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1147.cs b/mcs/class/I18N/Rare/CP1147.cs index ce19306a336..e949c8fe4ff 100644 --- a/mcs/class/I18N/Rare/CP1147.cs +++ b/mcs/class/I18N/Rare/CP1147.cs @@ -138,15 +138,16 @@ public class CP1147 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1147 : ByteEncoding case 0xFF5D: ch = 0x54; break; case 0xFF5E: ch = 0xBD; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1148.cs b/mcs/class/I18N/Rare/CP1148.cs index 923393e045a..0b9e6dec57e 100644 --- a/mcs/class/I18N/Rare/CP1148.cs +++ b/mcs/class/I18N/Rare/CP1148.cs @@ -138,15 +138,16 @@ public class CP1148 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1148 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xA1; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP1149.cs b/mcs/class/I18N/Rare/CP1149.cs index 8e61e908d92..28682452537 100644 --- a/mcs/class/I18N/Rare/CP1149.cs +++ b/mcs/class/I18N/Rare/CP1149.cs @@ -138,15 +138,16 @@ public class CP1149 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP1149 : ByteEncoding case 0xFF5D: ch = 0x9C; break; case 0xFF5E: ch = 0xCC; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20273.cs b/mcs/class/I18N/Rare/CP20273.cs index dff98a4db78..00d2f8080b0 100644 --- a/mcs/class/I18N/Rare/CP20273.cs +++ b/mcs/class/I18N/Rare/CP20273.cs @@ -138,15 +138,16 @@ public class CP20273 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -535,26 +536,14 @@ public class CP20273 : ByteEncoding case 0xFF5D: ch = 0xDC; break; case 0xFF5E: ch = 0x59; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20277.cs b/mcs/class/I18N/Rare/CP20277.cs index 705f8bf4049..72b63c256f5 100644 --- a/mcs/class/I18N/Rare/CP20277.cs +++ b/mcs/class/I18N/Rare/CP20277.cs @@ -138,15 +138,16 @@ public class CP20277 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -535,26 +536,14 @@ public class CP20277 : ByteEncoding case 0xFF5D: ch = 0x47; break; case 0xFF5E: ch = 0xDC; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20278.cs b/mcs/class/I18N/Rare/CP20278.cs index 2bcb65418c6..a38e561e5ca 100644 --- a/mcs/class/I18N/Rare/CP20278.cs +++ b/mcs/class/I18N/Rare/CP20278.cs @@ -138,15 +138,16 @@ public class CP20278 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -535,26 +536,14 @@ public class CP20278 : ByteEncoding case 0xFF5D: ch = 0x47; break; case 0xFF5E: ch = 0xDC; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20280.cs b/mcs/class/I18N/Rare/CP20280.cs index b6c1e9ded98..cbb0462787e 100644 --- a/mcs/class/I18N/Rare/CP20280.cs +++ b/mcs/class/I18N/Rare/CP20280.cs @@ -138,15 +138,16 @@ public class CP20280 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -535,26 +536,14 @@ public class CP20280 : ByteEncoding case 0xFF5D: ch = 0x54; break; case 0xFF5E: ch = 0x58; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20284.cs b/mcs/class/I18N/Rare/CP20284.cs index 5197213a1bb..13a1db81034 100644 --- a/mcs/class/I18N/Rare/CP20284.cs +++ b/mcs/class/I18N/Rare/CP20284.cs @@ -138,15 +138,16 @@ public class CP20284 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -535,26 +536,14 @@ public class CP20284 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xBD; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20285.cs b/mcs/class/I18N/Rare/CP20285.cs index 1c52500f341..5227ec7e293 100644 --- a/mcs/class/I18N/Rare/CP20285.cs +++ b/mcs/class/I18N/Rare/CP20285.cs @@ -138,15 +138,16 @@ public class CP20285 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -535,26 +536,14 @@ public class CP20285 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xBC; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20290.cs b/mcs/class/I18N/Rare/CP20290.cs index 801e9032eb8..781028a31eb 100644 --- a/mcs/class/I18N/Rare/CP20290.cs +++ b/mcs/class/I18N/Rare/CP20290.cs @@ -138,15 +138,16 @@ public class CP20290 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -519,26 +520,14 @@ public class CP20290 : ByteEncoding ch -= 0xFEE0; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20297.cs b/mcs/class/I18N/Rare/CP20297.cs index 25d61b43a8a..4eef20def25 100644 --- a/mcs/class/I18N/Rare/CP20297.cs +++ b/mcs/class/I18N/Rare/CP20297.cs @@ -138,15 +138,16 @@ public class CP20297 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -535,26 +536,14 @@ public class CP20297 : ByteEncoding case 0xFF5D: ch = 0x54; break; case 0xFF5E: ch = 0xBD; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20420.cs b/mcs/class/I18N/Rare/CP20420.cs index 252aaee2e54..7c832737d83 100644 --- a/mcs/class/I18N/Rare/CP20420.cs +++ b/mcs/class/I18N/Rare/CP20420.cs @@ -138,15 +138,16 @@ public class CP20420 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -623,26 +624,14 @@ public class CP20420 : ByteEncoding break; case 0xFF5C: ch = 0x4F; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20424.cs b/mcs/class/I18N/Rare/CP20424.cs index 20f49855702..1f521ddf773 100644 --- a/mcs/class/I18N/Rare/CP20424.cs +++ b/mcs/class/I18N/Rare/CP20424.cs @@ -138,15 +138,16 @@ public class CP20424 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -501,26 +502,14 @@ public class CP20424 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xA1; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP20871.cs b/mcs/class/I18N/Rare/CP20871.cs index 87af1698cf3..d26dfe1371a 100644 --- a/mcs/class/I18N/Rare/CP20871.cs +++ b/mcs/class/I18N/Rare/CP20871.cs @@ -138,15 +138,16 @@ public class CP20871 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -535,26 +536,14 @@ public class CP20871 : ByteEncoding case 0xFF5D: ch = 0x9C; break; case 0xFF5E: ch = 0xCC; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP21025.cs b/mcs/class/I18N/Rare/CP21025.cs index 2a2cf90dba5..d662161d249 100644 --- a/mcs/class/I18N/Rare/CP21025.cs +++ b/mcs/class/I18N/Rare/CP21025.cs @@ -138,15 +138,16 @@ public class CP21025 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -545,26 +546,14 @@ public class CP21025 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xA1; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP37.cs b/mcs/class/I18N/Rare/CP37.cs index f31ecdf0411..85a57df5168 100644 --- a/mcs/class/I18N/Rare/CP37.cs +++ b/mcs/class/I18N/Rare/CP37.cs @@ -138,15 +138,16 @@ public class CP37 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -535,26 +536,14 @@ public class CP37 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xA1; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP500.cs b/mcs/class/I18N/Rare/CP500.cs index fdee8f1c48f..fdf654d33e7 100644 --- a/mcs/class/I18N/Rare/CP500.cs +++ b/mcs/class/I18N/Rare/CP500.cs @@ -138,15 +138,16 @@ public class CP500 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -535,26 +536,14 @@ public class CP500 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xA1; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP708.cs b/mcs/class/I18N/Rare/CP708.cs index 94a1fe04a1e..743af5cd193 100644 --- a/mcs/class/I18N/Rare/CP708.cs +++ b/mcs/class/I18N/Rare/CP708.cs @@ -138,15 +138,16 @@ public class CP708 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 161) switch(ch) { case 0x00A4: @@ -359,29 +360,17 @@ public class CP708 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP852.cs b/mcs/class/I18N/Rare/CP852.cs index 1f079a7e0a9..431a6016f5c 100644 --- a/mcs/class/I18N/Rare/CP852.cs +++ b/mcs/class/I18N/Rare/CP852.cs @@ -138,15 +138,16 @@ public class CP852 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -426,29 +427,17 @@ public class CP852 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP855.cs b/mcs/class/I18N/Rare/CP855.cs index 3dd917214ac..8f4d0dba3f1 100644 --- a/mcs/class/I18N/Rare/CP855.cs +++ b/mcs/class/I18N/Rare/CP855.cs @@ -138,15 +138,16 @@ public class CP855 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -426,29 +427,17 @@ public class CP855 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP857.cs b/mcs/class/I18N/Rare/CP857.cs index d40c5410928..0d05a07e96e 100644 --- a/mcs/class/I18N/Rare/CP857.cs +++ b/mcs/class/I18N/Rare/CP857.cs @@ -138,15 +138,16 @@ public class CP857 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -423,29 +424,17 @@ public class CP857 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP858.cs b/mcs/class/I18N/Rare/CP858.cs index f85ef1ac81f..c05a03263db 100644 --- a/mcs/class/I18N/Rare/CP858.cs +++ b/mcs/class/I18N/Rare/CP858.cs @@ -138,15 +138,16 @@ public class CP858 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -426,29 +427,17 @@ public class CP858 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP862.cs b/mcs/class/I18N/Rare/CP862.cs index 17b687c8131..dc3543466ee 100644 --- a/mcs/class/I18N/Rare/CP862.cs +++ b/mcs/class/I18N/Rare/CP862.cs @@ -138,15 +138,16 @@ public class CP862 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -429,29 +430,17 @@ public class CP862 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP864.cs b/mcs/class/I18N/Rare/CP864.cs index 6b0f86b467e..1513327e132 100644 --- a/mcs/class/I18N/Rare/CP864.cs +++ b/mcs/class/I18N/Rare/CP864.cs @@ -138,15 +138,16 @@ public class CP864 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -517,29 +518,17 @@ public class CP864 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP866.cs b/mcs/class/I18N/Rare/CP866.cs index b663fccc832..718488abbda 100644 --- a/mcs/class/I18N/Rare/CP866.cs +++ b/mcs/class/I18N/Rare/CP866.cs @@ -138,15 +138,16 @@ public class CP866 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -431,29 +432,17 @@ public class CP866 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP869.cs b/mcs/class/I18N/Rare/CP869.cs index 16ffb17f930..44bf879566c 100644 --- a/mcs/class/I18N/Rare/CP869.cs +++ b/mcs/class/I18N/Rare/CP869.cs @@ -138,15 +138,16 @@ public class CP869 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -427,29 +428,17 @@ public class CP869 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP870.cs b/mcs/class/I18N/Rare/CP870.cs index e9d3a318f19..c35e4a70eda 100644 --- a/mcs/class/I18N/Rare/CP870.cs +++ b/mcs/class/I18N/Rare/CP870.cs @@ -138,15 +138,16 @@ public class CP870 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -534,26 +535,14 @@ public class CP870 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xA1; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/Rare/CP875.cs b/mcs/class/I18N/Rare/CP875.cs index ef93f4e3ac4..70c558c29e5 100644 --- a/mcs/class/I18N/Rare/CP875.cs +++ b/mcs/class/I18N/Rare/CP875.cs @@ -138,15 +138,16 @@ public class CP875 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 4) switch(ch) { case 0x000B: @@ -543,26 +544,14 @@ public class CP875 : ByteEncoding case 0xFF5D: ch = 0xD0; break; case 0xFF5E: ch = 0xA1; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP10000.cs b/mcs/class/I18N/West/CP10000.cs index a93a3f7a120..22923759c68 100644 --- a/mcs/class/I18N/West/CP10000.cs +++ b/mcs/class/I18N/West/CP10000.cs @@ -138,15 +138,16 @@ public class CP10000 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x00A2: @@ -289,29 +290,17 @@ public class CP10000 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP10079.cs b/mcs/class/I18N/West/CP10079.cs index 7899a1b765c..77735acfb59 100644 --- a/mcs/class/I18N/West/CP10079.cs +++ b/mcs/class/I18N/West/CP10079.cs @@ -138,15 +138,16 @@ public class CP10079 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x00A2: @@ -279,26 +280,14 @@ public class CP10079 : ByteEncoding case 0x25CA: ch = 0xD7; break; case 0xF8FF: ch = 0xF0; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP1250.cs b/mcs/class/I18N/West/CP1250.cs index cafe93004fc..ec049ca1a0a 100644 --- a/mcs/class/I18N/West/CP1250.cs +++ b/mcs/class/I18N/West/CP1250.cs @@ -138,15 +138,16 @@ public class CP1250 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x0081: @@ -286,29 +287,17 @@ public class CP1250 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP1252.cs b/mcs/class/I18N/West/CP1252.cs index a0295cff0cb..541767128b8 100644 --- a/mcs/class/I18N/West/CP1252.cs +++ b/mcs/class/I18N/West/CP1252.cs @@ -138,15 +138,16 @@ public class CP1252 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x0081: @@ -286,29 +287,17 @@ public class CP1252 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP1253.cs b/mcs/class/I18N/West/CP1253.cs index e0a50a9f47a..28f01e32dcf 100644 --- a/mcs/class/I18N/West/CP1253.cs +++ b/mcs/class/I18N/West/CP1253.cs @@ -138,15 +138,16 @@ public class CP1253 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x0081: @@ -289,29 +290,17 @@ public class CP1253 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP28592.cs b/mcs/class/I18N/West/CP28592.cs index 148ef7068df..f735b0d7b89 100644 --- a/mcs/class/I18N/West/CP28592.cs +++ b/mcs/class/I18N/West/CP28592.cs @@ -138,15 +138,16 @@ public class CP28592 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 161) switch(ch) { case 0x00A4: @@ -322,29 +323,17 @@ public class CP28592 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP28593.cs b/mcs/class/I18N/West/CP28593.cs index 72ab0f3dbd6..55c0b4d83cf 100644 --- a/mcs/class/I18N/West/CP28593.cs +++ b/mcs/class/I18N/West/CP28593.cs @@ -138,15 +138,16 @@ public class CP28593 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 161) switch(ch) { case 0x00A3: @@ -246,29 +247,17 @@ public class CP28593 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP28597.cs b/mcs/class/I18N/West/CP28597.cs index 4f7d6a95563..e7787fb201b 100644 --- a/mcs/class/I18N/West/CP28597.cs +++ b/mcs/class/I18N/West/CP28597.cs @@ -138,15 +138,16 @@ public class CP28597 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 161) switch(ch) { case 0x00A3: @@ -256,29 +257,17 @@ public class CP28597 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP28605.cs b/mcs/class/I18N/West/CP28605.cs index 34761f15882..317dcdb8257 100644 --- a/mcs/class/I18N/West/CP28605.cs +++ b/mcs/class/I18N/West/CP28605.cs @@ -138,15 +138,16 @@ public class CP28605 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 164) switch(ch) { case 0x00A5: @@ -250,29 +251,17 @@ public class CP28605 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP437.cs b/mcs/class/I18N/West/CP437.cs index ab0a5acf591..4b681f193b7 100644 --- a/mcs/class/I18N/West/CP437.cs +++ b/mcs/class/I18N/West/CP437.cs @@ -138,15 +138,16 @@ public class CP437 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 128) switch(ch) { case 0x00A0: ch = 0xFF; break; @@ -758,26 +759,14 @@ public class CP437 : ByteEncoding ch -= 0xFEE0; break; default: -#if NET_2_0 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif - break; + continue; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP850.cs b/mcs/class/I18N/West/CP850.cs index 07295316cf9..9344b80e4a0 100644 --- a/mcs/class/I18N/West/CP850.cs +++ b/mcs/class/I18N/West/CP850.cs @@ -138,15 +138,16 @@ public class CP850 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -427,29 +428,17 @@ public class CP850 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP860.cs b/mcs/class/I18N/West/CP860.cs index 7cd96db5713..268b44d35e6 100644 --- a/mcs/class/I18N/West/CP860.cs +++ b/mcs/class/I18N/West/CP860.cs @@ -138,15 +138,16 @@ public class CP860 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -427,29 +428,17 @@ public class CP860 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP861.cs b/mcs/class/I18N/West/CP861.cs index 7936b4fabcf..794ea795ad4 100644 --- a/mcs/class/I18N/West/CP861.cs +++ b/mcs/class/I18N/West/CP861.cs @@ -138,15 +138,16 @@ public class CP861 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -427,29 +428,17 @@ public class CP861 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP863.cs b/mcs/class/I18N/West/CP863.cs index 7f9c3212cf4..e8080c6fae4 100644 --- a/mcs/class/I18N/West/CP863.cs +++ b/mcs/class/I18N/West/CP863.cs @@ -138,15 +138,16 @@ public class CP863 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -426,29 +427,17 @@ public class CP863 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } diff --git a/mcs/class/I18N/West/CP865.cs b/mcs/class/I18N/West/CP865.cs index f93a2237bdd..e56b6472ec5 100644 --- a/mcs/class/I18N/West/CP865.cs +++ b/mcs/class/I18N/West/CP865.cs @@ -138,15 +138,16 @@ public class CP865 : ByteEncoding byte* bytes, int byteCount) { int ch; - int charIndex; + int charIndex = 0; int byteIndex = 0; #if NET_2_0 EncoderFallbackBuffer buffer = null; #endif - for (charIndex=0; charCount > 0; charIndex++, charCount--) + while (charCount > 0) { ch = (int)(chars[charIndex]); - bool fallback = false; + charIndex++; + charCount--; if(ch >= 26) switch(ch) { case 0x001B: @@ -427,29 +428,17 @@ public class CP865 : ByteEncoding } else { -#if NET_2_0 - //Execute fallback routine and set fallback flag on HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); - fallback = true; -#else - ch = 0x3F; -#endif + continue; } } break; } //Write encoded byte to buffer, if buffer is defined and fallback was not used - if (bytes != null && !fallback) - { + if (bytes != null) bytes[byteIndex] = (byte)ch; - } - - //Bump counters if fallback was not used - if (!fallback) - { - byteIndex++; - byteCount--; - } + byteIndex++; + byteCount--; } return byteIndex; } |