From f1380f2fc3eecd8dfd2f75d053ff86716d5055f7 Mon Sep 17 00:00:00 2001 From: Robert Knop Date: Mon, 19 Jan 2009 20:40:59 +0000 Subject: Merging from the server/server-1.25 branch svn merge -r107352:108210 svn+ssh://svn.lindenlab.com/svn/linden/branches/server/server-1.25 Merge conflicts were resolved: scripts/start-server : one conflict, kept the "working" version indra/llcommon/llversionserver.h : reverted indra/newview/Info-SecondLife.plist : reverted indra/newview/res/viewerRes.rc : reverted indra/newsim/llagentinfo.cpp : kept *both*... "working" had is_agent_online, which nothing else had, and the merge had isGodAllowed(), part of SEC resolution indra/backbone/agent_router.py : kartic & rdw merged and reviewed using brains and things indra/newsim/llsimhttpresponder.cpp : doesn't exist in trunk, and that's OK (even though there was a change for it) --- indra/llcommon/llstring.cpp | 54 ++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 33 deletions(-) (limited to 'indra/llcommon/llstring.cpp') diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 7a97830343..1f653c159c 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -663,7 +663,8 @@ S32 LLStringOps::collate(const llwchar* a, const llwchar* b) namespace LLStringFn { - void replace_nonprintable(std::basic_string& string, char replacement) + // NOTE - this restricts output to ascii + void replace_nonprintable_in_ascii(std::basic_string& string, char replacement) { const char MIN = 0x20; std::basic_string::size_type len = string.size(); @@ -676,23 +677,9 @@ namespace LLStringFn } } - void replace_nonprintable( - std::basic_string& string, - llwchar replacement) - { - const llwchar MIN = 0x20; - const llwchar MAX = 0x7f; - std::basic_string::size_type len = string.size(); - for(std::basic_string::size_type ii = 0; ii < len; ++ii) - { - if((string[ii] < MIN) || (string[ii] > MAX)) - { - string[ii] = replacement; - } - } - } - void replace_nonprintable_and_pipe(std::basic_string& str, + // NOTE - this restricts output to ascii + void replace_nonprintable_and_pipe_in_ascii(std::basic_string& str, char replacement) { const char MIN = 0x20; @@ -707,22 +694,6 @@ namespace LLStringFn } } - void replace_nonprintable_and_pipe(std::basic_string& str, - llwchar replacement) - { - const llwchar MIN = 0x20; - const llwchar MAX = 0x7f; - const llwchar PIPE = 0x7c; - std::basic_string::size_type len = str.size(); - for(std::basic_string::size_type ii = 0; ii < len; ++ii) - { - if( (str[ii] < MIN) || (str[ii] > MAX) || (str[ii] == PIPE) ) - { - str[ii] = replacement; - } - } - } - // https://wiki.lindenlab.com/wiki/Unicode_Guidelines has details on // allowable code points for XML. Specifically, they are: // 0x09, 0x0a, 0x0d, and 0x20 on up. JC @@ -748,6 +719,23 @@ namespace LLStringFn return output; } + /** + * @brief Replace all control characters (c < 0x20) with replacement in + * string. + */ + void replace_ascii_controlchars(std::basic_string& string, char replacement) + { + const unsigned char MIN = 0x20; + std::basic_string::size_type len = string.size(); + for(std::basic_string::size_type ii = 0; ii < len; ++ii) + { + const unsigned char c = (unsigned char) string[ii]; + if(c < MIN) + { + string[ii] = replacement; + } + } + } } -- cgit v1.2.3