diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2010-07-23 16:34:17 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2010-07-23 16:34:17 -0400 |
commit | 0c5a5934d87cb7e64cb8db96551009b9b9ed8be9 (patch) | |
tree | a8973a0ab6ec43469a71ea80e1d6328a9ad779de /indra/llcommon/llformat.cpp | |
parent | d9f01a7c5a70d184bb5fac1f620cfbe1ad4c957d (diff) | |
parent | 056685d9d4ac82aad45e46ae5d5226690d416513 (diff) |
merge
Diffstat (limited to 'indra/llcommon/llformat.cpp')
-rw-r--r-- | indra/llcommon/llformat.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/indra/llcommon/llformat.cpp b/indra/llcommon/llformat.cpp index cf509bee14..689f649d0a 100644 --- a/indra/llcommon/llformat.cpp +++ b/indra/llcommon/llformat.cpp @@ -37,16 +37,40 @@ #include <cstdarg> -std::string llformat(const char *fmt, ...) +// common used function with va_list argument +// wrapper for vsnprintf to be called from llformatXXX functions. +static void va_format(std::string& out, const char *fmt, va_list va) { char tstr[1024]; /* Flawfinder: ignore */ - va_list va; - va_start(va, fmt); #if LL_WINDOWS _vsnprintf(tstr, 1024, fmt, va); #else vsnprintf(tstr, 1024, fmt, va); /* Flawfinder: ignore */ #endif + out.assign(tstr); +} + +std::string llformat(const char *fmt, ...) +{ + std::string res; + va_list va; + va_start(va, fmt); + va_format(res, fmt, va); va_end(va); - return std::string(tstr); + return res; +} + +std::string llformat_to_utf8(const char *fmt, ...) +{ + std::string res; + va_list va; + va_start(va, fmt); + va_format(res, fmt, va); + va_end(va); + +#if LL_WINDOWS + // made converting to utf8. See EXT-8318. + res = ll_convert_string_to_utf8_string(res); +#endif + return res; } |