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/Rare | |
parent | 66a26049aa5417e9c6e0135b98c502471f669034 (diff) |
re-generated codepages with new ucm2cp.c: removed dotnet 1.0 support for cleaner code
Diffstat (limited to 'mcs/class/I18N/Rare')
37 files changed, 296 insertions, 703 deletions
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; } |