Skip to content

Commit

Permalink
csharp/IOBuffer.cs: Change IntPtr cast to long instead of int.
Browse files Browse the repository at this point in the history
IntPtr is a platform specific type and is expected to have different
values on 32-bit or 64-bit systems. In C#, int is a 32-bit signed integer,
while a 64-bit integer is represented as long.


Signed-off-by: Alexandra.Trifan <[email protected]>
  • Loading branch information
AlexandraTrifan committed Feb 3, 2020
1 parent 3c7d514 commit 22486dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bindings/csharp/IOBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ private void Dispose(bool clean)
/// <remarks>The number of samples written will not exceed the size of the buffer.</remarks>
public void fill(byte[] array)
{
int length = (int) iio_buffer_end(buf) - (int) iio_buffer_start(buf);
long length = (long) iio_buffer_end(buf) - (long) iio_buffer_start(buf);
if (length > array.Length)
length = array.Length;
Marshal.Copy(array, 0, iio_buffer_start(buf), length);
Marshal.Copy(array, 0, iio_buffer_start(buf), (int)length);
}
}
}

0 comments on commit 22486dc

Please sign in to comment.