X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FI18N%2FRare%2FCP20285.cs;h=81967392bc9cb5c19772669b691f46c3034293f2;hb=4c960e1dd530396fdd9400c87729a6ce3101e5c1;hp=1c52500f3418fc940f8847e134d286f8458eaf9e;hpb=77eb88801ec55bbdb769c4d3b14b8cb39fad2a5f;p=mono.git diff --git a/mcs/class/I18N/Rare/CP20285.cs b/mcs/class/I18N/Rare/CP20285.cs index 1c52500f341..81967392bc9 100644 --- a/mcs/class/I18N/Rare/CP20285.cs +++ b/mcs/class/I18N/Rare/CP20285.cs @@ -138,15 +138,14 @@ 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 +534,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; }