diff options
Diffstat (limited to 'core/io/pck_packer.cpp')
-rw-r--r-- | core/io/pck_packer.cpp | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 124ac30b88..4863cd1dbb 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -35,7 +35,6 @@ #include "core/version.h" static uint64_t _align(uint64_t p_n, int p_alignment) { - if (p_alignment == 0) return p_n; @@ -47,22 +46,18 @@ static uint64_t _align(uint64_t p_n, int p_alignment) { }; static void _pad(FileAccess *p_file, int p_bytes) { - for (int i = 0; i < p_bytes; i++) { - p_file->store_8(0); }; }; void PCKPacker::_bind_methods() { - ClassDB::bind_method(D_METHOD("pck_start", "pck_name", "alignment"), &PCKPacker::pck_start, DEFVAL(0)); ClassDB::bind_method(D_METHOD("add_file", "pck_path", "source_path"), &PCKPacker::add_file); ClassDB::bind_method(D_METHOD("flush", "verbose"), &PCKPacker::flush, DEFVAL(false)); }; Error PCKPacker::pck_start(const String &p_file, int p_alignment) { - if (file != nullptr) { memdelete(file); } @@ -80,7 +75,6 @@ Error PCKPacker::pck_start(const String &p_file, int p_alignment) { file->store_32(VERSION_PATCH); for (int i = 0; i < 16; i++) { - file->store_32(0); // reserved }; @@ -90,7 +84,6 @@ Error PCKPacker::pck_start(const String &p_file, int p_alignment) { }; Error PCKPacker::add_file(const String &p_file, const String &p_src) { - FileAccess *f = FileAccess::open(p_src, FileAccess::READ); if (!f) { return ERR_FILE_CANT_OPEN; @@ -111,7 +104,6 @@ Error PCKPacker::add_file(const String &p_file, const String &p_src) { }; Error PCKPacker::flush(bool p_verbose) { - ERR_FAIL_COND_V_MSG(!file, ERR_INVALID_PARAMETER, "File must be opened before use."); // write the index @@ -119,7 +111,6 @@ Error PCKPacker::flush(bool p_verbose) { file->store_32(files.size()); for (int i = 0; i < files.size(); i++) { - file->store_pascal_string(files[i].path); files.write[i].offset_offset = file->get_position(); file->store_64(0); // offset @@ -142,11 +133,9 @@ Error PCKPacker::flush(bool p_verbose) { int count = 0; for (int i = 0; i < files.size(); i++) { - FileAccess *src = FileAccess::open(files[i].src_path, FileAccess::READ); uint64_t to_write = files[i].size; while (to_write > 0) { - int read = src->get_buffer(buf, MIN(to_write, buf_max)); file->store_buffer(buf, read); to_write -= read; |