From e70b7c569ba13a68aba1c2b127811e61ac88a902 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Wed, 21 Oct 2009 19:11:53 +0200 Subject: Started working on user managment --- Source/Library/Common/BasicString.class.cpp | 34 ++++++++++++++--------------- Source/Library/Common/String.class.cpp | 1 + 2 files changed, 18 insertions(+), 17 deletions(-) (limited to 'Source/Library/Common') diff --git a/Source/Library/Common/BasicString.class.cpp b/Source/Library/Common/BasicString.class.cpp index ceab60b..b8f7eea 100644 --- a/Source/Library/Common/BasicString.class.cpp +++ b/Source/Library/Common/BasicString.class.cpp @@ -1,8 +1,8 @@ #include -#define FREE if (m_string != 0) delete m_string; -#define ALLOC m_string = new T[m_length]; -#define VRFY if (m_length == 0) { m_string = NULL; return; } +#define BS_FREE if (m_string != 0) delete m_string; +#define BS_ALLOC m_string = new T[m_length]; +#define BS_VRFY if (m_length == 0) { m_string = NULL; return; } using namespace CMem; @@ -32,33 +32,33 @@ BasicString::BasicString(const T value, u32int count) { template BasicString::~BasicString() { - FREE; + BS_FREE; } template void BasicString::affect(const BasicString &other) { - FREE; + BS_FREE; m_length = other.m_length; - VRFY; - ALLOC; + BS_VRFY; + BS_ALLOC; memcpy((u8int*)m_string, (u8int*)(other.m_string), m_length * sizeof(T)); } template void BasicString::affect(const T* string, u32int length) { - FREE; + BS_FREE; m_length = length; - VRFY; - ALLOC; + BS_VRFY; + BS_ALLOC; memcpy((u8int*)string, (u8int*)string, m_length * sizeof(T)); } template void BasicString::affect(const T value, u32int count) { - FREE; + BS_FREE; m_length = count; - VRFY; - ALLOC; + BS_VRFY; + BS_ALLOC; for (u32int i = 0; i < count; i++) { m_string[i] = value; } @@ -91,7 +91,7 @@ BasicString &BasicString::append(const BasicString &other) { for (u32int i = 0; i < other.m_length; i++) { newdata[i + m_length] = other.m_string[i]; } - FREE; + BS_FREE; m_string = newdata; m_length += other.m_length; return *this; @@ -106,7 +106,7 @@ BasicString &BasicString::append(const T* string, u32int length) { for (u32int i = 0; i < length; i++) { newdata[i + m_length] = string[i]; } - FREE; + BS_FREE; m_string = newdata; m_length += length; return *this; @@ -118,7 +118,7 @@ BasicString &BasicString::append(const T other) { for (u32int i = 0; i < m_length; i++) { newdata[i] = m_string[i]; } - FREE; + BS_FREE; m_string = newdata; m_string[m_length] = other; m_length++; @@ -145,7 +145,7 @@ BasicString BasicString::concat(const T other) const { template void BasicString::clear() { - FREE; + BS_FREE; m_string = 0; m_length = 0; } diff --git a/Source/Library/Common/String.class.cpp b/Source/Library/Common/String.class.cpp index ac0eba0..63ff837 100644 --- a/Source/Library/Common/String.class.cpp +++ b/Source/Library/Common/String.class.cpp @@ -50,6 +50,7 @@ String String::number(s32int number) { } String String::unserialize(u32int w) { + if (w == (u32int) - 1) return String(); u32int* a = (u32int*)w; String ret; ret.m_length = a[0]; -- cgit v1.2.3