Skip to content

Commit

Permalink
Quick fix to incorrect error messages when writing to compressed or e…
Browse files Browse the repository at this point in the history
…ncrypted files.
  • Loading branch information
andy-noisyduck committed Dec 15, 2020
1 parent 6ccc6b6 commit c65f097
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions core/io/file_access_compressed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,14 @@ Error FileAccessCompressed::get_error() const {

void FileAccessCompressed::flush() {
ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
ERR_FAIL_COND_MSG(!writing, "File has not been opened in write mode.");

// compressed files keep data in memory till close()
}

void FileAccessCompressed::store_8(uint8_t p_dest) {
ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
ERR_FAIL_COND_MSG(!writing, "File has not been opened in write mode.");

WRITE_FIT(1);
write_ptr[write_pos++] = p_dest;
Expand Down
6 changes: 3 additions & 3 deletions core/io/file_access_encrypted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Error FileAccessEncrypted::get_error() const {
}

void FileAccessEncrypted::store_buffer(const uint8_t *p_src, int p_length) {
ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
ERR_FAIL_COND_MSG(!writing, "File has not been opened in write mode.");

if (pos < data.size()) {
for (int i = 0; i < p_length; i++) {
Expand All @@ -272,13 +272,13 @@ void FileAccessEncrypted::store_buffer(const uint8_t *p_src, int p_length) {
}

void FileAccessEncrypted::flush() {
ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
ERR_FAIL_COND_MSG(!writing, "File has not been opened in write mode.");

// encrypted files keep data in memory till close()
}

void FileAccessEncrypted::store_8(uint8_t p_dest) {
ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
ERR_FAIL_COND_MSG(!writing, "File has not been opened in write mode.");

if (pos < data.size()) {
data.write[pos] = p_dest;
Expand Down

0 comments on commit c65f097

Please sign in to comment.