diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llstring.h | 31 | ||||
-rw-r--r-- | indra/llcommon/llversionviewer.h | 2 |
2 files changed, 20 insertions, 13 deletions
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 1a60a35c2c..a3a5f40414 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -161,14 +161,28 @@ public: static S32 collate(const llwchar* a, const llwchar* b); }; +/** + * @brief Return a string constructed from in without crashing if the + * pointer is NULL. + */ +std::string ll_safe_string(const char* in); +std::string ll_safe_string(const char* in, S32 maxlen); + + // Allowing assignments from non-strings into format_map_t is apparently // *really* error-prone, so subclass std::string with just basic c'tors. -class FormatMapString : public std::string +class LLFormatMapString { public: - FormatMapString() : std::string() {}; - FormatMapString(const char* s) : std::string(s) {}; - FormatMapString(const std::string& s) : std::string(s) {}; + LLFormatMapString() {}; + LLFormatMapString(const char* s) : mString(ll_safe_string(s)) {}; + LLFormatMapString(const std::string& s) : mString(s) {}; + operator std::string() const { return mString; } + bool operator<(const LLFormatMapString& rhs) const { return mString < rhs.mString; } + std::size_t length() const { return mString.length(); } + +private: + std::string mString; }; template <class T> @@ -183,7 +197,7 @@ public: static std::basic_string<T> null; - typedef std::map<FormatMapString, FormatMapString> format_map_t; + typedef std::map<LLFormatMapString, LLFormatMapString> format_map_t; static S32 format(std::basic_string<T>& s, const format_map_t& fmt_map); static bool isValidIndex(const std::basic_string<T>& string, size_type i) @@ -318,13 +332,6 @@ inline std::string chop_tail_copy( } /** - * @brief Return a string constructed from in without crashing if the - * pointer is NULL. - */ -std::string ll_safe_string(const char* in); -std::string ll_safe_string(const char* in, S32 maxlen); - -/** * @brief This translates a nybble stored as a hex value from 0-f back * to a nybble in the low order bits of the return byte. */ diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index ce8d1e5759..9e3ad076fc 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -34,7 +34,7 @@ const S32 LL_VERSION_MAJOR = 1; const S32 LL_VERSION_MINOR = 21; -const S32 LL_VERSION_PATCH = 2; +const S32 LL_VERSION_PATCH = 3; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Release"; |