diff --git a/Sources/Plasma/CoreLib/hsStream.cpp b/Sources/Plasma/CoreLib/hsStream.cpp index 9641e57d..18071430 100644 --- a/Sources/Plasma/CoreLib/hsStream.cpp +++ b/Sources/Plasma/CoreLib/hsStream.cpp @@ -322,18 +322,18 @@ wchar_t *hsStream::ReadSafeWString() return retVal; } -UInt32 hsStream::WriteSafeString_TEMP(const plString &string) +uint32_t hsStream::WriteSafeString_TEMP(const plString &string) { return WriteSafeString(string.c_str()); } -UInt32 hsStream::WriteSafeWString_TEMP(const plString &string) +uint32_t hsStream::WriteSafeWString_TEMP(const plString &string) { plStringBuffer wbuffer = string.ToWchar(); return WriteSafeWString(wbuffer.GetData()); } -plString hsStream::ReadSafeString_TEMP() +plString hsStream::ReadSafeString_TEMP() { char *buffer = ReadSafeString(); plString result = plString::FromIso8859_1(buffer); @@ -341,7 +341,7 @@ plString hsStream::ReadSafeString_TEMP() return result; } -plString hsStream::ReadSafeWString_TEMP() +plString hsStream::ReadSafeWString_TEMP() { wchar_t *wbuffer = ReadSafeWString(); plString result = plString::FromWchar(wbuffer); diff --git a/Sources/Plasma/CoreLib/plString.cpp b/Sources/Plasma/CoreLib/plString.cpp index 6bbadc99..da9e7c30 100644 --- a/Sources/Plasma/CoreLib/plString.cpp +++ b/Sources/Plasma/CoreLib/plString.cpp @@ -38,7 +38,7 @@ const plString plString::Null; #if WCHAR_BYTES == 2 #define u16slen(str, max) wcsnlen((const wchar_t *)(str), (max)) #else -static inline size_t u16slen(const UInt16 *ustr, size_t max) +static inline size_t u16slen(const uint16_t *ustr, size_t max) { size_t length = 0; for ( ; *ustr++ && max--; ++length) @@ -83,14 +83,14 @@ void plString::IConvertFromUtf8(const char *utf8, size_t size, bool steal) : plStringBuffer(utf8, size); } -void plString::IConvertFromUtf16(const UInt16 *utf16, size_t size) +void plString::IConvertFromUtf16(const uint16_t *utf16, size_t size) { if ((long)size < 0) size = u16slen(utf16, -(long)size); // Calculate the UTF-8 size size_t convlen = 0; - const UInt16 *sp = utf16; + const uint16_t *sp = utf16; while (sp < utf16 + size) { if (*sp >= 0xD800 && *sp <= 0xDFFF) { // Surrogate pair @@ -107,7 +107,7 @@ void plString::IConvertFromUtf16(const UInt16 *utf16, size_t size) } // And perform the actual conversion - char *utf8 = TRACKED_NEW char[convlen + 1]; + char *utf8 = new char[convlen + 1]; char *dp = utf8; sp = utf16; while (sp < utf16 + size) { @@ -154,7 +154,7 @@ void plString::IConvertFromWchar(const wchar_t *wstr, size_t size) { #if WCHAR_BYTES == 2 // We assume that if sizeof(wchar_t) == 2, the data is UTF-16 already - IConvertFromUtf16((const UInt16 *)wstr, size); + IConvertFromUtf16((const uint16_t *)wstr, size); #else if ((long)size < 0) size = wcsnlen(wstr, -(long)size); @@ -179,7 +179,7 @@ void plString::IConvertFromWchar(const wchar_t *wstr, size_t size) } // And perform the actual conversion - char *utf8 = TRACKED_NEW char[convlen + 1]; + char *utf8 = new char[convlen + 1]; char *dp = utf8; sp = wstr; while (sp < wstr + size) { @@ -227,7 +227,7 @@ void plString::IConvertFromIso8859_1(const char *astr, size_t size) } // And perform the actual conversion - char *utf8 = TRACKED_NEW char[convlen + 1]; + char *utf8 = new char[convlen + 1]; char *dp = utf8; sp = astr; while (sp < astr + size) { @@ -244,10 +244,10 @@ void plString::IConvertFromIso8859_1(const char *astr, size_t size) fUtf8Buffer = plStringBuffer::Steal(utf8, convlen); } -plStringBuffer plString::ToUtf16() const +plStringBuffer plString::ToUtf16() const { if (IsNull()) - return plStringBuffer(); + return plStringBuffer(); // Calculate the UTF-16 size size_t convlen = 0; @@ -270,8 +270,8 @@ plStringBuffer plString::ToUtf16() const } // And perform the actual conversion - UInt16 *ustr = TRACKED_NEW UInt16[convlen + 1]; - UInt16 *dp = ustr; + uint16_t *ustr = new uint16_t[convlen + 1]; + uint16_t *dp = ustr; sp = utf8; while (sp < utf8 + srcSize) { unsigned int unichar; @@ -298,14 +298,14 @@ plStringBuffer plString::ToUtf16() const } ustr[convlen] = 0; - return plStringBuffer::Steal(ustr, convlen); + return plStringBuffer::Steal(ustr, convlen); } plStringBuffer plString::ToWchar() const { #if WCHAR_BYTES == 2 // We assume that if sizeof(wchar_t) == 2, the data is UTF-16 already - plStringBuffer utf16 = ToUtf16(); + plStringBuffer utf16 = ToUtf16(); return *reinterpret_cast*>(&utf16); #else if (IsNull()) @@ -329,7 +329,7 @@ plStringBuffer plString::ToWchar() const } // And perform the actual conversion - wchar_t *wstr = TRACKED_NEW wchar_t[convlen + 1]; + wchar_t *wstr = new wchar_t[convlen + 1]; wchar_t *dp = wstr; sp = utf8; while (sp < utf8 + srcSize) { @@ -380,7 +380,7 @@ plStringBuffer plString::ToIso8859_1() const } // And perform the actual conversion - char *astr = TRACKED_NEW char[convlen + 1]; + char *astr = new char[convlen + 1]; char *dp = astr; sp = utf8; while (sp < utf8 + srcSize) { @@ -463,7 +463,7 @@ plString plString::IFormat(const char *fmt, va_list vptr) int size = 4096; for ( ;; ) { va_copy(vptr, vptr_save); - char *bigbuffer = TRACKED_NEW char[size]; + char *bigbuffer = new char[size]; chars = vsnprintf(bigbuffer, size, fmt, vptr); if (chars >= 0) return plString::Steal(bigbuffer); @@ -473,7 +473,7 @@ plString plString::IFormat(const char *fmt, va_list vptr) } } else if (chars >= 256) { va_copy(vptr, vptr_save); - char *bigbuffer = TRACKED_NEW char[chars+1]; + char *bigbuffer = new char[chars+1]; vsnprintf(bigbuffer, chars+1, fmt, vptr); return plString::Steal(bigbuffer); } @@ -611,7 +611,7 @@ plString plString::Substr(int start, size_t size) const if (start == 0 && size == maxSize) return *this; - char *substr = TRACKED_NEW char[size + 1]; + char *substr = new char[size + 1]; memcpy(substr, c_str() + start, size); substr[size] = 0; @@ -624,7 +624,7 @@ plString plString::Substr(int start, size_t size) const plString &plString::operator+=(const plString &str) { size_t catsize = GetSize() + str.GetSize(); - char *catstr = TRACKED_NEW char[catsize + 1]; + char *catstr = new char[catsize + 1]; memcpy(catstr, s_str(), GetSize()); memcpy(catstr + GetSize(), str.s_str(), str.GetSize()); catstr[catsize] = 0; @@ -635,7 +635,7 @@ plString &plString::operator+=(const plString &str) plString operator+(const plString &left, const plString &right) { size_t catsize = left.GetSize() + right.GetSize(); - char *catstr = TRACKED_NEW char[catsize + 1]; + char *catstr = new char[catsize + 1]; memcpy(catstr, left.s_str(), left.GetSize()); memcpy(catstr + left.GetSize(), right.s_str(), right.GetSize()); catstr[catsize] = 0; diff --git a/Sources/Plasma/CoreLib/plString.h b/Sources/Plasma/CoreLib/plString.h index fc821c5c..081e1d60 100644 --- a/Sources/Plasma/CoreLib/plString.h +++ b/Sources/Plasma/CoreLib/plString.h @@ -27,8 +27,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plString_Defined #define plString_Defined -#include "hsTypes.h" -#include "hsUtils.h" +#include "HeadSpin.h" #include #include #include @@ -133,7 +132,7 @@ private: plStringBuffer fUtf8Buffer; void IConvertFromUtf8(const char *utf8, size_t size, bool steal); - void IConvertFromUtf16(const UInt16 *utf16, size_t size); + void IConvertFromUtf16(const uint16_t *utf16, size_t size); void IConvertFromWchar(const wchar_t *wstr, size_t size); void IConvertFromIso8859_1(const char *astr, size_t size); @@ -157,7 +156,7 @@ public: return str; } - static inline plString FromUtf16(const UInt16 *utf16, size_t size = kSizeAuto) + static inline plString FromUtf16(const uint16_t *utf16, size_t size = kSizeAuto) { plString str; str.IConvertFromUtf16(utf16, size); @@ -183,7 +182,7 @@ public: char CharAt(size_t position) const { return c_str()[position]; } plStringBuffer ToUtf8() const { return fUtf8Buffer; } - plStringBuffer ToUtf16() const; + plStringBuffer ToUtf16() const; plStringBuffer ToWchar() const; plStringBuffer ToIso8859_1() const; diff --git a/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp b/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp index daa1395e..5796fe6a 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp @@ -256,13 +256,13 @@ int plMsgStdStringHelper::PokeBig(const char * buf, uint32_t bufsz, hsStream* st return stream->GetPosition(); } -int plMsgStdStringHelper::Poke(const plString & stringref, hsStream* stream, const UInt32 peekOptions) +int plMsgStdStringHelper::Poke(const plString & stringref, hsStream* stream, const uint32_t peekOptions) { std::string temp = stringref.c_str(); return Poke(temp, stream, peekOptions); } -int plMsgStdStringHelper::PokeBig(const plString & stringref, hsStream* stream, const UInt32 peekOptions) +int plMsgStdStringHelper::PokeBig(const plString & stringref, hsStream* stream, const uint32_t peekOptions) { std::string temp = stringref.c_str(); return PokeBig(temp, stream, peekOptions); @@ -313,7 +313,7 @@ int plMsgStdStringHelper::PeekBig(std::string & stringref, hsStream* stream, co return stream->GetPosition(); } -int plMsgStdStringHelper::Peek(plString & stringref, hsStream* stream, const UInt32 peekOptions) +int plMsgStdStringHelper::Peek(plString & stringref, hsStream* stream, const uint32_t peekOptions) { std::string temp; int pos = Peek(temp, stream, peekOptions); @@ -321,7 +321,7 @@ int plMsgStdStringHelper::Peek(plString & stringref, hsStream* stream, const UIn return pos; } -int plMsgStdStringHelper::PeekBig(plString & stringref, hsStream* stream, const UInt32 peekOptions) +int plMsgStdStringHelper::PeekBig(plString & stringref, hsStream* stream, const uint32_t peekOptions) { std::string temp; int pos = PeekBig(temp, stream, peekOptions); @@ -399,12 +399,12 @@ int plMsgCStringHelper::Peek(char *& str, hsStream* stream, const uint32_t peekO return stream->GetPosition(); } -int plMsgCStringHelper::Poke(const plString & str, hsStream* stream, const UInt32 peekOptions) +int plMsgCStringHelper::Poke(const plString & str, hsStream* stream, const uint32_t peekOptions) { return Poke(str.c_str(), stream, peekOptions); } -int plMsgCStringHelper::Peek(plString & str, hsStream* stream, const UInt32 peekOptions) +int plMsgCStringHelper::Peek(plString & str, hsStream* stream, const uint32_t peekOptions) { char * temp = nil; int pos = Peek(temp, stream, peekOptions);