From 7342ebf43aa7500afe7410b49689a3aefa669e58 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 18 Jun 2024 20:32:24 +0200 Subject: Follow-up improvements of 810219d3bf27d81751d0f41b65013ca31db34ff7 --- indra/llfilesystem/lldir.cpp | 8 ++++---- indra/llfilesystem/lldir.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index 85ae6d4d1d..8ee2c309a5 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -876,15 +876,15 @@ std::string LLDir::getTempFilename() const } // static -std::string LLDir::getScrubbedFileName(const std::string uncleanFileName) +std::string LLDir::getScrubbedFileName(std::string_view uncleanFileName) { std::string name(uncleanFileName); const std::string illegalChars(getForbiddenFileChars()); // replace any illegal file chars with and underscore '_' - for( const char &ch : illegalChars) + for (const char& ch : illegalChars) { - std::string::size_type j = -1; - while((j = name.find(ch)) != std::string::npos) + std::string::size_type j{ 0 }; + while ((j = name.find(ch, j)) != std::string::npos) { name[j] = '_'; } diff --git a/indra/llfilesystem/lldir.h b/indra/llfilesystem/lldir.h index be82f55e46..b0d2b6aada 100644 --- a/indra/llfilesystem/lldir.h +++ b/indra/llfilesystem/lldir.h @@ -178,7 +178,7 @@ class LLDir static std::string getDumpLogsDirPath(const std::string &file_name = ""); // For producing safe download file names from potentially unsafe ones - static std::string getScrubbedFileName(const std::string uncleanFileName); + static std::string getScrubbedFileName(std::string_view uncleanFileName); static std::string getForbiddenFileChars(); void setDumpDir( const std::string& path ); -- cgit v1.2.3