diff options
Diffstat (limited to 'mcs/class/corlib/System')
-rw-r--r-- | mcs/class/corlib/System/Activator.cs | 14 | ||||
-rwxr-xr-x | mcs/class/corlib/System/AppDomain.cs | 4 | ||||
-rw-r--r-- | mcs/class/corlib/System/ChangeLog | 55 | ||||
-rw-r--r-- | mcs/class/corlib/System/Console.cs | 6 | ||||
-rw-r--r-- | mcs/class/corlib/System/Convert.cs | 29 | ||||
-rw-r--r-- | mcs/class/corlib/System/DateTime.cs | 20 | ||||
-rw-r--r-- | mcs/class/corlib/System/Environment.cs | 2 | ||||
-rw-r--r-- | mcs/class/corlib/System/Random.cs | 2 | ||||
-rw-r--r-- | mcs/class/corlib/System/Version.cs | 7 |
9 files changed, 116 insertions, 23 deletions
diff --git a/mcs/class/corlib/System/Activator.cs b/mcs/class/corlib/System/Activator.cs index 4727251d9e6..6cb4c24b262 100644 --- a/mcs/class/corlib/System/Activator.cs +++ b/mcs/class/corlib/System/Activator.cs @@ -168,9 +168,10 @@ namespace System length = args.Length; Type [] atypes = new Type [length]; - for (int i = 0; i < length; ++i) { - atypes [i] = args [i].GetType (); - } + for (int i = 0; i < length; ++i) + if (args [i] != null) + atypes [i] = args [i].GetType (); + ConstructorInfo ctor = type.GetConstructor (atypes); if (ctor == null) { if (type.IsValueType && atypes.Length == 0) @@ -213,9 +214,10 @@ namespace System length = args.Length; Type[] atypes = new Type [length]; - for (int i = 0; i < length; ++i) { - atypes [i] = args [i].GetType (); - } + for (int i = 0; i < length; ++i) + if (args [i] != null) + atypes [i] = args [i].GetType (); + ConstructorInfo ctor = type.GetConstructor (bindingAttr, binder, atypes, null); if (ctor == null) { // Not sure about this diff --git a/mcs/class/corlib/System/AppDomain.cs b/mcs/class/corlib/System/AppDomain.cs index 06ab7351c93..e987f1a7b4f 100755 --- a/mcs/class/corlib/System/AppDomain.cs +++ b/mcs/class/corlib/System/AppDomain.cs @@ -63,10 +63,10 @@ namespace System static string _process_guid; [ThreadStatic] - Hashtable type_resolve_in_progress; + static Hashtable type_resolve_in_progress; [ThreadStatic] - Hashtable assembly_resolve_in_progress; + static Hashtable assembly_resolve_in_progress; // Evidence evidence; diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog index 8e4560b1bea..f9b59c29d4f 100644 --- a/mcs/class/corlib/System/ChangeLog +++ b/mcs/class/corlib/System/ChangeLog @@ -1,3 +1,58 @@ +2004-10-08 Zoltan Varga <vargaz@freemail.hu> + + * Convert.cs (ToType): Throw an exception when converting null to a + valuetype. Fixes #67780. + +2004-10-08 Atsushi Enomoto <atsushi@ximian.com> + + * DateTime.cs : Removed incorrectly injected HEAD fix. + +2004-10-08 Atsushi Enomoto <atsushi@ximian.com> + + * DateTime.cs : When it it not exact parse, 'Z' is allowed as a suffix + of m/s/t/z. This fixes bug 66723. + +2004-10-04 Zoltan Varga <vargaz@freemail.hu> + + * AppDomain.cs: Make ThreadStatic variables static. Fixes #56614. + +2004-09-30 Geoff Norton <gnorton@customerdna.com> + + * Convert.cs: ConvertToBase* was not endian aware. Implemented EndianSwap + and swapping of all values before going into the BitConverter so that values + are returned with proper endianess. + +2004-09-23 Martin Garton <martin@wrasse.demon.co.uk> + + * Convert.cs: ToType was returning unconverted object when it should + fail with an ArgumentException. + +2004-09-19 Dick Porter <dick@ximian.com> + + * Console.cs: Use the internal wrappers for StreamReader and + StreamWriter that catch IOException. + +2004-08-29 Ben Maurer <bmaurer@users.sourceforge.net> + + * Activator.cs (CreateInstance): If an argument is null, + do not call GetType () on it. #63852 + +2004-09-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Environment.cs: (ExpandEnvironmentVariables) don't nullify the case + insensitive environment variables hashtable once we create it. + +2004-08-19 Atsushi Enomoto <atsushi@ximian.com> + + * DateTime.cs : When hour format is "hh", MS.NET (maybe incorrectly) + allows 12, that should not be accepted (13 is rejected) and + interpreted as 0. This fixes bug 63376. + +2004-08-17 Sebastien Pouliot <sebastien@ximian.com> + + * Version.cs: Fixed Clone so we can use it on versions with only + major/minor or major/minor/build. + 2004-07-07 Geoff Norton <gnorton@customerdna.com> * Monotype.cs: Patch for bug #58844. Dont throw exceptions right away; diff --git a/mcs/class/corlib/System/Console.cs b/mcs/class/corlib/System/Console.cs index 8a0830a7328..f71b4069c43 100644 --- a/mcs/class/corlib/System/Console.cs +++ b/mcs/class/corlib/System/Console.cs @@ -63,15 +63,15 @@ namespace System encoding = Encoding.Default; } - stderr = new StreamWriter (OpenStandardError (0), encoding); + stderr = new UnexceptionalStreamWriter (OpenStandardError (0), encoding); ((StreamWriter)stderr).AutoFlush = true; stderr = TextWriter.Synchronized (stderr, true); - stdout = new StreamWriter (OpenStandardOutput (0), encoding); + stdout = new UnexceptionalStreamWriter (OpenStandardOutput (0), encoding); ((StreamWriter)stdout).AutoFlush = true; stdout = TextWriter.Synchronized (stdout, true); - stdin = new StreamReader (OpenStandardInput (0), encoding); + stdin = new UnexceptionalStreamReader (OpenStandardInput (0), encoding); stdin = TextReader.Synchronized (stdin); } diff --git a/mcs/class/corlib/System/Convert.cs b/mcs/class/corlib/System/Convert.cs index f63481831c5..5e15d578704 100644 --- a/mcs/class/corlib/System/Convert.cs +++ b/mcs/class/corlib/System/Convert.cs @@ -2559,8 +2559,18 @@ namespace System { return (long) result;
}
+ private static void EndianSwap (ref byte[] value) + { + byte[] buf = new byte[value.Length]; + for (int i = 0; i < value.Length; i++) + buf[i] = value[value.Length-1-i]; + value = buf; + } + private static string ConvertToBase2 (byte[] value) { + if (!BitConverter.IsLittleEndian) + EndianSwap (ref value); StringBuilder sb = new StringBuilder (); for (int i = value.Length - 1; i >= 0; i--) { byte b = value [i]; @@ -2580,6 +2590,8 @@ namespace System { private static string ConvertToBase8 (byte[] value)
{ + if (!BitConverter.IsLittleEndian) + EndianSwap (ref value); ulong l = 0; switch (value.Length) { case 1: @@ -2612,6 +2624,8 @@ namespace System { private static string ConvertToBase16 (byte[] value) { + if (!BitConverter.IsLittleEndian) + EndianSwap (ref value); StringBuilder sb = new StringBuilder (); for (int i = value.Length - 1; i >= 0; i--) { char high = (char)((value[i] >> 4) & 0x0f); @@ -2672,8 +2686,12 @@ namespace System { internal static object ToType (object value, Type conversionType,
IFormatProvider provider)
{
- if (value == null)
- return null;
+ if (value == null) { + if ((conversionType != null) && conversionType.IsValueType) + throw new InvalidCastException ("Null object can not be converted to a value type."); + else + return null; + } if (conversionType == null)
throw new InvalidCastException ("Cannot cast to destination type.");
@@ -2739,12 +2757,7 @@ namespace System { else if (conversionType == conversionTable[18]) // 18 TypeCode.String
return (object) convertValue.ToString (provider);
else {
- try {
- return (object) convertValue;
- }
- catch {
- throw new ArgumentException (Locale.GetText ("Unknown target conversion type"));
- }
+ throw new ArgumentException (Locale.GetText ("Unknown target conversion type"));
}
} else
// Not in the conversion table
diff --git a/mcs/class/corlib/System/DateTime.cs b/mcs/class/corlib/System/DateTime.cs index cb90d719a98..188d0d27bd4 100644 --- a/mcs/class/corlib/System/DateTime.cs +++ b/mcs/class/corlib/System/DateTime.cs @@ -1007,8 +1007,10 @@ namespace System num = 1; } - if (hour >= 12) + if (hour > 12) return false; + if (hour == 12) + hour = 0; break; case 'H': @@ -1188,6 +1190,22 @@ namespace System s = s.Substring (num_parsed); + if (!exact) { + switch (chars [pos]) { + case 'm': + case 's': + case 'f': + case 'z': + if (s.Length > 0 && s [0] == 'Z' + && (pos + 1 == chars.Length + || chars [pos + 1] != 'Z')) { + useutc = true; + s = s.Substring (1); + } + break; + } + } + pos = pos + num + 1; num = 0; } diff --git a/mcs/class/corlib/System/Environment.cs b/mcs/class/corlib/System/Environment.cs index bf213ff4cb7..c21030f8b35 100644 --- a/mcs/class/corlib/System/Environment.cs +++ b/mcs/class/corlib/System/Environment.cs @@ -290,8 +290,8 @@ namespace System PlatformID platform = Platform; StringBuilder result = new StringBuilder (); result.Append (name, 0, off1); + Hashtable tbl = null; do { - Hashtable tbl = null; string var = name.Substring (off1 + 1, off2 - off1 - 1); string value = GetEnvironmentVariable (var); if (value == null && (int) platform != 128) { diff --git a/mcs/class/corlib/System/Random.cs b/mcs/class/corlib/System/Random.cs index 3bc3e23498b..e730865d76e 100644 --- a/mcs/class/corlib/System/Random.cs +++ b/mcs/class/corlib/System/Random.cs @@ -74,7 +74,7 @@ namespace System } } inext = 0; - inextp = 21; + inextp = 31; } protected virtual double Sample () diff --git a/mcs/class/corlib/System/Version.cs b/mcs/class/corlib/System/Version.cs index ea64cde7080..adc86fa5568 100644 --- a/mcs/class/corlib/System/Version.cs +++ b/mcs/class/corlib/System/Version.cs @@ -152,7 +152,12 @@ namespace System public object Clone () { - return new Version (_Major, _Minor, _Build, _Revision); + if (_Build == -1) + return new Version (_Major, _Minor); + else if (_Revision == -1) + return new Version (_Major, _Minor, _Build); + else + return new Version (_Major, _Minor, _Build, _Revision); } public int CompareTo (object version) |