You've already forked godot
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:
committed by
Pāvels Nadtočajevs
parent
56a7dba10b
commit
a4b17e7852
@@ -147,16 +147,16 @@ void FileAccessMemory::flush() {
|
||||
ERR_FAIL_NULL(data);
|
||||
}
|
||||
|
||||
void FileAccessMemory::store_buffer(const uint8_t *p_src, uint64_t p_length) {
|
||||
ERR_FAIL_COND(!p_src && p_length > 0);
|
||||
bool FileAccessMemory::store_buffer(const uint8_t *p_src, uint64_t p_length) {
|
||||
ERR_FAIL_COND_V(!p_src && p_length > 0, false);
|
||||
|
||||
uint64_t left = length - pos;
|
||||
uint64_t write = MIN(p_length, left);
|
||||
|
||||
if (write < p_length) {
|
||||
WARN_PRINT("Writing less data than requested");
|
||||
}
|
||||
|
||||
memcpy(&data[pos], p_src, write);
|
||||
pos += write;
|
||||
|
||||
ERR_FAIL_COND_V_MSG(write < p_length, false, "Writing less data than requested.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user