summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorFlorian Kothmeier <floriankothmeier@web.de>2023-09-10 00:22:53 +0200
committerFlorian Kothmeier <floriankothmeier@web.de>2023-09-10 00:22:53 +0200
commita41ae7d69c1f51880a5f41ee6e351fa8e0f83d73 (patch)
tree58ab940bc3d9d23e3c7f9b236d999d08cb70b7a4 /modules
parentfc99492d3066098e938449b10e02f8e01d07e2d1 (diff)
downloadredot-engine-a41ae7d69c1f51880a5f41ee6e351fa8e0f83d73.tar.gz
Use pass by reference in ZIPPacker & ZIPReader signatures
Diffstat (limited to 'modules')
-rw-r--r--modules/zip/zip_packer.cpp6
-rw-r--r--modules/zip/zip_packer.h6
-rw-r--r--modules/zip/zip_reader.cpp6
-rw-r--r--modules/zip/zip_reader.h6
4 files changed, 12 insertions, 12 deletions
diff --git a/modules/zip/zip_packer.cpp b/modules/zip/zip_packer.cpp
index c8b4fb4e77..5f623476fc 100644
--- a/modules/zip/zip_packer.cpp
+++ b/modules/zip/zip_packer.cpp
@@ -33,7 +33,7 @@
#include "core/io/zip_io.h"
#include "core/os/os.h"
-Error ZIPPacker::open(String p_path, ZipAppend p_append) {
+Error ZIPPacker::open(const String &p_path, ZipAppend p_append) {
if (fa.is_valid()) {
close();
}
@@ -55,7 +55,7 @@ Error ZIPPacker::close() {
return err;
}
-Error ZIPPacker::start_file(String p_path) {
+Error ZIPPacker::start_file(const String &p_path) {
ERR_FAIL_COND_V_MSG(fa.is_null(), FAILED, "ZIPPacker must be opened before use.");
zip_fileinfo zipfi;
@@ -76,7 +76,7 @@ Error ZIPPacker::start_file(String p_path) {
return err == ZIP_OK ? OK : FAILED;
}
-Error ZIPPacker::write_file(Vector<uint8_t> p_data) {
+Error ZIPPacker::write_file(const Vector<uint8_t> &p_data) {
ERR_FAIL_COND_V_MSG(fa.is_null(), FAILED, "ZIPPacker must be opened before use.");
return zipWriteInFileInZip(zf, p_data.ptr(), p_data.size()) == ZIP_OK ? OK : FAILED;
diff --git a/modules/zip/zip_packer.h b/modules/zip/zip_packer.h
index 142d0fddbf..e194f5ebbe 100644
--- a/modules/zip/zip_packer.h
+++ b/modules/zip/zip_packer.h
@@ -52,11 +52,11 @@ public:
APPEND_ADDINZIP = 2,
};
- Error open(String p_path, ZipAppend p_append);
+ Error open(const String &p_path, ZipAppend p_append);
Error close();
- Error start_file(String p_path);
- Error write_file(Vector<uint8_t> p_data);
+ Error start_file(const String &p_path);
+ Error write_file(const Vector<uint8_t> &p_data);
Error close_file();
ZIPPacker();
diff --git a/modules/zip/zip_reader.cpp b/modules/zip/zip_reader.cpp
index 5752b829ef..f4a92dce5b 100644
--- a/modules/zip/zip_reader.cpp
+++ b/modules/zip/zip_reader.cpp
@@ -33,7 +33,7 @@
#include "core/error/error_macros.h"
#include "core/io/zip_io.h"
-Error ZIPReader::open(String p_path) {
+Error ZIPReader::open(const String &p_path) {
if (fa.is_valid()) {
close();
}
@@ -81,7 +81,7 @@ PackedStringArray ZIPReader::get_files() {
return arr;
}
-PackedByteArray ZIPReader::read_file(String p_path, bool p_case_sensitive) {
+PackedByteArray ZIPReader::read_file(const String &p_path, bool p_case_sensitive) {
ERR_FAIL_COND_V_MSG(fa.is_null(), PackedByteArray(), "ZIPReader must be opened before use.");
int err = UNZ_OK;
@@ -118,7 +118,7 @@ PackedByteArray ZIPReader::read_file(String p_path, bool p_case_sensitive) {
return data;
}
-bool ZIPReader::file_exists(String p_path, bool p_case_sensitive) {
+bool ZIPReader::file_exists(const String &p_path, bool p_case_sensitive) {
ERR_FAIL_COND_V_MSG(fa.is_null(), false, "ZIPReader must be opened before use.");
int cs = p_case_sensitive ? 1 : 2;
diff --git a/modules/zip/zip_reader.h b/modules/zip/zip_reader.h
index 0f78352e3f..874bd81ed3 100644
--- a/modules/zip/zip_reader.h
+++ b/modules/zip/zip_reader.h
@@ -46,12 +46,12 @@ protected:
static void _bind_methods();
public:
- Error open(String p_path);
+ Error open(const String &p_path);
Error close();
PackedStringArray get_files();
- PackedByteArray read_file(String p_path, bool p_case_sensitive);
- bool file_exists(String p_path, bool p_case_sensitive);
+ PackedByteArray read_file(const String &p_path, bool p_case_sensitive);
+ bool file_exists(const String &p_path, bool p_case_sensitive);
ZIPReader();
~ZIPReader();