1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-22 11:44:17 +01:00

Codechange: replace char* with std::string_view

This commit is contained in:
Rubidium
2025-04-27 18:31:42 +02:00
committed by rubidium42
parent e1859df1c0
commit 49ef3eee13
25 changed files with 53 additions and 49 deletions

View File

@@ -22,7 +22,7 @@
* @param filename Name of the file at the disk.
* @param subdir The sub directory to search this file in.
*/
RandomAccessFile::RandomAccessFile(const std::string &filename, Subdirectory subdir) : filename(filename)
RandomAccessFile::RandomAccessFile(std::string_view filename, Subdirectory subdir) : filename(filename)
{
size_t file_size;
this->file_handle = FioFOpenFile(filename, "rb", subdir, &file_size);
@@ -38,7 +38,7 @@ RandomAccessFile::RandomAccessFile(const std::string &filename, Subdirectory sub
/* Store the filename without path and extension */
auto t = filename.rfind(PATHSEPCHAR);
std::string name_without_path = filename.substr(t != std::string::npos ? t + 1 : 0);
std::string name_without_path{filename.substr(t != std::string::npos ? t + 1 : 0)};
this->simplified_filename = name_without_path.substr(0, name_without_path.rfind('.'));
strtolower(this->simplified_filename);