diff --git a/src/base_media_func.h b/src/base_media_func.h --- a/src/base_media_func.h +++ b/src/base_media_func.h @@ -150,14 +150,14 @@ bool BaseSet -bool BaseMedia::AddFile(const char *filename, size_t basepath_length, const char *tar_filename) +bool BaseMedia::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) { bool ret = false; - DEBUG(grf, 1, "Checking %s for base " SET_TYPE " set", filename); + DEBUG(grf, 1, "Checking %s for base " SET_TYPE " set", filename.c_str()); Tbase_set *set = new Tbase_set(); IniFile *ini = new IniFile(); - std::string path{ filename + basepath_length }; + std::string path{ filename, basepath_length }; ini->LoadFromDisk(path, BASESET_DIR); auto psep = path.rfind(PATHSEPCHAR); @@ -167,7 +167,7 @@ bool BaseMedia::AddFile(const path.clear(); } - if (set->FillSetDetails(ini, path.c_str(), filename)) { + if (set->FillSetDetails(ini, path.c_str(), filename.c_str())) { Tbase_set *duplicate = nullptr; for (Tbase_set *c = BaseMedia::available_sets; c != nullptr; c = c->next) { if (c->name == set->name || c->shortname == set->shortname) { @@ -377,7 +377,7 @@ template #define INSTANTIATE_BASE_MEDIA_METHODS(repl_type, set_type) \ template std::string repl_type::ini_set; \ template const char *repl_type::GetExtension(); \ - template bool repl_type::AddFile(const char *filename, size_t pathlength, const char *tar_filename); \ + template bool repl_type::AddFile(const std::string &filename, size_t pathlength, const std::string &tar_filename); \ template bool repl_type::HasSet(const struct ContentInfo *ci, bool md5sum); \ template bool repl_type::SetSet(const std::string &name); \ template char *repl_type::GetSetsList(char *p, const char *last); \