[corlib][ios] Fix 'write' pinvoke declaration to be 64bits safe
authorSebastien Pouliot <sebastien@xamarin.com>
Wed, 28 May 2014 13:06:36 +0000 (09:06 -0400)
committerSebastien Pouliot <sebastien@xamarin.com>
Wed, 28 May 2014 13:06:44 +0000 (09:06 -0400)
mcs/class/corlib/System/Console.iOS.cs

index 6a5f71471288ad27e8c3a262b4c84637f5af6dae..d14271c623a0965ce9f5c9e75411b05e2f2fe293 100644 (file)
@@ -4,7 +4,7 @@
 // Authors:
 //     Sebastien Pouliot  <sebastien@xamarin.com>
 //
-// Copyright 2012-2013 Xamarin Inc. All rights reserved.
+// Copyright 2012-2014 Xamarin Inc. All rights reserved.
 //
 
 #if FULL_AOT_RUNTIME
@@ -23,7 +23,7 @@ namespace System {
                        extern static void monotouch_log (string s);
 
                        [DllImport ("/usr/lib/libSystem.dylib")]
-                       extern static int write (int fd, byte [] buffer, int n);
+                       extern static /* ssize_t */ IntPtr write (int fd, byte [] buffer, /* size_t */ IntPtr n);
                        
                        StringBuilder sb;
                        
@@ -39,7 +39,8 @@ namespace System {
                        static void direct_write_to_stdout (string s)
                        {
                                byte [] b = Encoding.Default.GetBytes (s);
-                               while (write (1, b, b.Length) == -1 && Marshal.GetLastWin32Error () == /* EINTR*/ 4)
+                               var len = (IntPtr) b.Length;
+                               while ((int) write (1, b, len) == -1 && Marshal.GetLastWin32Error () == /* EINTR*/ 4)
                                        ;
                        }