diff options
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/file_access_compressed.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_compressed.h | 2 | ||||
-rw-r--r-- | core/io/file_access_encrypted.cpp | 22 | ||||
-rw-r--r-- | core/io/file_access_encrypted.h | 2 | ||||
-rw-r--r-- | core/io/file_access_memory.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_memory.h | 2 | ||||
-rw-r--r-- | core/io/file_access_network.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_network.h | 2 | ||||
-rw-r--r-- | core/io/file_access_pack.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_pack.h | 6 | ||||
-rw-r--r-- | core/io/file_access_zip.cpp | 8 | ||||
-rw-r--r-- | core/io/file_access_zip.h | 2 | ||||
-rw-r--r-- | core/io/pck_packer.cpp | 2 | ||||
-rw-r--r-- | core/io/xml_parser.cpp | 2 | ||||
-rw-r--r-- | core/io/zip_io.cpp | 2 |
15 files changed, 31 insertions, 29 deletions
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index efcaa80fc5..e54c947340 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -237,7 +237,7 @@ uint64_t FileAccessCompressed::get_position() const { } } -uint64_t FileAccessCompressed::get_len() const { +uint64_t FileAccessCompressed::get_length() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); if (writing) { return write_max; diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h index d8a81c2417..19e4f241dd 100644 --- a/core/io/file_access_compressed.h +++ b/core/io/file_access_compressed.h @@ -75,7 +75,7 @@ public: virtual void seek(uint64_t p_position); ///< seek to a given position virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file virtual uint64_t get_position() const; ///< get position in the file - virtual uint64_t get_len() const; ///< get size of the file + virtual uint64_t get_length() const; ///< get size of the file virtual bool eof_reached() const; ///< reading passed EOF diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index 9a6bee7348..b9514c8c8b 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -69,7 +69,7 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8 } base = p_base->get_position(); - ERR_FAIL_COND_V(p_base->get_len() < base + length, ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(p_base->get_length() < base + length, ERR_FILE_CORRUPT); uint64_t ds = length; if (ds % 16) { ds += 16 - (ds % 16); @@ -199,8 +199,8 @@ String FileAccessEncrypted::get_path_absolute() const { } void FileAccessEncrypted::seek(uint64_t p_position) { - if (p_position > get_len()) { - p_position = get_len(); + if (p_position > get_length()) { + p_position = get_length(); } pos = p_position; @@ -208,14 +208,14 @@ void FileAccessEncrypted::seek(uint64_t p_position) { } void FileAccessEncrypted::seek_end(int64_t p_position) { - seek(get_len() + p_position); + seek(get_length() + p_position); } uint64_t FileAccessEncrypted::get_position() const { return pos; } -uint64_t FileAccessEncrypted::get_len() const { +uint64_t FileAccessEncrypted::get_length() const { return data.size(); } @@ -225,7 +225,7 @@ bool FileAccessEncrypted::eof_reached() const { uint8_t FileAccessEncrypted::get_8() const { ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode."); - if (pos >= get_len()) { + if (pos >= get_length()) { eofed = true; return 0; } @@ -239,7 +239,7 @@ uint64_t FileAccessEncrypted::get_buffer(uint8_t *p_dst, uint64_t p_length) cons ERR_FAIL_COND_V(!p_dst && p_length > 0, -1); ERR_FAIL_COND_V_MSG(writing, -1, "File has not been opened in read mode."); - uint64_t to_copy = MIN(p_length, get_len() - pos); + uint64_t to_copy = MIN(p_length, get_length() - pos); for (uint64_t i = 0; i < to_copy; i++) { p_dst[i] = data[pos++]; } @@ -258,11 +258,11 @@ Error FileAccessEncrypted::get_error() const { void FileAccessEncrypted::store_buffer(const uint8_t *p_src, uint64_t p_length) { ERR_FAIL_COND_MSG(!writing, "File has not been opened in write mode."); - if (pos < get_len()) { + if (pos < get_length()) { for (uint64_t i = 0; i < p_length; i++) { store_8(p_src[i]); } - } else if (pos == get_len()) { + } else if (pos == get_length()) { data.resize(pos + p_length); for (uint64_t i = 0; i < p_length; i++) { data.write[pos + i] = p_src[i]; @@ -280,10 +280,10 @@ void FileAccessEncrypted::flush() { void FileAccessEncrypted::store_8(uint8_t p_dest) { ERR_FAIL_COND_MSG(!writing, "File has not been opened in write mode."); - if (pos < get_len()) { + if (pos < get_length()) { data.write[pos] = p_dest; pos++; - } else if (pos == get_len()) { + } else if (pos == get_length()) { data.push_back(p_dest); pos++; } diff --git a/core/io/file_access_encrypted.h b/core/io/file_access_encrypted.h index 8bea8c2585..00f14099f9 100644 --- a/core/io/file_access_encrypted.h +++ b/core/io/file_access_encrypted.h @@ -71,7 +71,7 @@ public: virtual void seek(uint64_t p_position); ///< seek to a given position virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file virtual uint64_t get_position() const; ///< get position in the file - virtual uint64_t get_len() const; ///< get size of the file + virtual uint64_t get_length() const; ///< get size of the file virtual bool eof_reached() const; ///< reading passed EOF diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 14e24d6668..0114ab1765 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -117,7 +117,7 @@ uint64_t FileAccessMemory::get_position() const { return pos; } -uint64_t FileAccessMemory::get_len() const { +uint64_t FileAccessMemory::get_length() const { ERR_FAIL_COND_V(!data, 0); return length; } diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h index cc589dc259..4157531d01 100644 --- a/core/io/file_access_memory.h +++ b/core/io/file_access_memory.h @@ -52,7 +52,7 @@ public: virtual void seek(uint64_t p_position); ///< seek to a given position virtual void seek_end(int64_t p_position); ///< seek from the end of file virtual uint64_t get_position() const; ///< get position in the file - virtual uint64_t get_len() const; ///< get size of the file + virtual uint64_t get_length() const; ///< get size of the file virtual bool eof_reached() const; ///< reading passed EOF diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index dedd5523ed..63a8f9c5b6 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -328,7 +328,7 @@ uint64_t FileAccessNetwork::get_position() const { return pos; } -uint64_t FileAccessNetwork::get_len() const { +uint64_t FileAccessNetwork::get_length() const { ERR_FAIL_COND_V_MSG(!opened, 0, "File must be opened before use."); return total_size; } diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h index 4810cca195..94b66c2480 100644 --- a/core/io/file_access_network.h +++ b/core/io/file_access_network.h @@ -137,7 +137,7 @@ public: virtual void seek(uint64_t p_position); ///< seek to a given position virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file virtual uint64_t get_position() const; ///< get position in the file - virtual uint64_t get_len() const; ///< get size of the file + virtual uint64_t get_length() const; ///< get size of the file virtual bool eof_reached() const; ///< reading passed EOF diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 3e1c51b733..e9983ece47 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -279,7 +279,7 @@ uint64_t FileAccessPack::get_position() const { return pos; } -uint64_t FileAccessPack::get_len() const { +uint64_t FileAccessPack::get_length() const { return pf.size; } diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index e47c9ea543..9747e865c8 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -163,7 +163,7 @@ public: virtual void seek(uint64_t p_position); virtual void seek_end(int64_t p_position = 0); virtual uint64_t get_position() const; - virtual uint64_t get_len() const; + virtual uint64_t get_length() const; virtual bool eof_reached() const; @@ -245,6 +245,10 @@ public: uint64_t get_space_left(); + virtual bool is_link(String p_file) { return false; } + virtual String read_link(String p_file) { return p_file; } + virtual Error create_link(String p_source, String p_target) { return FAILED; } + virtual String get_filesystem_type() const; DirAccessPack(); diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index 304e24ee90..b8383fd865 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -73,7 +73,7 @@ static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) { pos = f->get_position() + offset; break; case ZLIB_FILEFUNC_SEEK_END: - pos = f->get_len() + offset; + pos = f->get_length() + offset; break; default: break; @@ -226,9 +226,7 @@ ZipArchive::ZipArchive() { ZipArchive::~ZipArchive() { for (int i = 0; i < packages.size(); i++) { - FileAccess *f = (FileAccess *)unzGetOpaque(packages[i].zfile); unzClose(packages[i].zfile); - memdelete(f); } packages.clear(); @@ -272,7 +270,7 @@ void FileAccessZip::seek(uint64_t p_position) { void FileAccessZip::seek_end(int64_t p_position) { ERR_FAIL_COND(!zfile); - unzSeekCurrentFile(zfile, get_len() + p_position); + unzSeekCurrentFile(zfile, get_length() + p_position); } uint64_t FileAccessZip::get_position() const { @@ -280,7 +278,7 @@ uint64_t FileAccessZip::get_position() const { return unztell(zfile); } -uint64_t FileAccessZip::get_len() const { +uint64_t FileAccessZip::get_length() const { ERR_FAIL_COND_V(!zfile, 0); return file_info.uncompressed_size; } diff --git a/core/io/file_access_zip.h b/core/io/file_access_zip.h index 91bdaafb68..cca14ded62 100644 --- a/core/io/file_access_zip.h +++ b/core/io/file_access_zip.h @@ -90,7 +90,7 @@ public: virtual void seek(uint64_t p_position); ///< seek to a given position virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file virtual uint64_t get_position() const; ///< get position in the file - virtual uint64_t get_len() const; ///< get size of the file + virtual uint64_t get_length() const; ///< get size of the file virtual bool eof_reached() const; ///< reading passed EOF diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 4fe22e57d8..cadb02b5dd 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -120,7 +120,7 @@ Error PCKPacker::add_file(const String &p_file, const String &p_src, bool p_encr pf.path = p_file; pf.src_path = p_src; pf.ofs = ofs; - pf.size = f->get_len(); + pf.size = f->get_length(); Vector<uint8_t> data = FileAccess::get_file_as_array(p_src); { diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index f3ce2319e3..938d93a01b 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -476,7 +476,7 @@ Error XMLParser::open(const String &p_path) { ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot open file '" + p_path + "'."); - length = file->get_len(); + length = file->get_length(); ERR_FAIL_COND_V(length < 1, ERR_FILE_CORRUPT); if (data) { diff --git a/core/io/zip_io.cpp b/core/io/zip_io.cpp index e0e491dc85..fb4c76aa7a 100644 --- a/core/io/zip_io.cpp +++ b/core/io/zip_io.cpp @@ -74,7 +74,7 @@ long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin) { pos = f->get_position() + offset; break; case ZLIB_FILEFUNC_SEEK_END: - pos = f->get_len() + offset; + pos = f->get_length() + offset; break; default: break; |