merged Sys.Web.Services 2.0 support in my branch:
[mono.git] / mcs / class / I18N / West / CP860.cs
index ebb0b569de8ecd03e6dcb157b41246d6d3987b8b..af5bd7983031c0e4afa8c3ae7680bfb7b665867d 100644 (file)
@@ -28,8 +28,10 @@ namespace I18N.West
 {
 
 using System;
+using System.Text;
 using I18N.Common;
 
+[Serializable]
 public class CP860 : ByteEncoding
 {
        public CP860()
@@ -84,10 +86,15 @@ public class CP860 : ByteEncoding
                '\u207F', '\u00B2', '\u25A0', '\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++]);
@@ -368,15 +375,21 @@ public class CP860 : 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)
        {
@@ -669,9 +682,11 @@ public class CP860 : ByteEncoding
                        --charCount;
                }
        }
+       */
 
 }; // class CP860
 
+[Serializable]
 public class ENCibm860 : CP860
 {
        public ENCibm860() : base() {}