diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index c344f1da71076f920280310055f595c15184c449..82a0f983b7714127fc4026982efd4914d82e74a7 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -142,7 +142,7 @@ const char *LLAssetType::lookup(LLAssetType::EType asset_type) // static LLAssetType::EType LLAssetType::lookup(const char* name) { - return lookup(ll_safe_string(name)); + return lookup(al::safe_string_view(name)); } // static @@ -180,7 +180,7 @@ const char *LLAssetType::lookupHumanReadable(LLAssetType::EType asset_type) // static LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name) { - return lookupHumanReadable(ll_safe_string(name)); + return lookupHumanReadable(al::safe_string_view(name)); } // static diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 3d1917b043fbf716253e4d50de46cd31dbf9e8c4..3a44c75877996ff7b24c0ebff2ef1972f62d0ed4 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -314,9 +314,9 @@ class LL_COMMON_API LLSD final LLSD& with(const String&, const LLSD&); LLSD& operator[](const std::string_view); - LLSD& operator[](const char* c) { return (*this)[std::string_view(c)]; } + LLSD& operator[](const char* c) { return (*this)[al::safe_string_view(c)]; } const LLSD& operator[](const std::string_view) const; - const LLSD& operator[](const char* c) const { return (*this)[std::string_view(c)]; } + const LLSD& operator[](const char* c) const { return (*this)[al::safe_string_view(c)]; } //@} /** @name Array Values */ diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index c4316d8a4a23724512307961f4efea217cdf16f9..155075731b86ad040a1ea3419383fdb5e6881c09 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -162,6 +162,10 @@ namespace al [[nodiscard]] size_t operator()(std::string_view txt) const { return hash_type{}(txt); } [[nodiscard]] size_t operator()(const std::string& txt) const { return hash_type{}(txt); } }; + + inline std::string_view safe_string_view(const char* p) { + return p ? std::string_view(p) : std::string_view(); + } } class LL_COMMON_API LLStringOps diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 19db7f0c4d41a745257d506069fb3320f84a921d..42f4a4d2727069b8c33bf36afaa2a03c0e504911 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -220,7 +220,7 @@ void LLUUID::toCompressedString(char *out) const BOOL LLUUID::set(const char* in_string, BOOL emit) { - return set(ll_safe_string(in_string), emit); + return set(al::safe_string_view(in_string), emit); } BOOL LLUUID::parseInternalScalar(const char* in_string, bool broken_format, bool emit) diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index d232de42f79ae9db4d5a84101aff3df0d4028772..040bd7b11a9b1943503d0ddbaacf3967749aa50a 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -132,7 +132,7 @@ LLUUID find_ui_sound(std::string_view name) LLUUID find_ui_sound(const char* namep) { - return find_ui_sound(ll_safe_string(namep)); + return find_ui_sound(al::safe_string_view(namep)); } void make_ui_sound(const char* namep)