Change strings to use mtl::memmove instead of memcpy ot std::memmove
This commit is contained in:
parent
ecac9d2087
commit
56ea8ad91d
@ -20,7 +20,7 @@ istring& istring::assign(const istring& str) {
|
||||
m_size = str.m_size;
|
||||
if (m_size > m_capacity) { m_size = m_capacity; }
|
||||
|
||||
std::memcpy(m_str, str.m_str, m_size);
|
||||
mtl::memmove(m_str, str.m_str, m_size);
|
||||
m_str[m_size] = '\0';
|
||||
|
||||
return *this;
|
||||
@ -32,7 +32,7 @@ istring& istring::assign(const istring& str, size_t pos, size_t count) {
|
||||
if (m_size > m_capacity) { m_size = m_capacity; }
|
||||
|
||||
// str may overlap
|
||||
std::memmove(m_str, str.m_str + pos, m_size);
|
||||
mtl::memmove(m_str, str.m_str + pos, m_size);
|
||||
m_str[m_size] = '\0';
|
||||
|
||||
return *this;
|
||||
@ -42,7 +42,7 @@ istring& istring::assign(const string_view& str) {
|
||||
if (m_size > m_capacity) { m_size = m_capacity; }
|
||||
|
||||
// str may overlap
|
||||
mtl::memcpy(m_str, str.c_str(), m_size);
|
||||
mtl::memmove(m_str, str.c_str(), m_size);
|
||||
m_str[m_size] = '\0';
|
||||
|
||||
return *this;
|
||||
@ -54,7 +54,7 @@ istring& istring::assign(const string_view& str, size_t pos, size_t count) {
|
||||
if (m_size > m_capacity) { m_size = m_capacity; }
|
||||
|
||||
// str may overlap
|
||||
mtl::memcpy(m_str, str.c_str() + pos, m_size);
|
||||
mtl::memmove(m_str, str.c_str() + pos, m_size);
|
||||
m_str[m_size] = '\0';
|
||||
|
||||
return *this;
|
||||
@ -205,7 +205,7 @@ istring& istring::insert(size_t index, const istring& str) {
|
||||
|
||||
// only copy the string if there is room
|
||||
size_t num_to_copy = std::min(str.m_size, space);
|
||||
mtl::memcpy(substr, str.m_str, num_to_copy);
|
||||
mtl::memmove(substr, str.m_str, num_to_copy);
|
||||
|
||||
m_size += num_to_copy;
|
||||
m_str[m_size] = '\0';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user