summaryrefslogtreecommitdiff
path: root/indra/llui/tests
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/tests
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/tests')
-rw-r--r--indra/llui/tests/llurlentry_test.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp
index 89a80f1e73..1e7a0f7f2c 100644
--- a/indra/llui/tests/llurlentry_test.cpp
+++ b/indra/llui/tests/llurlentry_test.cpp
@@ -44,19 +44,17 @@ namespace
namespace tut
{
- void testRegex(const std::string &testname, boost::wregex regex,
+ void testRegex(const std::string &testname, boost::regex regex,
const char *text, const std::string &expected)
{
std::string url = "";
- boost::wcmatch result;
- LLWString wtext = utf8str_to_wstring(text);
- const wchar_t *wctext = wtext.c_str();
- bool found = boost::regex_search(wctext, result, regex);
+ boost::cmatch result;
+ bool found = boost::regex_search(text, result, regex);
if (found)
{
- S32 start = static_cast<U32>(result[0].first - wctext);
- S32 end = static_cast<U32>(result[0].second - wctext);
- url = wstring_to_utf8str(wtext.substr(start, end-start));
+ S32 start = static_cast<U32>(result[0].first - text);
+ S32 end = static_cast<U32>(result[0].second - text);
+ url = std::string(text+start, end-start);
}
ensure_equals(testname, url, expected);
}
@@ -68,7 +66,7 @@ namespace tut
// test LLUrlEntryHTTP - standard http Urls
//
LLUrlEntryHTTP url;
- boost::wregex r = url.getPattern();
+ boost::regex r = url.getPattern();
testRegex("no valid url", r,
"htp://slurl.com/",
@@ -147,7 +145,7 @@ namespace tut
// test LLUrlEntryHTTPLabel - wiki-style http Urls with labels
//
LLUrlEntryHTTPLabel url;
- boost::wregex r = url.getPattern();
+ boost::regex r = url.getPattern();
testRegex("invalid wiki url [1]", r,
"[http://www.example.org]",
@@ -189,7 +187,7 @@ namespace tut
// test LLUrlEntrySLURL - second life URLs
//
LLUrlEntrySLURL url;
- boost::wregex r = url.getPattern();
+ boost::regex r = url.getPattern();
testRegex("no valid slurl [1]", r,
"htp://slurl.com/secondlife/Ahern/50/50/50/",
@@ -261,7 +259,7 @@ namespace tut
// test LLUrlEntryAgent - secondlife://app/agent Urls
//
LLUrlEntryAgent url;
- boost::wregex r = url.getPattern();
+ boost::regex r = url.getPattern();
testRegex("Invalid Agent Url", r,
"secondlife:///app/agent/0e346d8b-4433-4d66-XXXX-fd37083abc4c/about",
@@ -287,7 +285,7 @@ namespace tut
// test LLUrlEntryGroup - secondlife://app/group Urls
//
LLUrlEntryGroup url;
- boost::wregex r = url.getPattern();
+ boost::regex r = url.getPattern();
testRegex("Invalid Group Url", r,
"secondlife:///app/group/00005ff3-4044-c79f-XXXX-fb28ae0df991/about",
@@ -313,7 +311,7 @@ namespace tut
// test LLUrlEntryPlace - secondlife://<location> URLs
//
LLUrlEntryPlace url;
- boost::wregex r = url.getPattern();
+ boost::regex r = url.getPattern();
testRegex("no valid slurl [1]", r,
"secondlife://Ahern/FOO/50/",
@@ -361,7 +359,7 @@ namespace tut
// test LLUrlEntryParcel - secondlife://app/parcel Urls
//
LLUrlEntryParcel url;
- boost::wregex r = url.getPattern();
+ boost::regex r = url.getPattern();
testRegex("Invalid Classified Url", r,
"secondlife:///app/parcel/0000060e-4b39-e00b-XXXX-d98b1934e3a8/about",
@@ -386,7 +384,7 @@ namespace tut
// test LLUrlEntryTeleport - secondlife://app/teleport URLs
//
LLUrlEntryTeleport url;
- boost::wregex r = url.getPattern();
+ boost::regex r = url.getPattern();
testRegex("no valid teleport [1]", r,
"http://slurl.com/secondlife/Ahern/50/50/50/",
@@ -462,7 +460,7 @@ namespace tut
// test LLUrlEntrySL - general secondlife:// URLs
//
LLUrlEntrySL url;
- boost::wregex r = url.getPattern();
+ boost::regex r = url.getPattern();
testRegex("no valid slapp [1]", r,
"http:///app/",
@@ -500,7 +498,7 @@ namespace tut
// test LLUrlEntrySLLabel - general secondlife:// URLs with labels
//
LLUrlEntrySLLabel url;
- boost::wregex r = url.getPattern();
+ boost::regex r = url.getPattern();
testRegex("invalid wiki url [1]", r,
"[secondlife:///app/]",