diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index a6fa75da9af8776e262185cd8c840c114c74c488..34c5dd3b39fef0dea742b91a259b36cbd09382bc 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -84,7 +84,7 @@ std::string LLDate::asRFC1123() const LLTrace::BlockTimerStatHandle FT_DATE_FORMAT("Date Format"); -std::string LLDate::toHTTPDateString (std::string fmt) const +std::string LLDate::toHTTPDateString (const std::string& fmt) const { LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT); @@ -93,7 +93,7 @@ std::string LLDate::toHTTPDateString (std::string fmt) const return toHTTPDateString(gmt, fmt); } -std::string LLDate::toHTTPDateString (tm * gmt, std::string fmt) +std::string LLDate::toHTTPDateString (tm * gmt, const std::string& fmt) { LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT); @@ -103,7 +103,7 @@ std::string LLDate::toHTTPDateString (tm * gmt, std::string fmt) if (this_locale != prev_locale) { setlocale(LC_TIME, this_locale.c_str()); - prev_locale = this_locale; + prev_locale = std::move(this_locale); } // use strftime() as it appears to be faster than std::time_put diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index 847f08d8c77fc6abcb4999cb13b86ebba833cc56..d223d75e91917f141b784bcb597acb40e4d2a18b 100644 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h @@ -80,8 +80,8 @@ class LL_COMMON_API LLDate std::string asRFC1123() const; void toStream(std::ostream&) const; bool split(S32 *year, S32 *month = NULL, S32 *day = NULL, S32 *hour = NULL, S32 *min = NULL, S32 *sec = NULL) const; - std::string toHTTPDateString (std::string fmt) const; - static std::string toHTTPDateString (tm * gmt, std::string fmt); + std::string toHTTPDateString (const std::string& fmt) const; + static std::string toHTTPDateString (tm * gmt, const std::string& fmt); /** * @brief Set the date from an ISO-8601 string. * diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 7e78b91dba1c48e4e04cf0797dd14763fae0cd39..723493a4455387bbec0d6b3a15accc72e1d43f3c 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1521,9 +1521,8 @@ namespace LLError } } - std::string abbreviateFile(const std::string& filePath) + std::string abbreviateFile(std::string f) { - std::string f = filePath; #if LL_WINDOWS replaceChar(f, '\\', '/'); #endif @@ -1534,7 +1533,6 @@ namespace LLError static std::string newview_prefix = "newview/../"; f = removePrefix(f, newview_prefix); #endif - return f; } diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 7580fa0e7dbdf7c830d788db41007c07052a2ae2..e191055d10e9c75b34501b000eda25a6ec47fd05 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -201,7 +201,7 @@ namespace LLError LL_COMMON_API SettingsStoragePtr saveAndResetSettings(); LL_COMMON_API void restoreSettings(SettingsStoragePtr pSettingsStorage); - LL_COMMON_API std::string abbreviateFile(const std::string& filePath); + LL_COMMON_API std::string abbreviateFile(std::string filePath); LL_COMMON_API int shouldLogCallCount(); }; diff --git a/indra/llcommon/llevent.cpp b/indra/llcommon/llevent.cpp index 30572a8055cdb50eaf879ea183bef37721526fcb..cbc32c3ff8dba1b972cb18b1f027ca6724028043 100644 --- a/indra/llcommon/llevent.cpp +++ b/indra/llcommon/llevent.cpp @@ -215,7 +215,7 @@ bool LLSimpleDispatcher::fireEvent(LLPointer<LLEvent> event, LLSD filter) for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor) { LLListenerEntry& entry = *itor; - if (filter_string == "" || entry.filter.asString() == filter_string) + if (filter_string.empty() || entry.filter.asString() == filter_string) { (entry.listener)->handleEvent(event, (*itor).userdata); } diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index eed4b53aa9fd9c717aeb7cc95f20cb7ca8a14606..662c276b412167bdc58ba24aaab83b358f009efd 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -275,7 +275,7 @@ int LLFile::rename(const std::string& filename, const std::string& newname, int return warnif(STRINGIZE("rename to '" << newname << "' from"), filename, rc, supress_error); } -bool LLFile::copy(const std::string from, const std::string to) +bool LLFile::copy(const std::string& from, const std::string& to) { bool copied = false; LLFILE* in = LLFile::fopen(from, "rb"); /* Flawfinder: ignore */ diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 9de095b45d2d8d5ea77549fbab5da6d36440562b..a2f3a12aca129c6ef9336ed46fd3689f6b208de9 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -75,7 +75,7 @@ class LL_COMMON_API LLFile static int rmdir(const std::string& filename); static int remove(const std::string& filename, int supress_error = 0); static int rename(const std::string& filename,const std::string& newname, int supress_error = 0); - static bool copy(const std::string from, const std::string to); + static bool copy(const std::string& from, const std::string& to); static int stat(const std::string& filename,llstat* file_status); static bool isdir(const std::string& filename); diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index be782730d89e6a632c0fc193221be4378c511085..1559ec15003fedb4bb8307713d1cb7336680f422 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -236,7 +236,7 @@ class LLFormatMapString public: LLFormatMapString() = default; LLFormatMapString(const char* s) : mString(ll_safe_string(s)) {}; - LLFormatMapString(const std::string s) : mString(std::move(s)) {}; + LLFormatMapString(std::string s) : mString(std::move(s)) {}; operator std::string() const { return mString; } operator std::string_view() const { return mString; } bool operator<(const LLFormatMapString& rhs) const { return mString < rhs.mString; } diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index e15b87b970eadfeb249a2271c325684c53d2a2df..b0b4cc57b48c1d4830dc48d895b89003d98466f1 100644 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -310,7 +310,7 @@ LLURI::LLURI(const std::string& escaped_str) delim_pos = escaped_str.find(':'); if (delim_pos == std::string::npos) { - mScheme = ""; + mScheme.clear(); mEscapedOpaque = escaped_str; } else @@ -360,7 +360,7 @@ void LLURI::parseAuthorityAndPathUsingOpaque() delim_pos2 == std::string::npos) { mEscapedAuthority = mEscapedOpaque.substr(2); - mEscapedPath = ""; + mEscapedPath.clear(); } // path exist, no query else if (delim_pos2 == std::string::npos) @@ -567,7 +567,7 @@ namespace { std::string::size_type start_pos = authority.find('@'); if (start_pos == std::string::npos) { - user = ""; + user.clear(); start_pos = 0; } else @@ -580,7 +580,7 @@ namespace { if (end_pos == std::string::npos) { host = authority.substr(start_pos); - port = ""; + port.clear(); } else { @@ -692,8 +692,8 @@ LLSD LLURI::queryMap(std::string escaped_query_string) } else { - tuple = escaped_query_string; - escaped_query_string = ""; + tuple = std::move(escaped_query_string); + escaped_query_string.clear(); } if (tuple.empty()) continue; diff --git a/indra/llcorehttp/httpcommon.cpp b/indra/llcorehttp/httpcommon.cpp index 709efcb17deaef84690ffea98c19604ac1618f83..457fafd0f7ac2f7d22599ab8adb59c76ff8a1747 100644 --- a/indra/llcorehttp/httpcommon.cpp +++ b/indra/llcorehttp/httpcommon.cpp @@ -143,7 +143,7 @@ std::string HttpStatus::toString() const if (*this) { - return std::string(""); + return std::string(); } switch (getType()) {