New test.
[mono.git] / mcs / class / I18N / West / CP10000.cs
index 3cd1c00b203b164d6b38b3782f449b437da165f2..8ea0002f842597332395b542c521fa1c94f9303d 100644 (file)
@@ -28,8 +28,10 @@ namespace I18N.West
 {
 
 using System;
+using System.Text;
 using I18N.Common;
 
+[Serializable]
 public class CP10000 : ByteEncoding
 {
        public CP10000()
@@ -84,10 +86,15 @@ public class CP10000 : ByteEncoding
                '\u00B8', '\u02DD', '\u02DB', '\u02C7', 
        };
 
-       protected override void ToBytes(char[] chars, int charIndex, int charCount,
-                                       byte[] bytes, int byteIndex)
+       protected unsafe override void ToBytes(char* chars, int charCount,
+                                       byte* bytes, int byteCount)
        {
                int ch;
+               int charIndex = 0;
+               int byteIndex = 0;
+#if NET_2_0
+               EncoderFallbackBuffer buffer = null;
+#endif
                while(charCount > 0)
                {
                        ch = (int)(chars[charIndex++]);
@@ -230,15 +237,21 @@ public class CP10000 : ByteEncoding
                                        if(ch >= 0xFF01 && ch <= 0xFF5E)
                                                ch -= 0xFEE0;
                                        else
+#if NET_2_0
+                                       HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
+#else
                                                ch = 0x3F;
+#endif
                                }
                                break;
                        }
                        bytes[byteIndex++] = (byte)ch;
                        --charCount;
+                       --byteCount;
                }
        }
 
+       /*
        protected override void ToBytes(String s, int charIndex, int charCount,
                                        byte[] bytes, int byteIndex)
        {
@@ -393,9 +406,11 @@ public class CP10000 : ByteEncoding
                        --charCount;
                }
        }
+       */
 
 }; // class CP10000
 
+[Serializable]
 public class ENCmacintosh : CP10000
 {
        public ENCmacintosh() : base() {}