mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Convert ReadSafe(W)String* to the plString variants, and remove the now
unneeded _TEMP variants. All safe strings read from hsStreams are now plStringified :)
This commit is contained in:
@ -158,7 +158,7 @@ uint32_t hsStream::WriteSafeWStringLong(const plString &string)
|
||||
return 0;
|
||||
}
|
||||
|
||||
plString hsStream::ReadSafeStringLong_TEMP()
|
||||
plString hsStream::ReadSafeStringLong()
|
||||
{
|
||||
plStringBuffer<char> name;
|
||||
uint32_t numChars = ReadLE32();
|
||||
@ -179,15 +179,7 @@ plString hsStream::ReadSafeStringLong_TEMP()
|
||||
return name;
|
||||
}
|
||||
|
||||
char *hsStream::ReadSafeStringLong()
|
||||
{
|
||||
plString name = ReadSafeStringLong_TEMP();
|
||||
char *buff = new char[name.GetSize() + 1];
|
||||
memcpy(buff, name.c_str(), name.GetSize() + 1);
|
||||
return buff;
|
||||
}
|
||||
|
||||
plString hsStream::ReadSafeWStringLong_TEMP()
|
||||
plString hsStream::ReadSafeWStringLong()
|
||||
{
|
||||
plStringBuffer<uint16_t> retVal;
|
||||
uint32_t numChars = ReadLE32();
|
||||
@ -209,17 +201,6 @@ plString hsStream::ReadSafeWStringLong_TEMP()
|
||||
return plString::FromUtf16(retVal);
|
||||
}
|
||||
|
||||
wchar_t *hsStream::ReadSafeWStringLong()
|
||||
{
|
||||
// Horribly inefficient (convert to UTF-8 and then back to UTF-16), which
|
||||
// is why this should go away completely after plString has taken over
|
||||
// the world^H^H^H^H^HPlasma
|
||||
plStringBuffer<wchar_t> retVal = ReadSafeWStringLong_TEMP().ToWchar();
|
||||
wchar_t *buff = new wchar_t[retVal.GetSize() + 1];
|
||||
memcpy(buff, retVal.GetData(), retVal.GetSize() + 1);
|
||||
return buff;
|
||||
}
|
||||
|
||||
uint32_t hsStream::WriteSafeString(const plString &string)
|
||||
{
|
||||
int len = string.GetSize();
|
||||
@ -261,7 +242,7 @@ uint32_t hsStream::WriteSafeWString(const plString &string)
|
||||
return 0;
|
||||
}
|
||||
|
||||
plString hsStream::ReadSafeString_TEMP()
|
||||
plString hsStream::ReadSafeString()
|
||||
{
|
||||
plStringBuffer<char> name;
|
||||
uint16_t numChars = ReadLE16();
|
||||
@ -293,15 +274,7 @@ plString hsStream::ReadSafeString_TEMP()
|
||||
return name;
|
||||
}
|
||||
|
||||
char *hsStream::ReadSafeString()
|
||||
{
|
||||
plString name = ReadSafeString_TEMP();
|
||||
char *buff = new char[name.GetSize() + 1];
|
||||
memcpy(buff, name.c_str(), name.GetSize() + 1);
|
||||
return buff;
|
||||
}
|
||||
|
||||
plString hsStream::ReadSafeWString_TEMP()
|
||||
plString hsStream::ReadSafeWString()
|
||||
{
|
||||
plStringBuffer<uint16_t> retVal;
|
||||
uint32_t numChars = ReadLE16();
|
||||
@ -326,17 +299,6 @@ plString hsStream::ReadSafeWString_TEMP()
|
||||
return plString::FromUtf16(retVal);
|
||||
}
|
||||
|
||||
wchar_t *hsStream::ReadSafeWString()
|
||||
{
|
||||
// Horribly inefficient (convert to UTF-8 and then back to UTF-16), which
|
||||
// is why this should go away completely after plString has taken over
|
||||
// the world^H^H^H^H^HPlasma
|
||||
plStringBuffer<wchar_t> retVal = ReadSafeWString_TEMP().ToWchar();
|
||||
wchar_t *buff = new wchar_t[retVal.GetSize() + 1];
|
||||
memcpy(buff, retVal.GetData(), retVal.GetSize() + 1);
|
||||
return buff;
|
||||
}
|
||||
|
||||
bool hsStream::Read4Bytes(void *pv) // Virtual, faster version in sub classes
|
||||
{
|
||||
int knt = this->Read(sizeof(uint32_t), pv);
|
||||
|
@ -55,7 +55,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define hsReadOnlyLoggingStream hsReadOnlyStream
|
||||
#define LogRead(byteCount, buffer, desc) Read(byteCount, buffer)
|
||||
#define LogReadSafeString() ReadSafeString()
|
||||
#define LogReadSafeString_TEMP() ReadSafeString_TEMP()
|
||||
#define LogReadSafeStringLong() ReadSafeStringLong();
|
||||
#define LogSkip(deltaByteCount, desc) Skip(deltaByteCount)
|
||||
#define LogReadLE(value, desc) ReadLE(value)
|
||||
@ -126,18 +125,13 @@ public:
|
||||
|
||||
uint32_t WriteSafeStringLong(const plString &string); // uses 4 bytes for length
|
||||
uint32_t WriteSafeWStringLong(const plString &string);
|
||||
char * ReadSafeStringLong();
|
||||
wchar_t * ReadSafeWStringLong();
|
||||
plString ReadSafeStringLong();
|
||||
plString ReadSafeWStringLong();
|
||||
|
||||
uint32_t WriteSafeString(const plString &string); // uses 2 bytes for length
|
||||
uint32_t WriteSafeWString(const plString &string);
|
||||
char * ReadSafeString();
|
||||
wchar_t * ReadSafeWString();
|
||||
|
||||
plString ReadSafeStringLong_TEMP();
|
||||
plString ReadSafeWStringLong_TEMP();
|
||||
plString ReadSafeString_TEMP();
|
||||
plString ReadSafeWString_TEMP();
|
||||
plString ReadSafeString();
|
||||
plString ReadSafeWString();
|
||||
|
||||
bool GetToken(char *s, uint32_t maxLen=uint32_t(-1), const char beginComment=kComment, const char endComment=kEolnCode);
|
||||
bool ReadLn(char* s, uint32_t maxLen=uint32_t(-1), const char beginComment=kComment, const char endComment=kEolnCode);
|
||||
|
@ -144,7 +144,7 @@ int plGeneric::Read(hsStream* stream)
|
||||
break;
|
||||
|
||||
case kString:
|
||||
fStringVal = stream->ReadSafeWString_TEMP();
|
||||
fStringVal = stream->ReadSafeWString();
|
||||
break;
|
||||
}
|
||||
return stream->GetPosition();
|
||||
|
Reference in New Issue
Block a user