maint(compression): pass args by reference

Co-authored-by: William Roy <wroy@proton.me>
This commit is contained in:
Diavolo 2023-05-26 19:19:43 +02:00
parent cf3a4e18e6
commit beb90226fe
3 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,7 @@ int main(const int argc, const char** argv)
try try
{ {
unsafe_main(argc > 1 ? static_cast<uint16_t>(atoi(argv[1])) : 20810); unsafe_main(argc > 1 ? static_cast<uint16_t>(std::strtol(argv[1], nullptr, 10)) : 20810);
} }
catch (std::exception& e) catch (std::exception& e)
{ {

View File

@ -134,9 +134,9 @@ namespace utils::compression
} }
} }
void archive::add(std::string filename, std::string data) void archive::add(const std::string& filename, const std::string& data)
{ {
this->files_[std::move(filename)] = std::move(data); this->files_[filename] = data;
} }
bool archive::write(const std::string& filename, const std::string& comment) bool archive::write(const std::string& filename, const std::string& comment)

View File

@ -18,7 +18,7 @@ namespace utils::compression
class archive class archive
{ {
public: public:
void add(std::string filename, std::string data); void add(const std::string& filename, const std::string& data);
bool write(const std::string& filename, const std::string& comment = {}); bool write(const std::string& filename, const std::string& comment = {});
private: private: