mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-23 04:04:09 +01:00
Codechange: use std::string_view over const char *
This commit is contained in:
@@ -240,10 +240,10 @@ bool ScriptScanner::HasScript(const ContentInfo &ci, bool md5sum)
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *ScriptScanner::FindMainScript(const ContentInfo &ci, bool md5sum)
|
||||
std::optional<std::string_view> ScriptScanner::FindMainScript(const ContentInfo &ci, bool md5sum)
|
||||
{
|
||||
for (const auto &item : this->info_list) {
|
||||
if (IsSameScript(ci, md5sum, item.second, this->GetDirectory())) return item.second->GetMainScript().c_str();
|
||||
if (IsSameScript(ci, md5sum, item.second, this->GetDirectory())) return item.second->GetMainScript();
|
||||
}
|
||||
return nullptr;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
* @param md5sum Whether to check the MD5 checksum.
|
||||
* @return A filename of a file of the content, else \c nullptr.
|
||||
*/
|
||||
const char *FindMainScript(const ContentInfo &ci, bool md5sum);
|
||||
std::optional<std::string_view> FindMainScript(const ContentInfo &ci, bool md5sum);
|
||||
|
||||
bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user