Extended CloneCopy() test with ReadOnly field
[mono.git] / mcs / class / I18N / Other / CP874.cs
index 97b41aa29d848be4c25a82ec0a5619744e7c115e..1f08062fbb4c9023b705f4d0a2574e09c95804cf 100644 (file)
@@ -28,8 +28,10 @@ namespace I18N.Other
 {
 
 using System;
+using System.Text;
 using I18N.Common;
 
+[Serializable]
 public class CP874 : ByteEncoding
 {
        public CP874()
@@ -84,10 +86,15 @@ public class CP874 : ByteEncoding
                '\u00A2', '\u00AC', '\u00A6', '\u00A0', 
        };
 
-       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++]);
@@ -296,15 +303,21 @@ public class CP874 : 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)
        {
@@ -525,9 +538,11 @@ public class CP874 : ByteEncoding
                        --charCount;
                }
        }
+       */
 
 }; // class CP874
 
+[Serializable]
 public class ENCwindows_874 : CP874
 {
        public ENCwindows_874() : base() {}