diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-09-10 17:16:14 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-09-10 17:16:14 -0400 |
commit | dca6f0deae49d133f180ef937939b8648649fbc6 (patch) | |
tree | 22a8d38915a22346504708e112c5fa18af68bf87 /indra/llui | |
parent | 9f38f25b93be2566399fac2d528da9810edd2fa6 (diff) |
Fix risky signature of `wchar_to_utf8chars()`. Add `ll_convert()` alias.
`wchar_to_utf8chars()` used to require a `char*` output buffer with no length,
assuming that its caller knew enough to provide a buffer of sufficient length.
In fact a `char[8]` buffer suffices, but nothing in the header indicated that.
Eliminate the output parameter and return `std::string`. Fix the few existing
callers.
Also set an `ll_convert_alias` so that `ll_convert_to<std::string>(llwchar)`
directly calls `wchar_to_utf8chars()`. Replace instances of the workaround
`wstring_to_utf8str(LLWString(1, llwchar))`.
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llviewereventrecorder.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index 6d907d7e45..0a4fe5234b 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -24,9 +24,10 @@ */ -#include "llviewereventrecorder.h" -#include "llui.h" #include "llleap.h" +#include "llstring.h" +#include "llui.h" +#include "llviewereventrecorder.h" LLViewerEventRecorder::LLViewerEventRecorder() { @@ -247,11 +248,9 @@ void LLViewerEventRecorder::logKeyUnicodeEvent(llwchar uni_char) { // keycode...or // char - LL_DEBUGS() << "Wrapped in conversion to wstring " << wstring_to_utf8str(LLWString( 1, uni_char)) << "\n" << LL_ENDL; + LL_DEBUGS() << "Wrapped in conversion to wstring " << ll_convert_to<std::string>(uni_char) << "\n" << LL_ENDL; - event.insert("char", - LLSD( wstring_to_utf8str(LLWString( 1,uni_char)) ) - ); + event.insert("char", LLSD(ll_convert_to<std::string>(uni_char))); // path (optional) - for now we are not recording path for key events during record - should not be needed for full record and playback of recorded steps // as a vita script - it does become useful if you edit the resulting vita script and wish to remove some steps leading to a key event - that sort of edit might |