diff options
-rw-r--r-- | mcs/class/System/System.Text.RegularExpressions/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/class/System/System.Text.RegularExpressions/syntax.cs | 22 | ||||
-rw-r--r-- | mcs/class/corlib/System.Reflection/common.src | 25 | ||||
-rw-r--r-- | mcs/class/corlib/System/Array.cs | 9 | ||||
-rw-r--r-- | mcs/class/corlib/System/Byte.cs | 3 | ||||
-rw-r--r-- | mcs/class/corlib/System/ChangeLog | 12 | ||||
-rwxr-xr-x | mcs/class/corlib/System/Guid.cs | 224 | ||||
-rw-r--r-- | mcs/class/corlib/System/String.cs | 5 |
8 files changed, 157 insertions, 147 deletions
diff --git a/mcs/class/System/System.Text.RegularExpressions/ChangeLog b/mcs/class/System/System.Text.RegularExpressions/ChangeLog index 3967632a442..181406cfcde 100644 --- a/mcs/class/System/System.Text.RegularExpressions/ChangeLog +++ b/mcs/class/System/System.Text.RegularExpressions/ChangeLog @@ -1,3 +1,7 @@ +2004-06-01 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * syntax.cs: reverting my previous patch. It causes bigger problems. + 2004-05-27 Gonzalo Paniagua Javier <gonzalo@ximian.com> * category.cs: added LastValue field to mark the end of enum Category. diff --git a/mcs/class/System/System.Text.RegularExpressions/syntax.cs b/mcs/class/System/System.Text.RegularExpressions/syntax.cs index 387a2f2f87b..ed02509572a 100644 --- a/mcs/class/System/System.Text.RegularExpressions/syntax.cs +++ b/mcs/class/System/System.Text.RegularExpressions/syntax.cs @@ -773,9 +773,14 @@ namespace System.Text.RegularExpressions.Syntax { // initialize pos/neg category arrays - int cat_size = (int) Category.LastValue; - pos_cats = new BitArray (cat_size); - neg_cats = new BitArray (cat_size); + Array cat_values = Enum.GetValues (typeof (Category)); + int cat_size = (int)(Category)cat_values.GetValue (cat_values.Length - 1) + 1; + pos_cats = new bool[cat_size]; + neg_cats = new bool[cat_size]; + for (int i = 0; i < cat_size; ++ i) { + pos_cats[i] = false; + neg_cats[i] = false; + } } public CharacterClass (Category cat, bool negate) : this (false, false) { @@ -796,8 +801,15 @@ namespace System.Text.RegularExpressions.Syntax { int n = (int)cat; if (negate) { + if (pos_cats[n]) + pos_cats[n] = false; + neg_cats[n] = true; - } else { + } + else { + if (neg_cats[n]) + neg_cats[n] = false; + pos_cats[n] = true; } } @@ -926,7 +938,7 @@ namespace System.Text.RegularExpressions.Syntax { private static Interval upper_case_characters = new Interval ((char)65, (char)90); private const int distance_between_upper_and_lower_case = 32; private bool negate, ignore; - private BitArray pos_cats, neg_cats; + private bool[] pos_cats, neg_cats; private IntervalCollection intervals; } diff --git a/mcs/class/corlib/System.Reflection/common.src b/mcs/class/corlib/System.Reflection/common.src deleted file mode 100644 index 022b6768fcc..00000000000 --- a/mcs/class/corlib/System.Reflection/common.src +++ /dev/null @@ -1,25 +0,0 @@ -Assembly.cs -AssemblyNameFlags.cs -BindingFlags.cs -CallingConventions.cs -ConstructorInfo.cs -DefaultMemberAttribute.cs -EventAttributes.cs -EventInfo.cs -FieldAttributes.cs -FieldInfo.cs -ICustomAttributeProvider.cs -MemberFilter.cs -MemberInfo.cs -MemberTypes.cs -MethodAttributes.cs -MethodBase.cs -MethodImplAttributes.cs -MethodInfo.cs -Module.cs -ParameterAttributes.cs -PropertyAttributes.cs -PropertyInfo.cs -ResourceAttributes.cs -ResourceLocation.cs -TypeAttributes.cs diff --git a/mcs/class/corlib/System/Array.cs b/mcs/class/corlib/System/Array.cs index f1c01112e02..d7046da7910 100644 --- a/mcs/class/corlib/System/Array.cs +++ b/mcs/class/corlib/System/Array.cs @@ -485,6 +485,9 @@ namespace System if (array == null) throw new ArgumentNullException ("array"); + if (value == null) + return -1; + if (array.Rank > 1) throw new RankException (Locale.GetText ("Only single dimension arrays are supported.")); @@ -502,7 +505,7 @@ namespace System if (array.Rank > 1) throw new RankException (Locale.GetText ("Only single dimension arrays are supported.")); - if ((comparer == null) && !(value is IComparable)) + if ((comparer == null) && (value != null) && !(value is IComparable)) throw new ArgumentException (Locale.GetText ( "comparer is null and value does not support IComparable.")); @@ -527,7 +530,7 @@ namespace System if (index > array.GetLowerBound (0) + array.GetLength (0) - length) throw new ArgumentException (Locale.GetText ( "index and length do not specify a valid range in array.")); - if (!(value is IComparable)) + if ((value != null) && (!(value is IComparable))) throw new ArgumentException (Locale.GetText ( "value does not support IComparable")); @@ -553,7 +556,7 @@ namespace System throw new ArgumentException (Locale.GetText ( "index and length do not specify a valid range in array.")); - if ((comparer == null) && !(value is IComparable)) + if ((comparer == null) && (value != null) && !(value is IComparable)) throw new ArgumentException (Locale.GetText ( "comparer is null and value does not support IComparable.")); diff --git a/mcs/class/corlib/System/Byte.cs b/mcs/class/corlib/System/Byte.cs index ca35c33af54..41a5b2e1ec3 100644 --- a/mcs/class/corlib/System/Byte.cs +++ b/mcs/class/corlib/System/Byte.cs @@ -157,7 +157,8 @@ namespace System { NumberFormatInfo nfi = NumberFormatInfo.GetInstance (provider); - if (format == null) + // null or empty ("") + if ((format == null) || (format.Length == 0)) format = "G"; return IntegerFormatter.NumberToString (format, nfi, m_value); diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog index a1be7b6e78e..e360292865c 100644 --- a/mcs/class/corlib/System/ChangeLog +++ b/mcs/class/corlib/System/ChangeLog @@ -1,3 +1,15 @@ +2004-06-01 Miguel de Icaza <miguel@ximian.com> + + * String.cs: Flag concat with four arguments internal. + +2004-05-31 Sebastien Pouliot <sebastien@ximian.com> + + * Array.cs: Fixed legal case where value is null. + * Byte.cs: Fixed ToString when format is an empty string (use "G"). + * Guid.cs: Renamed private fields (and changed some to signed) to + match MS implementation and allow serialization to work. Fix + bug #59113. + 2004-05-30 Gonzalo Paniagua Javier <gonzalo@ximian.com> * DateTime.cs: adjust milliseconds for fraction specifier ('f'). diff --git a/mcs/class/corlib/System/Guid.cs b/mcs/class/corlib/System/Guid.cs index 0db80076eba..32d596f3454 100755 --- a/mcs/class/corlib/System/Guid.cs +++ b/mcs/class/corlib/System/Guid.cs @@ -23,17 +23,17 @@ namespace System [StructLayout (LayoutKind.Sequential)] public struct Guid : IFormattable, IComparable { - private uint _timeLow; - private ushort _timeMid; - private ushort _timeHighAndVersion; - private byte _clockSeqHiAndReserved; - private byte _clockSeqLow; - private byte _node0; - private byte _node1; - private byte _node2; - private byte _node3; - private byte _node4; - private byte _node5; + private int _a; //_timeLow; + private short _b; //_timeMid; + private short _c; //_timeHighAndVersion; + private byte _d; //_clockSeqHiAndReserved; + private byte _e; //_clockSeqLow; + private byte _f; //_node0; + private byte _g; //_node1; + private byte _h; //_node2; + private byte _i; //_node3; + private byte _j; //_node4; + private byte _k; //_node5; internal class GuidParser { @@ -242,17 +242,17 @@ namespace System public Guid (byte[] b) { CheckArray (b, 16); - _timeLow = System.BitConverter.ToUInt32 (b, 0); - _timeMid = System.BitConverter.ToUInt16 (b, 4); - _timeHighAndVersion = System.BitConverter.ToUInt16 (b, 6); - _clockSeqHiAndReserved = b[8]; - _clockSeqLow = b[9]; - _node0 = b[10]; - _node1 = b[11]; - _node2 = b[12]; - _node3 = b[13]; - _node4 = b[14]; - _node5 = b[15]; + _a = System.BitConverter.ToInt32 (b, 0); + _b = System.BitConverter.ToInt16 (b, 4); + _c = System.BitConverter.ToInt16 (b, 6); + _d = b [8]; + _e = b [9]; + _f = b [10]; + _g = b [11]; + _h = b [12]; + _i = b [13]; + _j = b [14]; + _k = b [15]; } public Guid (string g) @@ -267,44 +267,44 @@ namespace System public Guid (int a, short b, short c, byte[] d) { - CheckArray(d, 8); - _timeLow = (uint) a; - _timeMid = (ushort) b; - _timeHighAndVersion = (ushort) c; - _clockSeqHiAndReserved = d[0]; - _clockSeqLow = d[1]; - _node0 = d[2]; - _node1 = d[3]; - _node2 = d[4]; - _node3 = d[5]; - _node4 = d[6]; - _node5 = d[7]; + CheckArray (d, 8); + _a = (int) a; + _b = (short) b; + _c = (short) c; + _d = d [0]; + _e = d [1]; + _f = d [2]; + _g = d [3]; + _h = d [4]; + _i = d [5]; + _j = d [6]; + _k = d [7]; } public Guid (int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) - : this((uint) a, (ushort) b, (ushort) c, d, e, f, g, h, i, j, k) { + _a = a; + _b = b; + _c = c; + _d = d; + _e = e; + _f = f; + _g = g; + _h = h; + _i = i; + _j = j; + _k = k; } [CLSCompliant (false)] public Guid (uint a, ushort b, ushort c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) + : this((int) a, (short) b, (short) c, d, e, f, g, h, i, j, k) { - _timeLow = a; - _timeMid = b; - _timeHighAndVersion = c; - _clockSeqHiAndReserved = d; - _clockSeqLow = e; - _node0 = f; - _node1 = g; - _node2 = h; - _node3 = i; - _node4 = j; - _node5 = k; } public static readonly Guid Empty = new Guid (0,0,0,0,0,0,0,0,0,0,0); - private static int Compare (uint x, uint y) + private static int Compare (int x, int y) { if (x < y) { return -1; @@ -314,7 +314,7 @@ namespace System } } - public int CompareTo (object value ) + public int CompareTo (object value) { if (value == null) return 1; @@ -326,38 +326,38 @@ namespace System Guid v = (Guid) value; - if (_timeLow != v._timeLow ) { - return Compare(_timeLow, v._timeLow); + if (_a != v._a) { + return Compare (_a, v._a); } - else if (_timeMid != v._timeMid) { - return Compare(_timeMid, v._timeMid); + else if (_b != v._b) { + return Compare (_b, v._b); } - else if (_timeHighAndVersion != v._timeHighAndVersion) { - return Compare(_timeHighAndVersion, v._timeHighAndVersion); + else if (_c != v._c) { + return Compare (_c, v._c); } - else if (_clockSeqHiAndReserved != v._clockSeqHiAndReserved) { - return Compare(_clockSeqHiAndReserved, v._clockSeqHiAndReserved); + else if (_d != v._d) { + return Compare (_d, v._d); } - else if (_clockSeqLow != v._clockSeqLow) { - return Compare(_clockSeqLow, v._clockSeqLow); + else if (_e != v._e) { + return Compare (_e, v._e); } - else if (_node0 != v._node0) { - return Compare(_node0, v._node0); + else if (_f != v._f) { + return Compare (_f, v._f); } - else if (_node1 != v._node1) { - return Compare(_node1, v._node1); + else if (_g != v._g) { + return Compare (_g, v._g); } - else if (_node2 != v._node2) { - return Compare(_node2, v._node2); + else if (_h != v._h) { + return Compare (_h, v._h); } - else if (_node3 != v._node3) { - return Compare(_node3, v._node3); + else if (_i != v._i) { + return Compare (_i, v._i); } - else if (_node4 != v._node4) { - return Compare(_node4, v._node4); + else if (_j != v._j) { + return Compare (_j, v._j); } - else if (_node5 != v._node5) { - return Compare(_node5, v._node5); + else if (_k != v._k) { + return Compare (_k, v._k); } return 0; } @@ -376,16 +376,16 @@ namespace System { int res; - res = (int) _timeLow; - res = res ^ ((int) _timeMid << 16 | _timeHighAndVersion); - res = res ^ ((int) _clockSeqHiAndReserved << 24); - res = res ^ ((int) _clockSeqLow << 16); - res = res ^ ((int) _node0 << 8); - res = res ^ ((int) _node1); - res = res ^ ((int) _node2 << 24); - res = res ^ ((int) _node3 << 16); - res = res ^ ((int) _node4 << 8); - res = res ^ ((int) _node5); + res = (int) _a; + res = res ^ ((int) _b << 16 | _c); + res = res ^ ((int) _d << 24); + res = res ^ ((int) _e << 16); + res = res ^ ((int) _f << 8); + res = res ^ ((int) _g); + res = res ^ ((int) _h << 24); + res = res ^ ((int) _i << 16); + res = res ^ ((int) _j << 8); + res = res ^ ((int) _k); return res; } @@ -413,9 +413,9 @@ namespace System Guid res = new Guid (b); // Mask in Variant 1-0 in Bit[7..6] - res._clockSeqHiAndReserved = (byte) ((res._clockSeqHiAndReserved & 0x3fu) | 0x80u); + res._d = (byte) ((res._d & 0x3fu) | 0x80u); // Mask in Version 4 (random based Guid) in Bits[15..13] - res._timeHighAndVersion = (ushort) ((res._timeHighAndVersion & 0x0fffu) | 0x4000u); + res._c = (short) ((res._c & 0x0fffu) | 0x4000u); return res; } @@ -452,29 +452,29 @@ namespace System int d = 0; int s; - tmp = BitConverter.GetBytes(_timeLow); + tmp = BitConverter.GetBytes(_a); for (s=0; s<4; ++s) { res[d++] = tmp[s]; } - tmp = BitConverter.GetBytes(_timeMid); + tmp = BitConverter.GetBytes(_b); for (s=0; s<2; ++s) { res[d++] = tmp[s]; } - tmp = BitConverter.GetBytes(_timeHighAndVersion); + tmp = BitConverter.GetBytes(_c); for (s=0; s<2; ++s) { res[d++] = tmp[s]; } - res[8] = _clockSeqHiAndReserved; - res[9] = _clockSeqLow; - res[10] = _node0; - res[11] = _node1; - res[12] = _node2; - res[13] = _node3; - res[14] = _node4; - res[15] = _node5; + res[8] = _d; + res[9] = _e; + res[10] = _f; + res[11] = _g; + res[12] = _h; + res[13] = _i; + res[14] = _j; + res[15] = _k; return res; } @@ -489,24 +489,24 @@ namespace System res.Append ('{'); } - res.Append (_timeLow.ToString ("x8")); + res.Append (_a.ToString ("x8")); if (h) { res.Append ('-'); } - res.Append (_timeMid.ToString ("x4")); + res.Append (_b.ToString ("x4")); if (h) { res.Append ('-'); } - res.Append (_timeHighAndVersion.ToString ("x4")); + res.Append (_c.ToString ("x4")); if (h) { res.Append ('-'); } char[] vals1 = { - ToHex((_clockSeqHiAndReserved >> 4) & 0xf), - ToHex(_clockSeqHiAndReserved & 0xf), - ToHex((_clockSeqLow >> 4) & 0xf), - ToHex(_clockSeqLow & 0xf) + ToHex((_d >> 4) & 0xf), + ToHex(_d & 0xf), + ToHex((_e >> 4) & 0xf), + ToHex(_e & 0xf) }; res.Append (vals1); @@ -516,18 +516,18 @@ namespace System } char[] vals2 = { - ToHex((_node0 >> 4) & 0xf), - ToHex(_node0 & 0xf), - ToHex((_node1 >> 4) & 0xf), - ToHex(_node1 & 0xf), - ToHex((_node2 >> 4) & 0xf), - ToHex(_node2 & 0xf), - ToHex((_node3 >> 4) & 0xf), - ToHex(_node3 & 0xf), - ToHex((_node4 >> 4) & 0xf), - ToHex(_node4 & 0xf), - ToHex((_node5 >> 4) & 0xf), - ToHex(_node5 & 0xf) + ToHex((_f >> 4) & 0xf), + ToHex(_f & 0xf), + ToHex((_g >> 4) & 0xf), + ToHex(_g & 0xf), + ToHex((_h >> 4) & 0xf), + ToHex(_h & 0xf), + ToHex((_i >> 4) & 0xf), + ToHex(_i & 0xf), + ToHex((_j >> 4) & 0xf), + ToHex(_j & 0xf), + ToHex((_k >> 4) & 0xf), + ToHex(_k & 0xf) }; res.Append (vals2); diff --git a/mcs/class/corlib/System/String.cs b/mcs/class/corlib/System/String.cs index 083fba9238d..04c65d76bd1 100644 --- a/mcs/class/corlib/System/String.cs +++ b/mcs/class/corlib/System/String.cs @@ -967,7 +967,10 @@ namespace System return Concat (s1, s2, s3); } - public static String Concat (Object obj1, Object obj2, Object obj3, Object obj4) + // + // Do *not* remove `internal' from that method + // + internal static String Concat (Object obj1, Object obj2, Object obj3, Object obj4) { string s1, s2, s3, s4; |