diff options
Diffstat (limited to 'core/io/pck_packer.cpp')
-rw-r--r-- | core/io/pck_packer.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 06d22ce897..374b2a5e07 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -45,19 +45,19 @@ static uint64_t _align(uint64_t p_n, int p_alignment) { } else { return p_n + (p_alignment - rest); } -}; +} 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) { @@ -78,18 +78,18 @@ Error PCKPacker::pck_start(const String &p_file, int p_alignment) { for (int i = 0; i < 16; i++) { file->store_32(0); // reserved - }; + } files.clear(); return OK; -}; +} 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; - }; + } File pf; pf.path = p_file; @@ -103,7 +103,7 @@ Error PCKPacker::add_file(const String &p_file, const String &p_src) { memdelete(f); return OK; -}; +} Error PCKPacker::flush(bool p_verbose) { ERR_FAIL_COND_V_MSG(!file, ERR_INVALID_PARAMETER, "File must be opened before use."); @@ -123,7 +123,7 @@ Error PCKPacker::flush(bool p_verbose) { file->store_32(0); file->store_32(0); file->store_32(0); - }; + } uint64_t ofs = file->get_position(); ofs = _align(ofs, alignment); @@ -141,7 +141,7 @@ Error PCKPacker::flush(bool p_verbose) { int read = src->get_buffer(buf, MIN(to_write, buf_max)); file->store_buffer(buf, read); to_write -= read; - }; + } uint64_t pos = file->get_position(); file->seek(files[i].offset_offset); // go back to store the file's offset @@ -158,9 +158,9 @@ Error PCKPacker::flush(bool p_verbose) { if (count % 100 == 0) { printf("%i/%i (%.2f)\r", count, files.size(), float(count) / files.size() * 100); fflush(stdout); - }; - }; - }; + } + } + } if (p_verbose) { printf("\n"); @@ -170,11 +170,11 @@ Error PCKPacker::flush(bool p_verbose) { memdelete_arr(buf); return OK; -}; +} PCKPacker::~PCKPacker() { if (file != nullptr) { memdelete(file); - }; + } file = nullptr; -}; +} |