1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-20 14:45:44 +00:00

Merge pull request #32051 from qarmin/some_error_explanation

Added some obvious errors explanations
This commit is contained in:
Rémi Verschelde
2019-09-25 11:51:54 +02:00
committed by GitHub
125 changed files with 435 additions and 458 deletions

View File

@@ -41,7 +41,7 @@
Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode) {
ERR_FAIL_COND_V(file != NULL, ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V_MSG(file != NULL, ERR_ALREADY_IN_USE, "Can't open file while another file from path '" + file->get_path_absolute() + "' is open.");
ERR_FAIL_COND_V(p_key.size() != 32, ERR_INVALID_PARAMETER);
pos = 0;
@@ -221,7 +221,7 @@ bool FileAccessEncrypted::eof_reached() const {
uint8_t FileAccessEncrypted::get_8() const {
ERR_FAIL_COND_V(writing, 0);
ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode.");
if (pos >= data.size()) {
eofed = true;
return 0;
@@ -233,7 +233,7 @@ uint8_t FileAccessEncrypted::get_8() const {
}
int FileAccessEncrypted::get_buffer(uint8_t *p_dst, int p_length) const {
ERR_FAIL_COND_V(writing, 0);
ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode.");
int to_copy = MIN(p_length, data.size() - pos);
for (int i = 0; i < to_copy; i++) {
@@ -255,7 +255,7 @@ Error FileAccessEncrypted::get_error() const {
void FileAccessEncrypted::store_buffer(const uint8_t *p_src, int p_length) {
ERR_FAIL_COND(!writing);
ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
if (pos < data.size()) {
@@ -275,14 +275,14 @@ void FileAccessEncrypted::store_buffer(const uint8_t *p_src, int p_length) {
}
void FileAccessEncrypted::flush() {
ERR_FAIL_COND(!writing);
ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
// encrypted files keep data in memory till close()
}
void FileAccessEncrypted::store_8(uint8_t p_dest) {
ERR_FAIL_COND(!writing);
ERR_FAIL_COND_MSG(!writing, "File has not been opened in read mode.");
if (pos < data.size()) {
data.write[pos] = p_dest;