From 0139012d683036fb661fed62babb71f59ec9ab45 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sat, 29 Aug 2009 15:20:49 +0200 Subject: . --- Source/Kernel/Library/.String.class.cpp.swp | Bin 0 -> 20480 bytes Source/Kernel/Library/String.class.cpp | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 Source/Kernel/Library/.String.class.cpp.swp (limited to 'Source/Kernel/Library') diff --git a/Source/Kernel/Library/.String.class.cpp.swp b/Source/Kernel/Library/.String.class.cpp.swp new file mode 100644 index 0000000..6fd369f Binary files /dev/null and b/Source/Kernel/Library/.String.class.cpp.swp differ diff --git a/Source/Kernel/Library/String.class.cpp b/Source/Kernel/Library/String.class.cpp index dc763bd..c118800 100644 --- a/Source/Kernel/Library/String.class.cpp +++ b/Source/Kernel/Library/String.class.cpp @@ -56,6 +56,10 @@ String::String() { String::String(char* string) { m_length = strlen(string); + if (m_length == 0) { + m_string = 0; + return; + } m_string = (char*)Mem::kalloc(m_length + 1); for (u32int i = 0; i < m_length; i++) { m_string[i] = string[i]; @@ -65,6 +69,10 @@ String::String(char* string) { String::String(const String &other) { m_length = other.m_length; + if (m_length == 0) { + m_string = 0; + return; + } m_string = (char*)Mem::kalloc(m_length + 1); for (u32int i = 0; i < m_length; i++) { m_string[i] = other.m_string[i]; @@ -79,6 +87,10 @@ String::~String() { void String::operator= (const String &other) { m_length = other.m_length; if (m_string != 0) Mem::kfree(m_string); + if (m_length == 0) { + m_string = 0; + return; + } m_string = (char*)Mem::kalloc(m_length + 1); for (u32int i = 0; i < m_length; i++) { m_string[i] = other.m_string[i]; @@ -89,6 +101,10 @@ void String::operator= (const String &other) { void String::operator= (char* string) { m_length = strlen(string); if (m_string != 0) Mem::kfree(m_string); + if (m_length == 0) { + m_string = 0; + return; + } m_string = (char*)Mem::kalloc(m_length + 1); for (u32int i = 0; i < m_length; i++) { m_string[i] = string[i]; -- cgit v1.2.3