Commit 22c82c61 authored by Ivan Dokunov's avatar Ivan Dokunov

Bugfix and small refactor

parent d34668be
......@@ -493,7 +493,7 @@ struct float4_t
{
}
float4_t(const float4 & f):x(f.x), y(f.y), z(f.z), w(f.w)
float4_t(const float4 & f) : float4_t(f.x, f.y, f.z, f.w)
{
}
......
......@@ -259,9 +259,12 @@ String & String::operator=(const String & str)
String & String::operator=(const char * str)
{
release();
m_szString = new char[strlen(str) + 1];
memcpy(m_szString, str, strlen(str) + 1);
if (str != m_szString)
{
release();
m_szString = new char[strlen(str) + 1];
memcpy(m_szString, str, strlen(str) + 1);
}
return(*this);
}
......@@ -1341,9 +1344,12 @@ StringW & StringW::operator=(const StringW & str)
StringW & StringW::operator=(const WCHAR * str)
{
release();
m_szString = new WCHAR[wcslen(str) + 1];
memcpy(m_szString, str, sizeof(WCHAR) * (wcslen(str) + 1));
if (m_szString != str)
{
release();
m_szString = new WCHAR[wcslen(str) + 1];
memcpy(m_szString, str, sizeof(WCHAR)* (wcslen(str) + 1));
}
return(*this);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment