2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-06-30 19:03:42 -04:00

Fix usage of uint in bindings (#246)

This commit is contained in:
2024-05-25 10:34:38 +01:00
committed by GitHub
parent 5949934932
commit 383ec91e95
8 changed files with 36 additions and 36 deletions

View File

@ -93,13 +93,13 @@ public class StorageValues
// Save integer value to storage file (to defined position)
// NOTE: Storage positions is directly related to file memory layout (4 bytes each integer)
private static unsafe bool SaveStorageValue(string fileName, uint position, int value)
private static unsafe bool SaveStorageValue(string fileName, int position, int value)
{
using var fileNameBuffer = fileName.ToUtf8Buffer();
bool success = false;
uint dataSize = 0;
uint newDataSize = 0;
int dataSize = 0;
int newDataSize = 0;
byte* fileData = LoadFileData(fileNameBuffer.AsPointer(), &dataSize);
byte* newFileData = null;
@ -110,7 +110,7 @@ public class StorageValues
{
// Increase data size up to position and store value
newDataSize = (position + 1) * sizeof(int);
newFileData = (byte*)MemRealloc(fileData, (int)newDataSize);
newFileData = (byte*)MemRealloc(fileData, (uint)newDataSize);
if (newFileData != null)
{
@ -121,7 +121,7 @@ public class StorageValues
else
{
// RL_REALLOC failed
uint positionInBytes = position * sizeof(int);
int positionInBytes = position * sizeof(int);
TraceLog(
TraceLogLevel.Warning,
@$"FILEIO: [{fileName}] Failed to realloc data ({dataSize}),
@ -154,7 +154,7 @@ public class StorageValues
TraceLog(TraceLogLevel.Info, $"FILEIO: [{fileName}] File created successfully");
dataSize = (position + 1) * sizeof(int);
fileData = (byte*)MemAlloc((int)dataSize);
fileData = (byte*)MemAlloc((uint)dataSize);
int* dataPtr = (int*)fileData;
dataPtr[position] = value;
@ -174,7 +174,7 @@ public class StorageValues
using var fileNameBuffer = fileName.ToUtf8Buffer();
int value = 0;
uint dataSize = 0;
int dataSize = 0;
byte* fileData = LoadFileData(fileNameBuffer.AsPointer(), &dataSize);
if (fileData != null)