Skip to content
Snippets Groups Projects
Commit 9665d7a7 authored by Adam Moss's avatar Adam Moss
Browse files

DEV-41081 - better than using the msvc kludge for suppressing warnings about...

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...
parent bb533f4d
No related branches found
No related tags found
No related merge requests found
...@@ -991,14 +991,15 @@ void LLStringUtilBase<T>::stripNonprintable(std::basic_string<T>& string) ...@@ -991,14 +991,15 @@ void LLStringUtilBase<T>::stripNonprintable(std::basic_string<T>& string)
{ {
return; 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) if(c_string == NULL)
{ {
return; return;
} }
strcpy(c_string, string.c_str()); /*Flawfinder: ignore*/ copy(c_string, string.c_str(), src_size+1);
char* write_head = &c_string[0]; 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]; char* read_head = &string[i];
write_head = &c_string[j]; write_head = &c_string[j];
......
...@@ -32,9 +32,6 @@ ...@@ -32,9 +32,6 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
// win32 kludge-o-rama
#define _CRT_SECURE_NO_WARNINGS
#include "../test/lltut.h" #include "../test/lltut.h"
#include "../llstring.h" #include "../llstring.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment