mirror of
https://github.com/AntonioND/nitro-engine.git
synced 2025-06-18 16:45:33 -04:00
library: Fix FAT load function
"rb+" isn't required, "rb" is more correct. Also, it is important to check the result of fread().
This commit is contained in:
parent
a4c1b40c7a
commit
95e6a16a89
@ -10,7 +10,7 @@
|
||||
|
||||
char *NE_FATLoadData(const char *filename)
|
||||
{
|
||||
FILE *f = fopen(filename, "rb+");
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if (f == NULL)
|
||||
{
|
||||
NE_DebugPrint("%s could't be opened", filename);
|
||||
@ -28,7 +28,12 @@ char *NE_FATLoadData(const char *filename)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fread(buffer, 1, size, f);
|
||||
if (fread(buffer, 1, size, f) != size)
|
||||
{
|
||||
NE_DebugPrint("Failed to read data of %s", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
return buffer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user