diff options
| author | Adam Moss <moss@lindenlab.com> | 2009-10-08 14:14:13 +0000 | 
|---|---|---|
| committer | Adam Moss <moss@lindenlab.com> | 2009-10-08 14:14:13 +0000 | 
| commit | 9665d7a71bcd5cd79889b2b4908beaf66b76341d (patch) | |
| tree | 4696e0c368c439fc0547d6dc92a3fb9746eabca6 | |
| parent | bb533f4d1123ff20d177ee4a3c7f69405da18bf5 (diff) | |
DEV-41081 - better than using the msvc kludge for suppressing warnings about memcpy, don't actually use memcpy - use our own safe 'copy' method.  also stripNonprintable() is probably a little faster now...
| -rw-r--r-- | indra/llcommon/llstring.h | 7 | ||||
| -rw-r--r-- | indra/llcommon/tests/llstring_test.cpp | 3 | 
2 files changed, 4 insertions, 6 deletions
| diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index d0def896cf..8f70726a9e 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -991,14 +991,15 @@ void LLStringUtilBase<T>::stripNonprintable(std::basic_string<T>& string)  	{  		return;  	} -	char* c_string = new char[string.size() + 1]; +	size_t src_size = string.size(); +	char* c_string = new char[src_size + 1];  	if(c_string == NULL)  	{  		return;  	} -	strcpy(c_string, string.c_str());	/*Flawfinder: ignore*/ +	copy(c_string, string.c_str(), src_size+1);  	char* write_head = &c_string[0]; -	for (size_type i = 0; i < string.size(); i++) +	for (size_type i = 0; i < src_size; i++)  	{  		char* read_head = &string[i];  		write_head = &c_string[j]; diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp index 1d99214d69..1f4603631a 100644 --- a/indra/llcommon/tests/llstring_test.cpp +++ b/indra/llcommon/tests/llstring_test.cpp @@ -32,9 +32,6 @@   * $/LicenseInfo$   */ -// win32 kludge-o-rama -#define _CRT_SECURE_NO_WARNINGS -  #include "../test/lltut.h"  #include "../llstring.h" | 
