2010-06-17 Miguel de Icaza <miguel@novell.com>
[mono.git] / mcs / class / corlib / Mono / DataConverter.cs
index ab1e8e41f8f0e35bad469a1365fc3a32978c9b50..a60337aebe5d3111042f4b90e3433eec0f20698c 100644 (file)
@@ -40,6 +40,8 @@ using System;
 using System.Collections;
 using System.Text;
 
+#pragma warning disable 3021
+
 namespace Mono {
 
 #if MONO_DATACONVERTER_PUBLIC
@@ -244,6 +246,8 @@ namespace Mono {
                //   f    float
                //   d    double
                //   b    byte
+                //   c    1-byte signed character
+                //   C    1-byte unsigned character
                //   z8   string encoded as UTF8 with 1-byte null terminator
                //   z6   string encoded as UTF16 with 2-byte null terminator
                //   z7   string encoded as UTF7 with 1-byte null terminator
@@ -478,7 +482,8 @@ namespace Mono {
                                default:
                                        throw new ArgumentException ("Invalid format for $ specifier", "description");
                                }
-                               b.align = 4;
+                               if (b.align == -1)
+                                       b.align = 4;
                                b.Add (e.GetBytes (Convert.ToString (oarg)));
                                if (add_null)
                                        b.Add (new byte [n]);
@@ -496,7 +501,7 @@ namespace Mono {
                                idx = Align (idx, size);
                                align = false;
                        }
-                       if (idx + size >= buffer.Length){
+                       if (idx + size > buffer.Length){
                                idx = buffer.Length;
                                return false;
                        }
@@ -614,6 +619,7 @@ namespace Mono {
                                case '1': case '2': case '3': case '4': case '5':
                                case '6': case '7': case '8': case '9':
                                        repeat = ((short) description [i]) - ((short) '0');
+                                       save = i + 1;
                                        break;
 
                                case '*':
@@ -637,6 +643,7 @@ namespace Mono {
                                        if (count == -1)
                                                throw new ArgumentException ("invalid size specification");
                                        i = j;
+                                       save = i + 1;
                                        repeat = count;
                                        break;