From 93076a9c75d83d18506227128d161f3ef5231b05 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Wed, 28 May 2014 09:06:36 -0400 Subject: [PATCH] [corlib][ios] Fix 'write' pinvoke declaration to be 64bits safe --- mcs/class/corlib/System/Console.iOS.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mcs/class/corlib/System/Console.iOS.cs b/mcs/class/corlib/System/Console.iOS.cs index 6a5f7147128..d14271c623a 100644 --- a/mcs/class/corlib/System/Console.iOS.cs +++ b/mcs/class/corlib/System/Console.iOS.cs @@ -4,7 +4,7 @@ // Authors: // Sebastien Pouliot // -// 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) ; } -- 2.25.1