Browse Source

Deprecate and remove xtl::format in favor of plString::Format

Michael Hansen 12 years ago
parent
commit
60021923a2
  1. 11
      Sources/Plasma/CoreLib/HeadSpin.cpp
  2. 204
      Sources/Plasma/CoreLib/hsStlUtils.cpp
  3. 12
      Sources/Plasma/CoreLib/hsStlUtils.h
  4. 5
      Sources/Plasma/CoreLib/hsStream.cpp
  5. 3
      Sources/Plasma/CoreLib/hsStream.h
  6. 9
      Sources/Plasma/CoreLib/plString.cpp
  7. 2
      Sources/Plasma/CoreLib/plString.h
  8. 14
      Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp
  9. 2
      Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp
  10. 2
      Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp
  11. 6
      Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp
  12. 2
      Sources/Plasma/NucleusLib/pnMessage/plMessage.h
  13. 31
      Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp
  14. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.h
  15. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h
  16. 35
      Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp
  17. 11
      Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp
  18. 10
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp
  19. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h
  20. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp
  21. 8
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp
  22. 4
      Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp
  23. 3
      Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h
  24. 2
      Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp
  25. 20
      Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h
  26. 2
      Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp
  27. 2
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp
  28. 11
      Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp
  29. 8
      Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp
  30. 3
      Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp
  31. 6
      Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp
  32. 8
      Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.cpp
  33. 2
      Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.h

11
Sources/Plasma/CoreLib/HeadSpin.cpp

@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsStlUtils.h" #include "hsStlUtils.h"
#include "hsTemplates.h" #include "hsTemplates.h"
#include "plString.h"
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -214,6 +215,7 @@ void hsStatusMessageF(const char * fmt, ...)
#endif #endif
// TODO: Deprecate these in favor of plString
char * hsFormatStr(const char * fmt, ...) char * hsFormatStr(const char * fmt, ...)
{ {
va_list args; va_list args;
@ -225,8 +227,7 @@ char * hsFormatStr(const char * fmt, ...)
char * hsFormatStrV(const char * fmt, va_list args) char * hsFormatStrV(const char * fmt, va_list args)
{ {
std::string buf; plString buf = plString::IFormat(fmt, args);
xtl::formatv(buf,fmt,args);
return hsStrcpy(buf.c_str()); return hsStrcpy(buf.c_str());
} }
@ -460,6 +461,8 @@ char *hsWStringToString( const wchar_t *str )
// //
char** DisplaySystemVersion() char** DisplaySystemVersion()
{ {
// TODO: I so want to std::vector<plString> this, but that requires
// including more headers in HeadSpin.h :(
#if HS_BUILD_FOR_WIN32 #if HS_BUILD_FOR_WIN32
#ifndef VER_SUITE_PERSONAL #ifndef VER_SUITE_PERSONAL
#define VER_SUITE_PERSONAL 0x200 #define VER_SUITE_PERSONAL 0x200
@ -554,7 +557,7 @@ char** DisplaySystemVersion()
if ( osvi.dwMajorVersion <= 4 ) if ( osvi.dwMajorVersion <= 4 )
{ {
versionStrs.Append(hsStrcpy (xtl::format("version %d.%d %s (Build %d)\n", versionStrs.Append(hsStrcpy (plString::Format("version %d.%d %s (Build %d)\n",
osvi.dwMajorVersion, osvi.dwMajorVersion,
osvi.dwMinorVersion, osvi.dwMinorVersion,
osvi.szCSDVersion, osvi.szCSDVersion,
@ -562,7 +565,7 @@ char** DisplaySystemVersion()
} }
else else
{ {
versionStrs.Append(hsStrcpy (xtl::format("%s (Build %d)\n", versionStrs.Append(hsStrcpy (plString::Format("%s (Build %d)\n",
osvi.szCSDVersion, osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF).c_str())); osvi.dwBuildNumber & 0xFFFF).c_str()));
} }

204
Sources/Plasma/CoreLib/hsStlUtils.cpp

@ -59,7 +59,7 @@ std::wstring & trimleft(std::wstring & s, const wchar_t * charset)
std::string & trimright(std::string & s, const char * charset) std::string & trimright(std::string & s, const char * charset)
{ {
int idx = s.find_last_not_of(charset); size_t idx = s.find_last_not_of(charset);
if (std::string::npos == idx) if (std::string::npos == idx)
{ {
@ -77,7 +77,7 @@ std::string & trimright(std::string & s, const char * charset)
std::wstring & trimright(std::wstring & s, const wchar_t * charset) std::wstring & trimright(std::wstring & s, const wchar_t * charset)
{ {
int idx = s.find_last_not_of(charset); size_t idx = s.find_last_not_of(charset);
if (std::wstring::npos == idx) if (std::wstring::npos == idx)
{ {
@ -107,197 +107,6 @@ std::wstring & trim(std::wstring & s, const wchar_t * charset)
return s; return s;
} }
// c-string
std::string trim(const char * s, const char * charset)
{
std::string result = s;
trimleft(result,charset);
trimright(result,charset);
return result;
}
std::wstring trim(const wchar_t * s, const wchar_t * charset)
{
std::wstring result = s;
trimleft(result,charset);
trimright(result,charset);
return result;
}
// format
std::string format(const char * fmt, ...)
{
std::string result;
va_list args;
va_start(args,fmt);
formatv(result,fmt,args);
va_end(args);
return result;
}
std::wstring format(const wchar_t * fmt, ...)
{
std::wstring result;
va_list args;
va_start(args,fmt);
formatv(result,fmt,args);
va_end(args);
return result;
}
std::string formatv(const char * fmt, va_list args)
{
std::string result;
formatv( result, fmt, args );
return result;
}
std::wstring formatv(const wchar_t * fmt, va_list args)
{
std::wstring result;
formatv( result, fmt, args );
return result;
}
bool format(std::string & out, const char * fmt, ...)
{
va_list args;
va_start(args,fmt);
bool r = formatv(out,fmt,args);
va_end(args);
return r;
}
bool format(std::wstring & out, const wchar_t * fmt, ...)
{
va_list args;
va_start(args,fmt);
bool r = formatv(out,fmt,args);
va_end(args);
return r;
}
bool formatv(std::string & out, const char * fmt, va_list args)
{
#define kBufSz 2048
char buf[kBufSz];
char * pbuf = buf;
int len = 0;
int attempts = 0;
bool success = false;
const int kMaxAttempts = 40;
do
{
int maxlen = kBufSz*attempts+kBufSz-1;
len = hsVsnprintf(pbuf,maxlen,fmt,args);
attempts++;
success = (len>=0 && len<maxlen);
if (!success)
{
if (pbuf!=buf)
delete [] pbuf;
pbuf = new char[kBufSz+kBufSz*attempts];
}
}
while (!success && attempts<kMaxAttempts);
if (success)
{
pbuf[len] = '\0';
out = pbuf;
}
if (success)
{
pbuf[len] = '\0';
out = pbuf;
}
else
{
out = "";
if ( attempts==kMaxAttempts )
{
hsDebugMessage( "xtl::formatv - Max reallocs occurred while formatting string. Result is likely truncated!", 0 );
}
}
if (pbuf!=buf)
delete [] pbuf;
return success;
}
bool formatv(std::wstring & out, const wchar_t * fmt, va_list args)
{
#define kBufSz 2048
wchar_t buf[kBufSz];
wchar_t * pbuf = buf;
int len = 0;
int attempts = 0;
bool success = false;
const int kMaxAttempts = 40;
do
{
int maxlen = kBufSz*attempts+kBufSz-1;
len = hsVsnwprintf(pbuf,maxlen,fmt,args);
attempts++;
success = (len>=0 && len<maxlen);
if (!success)
{
if (pbuf!=buf)
delete [] pbuf;
pbuf = new wchar_t[kBufSz+kBufSz*attempts];
}
}
while (!success && attempts<kMaxAttempts);
if (success)
{
pbuf[len] = L'\0';
out = pbuf;
}
if (success)
{
pbuf[len] = L'\0';
out = pbuf;
}
else
{
out = L"";
if ( attempts==kMaxAttempts )
{
hsDebugMessage( "xtl::formatv - Max reallocs occurred while formatting wstring. Result is likely truncated!", 0 );
}
}
if (pbuf!=buf)
delete [] pbuf;
return success;
}
/*
typedef std::vector<std::string> StringVector;
typedef std::vector<std::wstring> WStringVector;
typedef std::list<std::string> StringList;
typedef std::list<std::wstring> WStringList;
typedef std::set<std::string> StringSet;
typedef std::set<std::wstring> WStringSet;
template bool GetStringGroup<StringList>(const std::string& s, StringList& group, char sep);
template bool GetStringGroup<WStringList>(const std::wstring& s, WStringList& group, wchar_t sep);
template bool GetStringGroup<StringVector>(const std::string& s, StringVector& group, char sep);
template bool GetStringGroup<WStringVector>(const std::wstring& s, WStringVector& group, wchar_t sep);
template bool GetStringGroup<StringSet>(const std::string& s, StringSet& group, char sep);
template bool GetStringGroup<WStringSet>(const std::wstring& s, WStringSet& group, wchar_t sep);
*/
template <typename T> bool GetStringGroup(const std::string& s, T& group, char sep) template <typename T> bool GetStringGroup(const std::string& s, T& group, char sep)
{ {
bool ret = false; bool ret = false;
@ -339,15 +148,6 @@ template <typename T> bool GetStringGroup(const std::wstring& s, T& group, wchar
return ret; return ret;
} }
/*
template bool GetStringGroupAsString<StringList>(const StringList& group, std::string& s, char sep);
template bool GetStringGroupAsString<WStringList>(const WStringList& group, std::wstring& s, wchar_t sep);
template bool GetStringGroupAsString<StringVector>(const StringVector& group, std::string& s, char sep);
template bool GetStringGroupAsString<WStringVector>(const WStringVector& group, std::wstring& s, wchar_t sep);
template bool GetStringGroupAsString<StringSet>(const StringSet& group, std::string& s, char sep);
template bool GetStringGroupAsString<WStringSet>(const WStringSet& group, std::wstring& s, wchar_t sep);
*/
template <typename T> bool GetStringGroupAsString(const T& group, std::string& s, char sep) template <typename T> bool GetStringGroupAsString(const T& group, std::string& s, char sep)
{ {
typename T::const_iterator it = group.begin(); typename T::const_iterator it = group.begin();

12
Sources/Plasma/CoreLib/hsStlUtils.h

@ -62,18 +62,6 @@ std::string & trimright(std::string & s, const char * charset=" \t\n\r");
std::wstring & trimright(std::wstring & s, const wchar_t * charset=L" \t\n\r"); std::wstring & trimright(std::wstring & s, const wchar_t * charset=L" \t\n\r");
std::string & trim(std::string & s, const char * charset=" \t\n\r"); std::string & trim(std::string & s, const char * charset=" \t\n\r");
std::wstring & trim(std::wstring & s, const wchar_t * charset=L" \t\n\r"); std::wstring & trim(std::wstring & s, const wchar_t * charset=L" \t\n\r");
// c-string trim
std::string trim(const char * s, const char * charset=" \t\n\r");
std::wstring trim(const wchar_t * s, const wchar_t * charset=L" \t\n\r");
// format
std::string format(const char * fmt, ...);
std::wstring format(const wchar_t * fmt, ...);
std::string formatv(const char * fmt, va_list args);
std::wstring formatv(const wchar_t * fmt, va_list args);
bool format(std::string & out, const char * fmt, ...);
bool format(std::wstring & out, const wchar_t * fmt, ...);
bool formatv(std::string & out, const char * fmt, va_list args);
bool formatv(std::wstring & out, const wchar_t * fmt, va_list args);
template <typename T> bool GetStringGroup(const std::string& s, T& group, char sep = ','); template <typename T> bool GetStringGroup(const std::string& s, T& group, char sep = ',');

5
Sources/Plasma/CoreLib/hsStream.cpp

@ -123,9 +123,8 @@ uint32_t hsStream::WriteFmt(const char * fmt, ...)
uint32_t hsStream::WriteFmtV(const char * fmt, va_list av) uint32_t hsStream::WriteFmtV(const char * fmt, va_list av)
{ {
std::string buf; plString buf = plString::IFormat(fmt, av);
xtl::formatv( buf, fmt, av ); return Write( buf.GetSize(), buf.c_str() );
return Write( buf.length(), buf.data() );
} }
uint32_t hsStream::WriteSafeStringLong(const plString &string) uint32_t hsStream::WriteSafeStringLong(const plString &string)

3
Sources/Plasma/CoreLib/hsStream.h

@ -83,6 +83,9 @@ public:
hsStream() : fBytesRead(0), fPosition(0) {} hsStream() : fBytesRead(0), fPosition(0) {}
virtual ~hsStream() { } virtual ~hsStream() { }
// Pre-filename-stringification shortcut:
bool Open_TEMP(const plString & filename, const char * mode = "rb") { return Open(filename.c_str(), mode); }
virtual bool Open(const char *, const char * = "rb")=0; virtual bool Open(const char *, const char * = "rb")=0;
virtual bool Open(const wchar_t *, const wchar_t * = L"rb")=0; virtual bool Open(const wchar_t *, const wchar_t * = L"rb")=0;
virtual bool Close()=0; virtual bool Close()=0;

9
Sources/Plasma/CoreLib/plString.cpp

@ -750,6 +750,15 @@ std::vector<plString> plString::Split(const char *split, size_t maxSplits) const
return result; return result;
} }
plString plString::Fill(size_t count, char c)
{
plStringBuffer<char> buf;
char *data = buf.CreateWritableBuffer(count + 1);
memset(data, c, count);
data[count] = 0;
return buf;
}
plString operator+(const plString &left, const plString &right) plString operator+(const plString &left, const plString &right)
{ {
plString cat; plString cat;

2
Sources/Plasma/CoreLib/plString.h

@ -299,6 +299,8 @@ public:
std::vector<plString> Split(const char *split, size_t maxSplits = kSizeAuto) const; std::vector<plString> Split(const char *split, size_t maxSplits = kSizeAuto) const;
std::vector<plString> Tokenize(const char *delims = " \t\r\n\f\v") const; std::vector<plString> Tokenize(const char *delims = " \t\r\n\f\v") const;
static plString Fill(size_t count, char c);
public: public:
struct less struct less
{ {

14
Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp

@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnKeyedObject/plKey.h" #include "pnKeyedObject/plKey.h"
#include "plString.h" #include "plString.h"
static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info); static bool DumpSpecificMsgInfo(plMessage* msg, plString& info);
plDispatchLog::plDispatchLog() : plDispatchLog::plDispatchLog() :
fLog(nil), fLog(nil),
@ -101,7 +101,7 @@ void plDispatchLog::LogStatusBarChange(const char* name, const char* action)
void plDispatchLog::LogLongReceive(const char* keyname, const char* className, uint32_t clonePlayerID, plMessage* msg, float ms) void plDispatchLog::LogLongReceive(const char* keyname, const char* className, uint32_t clonePlayerID, plMessage* msg, float ms)
{ {
std::string info; plString info;
if (DumpSpecificMsgInfo(msg, info)) if (DumpSpecificMsgInfo(msg, info))
fLog->AddLineF("%-30s[%7u](%-20s) took %6.1f ms to receive %s[%s]\n", keyname, clonePlayerID, className, ms, msg->ClassName(), info.c_str()); fLog->AddLineF("%-30s[%7u](%-20s) took %6.1f ms to receive %s[%s]\n", keyname, clonePlayerID, className, ms, msg->ClassName(), info.c_str());
else else
@ -195,7 +195,7 @@ void plDispatchLog::RemoveFilterExactType(uint16_t type)
#include "plResMgr/plKeyFinder.h" #include "plResMgr/plKeyFinder.h"
#include "plResMgr/plPageInfo.h" #include "plResMgr/plPageInfo.h"
static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info) static bool DumpSpecificMsgInfo(plMessage* msg, plString& info)
{ {
#ifndef PLASMA_EXTERNAL_RELEASE // Don't bloat up the external release with all these strings #ifndef PLASMA_EXTERNAL_RELEASE // Don't bloat up the external release with all these strings
pfKIMsg* kiMsg = pfKIMsg::ConvertNoRef(msg); pfKIMsg* kiMsg = pfKIMsg::ConvertNoRef(msg);
@ -257,7 +257,7 @@ static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info)
PrintKIType(kGZFlashUpdate); // flash an update without saving (for animation of GZFill in) PrintKIType(kGZFlashUpdate); // flash an update without saving (for animation of GZFill in)
PrintKIType(kNoCommand); PrintKIType(kNoCommand);
info = xtl::format("Type: %s Str: %s User: %s(%d) Delay: %f Int: %d", info = plString::Format("Type: %s Str: %s User: %s(%d) Delay: %f Int: %d",
typeName, typeName,
kiMsg->GetString() != "" ? kiMsg->GetString().c_str() : "(nil)", kiMsg->GetString() != "" ? kiMsg->GetString().c_str() : "(nil)",
kiMsg->GetUser() ? kiMsg->GetUser() : "(nil)", kiMsg->GetUser() ? kiMsg->GetUser() : "(nil)",
@ -298,14 +298,14 @@ static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info)
const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(loc); const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(loc);
if (pageInfo) if (pageInfo)
info += xtl::format("%s-%s ", pageInfo->GetAge(), pageInfo->GetPage()); info += plString::Format("%s-%s ", pageInfo->GetAge(), pageInfo->GetPage());
} }
} }
break; break;
case plClientMsg::kLoadAgeKeys: case plClientMsg::kLoadAgeKeys:
case plClientMsg::kReleaseAgeKeys: case plClientMsg::kReleaseAgeKeys:
info += xtl::format(" - Age: %s", clientMsg->GetAgeName()); info += plString::Format(" - Age: %s", clientMsg->GetAgeName());
break; break;
} }
return true; return true;
@ -321,7 +321,7 @@ static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info)
GetType(kOnRequest); GetType(kOnRequest);
GetType(kOnRemove); GetType(kOnRemove);
GetType(kOnReplace); GetType(kOnReplace);
xtl::format(info, "Obj: %s RefType: %s", refMsg->GetRef()->GetKeyName().c_str(), typeName); info = plString::Format("Obj: %s RefType: %s", refMsg->GetRef()->GetKeyName().c_str(), typeName);
return true; return true;
} }

2
Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp

@ -219,7 +219,7 @@ PyObject* plPythonPack::OpenPacked(const char* fileName)
{ {
char *buf = new char[size]; char *buf = new char[size];
uint32_t readSize = fPackStream->Read(size, buf); uint32_t readSize = fPackStream->Read(size, buf);
hsAssert(readSize <= size, xtl::format("Python PackFile %s: Incorrect amount of data, read %d instead of %d", hsAssert(readSize <= size, plString::Format("Python PackFile %s: Incorrect amount of data, read %d instead of %d",
fileName, readSize, size).c_str()); fileName, readSize, size).c_str());
// let the python marshal make it back into a code object // let the python marshal make it back into a code object

2
Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp

@ -331,7 +331,7 @@ void plDispatch::IMsgDispatch()
if (plNetObjectDebuggerBase::GetInstance()->IsDebugObject(ko)) if (plNetObjectDebuggerBase::GetInstance()->IsDebugObject(ko))
{ {
hsLogEntry(plNetObjectDebuggerBase::GetInstance()->LogMsg( hsLogEntry(plNetObjectDebuggerBase::GetInstance()->LogMsg(
xtl::format("<RCV> object:%s, GameMessage %s st=%.3f rt=%.3f", plString::Format("<RCV> object:%s, GameMessage %s st=%.3f rt=%.3f",
ko->GetKeyName().c_str(), msg->ClassName(), hsTimer::GetSysSeconds(), hsTimer::GetSeconds()).c_str())); ko->GetKeyName().c_str(), msg->ClassName(), hsTimer::GetSysSeconds(), hsTimer::GetSeconds()).c_str()));
} }
} }

6
Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp

@ -280,7 +280,7 @@ int plMsgStdStringHelper::Peek(std::string & stringref, hsStream* stream, const
stringref.resize(strlen); stringref.resize(strlen);
if (strlen){ if (strlen){
stream->LogRead(strlen,(void*)stringref.data(),"StdString"); stream->LogRead(strlen,(void*)stringref.data(),"StdString");
stream->LogStringString(xtl::format("Value: %s", stringref.data()).c_str()); stream->LogStringString(plString::Format("Value: %s", stringref.data()).c_str());
} }
} }
else else
@ -302,7 +302,7 @@ int plMsgStdStringHelper::PeekBig(std::string & stringref, hsStream* stream, co
stringref.resize(bufsz); stringref.resize(bufsz);
if (bufsz){ if (bufsz){
stream->LogRead(bufsz,(void*)stringref.data(),"StdString"); stream->LogRead(bufsz,(void*)stringref.data(),"StdString");
stream->LogStringString(xtl::format("Value: %s", stringref.data()).c_str()); stream->LogStringString(plString::Format("Value: %s", stringref.data()).c_str());
} }
} }
else else
@ -357,7 +357,7 @@ int plMsgCStringHelper::Peek(char *& str, hsStream* stream, const uint32_t peekO
str[strlen] = '\0'; str[strlen] = '\0';
if (strlen) { if (strlen) {
stream->LogRead(strlen,str,"CString"); stream->LogRead(strlen,str,"CString");
stream->LogStringString(xtl::format("Value: %s",str).c_str()); stream->LogStringString(plString::Format("Value: %s",str).c_str());
} }
} }
} }

2
Sources/Plasma/NucleusLib/pnMessage/plMessage.h

@ -157,8 +157,8 @@ public:
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Helpers for reading/writing these types: // Helpers for reading/writing these types:
// plString
// std::string // std::string
// xtl::istring
// c strings (char *) // c strings (char *)
// c arrays (type []) // c arrays (type [])

31
Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp

@ -317,45 +317,28 @@ void plGenericType::SetVar(Types t, unsigned int size, void* val)
} }
std::string plGenericType::GetAsStdString() const plString plGenericType::GetAsString() const
{ {
std::string s;
switch (fType) switch (fType)
{ {
case kInt : case kInt :
{ return plString::Format("%d", fI);
xtl::format(s,"%d",fI);
break;
}
case kBool : case kBool :
case kUInt : case kUInt :
{ return plString::Format("%u", fType==kBool?fB:fU);
xtl::format(s,"%u",fType==kBool?fB:fU);
break;
}
case kFloat : case kFloat :
case kDouble : case kDouble :
{ return plString::Format("%f", fType==kDouble?fD:fF);
xtl::format(s,"%f",fType==kDouble?fD:fF);
break;
}
case kChar : case kChar :
{ return plString::Format("%c", fC);
xtl::format(s,"%c",fC);
break;
}
case kAny : case kAny :
case kString : case kString :
{ return fS;
s = fS;
break;
}
case kNone : case kNone :
break; break;
default: default:
hsAssert(false,"plGenericType::GetAsStdString unknown type"); hsAssert(false,"plGenericType::GetAsStdString unknown type");
} }
return s; return plString::Null;
} }

2
Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.h

@ -117,7 +117,7 @@ public:
void SetType(Types t) { fType=t; } void SetType(Types t) { fType=t; }
uint8_t GetType( void ) const { return fType; } uint8_t GetType( void ) const { return fType; }
std::string GetAsStdString() const; plString GetAsString() const;
// implicit set // implicit set
void Set( int32_t i ) { fI = i; fType = kInt; } void Set( int32_t i ) { fI = i; fType = kInt; }

2
Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h

@ -192,7 +192,7 @@ public:
virtual int IsLocallyOwned(const plUoid&) const { hsAssert(false, "stub"); return 0; } virtual int IsLocallyOwned(const plUoid&) const { hsAssert(false, "stub"); return 0; }
virtual plNetGroupId GetEffectiveNetGroup(const plSynchedObject* obj) const { hsAssert(false, "stub"); return plNetGroup::kNetGroupUnknown; } virtual plNetGroupId GetEffectiveNetGroup(const plSynchedObject* obj) const { hsAssert(false, "stub"); return plNetGroup::kNetGroupUnknown; }
virtual int Update(double secs) { return hsOK;} virtual int Update(double secs) { return hsOK;}
virtual const char* GetServerLogTimeAsString(std::string& ts) const { hsAssert(false, "stub"); return nil; } virtual const char* GetServerLogTimeAsString(plString& ts) const { hsAssert(false, "stub"); return nil; }
virtual plUoid GetAgeSDLObjectUoid(const char* ageName) const { hsAssert(false, "stub"); return plUoid(); } virtual plUoid GetAgeSDLObjectUoid(const char* ageName) const { hsAssert(false, "stub"); return plUoid(); }
virtual void StayAlive(double secs) {} virtual void StayAlive(double secs) {}
virtual void QueueDisableNet( bool showDlg, const char msg[] ) {} virtual void QueueDisableNet( bool showDlg, const char msg[] ) {}

35
Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp

@ -69,19 +69,19 @@ public:
fIsZipped = wcscmp(plFileUtils::GetFileExt(reqFile), L"gz") == 0; fIsZipped = wcscmp(plFileUtils::GetFileExt(reqFile), L"gz") == 0;
} }
~plResDownloadStream() virtual ~plResDownloadStream()
{ {
if (fFilename) if (fFilename)
delete[] fFilename; delete[] fFilename;
} }
bool Open(const char* filename, const char* mode) virtual bool Open(const char* filename, const char* mode)
{ {
fFilename = hsStrcpy(filename); fFilename = hsStrcpy(filename);
return plZlibStream::Open(filename, mode); return plZlibStream::Open(filename, mode);
} }
uint32_t Write(uint32_t count, const void* buf) virtual uint32_t Write(uint32_t count, const void* buf)
{ {
fProgress->Increment((float)count); fProgress->Increment((float)count);
if (fIsZipped) if (fIsZipped)
@ -231,37 +231,34 @@ void plResPatcher::IssueRequest()
Request req = fRequests.front(); Request req = fRequests.front();
fRequests.pop(); fRequests.pop();
std::wstring title; plString title;
if (req.fType == kManifest) if (req.fType == kManifest)
{ {
char* eapSucksString = hsWStringToString(req.fFile.c_str()); PatcherLog(kMajorStatus, " Downloading manifest... %S", req.fFile.c_str());
PatcherLog(kMajorStatus, " Downloading manifest... %s", eapSucksString); title = plString::Format("Checking %S for updates...", req.fFile.c_str());
xtl::format(title, L"Checking %s for updates...", req.fFile.c_str());
NetCliFileManifestRequest(ManifestDownloaded, this, req.fFile.c_str()); NetCliFileManifestRequest(ManifestDownloaded, this, req.fFile.c_str());
delete[] eapSucksString;
} else if (req.fType == kFile) { } else if (req.fType == kFile) {
char* eapSucksString = hsWStringToString(req.fFriendlyName.c_str()); PatcherLog(kMajorStatus, " Downloading file... %S", req.fFriendlyName.c_str());
PatcherLog(kMajorStatus, " Downloading file... %s", eapSucksString); title = plString::Format("Downloading... %S", plFileUtils::GetFileName(req.fFriendlyName.c_str()));
xtl::format(title, L"Downloading... %s", plFileUtils::GetFileName(req.fFriendlyName.c_str()));
// If this is a PRP, we need to unload it from the ResManager // If this is a PRP, we need to unload it from the ResManager
if (stricmp(plFileUtils::GetFileExt(eapSucksString), "prp") == 0)
((plResManager*)hsgResMgr::ResMgr())->RemoveSinglePage(eapSucksString); plString filename = plString::FromWchar(req.fFriendlyName.c_str());
if (stricmp(plFileUtils::GetFileExt(filename.c_str()), "prp") == 0)
((plResManager*)hsgResMgr::ResMgr())->RemoveSinglePage(filename.c_str());
plFileUtils::EnsureFilePathExists(req.fFriendlyName.c_str()); plFileUtils::EnsureFilePathExists(req.fFriendlyName.c_str());
plResDownloadStream* stream = new plResDownloadStream(fProgress, req.fFile.c_str()); plResDownloadStream* stream = new plResDownloadStream(fProgress, req.fFile.c_str());
if(stream->Open(eapSucksString, "wb")) uint32_t i = stream->ReadBE32();
if (stream->Open_TEMP(filename, "wb"))
NetCliFileDownloadRequest(req.fFile.c_str(), stream, FileDownloaded, this); NetCliFileDownloadRequest(req.fFile.c_str(), stream, FileDownloaded, this);
else { else {
PatcherLog(kError, " Unable to create file %s", eapSucksString); PatcherLog(kError, " Unable to create file %s", filename.c_str());
Finish(false); Finish(false);
} }
delete[] eapSucksString;
} }
char* hack = hsWStringToString(title.c_str()); fProgress->SetTitle(title.c_str());
fProgress->SetTitle(hack);
delete[] hack;
} }
} }

11
Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp

@ -835,17 +835,16 @@ void plSceneInputInterface::ILinkOffereeToAge()
// We must have an owned copy of the age before we can offer it, so make one now // We must have an owned copy of the age before we can offer it, so make one now
plUUID guid(GuidGenerate()); plUUID guid(GuidGenerate());
info.SetAgeInstanceGuid(&guid); info.SetAgeInstanceGuid(&guid);
std::string title; plString title, desc;
std::string desc;
unsigned nameLen = plNetClientMgr::GetInstance()->GetPlayerName().GetSize(); unsigned nameLen = plNetClientMgr::GetInstance()->GetPlayerName().GetSize();
if (plNetClientMgr::GetInstance()->GetPlayerName().CharAt(nameLen - 1) == 's' || plNetClientMgr::GetInstance()->GetPlayerName().CharAt(nameLen - 1) == 'S') { if (plNetClientMgr::GetInstance()->GetPlayerName().CharAt(nameLen - 1) == 's' || plNetClientMgr::GetInstance()->GetPlayerName().CharAt(nameLen - 1) == 'S') {
xtl::format( title, "%s'", plNetClientMgr::GetInstance()->GetPlayerName().c_str() ); title = plString::Format( "%s'", plNetClientMgr::GetInstance()->GetPlayerName().c_str() );
xtl::format( desc, "%s' %s", plNetClientMgr::GetInstance()->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() ); desc = plString::Format( "%s' %s", plNetClientMgr::GetInstance()->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() );
} }
else { else {
xtl::format( title, "%s's", plNetClientMgr::GetInstance()->GetPlayerName().c_str() ); title = plString::Format( "%s's", plNetClientMgr::GetInstance()->GetPlayerName().c_str() );
xtl::format( desc, "%s's %s", plNetClientMgr::GetInstance()->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() ); desc = plString::Format( "%s's %s", plNetClientMgr::GetInstance()->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() );
} }
info.SetAgeUserDefinedName( title.c_str() ); info.SetAgeUserDefinedName( title.c_str() );

10
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp

@ -252,10 +252,10 @@ void plNetClientMgr::SetNullSend(bool on)
// //
// returns server time in the form "[m/d/y h:m:s]" // returns server time in the form "[m/d/y h:m:s]"
// //
const char* plNetClientMgr::GetServerLogTimeAsString(std::string& timestamp) const const char* plNetClientMgr::GetServerLogTimeAsString(plString& timestamp) const
{ {
const plUnifiedTime st=GetServerTime(); const plUnifiedTime st=GetServerTime();
xtl::format(timestamp, "{%02d/%02d %02d:%02d:%02d}", timestamp = plString::Format("{%02d/%02d %02d:%02d:%02d}",
st.GetMonth(), st.GetDay(), st.GetHour(), st.GetMinute(), st.GetSecond()); st.GetMonth(), st.GetDay(), st.GetHour(), st.GetMinute(), st.GetSecond());
return timestamp.c_str(); return timestamp.c_str();
} }
@ -265,10 +265,10 @@ const char* plNetClientMgr::GetServerLogTimeAsString(std::string& timestamp) con
// //
const char* ProcessTab(const char* fmt) const char* ProcessTab(const char* fmt)
{ {
static std::string s; static plString s;
if (fmt && *fmt=='\t') if (fmt && *fmt=='\t')
{ {
s = xtl::format(" %s", fmt); s = plString::Format(" %s", fmt);
return s.c_str(); return s.c_str();
} }
return fmt; return fmt;
@ -283,7 +283,7 @@ bool plNetClientMgr::Log(const char* str) const
return true; return true;
// prepend raw time // prepend raw time
std::string buf2 = xtl::format("%.2f %s", hsTimer::GetSeconds(), ProcessTab(str)); plString buf2 = plString::Format("%.2f %s", hsTimer::GetSeconds(), ProcessTab(str));
if ( GetConsoleOutput() ) if ( GetConsoleOutput() )
hsStatusMessage(buf2.c_str()); hsStatusMessage(buf2.c_str());

2
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h

@ -348,7 +348,7 @@ public:
// time converters // time converters
plUnifiedTime GetServerTime() const; plUnifiedTime GetServerTime() const;
const char* GetServerLogTimeAsString(std::string& ts) const; const char* GetServerLogTimeAsString(plString& ts) const;
double GetCurrentAgeElapsedSeconds() const; double GetCurrentAgeElapsedSeconds() const;
float GetCurrentAgeTimeOfDayPercent() const; float GetCurrentAgeTimeOfDayPercent() const;

2
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp

@ -437,7 +437,7 @@ int plNetClientMgr::SendMsg(plNetMessage* msg)
if (plNetMsgGameMessage::ConvertNoRef(msg)) if (plNetMsgGameMessage::ConvertNoRef(msg))
SetFlagsBit(kSendingActions); SetFlagsBit(kSendingActions);
plCheckNetMgrResult_ValReturn(ret,(char*)xtl::format("Failed to send %s, NC ret=%d", plCheckNetMgrResult_ValReturn(ret, plString::Format("Failed to send %s, NC ret=%d",
msg->ClassName(), ret).c_str()); msg->ClassName(), ret).c_str());
return ret; return ret;

8
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp

@ -250,15 +250,15 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgSDLState)
plStateDataRecord* sdRec = des ? new plStateDataRecord(des) : nil; plStateDataRecord* sdRec = des ? new plStateDataRecord(des) : nil;
if (!sdRec || sdRec->GetDescriptor()->GetVersion()!=ver) if (!sdRec || sdRec->GetDescriptor()->GetVersion()!=ver)
{ {
std::string err; plString err;
if (!sdRec) if (!sdRec)
err = xtl::format( "SDL descriptor %s missing, v=%d", descName.c_str(), ver); err = plString::Format( "SDL descriptor %s missing, v=%d", descName.c_str(), ver);
else else
err = xtl::format( "SDL descriptor %s, version mismatch, server v=%d, client v=%d", err = plString::Format( "SDL descriptor %s, version mismatch, server v=%d, client v=%d",
descName.c_str(), ver, sdRec->GetDescriptor()->GetVersion()); descName.c_str(), ver, sdRec->GetDescriptor()->GetVersion());
hsAssert(false, err.c_str()); hsAssert(false, err.c_str());
nc->ErrorMsg(const_cast<char*>(err.c_str())); nc->ErrorMsg(err.c_str());
// Post Quit message // Post Quit message
nc->QueueDisableNet(true, "SDL Desc Problem"); nc->QueueDisableNet(true, "SDL Desc Problem");

4
Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp

@ -358,9 +358,9 @@ const char * plAgeInfoStruct::GetDisplayName() const
{ {
int seq = GetAgeSequenceNumber(); int seq = GetAgeSequenceNumber();
if ( seq>0 ) if ( seq>0 )
xtl::format( fDisplayName, "%s(%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() ); fDisplayName = plString::Format( "%s(%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() );
else else
xtl::format( fDisplayName, "%s %s", GetAgeUserDefinedName(), GetAgeInstanceName() ); fDisplayName = plString::Format( "%s %s", GetAgeUserDefinedName(), GetAgeInstanceName() );
return fDisplayName.c_str(); return fDisplayName.c_str();
} }

3
Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h

@ -84,7 +84,8 @@ class plAgeInfoStruct : public plCreatable
// The language of the client that created this age // The language of the client that created this age
int32_t fAgeLanguage; int32_t fAgeLanguage;
mutable std::string fDisplayName; // Evil (TODO: Nuke this)
mutable plString fDisplayName;
enum enum
{ {

2
Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp

@ -226,7 +226,7 @@ int plNetMessage::PeekBuffer(const char* bufIn, int bufLen, uint32_t peekOptions
readStream.LogSetList(el); readStream.LogSetList(el);
readStream.Init(bufLen, bufIn); readStream.Init(bufLen, bufIn);
readStream.LogSubStreamStart("plNetMessage"); readStream.LogSubStreamStart("plNetMessage");
readStream.LogStringString(xtl::format("ClassName: %s",this->ClassName()).c_str()); readStream.LogStringString(plString::Format("ClassName: %s", this->ClassName()).c_str());
int ret; int ret;
if (peekOptions & kBaseClassOnly) if (peekOptions & kBaseClassOnly)
{ {

20
Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h

@ -646,13 +646,11 @@ public:
bool GetRequestingState() const { return (fPageFlags & kRequestState) != 0; } bool GetRequestingState() const { return (fPageFlags & kRequestState) != 0; }
// debug // debug
std::string AsStdString() const plString AsString() const
{ {
std::string s; return plString::Format("pageFlags:%02X, paging %s, requestingState:%s, resetting=%d",
xtl::format(s,"pageFlags:%02X, paging %s, requestingState:%s, resetting=%d",fPageFlags, fPageFlags, (fPageFlags&kPagingOut)?"out":"in",
(fPageFlags&kPagingOut)?"out":"in", (fPageFlags&kRequestState)?"yes":"no", (fPageFlags&kRequestState)?"yes":"no", (fPageFlags & kResetList)!=0);
(fPageFlags & kResetList)!=0);
return s;
} }
}; };
@ -755,11 +753,9 @@ public:
void WriteVersion(hsStream* s, hsResMgr* mgr); void WriteVersion(hsStream* s, hsResMgr* mgr);
// debug // debug
std::string AsStdString() const plString AsString() const
{ {
std::string s; return plString::Format("len=%d",fVoiceData.size());
xtl::format(s,"len=%d",fVoiceData.size());
return s;
} }
}; };
@ -795,7 +791,7 @@ public:
void WriteVersion(hsStream* s, hsResMgr* mgr); void WriteVersion(hsStream* s, hsResMgr* mgr);
// debug // debug
plString AsStdString() const plString AsString() const
{ {
return plString::Format("lockReq=%d, %s",fLockRequest, plNetMsgStreamedObject::AsString().c_str()); return plString::Format("lockReq=%d, %s",fLockRequest, plNetMsgStreamedObject::AsString().c_str());
} }
@ -979,7 +975,7 @@ public:
const hsBitVector& GetRegionsICareAbout() const { return fRegionsICareAbout; } const hsBitVector& GetRegionsICareAbout() const { return fRegionsICareAbout; }
const hsBitVector& GetRegionsImIn() const { return fRegionsImIn; } const hsBitVector& GetRegionsImIn() const { return fRegionsImIn; }
plString AsStdString() const plString AsString() const
{ {
plString b1, b2; plString b1, b2;
int i; int i;

2
Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp

@ -168,7 +168,7 @@ void plRegistryPageNode::LoadKeys()
hsStream* stream = OpenStream(); hsStream* stream = OpenStream();
if (!stream) if (!stream)
{ {
hsAssert(0, xtl::format("plRegistryPageNode::LoadKeysFromSource - bad stream %s,%s", hsAssert(0, plString::Format("plRegistryPageNode::LoadKeysFromSource - bad stream %s,%s",
GetPageInfo().GetAge(), GetPageInfo().GetPage()).c_str()); GetPageInfo().GetAge(), GetPageInfo().GetPage()).c_str());
return; return;
} }

2
Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp

@ -1192,7 +1192,7 @@ void plResManager::PageInRoom(const plLocation& page, uint16_t objClassToRef, pl
kResMgrLog(1, ILog(1, "...IGNORING pageIn request; verification failed! (%s)", condStr.c_str())); kResMgrLog(1, ILog(1, "...IGNORING pageIn request; verification failed! (%s)", condStr.c_str()));
std::string msg = xtl::format("Data Problem: Age:%s Page:%s Error:%s", plString msg = plString::Format("Data Problem: Age:%s Page:%s Error:%s",
pageNode->GetPageInfo().GetAge(), pageNode->GetPageInfo().GetPage(), condStr.c_str()); pageNode->GetPageInfo().GetAge(), pageNode->GetPageInfo().GetPage(), condStr.c_str());
hsMessageBox(msg.c_str(), "Error", hsMessageBoxNormal, hsMessageBoxIconError); hsMessageBox(msg.c_str(), "Error", hsMessageBoxNormal, hsMessageBoxIconError);

11
Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp

@ -70,7 +70,7 @@ void plSDLParser::DebugMsgV(const char* fmt, va_list args) const
{ {
if (strlen(fmt)==nil) if (strlen(fmt)==nil)
return; return;
hsStatusMessage(xtl::formatv(fmt,args).c_str()); hsStatusMessage(plString::IFormat(fmt,args).c_str());
} }
// //
@ -109,7 +109,7 @@ bool plSDLParser::IParseStateDesc(const char* fileName, hsStream* stream, char t
if (!strcmp(token, "VERSION")) if (!strcmp(token, "VERSION"))
{ {
// read desc version // read desc version
hsAssert(curDesc, xtl::format("Syntax problem with .sdl file, fileName=%s", fileName).c_str()); hsAssert(curDesc, plString::Format("Syntax problem with .sdl file, fileName=%s", fileName).c_str());
if (stream->GetToken(token, kTokenLen)) if (stream->GetToken(token, kTokenLen))
{ {
int v=atoi(token); int v=atoi(token);
@ -119,14 +119,14 @@ bool plSDLParser::IParseStateDesc(const char* fileName, hsStream* stream, char t
} }
else else
{ {
hsAssert(false, xtl::format("Error parsing state desc, missing VERSION, fileName=%s", hsAssert(false, plString::Format("Error parsing state desc, missing VERSION, fileName=%s",
fileName).c_str()); fileName).c_str());
ok = false; ok = false;
} }
} }
else else
{ {
hsAssert(false, xtl::format("Error parsing state desc, fileName=%s", fileName).c_str()); hsAssert(false, plString::Format("Error parsing state desc, fileName=%s", fileName).c_str());
ok = false; ok = false;
} }
@ -135,7 +135,8 @@ bool plSDLParser::IParseStateDesc(const char* fileName, hsStream* stream, char t
ok = ( plSDLMgr::GetInstance()->FindDescriptor(curDesc->GetName(), curDesc->GetVersion())==nil ); ok = ( plSDLMgr::GetInstance()->FindDescriptor(curDesc->GetName(), curDesc->GetVersion())==nil );
if ( !ok ) if ( !ok )
{ {
std::string err = xtl::format( "Found duplicate SDL descriptor for %s version %d.\nFailed to parse file: %s", curDesc->GetName(), curDesc->GetVersion(), fileName ); plString err = plString::Format( "Found duplicate SDL descriptor for %s version %d.\nFailed to parse file: %s",
curDesc->GetName().c_str(), curDesc->GetVersion(), fileName );
plNetApp::StaticErrorMsg( err.c_str() ); plNetApp::StaticErrorMsg( err.c_str() );
hsAssert( false, err.c_str() ); hsAssert( false, err.c_str() );
} }

8
Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp

@ -2683,8 +2683,8 @@ void plSDStateVariable::DumpToObjectDebugger(bool dirtyOnly, int level) const
pad += " "; pad += " ";
int cnt = dirtyOnly ? GetDirtyCount() : GetUsedCount(); int cnt = dirtyOnly ? GetDirtyCount() : GetUsedCount();
dbg->LogMsg(xtl::format( "%sSDVar, name:%s dirtyOnly:%d count:%d", dbg->LogMsg(plString::Format( "%sSDVar, name:%s dirtyOnly:%d count:%d",
pad.c_str(), GetName(), dirtyOnly, cnt).c_str()); pad.c_str(), GetName().c_str(), dirtyOnly, cnt).c_str());
for(i=0;i<GetCount();i++) for(i=0;i<GetCount();i++)
{ {
@ -2704,8 +2704,8 @@ void plSDStateVariable::DumpToStream(hsStream* stream, bool dirtyOnly, int level
pad += " "; pad += " ";
int cnt = dirtyOnly ? GetDirtyCount() : GetUsedCount(); int cnt = dirtyOnly ? GetDirtyCount() : GetUsedCount();
stream->WriteString(xtl::format( "%sSDVar, name:%s dirtyOnly:%d count:%d", stream->WriteString(plString::Format( "%sSDVar, name:%s dirtyOnly:%d count:%d",
pad.c_str(), GetName(), dirtyOnly, cnt).c_str()); pad.c_str(), GetName().c_str(), dirtyOnly, cnt).c_str());
for(i=0;i<GetCount();i++) for(i=0;i<GetCount();i++)
{ {

3
Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp

@ -873,8 +873,7 @@ bool plStatusLog::IPrintLineToFile( const char *line, uint32_t count )
{ {
#if HS_BUILD_FOR_WIN32 #if HS_BUILD_FOR_WIN32
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
std::string str; plString str = plString::Format( "%.*s\n", count, line );
xtl::format( str, "%.*s\n", count, line );
OutputDebugString( str.c_str() ); OutputDebugString( str.c_str() );
#endif #endif
#else #else

6
Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp

@ -310,7 +310,7 @@ const char* plUnifiedTime::Print() const
// short year, month, day, hour, minute, second; // short year, month, day, hour, minute, second;
// GetTime(year, month, day, hour, minute, second); // GetTime(year, month, day, hour, minute, second);
// //
// xtl::format(s,"yr %d mo %d day %d hour %d min %d sec %d", // s = plString::Format("yr %d mo %d day %d hour %d min %d sec %d",
// year, month, day, hour, minute, second); // year, month, day, hour, minute, second);
s = Format("%c"); s = Format("%c");
@ -319,8 +319,8 @@ const char* plUnifiedTime::Print() const
const char* plUnifiedTime::PrintWMillis() const const char* plUnifiedTime::PrintWMillis() const
{ {
static std::string s; static plString s;
xtl::format(s,"%s,s:%lu,ms:%d", s = plString::Format("%s,s:%lu,ms:%d",
Print(), (unsigned long)GetSecs(), GetMillis() ); Print(), (unsigned long)GetSecs(), GetMillis() );
return s.c_str(); return s.c_str();
} }

8
Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.cpp

@ -91,11 +91,9 @@ void plDniCoordinateInfo::Write( hsStream* s, hsResMgr* mgr )
s->WriteLE( fTorans ); s->WriteLE( fTorans );
} }
std::string plDniCoordinateInfo::AsStdString( int level ) const plString plDniCoordinateInfo::AsString( int level ) const
{ {
std::string result; plString space = plString::Fill( level, ' ' );
std::string space( level, ' ' ); return plString::Format( "%sDniCoords[%d,%d,%d]", space.c_str(), fHSpans, fVSpans, fTorans );
xtl::format( result, "%sDniCoords[%d,%d,%d]", space.c_str(), fHSpans, fVSpans, fTorans );
return result;
} }
#endif // def CLIENT #endif // def CLIENT

2
Sources/Plasma/PubUtilLib/plVault/plDniCoordinateInfo.h

@ -80,7 +80,7 @@ public:
void Write( hsStream* s, hsResMgr* mgr ); void Write( hsStream* s, hsResMgr* mgr );
// debug // debug
std::string AsStdString( int level=0 ) const; plString AsString( int level=0 ) const;
}; };

Loading…
Cancel
Save