From d57bf84196f691e3667d4d1b1dabe6b2fae38194 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Thu, 18 Apr 2024 22:13:13 +0100 Subject: [PATCH] Codechange: Remove some unnecessary c_str() when passing std::strings. (#12532) Functions have been updated from `char *` to `std::string` since without removing `c_str()`. --- src/fios.cpp | 2 +- src/game/game_text.cpp | 4 ++-- src/social_integration.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fios.cpp b/src/fios.cpp index f5523c85aa..e647404bc2 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -707,7 +707,7 @@ FiosNumberedSaveName::FiosNumberedSaveName(const std::string &prefix) : prefix(p /* Get the save list. */ FileList list; FiosFileScanner scanner(SLO_SAVE, proc, list); - scanner.Scan(".sav", _autosave_path->c_str(), false); + scanner.Scan(".sav", *_autosave_path, false); /* Find the number for the most recent save, if any. */ if (list.begin() != list.end()) { diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp index 760a0b7395..2a8dab7690 100644 --- a/src/game/game_text.cpp +++ b/src/game/game_text.cpp @@ -180,7 +180,7 @@ public: /** * Scan. */ - void Scan(const char *directory) + void Scan(const std::string &directory) { this->FileScanner::Scan(".txt", directory, false); } @@ -241,7 +241,7 @@ GameStrings *LoadTranslations() } } else { /* Scan filesystem */ - scanner.Scan(ldir.c_str()); + scanner.Scan(ldir); } gs->Compile(); diff --git a/src/social_integration.cpp b/src/social_integration.cpp index 18e8e44eb7..1de92111f6 100644 --- a/src/social_integration.cpp +++ b/src/social_integration.cpp @@ -63,7 +63,7 @@ public: std::string extension = "-social.so"; #endif - this->FileScanner::Scan(extension.c_str(), SOCIAL_INTEGRATION_DIR, false); + this->FileScanner::Scan(extension, SOCIAL_INTEGRATION_DIR, false); } bool AddFile(const std::string &filename, size_t basepath_length, const std::string &) override