diff --git a/src/base_media_base.h b/src/base_media_base.h --- a/src/base_media_base.h +++ b/src/base_media_base.h @@ -31,9 +31,9 @@ struct MD5File { CR_NO_FILE, ///< The file did not exist }; - const char *filename; ///< filename + std::string filename; ///< filename uint8 hash[16]; ///< md5 sum of the file - const char *missing_warning; ///< warning when this file is missing + std::string missing_warning; ///< warning when this file is missing ChecksumResult check_result; ///< cached result of md5 check ChecksumResult CheckMD5(Subdirectory subdir, size_t max_size) const; @@ -73,11 +73,6 @@ struct BaseSet { /** Free everything we allocated */ ~BaseSet() { - for (uint i = 0; i < NUM_FILES; i++) { - free(this->files[i].filename); - free(this->files[i].missing_warning); - } - delete this->next; } @@ -100,7 +95,7 @@ struct BaseSet { return Tnum_files - this->valid_files; } - bool FillSetDetails(IniFile *ini, const char *path, const char *full_filename, bool allow_empty_filename = true); + bool FillSetDetails(IniFile *ini, const std::string &path, const std::string &full_filename, bool allow_empty_filename = true); /** * Get the description for the given ISO code. @@ -147,7 +142,7 @@ struct BaseSet { const char *GetTextfile(TextfileType type) const { for (uint i = 0; i < NUM_FILES; i++) { - const char *textfile = ::GetTextfile(type, BASESET_DIR, this->files[i].filename); + const char *textfile = ::GetTextfile(type, BASESET_DIR, this->files[i].filename.c_str()); if (textfile != nullptr) { return textfile; } @@ -249,7 +244,7 @@ struct GraphicsSet : BaseSet