Fix Visual Studio throwing C4996 warning in ustring.cpp.

This commit is contained in:
Marcel Admiraal 2019-11-18 21:51:54 +01:00
parent 95f1f4e82a
commit 70b0fad25a
1 changed files with 4 additions and 2 deletions

View File

@ -142,9 +142,11 @@ void CharString::copy_from(const char *p_cstr) {
return; return;
} }
resize(len + 1); // include terminating null char Error err = resize(++len); // include terminating null char
strcpy(ptrw(), p_cstr); ERR_FAIL_COND_MSG(err != OK, "Failed to copy C-string.");
memcpy(ptrw(), p_cstr, len);
} }
void String::copy_from(const char *p_cstr) { void String::copy_from(const char *p_cstr) {