re-generated codepages with new ucm2cp.c: removed dotnet 1.0 support for cleaner...
[mono.git] / mcs / class / I18N / Rare / CP500.cs
index fdee8f1c48f7e54acef7a3c1594919aef6daba17..fdf654d33e70748e4eb1c33b612cd262932f86c1 100644 (file)
@@ -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;
        }