diff options
author | Josh Bell <josh@lindenlab.com> | 2007-12-21 06:44:41 +0000 |
---|---|---|
committer | Josh Bell <josh@lindenlab.com> | 2007-12-21 06:44:41 +0000 |
commit | df4d167cd13fd89a85e4d30dca94e40c934707d7 (patch) | |
tree | cde9373bce657013bf04c83ab60b4a4aa826fc76 /indra/llcommon/llstring.h | |
parent | 8fde5f0d3241205067e5d7bf5380757e764eff31 (diff) |
svn merge -r74200:76302 svn+ssh://svn.lindenlab.com/svn/linden/branches/Branch_1-18-6-Viewer --> release
Wheee, this was fun. Um, let's back-port fixes a little more rapidly next time. Reviewed by CG until alexandria died, did the rest by my lonesome.
Diffstat (limited to 'indra/llcommon/llstring.h')
-rw-r--r-- | indra/llcommon/llstring.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index e2f605db4f..88d7e88edc 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -494,7 +494,37 @@ std::ostream& operator<<(std::ostream &s, const LLStringBase<T> &str) std::ostream& operator<<(std::ostream &s, const LLWString &wstr); #if LL_WINDOWS -int safe_snprintf(char *str, size_t size, const char *format, ...); +/* @name Windows string helpers + */ +//@{ + +/** + * @brief Implementation the expected snprintf interface. + * + * If the size of the passed in buffer is not large enough to hold the string, + * two bad things happen: + * 1. resulting formatted string is NOT null terminated + * 2. Depending on the platform, the return value could be a) the required + * size of the buffer to copy the entire formatted string or b) -1. + * On Windows with VS.Net 2003, it returns -1 e.g. + * + * safe_snprintf always adds a NULL terminator so that the caller does not + * need to check for return value or need to add the NULL terminator. + * It does not, however change the return value - to let the caller know + * that the passed in buffer size was not large enough to hold the + * formatted string. + * + */ +int safe_snprintf(char* str, size_t size, const char* format, ...); + +/** + * @brief Convert a wide string to std::string + * + * This replaces the unsafe W2A macro from ATL. + */ +std::string ll_convert_wide_to_string(const wchar_t* in); + +//@} #endif // LL_WINDOWS /** |