summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authormax nikolenko <maximnproductengine@lindenlab.com>2017-04-04 08:01:00 +0000
committermax nikolenko <maximnproductengine@lindenlab.com>2017-04-04 08:01:00 +0000
commitab927f7991acb9fb0b005f786b21cfe073192c2e (patch)
tree83543a6dc0b0931c26016858eb8199b21792c765 /indra
parent96f436b6500d6d6fbcf6eb782fa6f913a5b2b59a (diff)
parentc27dbc62148f51ff5848f63573f5816235f0cc35 (diff)
Merged in MAINT-6404
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llstring.h23
-rw-r--r--indra/llwindow/llwindowwin32.cpp2
2 files changed, 24 insertions, 1 deletions
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index a40db0f8cc..2255e638c2 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -336,6 +336,7 @@ public:
static void addCRLF(string_type& string);
static void removeCRLF(string_type& string);
+ static void removeWindowsCR(string_type& string);
static void replaceTabsWithSpaces( string_type& string, size_type spaces_per_tab );
static void replaceNonstandardASCII( string_type& string, T replacement );
@@ -1322,6 +1323,28 @@ void LLStringUtilBase<T>::removeCRLF(string_type& string)
//static
template<class T>
+void LLStringUtilBase<T>::removeWindowsCR(string_type& string)
+{
+ const T LF = 10;
+ const T CR = 13;
+
+ size_type cr_count = 0;
+ size_type len = string.size();
+ size_type i;
+ for( i = 0; i < len - cr_count - 1; i++ )
+ {
+ if( string[i+cr_count] == CR && string[i+cr_count+1] == LF)
+ {
+ cr_count++;
+ }
+
+ string[i] = string[i+cr_count];
+ }
+ string.erase(i, cr_count);
+}
+
+//static
+template<class T>
void LLStringUtilBase<T>::replaceChar( string_type& string, T target, T replacement )
{
size_type found_pos = 0;
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 321792eb14..b5ed53fd4f 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -2801,7 +2801,7 @@ BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst)
if (utf16str)
{
dst = utf16str_to_wstring(utf16str);
- LLWStringUtil::removeCRLF(dst);
+ LLWStringUtil::removeWindowsCR(dst);
GlobalUnlock(h_data);
success = TRUE;
}