Fix FileRead on Win32

This commit is contained in:
Aetias
2024-02-23 21:39:18 +01:00
parent 1281ac1340
commit 7c8cbdb6ea
+3 -2
View File
@@ -128,8 +128,9 @@ void FileClose(File *file) {
size_t FileRead(const File *file, void *buf, size_t size, size_t count) {
#ifdef __UTIL_WINDOWS
DWORD bytesRead;
if (ReadFile(file->handle, buf, size * count, &bytesRead, NULL)) return true;
if (bytesRead > 0) return bytesRead / size;
if (ReadFile(file->handle, buf, size * count, &bytesRead, NULL)) {
if (bytesRead > 0) return bytesRead / size;
}
#elif defined(__UTIL_LINUX)
size_t countRead = fread(buf, size, count, file->fp);
if (countRead > 0) return countRead;