mirror of
https://github.com/godotengine/godot.git
synced 2025-10-21 08:53:35 +00:00
[FileAccess] Return error codes from store_*
methods.
This commit is contained in:
parent
56a7dba10b
commit
a4b17e7852
30 changed files with 279 additions and 138 deletions
|
@ -150,14 +150,16 @@ Error FileAccessUnixPipe::get_error() const {
|
|||
return last_error;
|
||||
}
|
||||
|
||||
void FileAccessUnixPipe::store_buffer(const uint8_t *p_src, uint64_t p_length) {
|
||||
ERR_FAIL_COND_MSG(fd[1] < 0, "Pipe must be opened before use.");
|
||||
ERR_FAIL_COND(!p_src && p_length > 0);
|
||||
bool FileAccessUnixPipe::store_buffer(const uint8_t *p_src, uint64_t p_length) {
|
||||
ERR_FAIL_COND_V_MSG(fd[1] < 0, false, "Pipe must be opened before use.");
|
||||
ERR_FAIL_COND_V(!p_src && p_length > 0, false);
|
||||
|
||||
if (::write(fd[1], p_src, p_length) != (ssize_t)p_length) {
|
||||
last_error = ERR_FILE_CANT_WRITE;
|
||||
return false;
|
||||
} else {
|
||||
last_error = OK;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue