Follow up to last commit, allocate sizeof(char_type), not 1 byte

* This week is apparently not a good week for avoiding stupid mistakes.
This commit is contained in:
baldurk
2014-08-13 11:11:34 +01:00
parent dcbba16af5
commit df5913855e
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -33,7 +33,7 @@ wstr &wstr::operator =(const std::wstring &in)
count = (int32_t)in.size();
if(count == 0)
{
elems = (wchar_t*)allocate(1);
elems = (wchar_t*)allocate(sizeof(wchar_t));
elems[0] = 0;
}
else
@@ -51,7 +51,7 @@ str &str::operator =(const std::string &in)
count = (int32_t)in.size();
if(count == 0)
{
elems = (char*)allocate(1);
elems = (char*)allocate(sizeof(char));
elems[0] = 0;
}
else
@@ -69,7 +69,7 @@ wstr &wstr::operator =(const wchar_t *const in)
count = (int32_t)wcslen(in);
if(count == 0)
{
elems = (wchar_t*)allocate(1);
elems = (wchar_t*)allocate(sizeof(wchar_t));
elems[0] = 0;
}
else
@@ -87,7 +87,7 @@ str &str::operator =(const char *const in)
count = (int32_t)strlen(in);
if(count == 0)
{
elems = (char*)allocate(1);
elems = (char*)allocate(sizeof(char));
elems[0] = 0;
}
else
+2 -2
View File
@@ -124,7 +124,7 @@ struct str : public rdctype::array<char>
count = o.count;
if(count == 0)
{
elems = (char*)allocate(1);
elems = (char*)allocate(sizeof(char));
elems[0] = 0;
}
else
@@ -154,7 +154,7 @@ struct wstr : public rdctype::array<wchar_t>
count = o.count;
if(count == 0)
{
elems = (wchar_t*)allocate(1);
elems = (wchar_t*)allocate(sizeof(wchar_t));
elems[0] = 0;
}
else