From caea5ccb9b75e4f54f3080f86055f254752edca9 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Tue, 25 Jun 2019 13:01:41 +0100 Subject: [PATCH] Fixed pointer size in ConnectionInterface --- Facepunch.Steamworks/Classes/ConnectionInterface.cs | 6 ++---- Facepunch.Steamworks/Classes/SocketInterface.cs | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Facepunch.Steamworks/Classes/ConnectionInterface.cs b/Facepunch.Steamworks/Classes/ConnectionInterface.cs index 6f911a6..2d116aa 100644 --- a/Facepunch.Steamworks/Classes/ConnectionInterface.cs +++ b/Facepunch.Steamworks/Classes/ConnectionInterface.cs @@ -72,9 +72,8 @@ public virtual void OnDisconnected( ConnectionInfo data ) public void Receive( int bufferSize = 32 ) { - // #32bit int processed = 0; - IntPtr messageBuffer = Marshal.AllocHGlobal( 8 * bufferSize ); + IntPtr messageBuffer = Marshal.AllocHGlobal( IntPtr.Size * bufferSize ); try { @@ -82,8 +81,7 @@ public void Receive( int bufferSize = 32 ) for ( int i = 0; i < processed; i++ ) { - // #32bit - ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * 8) ); + ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * IntPtr.Size ) ); } } finally diff --git a/Facepunch.Steamworks/Classes/SocketInterface.cs b/Facepunch.Steamworks/Classes/SocketInterface.cs index 9e48273..813d082 100644 --- a/Facepunch.Steamworks/Classes/SocketInterface.cs +++ b/Facepunch.Steamworks/Classes/SocketInterface.cs @@ -64,9 +64,8 @@ public virtual void OnDisconnected( Connection connection, ConnectionInfo data ) public void Receive( int bufferSize = 32 ) { - // #32bit int processed = 0; - IntPtr messageBuffer = Marshal.AllocHGlobal( 8 * bufferSize ); + IntPtr messageBuffer = Marshal.AllocHGlobal( IntPtr.Size * bufferSize ); try { @@ -74,8 +73,7 @@ public void Receive( int bufferSize = 32 ) for ( int i = 0; i < processed; i++ ) { - // #32bit - ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * 8 ) ); + ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * IntPtr.Size ) ); } } finally