1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

[FileAccess] Return error codes from store_* methods.

This commit is contained in:
bruvzg
2023-06-15 21:21:43 +03:00
committed by Pāvels Nadtočajevs
parent 56a7dba10b
commit a4b17e7852
30 changed files with 279 additions and 138 deletions

View File

@@ -372,9 +372,9 @@ void FileAccessWindows::flush() {
}
}
void FileAccessWindows::store_buffer(const uint8_t *p_src, uint64_t p_length) {
ERR_FAIL_NULL(f);
ERR_FAIL_COND(!p_src && p_length > 0);
bool FileAccessWindows::store_buffer(const uint8_t *p_src, uint64_t p_length) {
ERR_FAIL_NULL_V(f, false);
ERR_FAIL_COND_V(!p_src && p_length > 0, false);
if (flags == READ_WRITE || flags == WRITE_READ) {
if (prev_op == READ) {
@@ -385,7 +385,7 @@ void FileAccessWindows::store_buffer(const uint8_t *p_src, uint64_t p_length) {
prev_op = WRITE;
}
ERR_FAIL_COND(fwrite(p_src, 1, p_length, f) != (size_t)p_length);
return fwrite(p_src, 1, p_length, f) == (size_t)p_length;
}
bool FileAccessWindows::file_exists(const String &p_name) {