Browse Source

2006-04-26 Miguel de Icaza <[email protected]>

	* FileStream.cs: Implement the FileOptions usage by passing all
	the information to the C layer.  Remove the "isAsync" argument for
	MonoIO.Open, and instead pass it on the FileOptions.

	* FileOptions.cs: Make it build when including WriteThrough

	* MonoIO.cs: Update MonoIO.Open signature to drop the async
	argument and take FileOptions instead. 

2006-04-26  Miguel de Icaza  <[email protected]>

	* MethodBuilder.cs: better error messages when we close the
	method. 



svn path=/trunk/mcs/; revision=59960
Miguel de Icaza 19 years ago
parent
commit
2b3a7db7cb

+ 11 - 0
mcs/class/corlib/System.IO/ChangeLog

@@ -1,3 +1,14 @@
+2006-04-26  Miguel de Icaza  <[email protected]>
+
+	* FileStream.cs: Implement the FileOptions usage by passing all
+	the information to the C layer.  Remove the "isAsync" argument for
+	MonoIO.Open, and instead pass it on the FileOptions.
+
+	* FileOptions.cs: Make it build when including WriteThrough
+
+	* MonoIO.cs: Update MonoIO.Open signature to drop the async
+	argument and take FileOptions instead. 
+
 2006-04-21  Zoltan Varga  <[email protected]>
 
 	* FileStream.cs: Add new net 2.0 ctor.

+ 1 - 2
mcs/class/corlib/System.IO/FileOptions.cs

@@ -49,8 +49,7 @@ namespace System.IO
 		SequentialScan = 0x8000000,
 		RandomAccess = 0x10000000,
 		Asynchronous = 0x40000000,
-		// FIXME: This field cannot be encoded as an int in C#
-		//WriteThrough = 0x80000000
+		WriteThrough = -2147483648
 	}
 }
 

+ 9 - 11
mcs/class/corlib/System.IO/FileStream.cs

@@ -108,7 +108,7 @@ namespace System.IO
 		// construct from filename
 		
 		public FileStream (string name, FileMode mode)
-			: this (name, mode, (mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), FileShare.Read, DefaultBufferSize, false, false)
+			: this (name, mode, (mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), FileShare.Read, DefaultBufferSize, false, FileOptions.None)
 		{
 		}
 
@@ -118,33 +118,33 @@ namespace System.IO
 		}
 
 		public FileStream (string name, FileMode mode, FileAccess access, FileShare share)
-			: this (name, mode, access, share, DefaultBufferSize, false, false)
+			: this (name, mode, access, share, DefaultBufferSize, false, FileOptions.None)
 		{
 		}
 		
 		public FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize)
-			: this (name, mode, access, share, bufferSize, false, false)
+			: this (name, mode, access, share, bufferSize, false, FileOptions.None)
 		{
 		}
 
 		public FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool isAsync)
-			: this (name, mode, access, share, bufferSize, isAsync, false)
+			: this (name, mode, access, share, bufferSize, isAsync, FileOptions.None)
 		{
 		}
 
 #if NET_2_0
 		public FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)
-			: this (name, mode, access, share, bufferSize, false, false, options)
+			: this (name, mode, access, share, bufferSize, false, options)
 		{
 		}
 #endif
 
 		internal FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool isAsync, bool anonymous)
-			: this (name, mode, access, share, bufferSize, isAsync, anonymous, FileOptions.None)
+			: this (name, mode, access, share, bufferSize, anonymous, isAsync ? FileOptions.Asynchronous : FileOptions.None)
 		{
 		}
 
-		internal FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool isAsync, bool anonymous, FileOptions options)
+		internal FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool anonymous, FileOptions options)
 		{
 			if (name == null) {
 				throw new ArgumentNullException ("name");
@@ -158,8 +158,6 @@ namespace System.IO
 			// ignore the Inheritable flag
 			share &= ~FileShare.Inheritable;
 
-			if (options != FileOptions.None)
-				throw new NotImplementedException ("Only FileOptions.None is supported.");
 #endif
 
 			if (bufferSize <= 0)
@@ -227,7 +225,7 @@ namespace System.IO
 
 			MonoIOError error;
 
-			this.handle = MonoIO.Open (name, mode, access, share, false, out error);
+			this.handle = MonoIO.Open (name, mode, access, share, options, out error);
 			if (handle == MonoIO.InvalidHandle) {
 				// don't leak the path information for isolated storage
 				string fname = (anonymous) ? Path.GetFileName (name) : name;
@@ -242,7 +240,7 @@ namespace System.IO
 			
 			if (MonoIO.GetFileType (handle, out error) == MonoFileType.Disk) {
 				this.canseek = true;
-				this.async = isAsync;
+				this.async = (options & FileOptions.Asynchronous) != 0;
 			} else {
 				this.canseek = false;
 				this.async = false;

+ 5 - 2
mcs/class/corlib/System.IO/MonoIO.cs

@@ -114,6 +114,9 @@ namespace System.IO
 			case MonoIOError.ERROR_DIR_NOT_EMPTY:
 				message = String.Format ("Directory {0} is not empty", path);
 				return new IOException (message, unchecked((int)0x80070000) | (int)error);
+
+			case MonoIOError.ERROR_ENCRYPTION_FAILED:
+				return new IOException ("Encryption failed", unchecked((int)0x80070000) | (int)error);
 				
 			default:
 				message = String.Format ("Win32 IO returned {0}. Path: {1}", error, path);
@@ -217,7 +220,7 @@ namespace System.IO
 						  FileMode mode,
 						  FileAccess access,
 						  FileShare share,
-						  bool async,
+						  FileOptions options,
 						  out MonoIOError error);
 		
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
@@ -308,7 +311,7 @@ namespace System.IO
 
 			handle = Open (path, FileMode.Open,
 				       FileAccess.ReadWrite,
-				       FileShare.ReadWrite, false, out error);
+				       FileShare.ReadWrite, FileOptions.None, out error);
 			if (handle == MonoIO.InvalidHandle)
 				return false;
 

+ 3 - 1
mcs/class/corlib/System.IO/MonoIOError.cs

@@ -1023,7 +1023,9 @@ namespace System.IO
 		ERROR_NODE_CANNOT_BE_CLUSTERED = 5898,
 		ERROR_CLUSTER_WRONG_OS_VERSION = 5899,
 		ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME = 5900,
-		ERROR_ENCRYPTION_FAILED = 6000,
+	*/
+		ERROR_ENCRYPTION_FAILED = 6000,
+	/*
 		ERROR_DECRYPTION_FAILED = 6001,
 		ERROR_FILE_ENCRYPTED = 6002,
 		ERROR_NO_RECOVERY_POLICY = 6003,

+ 9 - 4
mcs/class/corlib/System.Reflection.Emit/ChangeLog

@@ -1,12 +1,17 @@
+2006-04-26  Miguel de Icaza  <[email protected]>
+
+	* MethodBuilder.cs: better error messages when we close the
+	method. 
+
 2006-03-28  Marek Safar  <[email protected]>
 
-	* ILGenerator.cs: Delayed the exception stack creation. It saves ~1.5 MB
-	for corlib compilation.
-
+	* ILGenerator.cs: Delayed the exception stack creation. It saves ~1.5 MB
+	for corlib compilation.
+
 2006-03-27  Marek Safar  <[email protected]>
 
 	* ILGenerator.cs: Tune up label defaults, switched to double resizing.
-
+
 2006-03-15  Zoltan Varga  <[email protected]>
 
 	* AssemblyBuilder.cs (AddTypeForwarder): New internal method for

+ 3 - 1
mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs

@@ -294,7 +294,9 @@ namespace System.Reflection.Emit {
 #else
 				if (((ilgen == null) || (ILGenerator.Mono_GetCurrentOffset (ilgen) == 0)) && (code == null))
 #endif
-					throw new InvalidOperationException ("Method '" + Name + "' does not have a method body.");
+					throw new InvalidOperationException (
+									     String.Format ("Method '{0}.{1}' does not have a method body.",
+											    DeclaringType.Name, Name));
 			}
 			if (ilgen != null)
 				ilgen.label_fixup ();

+ 1 - 1
mcs/class/corlib/System/Environment.cs

@@ -59,7 +59,7 @@ namespace System {
 		 * Changes which are already detected at runtime, like the addition
 		 * of icalls, do not require an increment.
 		 */
-		private const int mono_corlib_version = 49;
+		private const int mono_corlib_version = 50;
 		
 		[MonoTODO]
 		public enum SpecialFolder