Forráskód Böngészése

Multiple files:

Deals with the extension to Environment.OSVersion.Platform that might return a new
value MacOSX (6) on .NET
 

svn path=/trunk/mcs/; revision=121711
Miguel de Icaza 17 éve
szülő
commit
8e07acf772
33 módosított fájl, 58 hozzáadás és 57 törlés
  1. 2 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
  2. 1 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxTextRenderer.cs
  3. 3 6
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
  4. 1 1
      mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TestHelper.cs
  5. 1 1
      mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs
  6. 1 1
      mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs
  7. 1 1
      mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestHatchBrush.cs
  8. 1 1
      mcs/class/System.Drawing/Test/System.Drawing.Imaging/GifCodecTest.cs
  9. 1 1
      mcs/class/System.Drawing/Test/System.Drawing.Imaging/IconCodecTest.cs
  10. 1 1
      mcs/class/System.Drawing/Test/System.Drawing.Imaging/PngCodecTest.cs
  11. 1 1
      mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestBmpCodec.cs
  12. 1 1
      mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestJpegCodec.cs
  13. 1 1
      mcs/class/System.Drawing/Test/System.Drawing.Imaging/TiffCodecTest.cs
  14. 3 5
      mcs/class/System.Drawing/Test/System.Drawing/TestIcon.cs
  15. 1 1
      mcs/class/System.Drawing/Test/System.Drawing/TestImage.cs
  16. 1 1
      mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Ipc/IpcChannel.cs
  17. 3 5
      mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceController.cs
  18. 1 5
      mcs/class/System.ServiceProcess/Test/System.ServiceProcess/ServiceControllerTest.cs
  19. 1 1
      mcs/class/System/System.IO.Ports/SerialPort.cs
  20. 1 1
      mcs/class/System/Test/System.Net/FileWebRequestTest.cs
  21. 1 1
      mcs/class/corlib/Mono.Security.Cryptography/KeyPairPersistence.cs
  22. 1 1
      mcs/class/corlib/System.IO/DriveInfo.cs
  23. 10 6
      mcs/class/corlib/System.Resources/Win32Resources.cs
  24. 4 1
      mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs
  25. 5 1
      mcs/class/corlib/System.Security.Principal/WindowsPrincipal.cs
  26. 1 1
      mcs/class/corlib/Test/System.IO/DirectoryTest.cs
  27. 3 3
      mcs/class/corlib/Test/System.IO/PathTest.cs
  28. 1 1
      mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs
  29. 1 1
      mcs/class/corlib/Test/System/AppDomainTest.cs
  30. 1 1
      mcs/tools/al/Al.cs
  31. 1 1
      mcs/tools/mkbundle/mkbundle.cs
  32. 1 1
      mcs/tools/monodoc/Monodoc/provider.cs
  33. 1 1
      mcs/tools/resgen/monoresgen.cs

+ 2 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs

@@ -1545,7 +1545,8 @@ namespace System.Windows.Forms {
 				//only do this when on Windows, since X behaves weirdly otherwise
 				//modal windows appear below their parent/owner/ancestor.
 				//(confirmed on several window managers, so it's not a wm bug).
-				bool is_unix = ((int) Environment.OSVersion.Platform) == 128 || ((int) Environment.OSVersion.Platform == 4);
+				int p = (int) Environment.OSVersion.Platform;
+				bool is_unix = (p == 128) || (p == 4) || (p == 6);
 				if ((VisibleInternal && (is_changing_visible_state == 0 || is_unix)) || this.IsRecreating)
 					cp.Style |= (int)WindowStyles.WS_VISIBLE;
 

+ 1 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxTextRenderer.cs

@@ -49,7 +49,7 @@ namespace System.Windows.Forms
 			// Another option would be to put Pango here for Linux.
 			int platform = (int)Environment.OSVersion.Platform;
 			
-			if (platform == 4 || platform == 128)
+			if (platform == 4 || platform == 128 || platform == 6)
 				use_textrenderer = false;
 			else
 				use_textrenderer = true;

+ 3 - 6
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs

@@ -119,12 +119,9 @@ namespace System.Windows.Forms {
 
 		public static bool RunningOnUnix {
 			get {
-#if NET_2_0 && !MWF_ON_MSRUNTIME
-				return (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX);
-#else
-				int platform = (int) Environment.OSVersion.Platform;
-				return (platform == 128);
-#endif
+				int p = (int) Environment.OSVersion.Platform;
+				
+				return (p == 4 || p == 6 || p == 128);
 			}
 		}
 

+ 1 - 1
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TestHelper.cs

@@ -299,7 +299,7 @@ namespace MonoTests.System.Windows.Forms
 				// check for Unix platforms - see FAQ for more details
 				// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 				int platform = (int) Environment.OSVersion.Platform;
-				return ((platform == 4) || (platform == 128));
+				return ((platform == 4) || (platform == 128) || (platform == 6));
 			}
 		}
 	}

+ 1 - 1
mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs

@@ -323,7 +323,7 @@ namespace Mono.Security.Cryptography {
 			// check for Unix platforms - see FAQ for more details
 			// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 			int platform = (int) Environment.OSVersion.Platform;
-			if ((platform == 4) || (platform == 128))
+			if ((platform == 4) || (platform == 128) || (platform == 6))
 				return true;
 
 			// while we ask the runtime for Windows OS

+ 1 - 1
mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs

@@ -1151,7 +1151,7 @@ namespace System.Data.OracleClient.Oci
 		#region AllocateClear
 
 		private static bool IsUnix =
-		(int) Environment.OSVersion.Platform == 4 || (int) Environment.OSVersion.Platform == 128;
+			(int) Environment.OSVersion.Platform == 4 || (int) Environment.OSVersion.Platform == 128 || (int) Environment.OSVersion.Platform == 6;
 
 		[DllImport("libc")]
 		private static extern IntPtr calloc (int nmemb, int size);

+ 1 - 1
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestHatchBrush.cs

@@ -615,7 +615,7 @@ namespace MonoTests.System.Drawing.Drawing2D
 			string s;
 
 			int p = (int) Environment.OSVersion.Platform;
-			if ((p == 4) || (p == 128))
+			if ((p == 4) || (p == 128) || (p == 6))
 				s = "-unix";
 			else
 				s = "-windows";

+ 1 - 1
mcs/class/System.Drawing/Test/System.Drawing.Imaging/GifCodecTest.cs

@@ -47,7 +47,7 @@ namespace MonoTests.System.Drawing.Imaging {
 			string s;
 
 			int p = (int) Environment.OSVersion.Platform;
-			if ((p == 4) || (p == 128))
+			if ((p == 4) || (p == 128) || (p == 6))
 				s = "-unix";
 			else
 				s = "-windows";

+ 1 - 1
mcs/class/System.Drawing/Test/System.Drawing.Imaging/IconCodecTest.cs

@@ -47,7 +47,7 @@ namespace MonoTests.System.Drawing.Imaging {
 			string s;
 
 			int p = (int) Environment.OSVersion.Platform;
-			if ((p == 4) || (p == 128))
+			if ((p == 4) || (p == 128) || (p == 6))
 				s = "-unix";
 			else
 				s = "-windows";

+ 1 - 1
mcs/class/System.Drawing/Test/System.Drawing.Imaging/PngCodecTest.cs

@@ -47,7 +47,7 @@ namespace MonoTests.System.Drawing.Imaging {
 			string s;
 
 			int p = (int) Environment.OSVersion.Platform;
-			if ((p == 4) || (p == 128))
+			if ((p == 4) || (p == 128) || (p == 6))
 				s = "-unix";
 			else
 				s = "-windows";

+ 1 - 1
mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestBmpCodec.cs

@@ -49,7 +49,7 @@ namespace MonoTests.System.Drawing.Imaging {
 			string s;
 
 			int p = (int) Environment.OSVersion.Platform;
-			if ((p == 4) || (p == 128))
+			if ((p == 4) || (p == 128) || (p == 6))
 				s = "-unix";
 			else
 				s = "-windows";

+ 1 - 1
mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestJpegCodec.cs

@@ -47,7 +47,7 @@ namespace MonoTests.System.Drawing.Imaging {
 			string s;
 
 			int p = (int) Environment.OSVersion.Platform;
-			if ((p == 4) || (p == 128))
+			if ((p == 4) || (p == 128) || (p == 6))
 				s = "-unix";
 			else
 				s = "-windows";

+ 1 - 1
mcs/class/System.Drawing/Test/System.Drawing.Imaging/TiffCodecTest.cs

@@ -53,7 +53,7 @@ namespace MonoTests.System.Drawing.Imaging {
 			string s;
 
 			int p = (int) Environment.OSVersion.Platform;
-			if ((p == 4) || (p == 128))
+			if ((p == 4) || (p == 128) || (p == 6))
 				s = "-unix";
 			else
 				s = "-windows";

+ 3 - 5
mcs/class/System.Drawing/Test/System.Drawing/TestIcon.cs

@@ -547,11 +547,9 @@ namespace MonoTests.System.Drawing {
 
 		private static bool RunningOnUnix {
 			get {
-#if NET_2_0
-				return Environment.OSVersion.Platform == PlatformID.Unix;
-#else
-				return (int) Environment.OSVersion.Platform == 128;
-#endif
+				int p = (int) Environment.OSVersion.Platform;
+
+				return (p == 4) || (p == 6) || (p == 128);
 			}
 		}
 	}

+ 1 - 1
mcs/class/System.Drawing/Test/System.Drawing/TestImage.cs

@@ -189,7 +189,7 @@ namespace MonoTests.System.Drawing{
 				int p = (int) Environment.OSVersion.Platform;
 				// libgdiplus (UNIX) doesn't lazy load the image so the
 				// stream may be freed (and this exception will never occur)
-				if ((p == 4) || (p == 128))
+				if ((p == 4) || (p == 128) || (p == 6))
 					throw;
 			}
 		}

+ 1 - 1
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Ipc/IpcChannel.cs

@@ -46,7 +46,7 @@ namespace System.Runtime.Remoting.Channels.Ipc
                 {
                         get { 
                                 int p = (int) Environment.OSVersion.Platform;
-                                return ((p == 4) || (p == 128));
+                                return ((p == 4) || (p == 128) || (p == 6));
                         }
                 }
 

+ 3 - 5
mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceController.cs

@@ -444,11 +444,9 @@ namespace System.ServiceProcess
 
 		private static ServiceControllerImpl CreateServiceControllerImpl (ServiceController serviceController)
 		{
-#if NET_2_0
-			if (Environment.OSVersion.Platform == PlatformID.Unix) {
-#else
-			if ((int) Environment.OSVersion.Platform == 128) {
-#endif
+			int p = (int) Environment.OSVersion.Platform;
+
+			if (p == 4 || p == 128 || p == 6){
 				return new UnixServiceController (serviceController);
 			} else {
 				return new Win32ServiceController (serviceController);

+ 1 - 5
mcs/class/System.ServiceProcess/Test/System.ServiceProcess/ServiceControllerTest.cs

@@ -4940,12 +4940,8 @@ namespace MonoTests.System.ServiceProcess
 		private bool RunningOnUnix
 		{
 			get {
-#if NET_2_0
-				return Environment.OSVersion.Platform == PlatformID.Unix;
-#else
 				int p = (int) Environment.OSVersion.Platform;
-				return ((p == 4) || (p == 128));
-#endif
+				return ((p == 4) || (p == 128) || (p == 6));
 			}
 		}
 

+ 1 - 1
mcs/class/System/System.IO.Ports/SerialPort.cs

@@ -520,7 +520,7 @@ namespace System.IO.Ports
 			List<string> serial_ports = new List<string>();
 			
 			// Are we on Unix?
-			if (p == 4 || p == 128) {
+			if (p == 4 || p == 128 || p == 6) {
 				string[] ttys = Directory.GetFiles("/dev/", "tty*");
 				foreach (string dev in ttys) {
 					if (dev.StartsWith("/dev/ttyS") || dev.StartsWith("/dev/ttyUSB"))

+ 1 - 1
mcs/class/System/Test/System.Net/FileWebRequestTest.cs

@@ -910,7 +910,7 @@ namespace MonoTests.System.Net
 				// check for Unix platforms - see FAQ for more details
 				// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 				int platform = (int) Environment.OSVersion.Platform;
-				return ((platform == 4) || (platform == 128));
+				return ((platform == 4) || (platform == 128) || (platform == 6));
 			}
 		}
 #endif		

+ 1 - 1
mcs/class/corlib/Mono.Security.Cryptography/KeyPairPersistence.cs

@@ -323,7 +323,7 @@ namespace Mono.Security.Cryptography {
 			// check for Unix platforms - see FAQ for more details
 			// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 			int platform = (int) Environment.OSVersion.Platform;
-			if ((platform == 4) || (platform == 128))
+			if ((platform == 4) || (platform == 128) || (platform == 6))
 				return true;
 
 			// while we ask the runtime for Windows OS

+ 1 - 1
mcs/class/corlib/System.IO/DriveInfo.cs

@@ -258,7 +258,7 @@ namespace System.IO {
 		{
 			int platform = (int) Environment.Platform;
 
-			if (platform == 4 || platform == 128)
+			if (platform == 4 || platform == 128 || platform == 6)
 				return UnixGetDrives ();
 			else
 				return WindowsGetDrives ();

+ 10 - 6
mcs/class/corlib/System.Resources/Win32Resources.cs

@@ -604,20 +604,24 @@ internal class Win32ResFileReader {
 
 	int read_int16 () {
 		int b1 = res_file.ReadByte ();
-		int b2 = res_file.ReadByte ();
+		if (b1 == -1)
+			return -1;
 
-		if ((b1 == -1) || (b2 == -1))
+		int b2 = res_file.ReadByte ();
+		if (b2 == -1)
 			return -1;
-		else
-			return b1 | (b2 << 8);
+
+		return b1 | (b2 << 8);
 	}
 
 	int read_int32 () {
 		int w1 = read_int16 ();
+		if (w1 == -1)
+			return -1;
 		int w2 = read_int16 ();
-
-		if ((w1 == -1) || (w2 == -1))
+		if (w2 == -1)
 			return -1;
+
 		return w1 | (w2 << 16);
 	}
 

+ 4 - 1
mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs

@@ -287,7 +287,10 @@ namespace System.Security.Principal {
 		}
 #endif
 		private static bool IsPosix {
-			get { return ((int) Environment.Platform == 128) || ((int)Environment.Platform == 4); }
+			get {
+				int p = (int) Environment.Platform;
+				return (p == 128) || (p == 4) || (p == 6);
+			}
 		}
 
 		private void SetToken (IntPtr token) 

+ 5 - 1
mcs/class/corlib/System.Security.Principal/WindowsPrincipal.cs

@@ -163,7 +163,11 @@ namespace System.Security.Principal {
 		}
 #endif
 		private static bool IsPosix {
-			get { return ((int) Environment.Platform == 128); }
+			get {
+				int p = (int) Environment.Platform;
+				
+				return p == 128 || p == 4 || p == 6;
+			}
 		}
 
 		private IntPtr Token {

+ 1 - 1
mcs/class/corlib/Test/System.IO/DirectoryTest.cs

@@ -1712,7 +1712,7 @@ public class DirectoryTest
 			// check for Unix platforms - see FAQ for more details
 			// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 			int platform = (int) Environment.OSVersion.Platform;
-			return ((platform == 4) || (platform == 128));
+			return ((platform == 4) || (platform == 128) || (platform == 6));
 		}
 	}
 

+ 3 - 3
mcs/class/corlib/Test/System.IO/PathTest.cs

@@ -949,7 +949,7 @@ namespace MonoTests.System.IO
 			// check for Unix platforms - see FAQ for more details
 			// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 			int platform = (int) Environment.OSVersion.Platform;
-			if ((platform == 4) || (platform == 128))
+			if ((platform == 4) || (platform == 128) || (platform == 6))
 				return;
 
 			string curdir = Directory.GetCurrentDirectory ();
@@ -974,7 +974,7 @@ namespace MonoTests.System.IO
 			// check for Unix platforms - see FAQ for more details
 			// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 			int platform = (int) Environment.OSVersion.Platform;
-			if ((platform == 4) || (platform == 128))
+			if ((platform == 4) || (platform == 128) || (platform == 6))
 				return;
 
 			string curdir = Directory.GetCurrentDirectory ();
@@ -1003,7 +1003,7 @@ namespace MonoTests.System.IO
 			// check for Unix platforms - see FAQ for more details
 			// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 			int platform = (int) Environment.OSVersion.Platform;
-			if ((platform == 4) || (platform == 128))
+			if ((platform == 4) || (platform == 128) || (platform == 6))
 				return;
 
 			AssertEquals ("1", @"C:\Windows\dir", Path.GetFullPath (@"C:\Windows\System32\..\dir"));

+ 1 - 1
mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs

@@ -71,7 +71,7 @@ namespace MonoTests.System.Security.Permissions {
 			filename = Path.GetTempFileName ();
 
 			int os = (int) Environment.OSVersion.Platform;
-			unix = ((os == 4) || (os == 128));
+			unix = ((os == 4) || (os == 128) || (os == 6));
 
 			p = null;
 			pathsInPermission = null;

+ 1 - 1
mcs/class/corlib/Test/System/AppDomainTest.cs

@@ -3297,7 +3297,7 @@ namespace MonoTests.System
 				// check for Unix platforms - see FAQ for more details
 				// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 				int platform = (int) Environment.OSVersion.Platform;
-				return ((platform == 4) || (platform == 128));
+				return ((platform == 4) || (platform == 128) || (platform == 6));
 			}
 		}
 

+ 1 - 1
mcs/tools/al/Al.cs

@@ -426,7 +426,7 @@ namespace Mono.AssemblyLinker
 				// check for Unix platforms - see FAQ for more details
 				// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 				int platform = (int) Environment.OSVersion.Platform;
-				return ((platform == 4) || (platform == 128));
+				return ((platform == 4) || (platform == 128) || (platform == 6));
 			}
 		}
 

+ 1 - 1
mcs/tools/mkbundle/mkbundle.cs

@@ -566,7 +566,7 @@ class MakeBundle {
 	static bool IsUnix {
 		get {
 			int p = (int) Environment.OSVersion.Platform;
-			return ((p == 4) || (p == 128));
+			return ((p == 4) || (p == 128) || (p == 6));
 		}
 	}
 

+ 1 - 1
mcs/tools/monodoc/Monodoc/provider.cs

@@ -1432,7 +1432,7 @@ public class RootTree : Tree {
 	static bool IsUnix {
 		get {
 			int p = (int) Environment.OSVersion.Platform;
-			return ((p == 4) || (p == 128));
+			return ((p == 4) || (p == 128) || (p == 6));
                 }
         }
 

+ 1 - 1
mcs/tools/resgen/monoresgen.cs

@@ -294,7 +294,7 @@ the output file name (if not set).";
 			// check for Unix platforms - see FAQ for more details
 			// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
 			int platform = (int) Environment.OSVersion.Platform;
-			return ((platform == 4) || (platform == 128));
+			return ((platform == 4) || (platform == 128) || (platform == 6));
 		}
 	}