From df5913855efcfefafe8bba8ad6d449534f55e0cd Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 13 Aug 2014 11:11:34 +0100 Subject: [PATCH] Follow up to last commit, allocate sizeof(char_type), not 1 byte * This week is apparently not a good week for avoiding stupid mistakes. --- renderdoc/replay/basic_types.cpp | 8 ++++---- renderdoc/replay/basic_types.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/renderdoc/replay/basic_types.cpp b/renderdoc/replay/basic_types.cpp index f53e5f6f8..3ce058304 100644 --- a/renderdoc/replay/basic_types.cpp +++ b/renderdoc/replay/basic_types.cpp @@ -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 diff --git a/renderdoc/replay/basic_types.h b/renderdoc/replay/basic_types.h index dc3780001..22808d9fe 100644 --- a/renderdoc/replay/basic_types.h +++ b/renderdoc/replay/basic_types.h @@ -124,7 +124,7 @@ struct str : public rdctype::array 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 count = o.count; if(count == 0) { - elems = (wchar_t*)allocate(1); + elems = (wchar_t*)allocate(sizeof(wchar_t)); elems[0] = 0; } else