summaryrefslogtreecommitdiff
path: root/Source/Kernel/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/Library')
-rw-r--r--Source/Kernel/Library/String.class.cpp12
-rw-r--r--Source/Kernel/Library/String.class.h12
-rw-r--r--Source/Kernel/Library/WChar.class.cpp6
-rw-r--r--Source/Kernel/Library/WChar.class.h10
4 files changed, 20 insertions, 20 deletions
diff --git a/Source/Kernel/Library/String.class.cpp b/Source/Kernel/Library/String.class.cpp
index e70d19f..8df5cbf 100644
--- a/Source/Kernel/Library/String.class.cpp
+++ b/Source/Kernel/Library/String.class.cpp
@@ -54,7 +54,7 @@ String::String() {
m_length = 0;
}
-String::String(char* string) {
+String::String(const char* string) {
m_length = WChar::utf8len(string);
if (m_length == 0) {
m_string = 0;
@@ -100,7 +100,7 @@ void String::operator= (const String &other) {
m_string[m_length] = 0;
}
-void String::operator= (char* string) {
+void String::operator= (const char* string) {
m_length = WChar::utf8len(string);
if (m_string != 0) delete [] m_string;
if (m_length == 0) {
@@ -116,7 +116,7 @@ void String::operator= (char* string) {
m_string[m_length] = 0;
}
-bool String::operator== (String &other) {
+bool String::operator== (const String &other) {
if (m_length != other.m_length) return false;
for (u32int i = 0; i < m_length; i++) {
if (m_string[i] != other.m_string[i]) return false;
@@ -124,7 +124,7 @@ bool String::operator== (String &other) {
return true;
}
-bool String::operator== (char* string) {
+bool String::operator== (const char* string) {
if (m_length != WChar::utf8len(string)) return false;
int i = 0, l = strlen(string), c = 0;
WChar tmp;
@@ -151,7 +151,7 @@ String& String::operator+= (String &other) {
return *this;
}
-String& String::operator+= (char* other) {
+String& String::operator+= (const char* other) {
WChar* newdata = new WChar[m_length + WChar::utf8len(other) + 1];
for (u32int i = 0; i < m_length; i++) {
newdata[i] = m_string[i];
@@ -186,7 +186,7 @@ String& String::operator+ (String &other) { //Can be optimized
return (ret += other);
}
-String& String::operator+ (char* other) { //Can be optimized
+String& String::operator+ (const char* other) { //Can be optimized
String ret(*this);
return (ret += other);
}
diff --git a/Source/Kernel/Library/String.class.h b/Source/Kernel/Library/String.class.h
index ecbc2a0..85ec268 100644
--- a/Source/Kernel/Library/String.class.h
+++ b/Source/Kernel/Library/String.class.h
@@ -15,21 +15,21 @@ class String {
static String hex(u32int number);
static String number(s32int number);
- String(char* string);
+ String(const char* string);
String();
String(const String &other);
~String();
void operator= (const String &other);
- void operator= (char* string);
+ void operator= (const char* string);
- bool operator== (String &other);
- bool operator== (char* string);
+ bool operator== (const String &other);
+ bool operator== (const char* string);
String &operator+= (String &other);
- String &operator+= (char* other);
+ String &operator+= (const char* other);
String &operator+= (WChar other);
String &operator+ (String &other);
- String &operator+ (char* other);
+ String &operator+ (const char* other);
String &operator+ (WChar other);
s32int toInt();
u32int toInt16(); //From HEX
diff --git a/Source/Kernel/Library/WChar.class.cpp b/Source/Kernel/Library/WChar.class.cpp
index c1a1977..bb1269d 100644
--- a/Source/Kernel/Library/WChar.class.cpp
+++ b/Source/Kernel/Library/WChar.class.cpp
@@ -19,11 +19,11 @@ WChar::WChar(char c) {
affectAscii(c);
}
-WChar::WChar(char* c) {
+WChar::WChar(const char* c) {
affectUtf8(c);
}
-u32int WChar::utf8len(char* c) {
+u32int WChar::utf8len(const char* c) {
int i = 0, l = CMem::strlen(c), co = 0;
while (i < l) {
if ((c[i] & 0x80) == 0) i += 1;
@@ -41,7 +41,7 @@ void WChar::affectAscii(char c) {
else value = CP437[c + 128];
}
-u32int WChar::affectUtf8(char* c) { //Returns the number of bytes for the character
+u32int WChar::affectUtf8(const char* c) { //Returns the number of bytes for the character
/*if ((c[0] & 0xB0) == 0x80) { //11000000b == 10000000b, means we are IN a sequence
value = 0;
return 1;
diff --git a/Source/Kernel/Library/WChar.class.h b/Source/Kernel/Library/WChar.class.h
index c582017..9ddccd1 100644
--- a/Source/Kernel/Library/WChar.class.h
+++ b/Source/Kernel/Library/WChar.class.h
@@ -9,14 +9,14 @@ struct WChar {
WChar(); //Creates a null character
WChar(char c); //From ascii character
- WChar(char* c); //From utf8 string
+ WChar(const char* c); //From utf8 string
- static u32int utf8len(char* c); //Returns count of utf8 characters in string
+ static u32int utf8len(const char* c); //Returns count of utf8 characters in string
void affectAscii(char c);
- u32int affectUtf8(char* c);
- void affectUtf16(char* c);
- void affectUtf32(char* c);
+ u32int affectUtf8(const char* c);
+ void affectUtf16(const char* c);
+ void affectUtf32(const char* c);
u8int toAscii();
inline WChar operator+ (u32int other) {