mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-01 06:44:27 +08:00
storage: Add error messages when ReadIO/WriteIO lengths mismatch
This commit is contained in:
@@ -85,6 +85,8 @@ static bool GENERIC_ReadStorageFile(void *userdata, const char *path, void *dest
|
|||||||
// FIXME: Should SDL_ReadIO use u64 now...?
|
// FIXME: Should SDL_ReadIO use u64 now...?
|
||||||
if (SDL_ReadIO(stream, destination, (size_t)length) == length) {
|
if (SDL_ReadIO(stream, destination, (size_t)length) == length) {
|
||||||
result = true;
|
result = true;
|
||||||
|
} else {
|
||||||
|
SDL_SetError("File length did not exactly match the destination length");
|
||||||
}
|
}
|
||||||
SDL_CloseIO(stream);
|
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...?
|
// FIXME: Should SDL_WriteIO use u64 now...?
|
||||||
if (SDL_WriteIO(stream, source, (size_t)length) == length) {
|
if (SDL_WriteIO(stream, source, (size_t)length) == length) {
|
||||||
result = true;
|
result = true;
|
||||||
|
} else {
|
||||||
|
SDL_SetError("Resulting file length did not exactly match the source length");
|
||||||
}
|
}
|
||||||
SDL_CloseIO(stream);
|
SDL_CloseIO(stream);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user