From 34948b7a0c93fdf1127ec91831c8a802cf31500a Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 22 Jan 2013 20:46:21 +0000 Subject: [PATCH] base: fix a bug in the String fixed-size constructor. --- src/lol/base/string.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lol/base/string.h b/src/lol/base/string.h index 0cc06346..6b15d0c8 100644 --- a/src/lol/base/string.h +++ b/src/lol/base/string.h @@ -14,8 +14,8 @@ // A very simple String class, based on Array. // -#if !defined __LOL_CORE_STRING_H__ -#define __LOL_CORE_STRING_H__ +#if !defined __LOL_BASE_STRING_H__ +#define __LOL_BASE_STRING_H__ #include @@ -49,9 +49,9 @@ public: : Super() { using namespace std; - Resize(count + 1); - memcpy(&(*this)[0], str, Count()); - ((Super &)*this).Last() = '\0'; + Resize(count); + memcpy(&(*this)[0], str, count); + (*this)[count] = '\0'; } inline String(String const &s) @@ -146,5 +146,5 @@ public: } /* namespace lol */ -#endif // __LOL_CORE_STRING_H__ +#endif // __LOL_BASE_STRING_H__