* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / I18N / Rare / CP37.cs
index e7c7da24d5badfb3c3d7b4c2337c8dc7f98baef8..8f1556a355b6a616ea9c0842c04cf670417665fa 100644 (file)
@@ -28,8 +28,10 @@ namespace I18N.Rare
 {
 
 using System;
+using System.Text;
 using I18N.Common;
 
+[Serializable]
 public class CP37 : ByteEncoding
 {
        public CP37()
@@ -84,10 +86,15 @@ public class CP37 : ByteEncoding
                '\u00DC', '\u00D9', '\u00DA', '\u009F', 
        };
 
-       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++]);
@@ -478,13 +485,21 @@ public class CP37 : ByteEncoding
                                case 0xFF5C: ch = 0x4F; break;
                                case 0xFF5D: ch = 0xD0; break;
                                case 0xFF5E: ch = 0xA1; break;
-                               default: ch = 0x3F; break;
+                               default:
+#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)
        {
@@ -885,9 +900,11 @@ public class CP37 : ByteEncoding
                        --charCount;
                }
        }
+       */
 
 }; // class CP37
 
+[Serializable]
 public class ENCibm037 : CP37
 {
        public ENCibm037() : base() {}