storage: Add error messages when ReadIO/WriteIO lengths mismatch

This commit is contained in:
Ethan Lee
2024-12-31 12:34:12 -05:00
parent 6ca2a48595
commit 3cd3c9317e

View File

@@ -85,6 +85,8 @@ static bool GENERIC_ReadStorageFile(void *userdata, const char *path, void *dest
// FIXME: Should SDL_ReadIO use u64 now...?
if (SDL_ReadIO(stream, destination, (size_t)length) == length) {
result = true;
} else {
SDL_SetError("File length did not exactly match the destination length");
}
SDL_CloseIO(stream);
}
@@ -110,6 +112,8 @@ static bool GENERIC_WriteStorageFile(void *userdata, const char *path, const voi
// FIXME: Should SDL_WriteIO use u64 now...?
if (SDL_WriteIO(stream, source, (size_t)length) == length) {
result = true;
} else {
SDL_SetError("Resulting file length did not exactly match the source length");
}
SDL_CloseIO(stream);
}