summaryrefslogtreecommitdiff
path: root/indra/llui/llurlregistry.cpp
diff options
context:
space:
mode:
authorMartin Reddy <lynx@lindenlab.com>2009-09-23 13:57:06 +0000
committerMartin Reddy <lynx@lindenlab.com>2009-09-23 13:57:06 +0000
commit47abd559082f6023dcdfadd2ec740195b1d07990 (patch)
tree244c81063dd56a8095a8fc137d89ad87c0e024c5 /indra/llui/llurlregistry.cpp
parent658849ee953da606035efba20a6e599ea7e9eb0f (diff)
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.
Diffstat (limited to 'indra/llui/llurlregistry.cpp')
-rw-r--r--indra/llui/llurlregistry.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index 2ea3c59e03..f2d340deb7 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -75,9 +75,9 @@ void LLUrlRegistry::registerUrl(LLUrlEntryBase *url)
}
}
-static bool matchRegex(const wchar_t *text, boost::wregex regex, U32 &start, U32 &end)
+static bool matchRegex(const char *text, boost::regex regex, U32 &start, U32 &end)
{
- boost::wcmatch result;
+ boost::cmatch result;
bool found;
// regex_search can potentially throw an exception, so check for it
@@ -107,7 +107,7 @@ static bool matchRegex(const wchar_t *text, boost::wregex regex, U32 &start, U32
}
// ignore a terminating ')' when Url contains no matching '('
// see DEV-19842 for details
- else if (text[end] == ')' && LLWString(text+start, end-start).find('(') == std::string::npos)
+ else if (text[end] == ')' && std::string(text+start, end-start).find('(') == std::string::npos)
{
end--;
}
@@ -115,10 +115,10 @@ static bool matchRegex(const wchar_t *text, boost::wregex regex, U32 &start, U32
return true;
}
-bool LLUrlRegistry::findUrl(const LLWString &text, LLUrlMatch &match, const LLUrlLabelCallback &cb)
+bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb)
{
// avoid costly regexes if there is clearly no URL in the text
- if (text.find(L"://") == std::string::npos)
+ if (text.find("://") == std::string::npos)
{
return false;
}
@@ -149,7 +149,7 @@ bool LLUrlRegistry::findUrl(const LLWString &text, LLUrlMatch &match, const LLUr
if (match_entry)
{
// fill in the LLUrlMatch object and return it
- std::string url = wstring_to_utf8str(text.substr(match_start, match_end - match_start + 1));
+ std::string url = text.substr(match_start, match_end - match_start + 1);
match.setValues(match_start, match_end,
match_entry->getUrl(url),
match_entry->getLabel(url, cb),