diff options
author | Alexis211 <alexis211@gmail.com> | 2009-10-21 19:11:53 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-10-21 19:11:53 +0200 |
commit | e70b7c569ba13a68aba1c2b127811e61ac88a902 (patch) | |
tree | 4fa6bb927e22b9664e172ebe9c74b10680df3036 /Source/Library/Common | |
parent | dc37d089e8ca98ff2dc8a320c21fc3ac0a87eaa6 (diff) | |
download | Melon-e70b7c569ba13a68aba1c2b127811e61ac88a902.tar.gz Melon-e70b7c569ba13a68aba1c2b127811e61ac88a902.zip |
Started working on user managment
Diffstat (limited to 'Source/Library/Common')
-rw-r--r-- | Source/Library/Common/BasicString.class.cpp | 34 | ||||
-rw-r--r-- | Source/Library/Common/String.class.cpp | 1 |
2 files changed, 18 insertions, 17 deletions
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 <Vector.class.h> -#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<T>::BasicString(const T value, u32int count) { template <typename T> BasicString<T>::~BasicString() { - FREE; + BS_FREE; } template <typename T> void BasicString<T>::affect(const BasicString<T> &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 <typename T> void BasicString<T>::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 <typename T> void BasicString<T>::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<T> &BasicString<T>::append(const BasicString<T> &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<T> &BasicString<T>::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<T> &BasicString<T>::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<T> BasicString<T>::concat(const T other) const { template <typename T> void BasicString<T>::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]; |