From 47abd559082f6023dcdfadd2ec740195b1d07990 Mon Sep 17 00:00:00 2001 From: Martin Reddy Date: Wed, 23 Sep 2009 13:57:06 +0000 Subject: EXT-944 EXT-1026: reverting my previous fix for these crashes. This didn't work on Windows because wchar_t is 2 bytes on that platform, not 4 bytes (whereas llwchar is 4 bytes everywhere). Boost's regex methods need to work on wchar_t, but I believe that using a UTF-16 string would still be prone to crashing on Windows as UTF-16 is still a variable-length encoding. Besides, trying to compile a UTF-16 solution generates weird link errors. Instead, I'm going to fix this problem a different way. And I'm starting by reverting the previous attempt. Thanks Win32. --- indra/llui/lltexteditor.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/llui/lltexteditor.cpp') diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index f7680a0a2b..983777b747 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -3525,7 +3525,7 @@ void LLTextEditor::appendStyledText(const std::string &new_text, S32 start=0,end=0; LLUrlMatch match; - LLWString text = utf8str_to_wstring(new_text); + std::string text = new_text; while ( LLUrlRegistry::instance().findUrl(text, match, boost::bind(&LLTextEditor::onUrlLabelUpdated, this, _1, _2)) ) { @@ -3549,8 +3549,8 @@ void LLTextEditor::appendStyledText(const std::string &new_text, { part = (S32)LLTextParser::MIDDLE; } - std::string subtext = wstring_to_utf8str(text.substr(0,start)); - appendHighlightedText(subtext, allow_undo, prepend_newline, part, style_params); + std::string subtext=text.substr(0,start); + appendHighlightedText(subtext,allow_undo, prepend_newline, part, style_params); prepend_newline = false; } @@ -3595,8 +3595,7 @@ void LLTextEditor::appendStyledText(const std::string &new_text, } } if (part != (S32)LLTextParser::WHOLE) part=(S32)LLTextParser::END; - if (end < (S32)text.length()) appendHighlightedText(wstring_to_utf8str(text), allow_undo, - prepend_newline, part, style_params); + if (end < (S32)text.length()) appendHighlightedText(text,allow_undo, prepend_newline, part, style_params); } else { @@ -4138,7 +4137,7 @@ void LLTextEditor::updateLinkSegments() LLUrlMatch match; LLStyleSP style = static_cast(segment->getStyle()); std::string url_label = getText().substr(segment->getStart(), segment->getEnd()-segment->getStart()); - if (LLUrlRegistry::instance().findUrl(utf8str_to_wstring(url_label), match)) + if (LLUrlRegistry::instance().findUrl(url_label, match)) { LLStringUtil::trim(url_label); style->setLinkHREF(url_label); -- cgit v1.2.3