diff --git a/Sources/Plasma/CoreLib/plString.cpp b/Sources/Plasma/CoreLib/plString.cpp index 81a3d7f5..57c0c422 100644 --- a/Sources/Plasma/CoreLib/plString.cpp +++ b/Sources/Plasma/CoreLib/plString.cpp @@ -513,17 +513,21 @@ plString plString::IFormat(const char *fmt, va_list vptr) for ( ;; ) { va_copy(vptr, vptr_save); plStringBuffer bigbuffer; - char *data = bigbuffer.CreateWritableBuffer(size); + char *data = bigbuffer.CreateWritableBuffer(size-1); chars = vsnprintf(data, size, fmt, vptr); - if (chars >= 0) - return bigbuffer; + if (chars >= 0) { + // We need to construct a new string here so the length + // parameter is accurate :( + return plString::FromUtf8(bigbuffer.GetData(), chars); + } size *= 2; + hsAssert(size > 0, "Formatted string output is waaaaay too long"); } } else if (chars >= 256) { va_copy(vptr, vptr_save); plStringBuffer bigbuffer; - char *data = bigbuffer.CreateWritableBuffer(chars+1); + char *data = bigbuffer.CreateWritableBuffer(chars); vsnprintf(data, chars+1, fmt, vptr); return bigbuffer; } diff --git a/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp b/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp index bc9d197c..330fe267 100644 --- a/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp @@ -249,7 +249,6 @@ void plResPatcher::IssueRequest() plFileUtils::EnsureFilePathExists(req.fFriendlyName.c_str()); plResDownloadStream* stream = new plResDownloadStream(fProgress, req.fFile.c_str()); - uint32_t i = stream->ReadBE32(); if (stream->Open_TEMP(filename, "wb")) NetCliFileDownloadRequest(req.fFile.c_str(), stream, FileDownloaded, this); else { diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp index 150bd7f2..2827daf0 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp @@ -353,16 +353,6 @@ void plAgeInfoStruct::Clear() fAgeLanguage = -1; } -const char * plAgeInfoStruct::GetDisplayName() const -{ - int seq = GetAgeSequenceNumber(); - if ( seq>0 ) - fDisplayName = plString::Format( "%s(%d) %s", GetAgeUserDefinedName(), seq, GetAgeInstanceName() ); - else - fDisplayName = plString::Format( "%s %s", GetAgeUserDefinedName(), GetAgeInstanceName() ); - return fDisplayName.c_str(); -} - //////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h index e9c0cb68..43a68608 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.h @@ -85,9 +85,6 @@ class plAgeInfoStruct : public plCreatable // The language of the client that created this age int32_t fAgeLanguage; - // Evil (TODO: Nuke this) - mutable plString fDisplayName; - enum { kHasAgeFilename = 1<<0, @@ -147,8 +144,6 @@ public: void Read( hsStream * s, hsResMgr* ); void Write( hsStream * s, hsResMgr* ); - const char * GetDisplayName() const; - plString AsString() const; }; @@ -305,48 +300,4 @@ public: virtual void WriteVersion(hsStream* s, hsResMgr* mgr); }; -//////////////////////////////////////////////////////////////////// - -//class plVaultAgeInfoNode; -//class plAgeLinkingInfo : public plCreatable -//{ -// int fLinkingRules; -// uint32_t fPlayerID; -// bool8 fSuperUser; -// mutable plAgeInfoStruct fAgeInfo; -// mutable plNetServerSessionInfo fServerInfo; -// -//public: -// plAgeLinkingInfo(); -// -// CLASSNAME_REGISTER( plAgeLinkingInfo ); -// GETINTERFACE_ANY( plAgeLinkingInfo, plCreatable ); -// -// int GetLinkingRules( void ) const { return fLinkingRules;} -// void SetLinkingRules( int v ) { fLinkingRules=v;} -// uint32_t GetPlayerID( void ) const { return fPlayerID;} -// void SetPlayerID( uint32_t v ) { fPlayerID=v;} -// void SetSuperUser(bool b) { fSuperUser=b; } -// bool GetSuperUser() const { return fSuperUser ? true : false; } -// -// plAgeInfoStruct * GetAgeInfo(); -// const plAgeInfoStruct * GetAgeInfo() const; -// -// // initializes info with age name and guid for you. -// plNetServerSessionInfo * GetServerInfo(); -// const plNetServerSessionInfo * GetServerInfo() const; -// const plNetServerSessionInfo * AsServerInfo() const; -// -// void Clear( void ); -// void CopyFrom( const plAgeLinkingInfo * other ); -// void CopyFrom( const plVaultAgeInfoNode * node ); -// void CopyFrom( const plNetServerSessionInfo * info ); -// void CopyFrom( const plAgeInfoStruct * info ); -// -// void Read(hsStream* s, hsResMgr* mgr=nil); -// void Write(hsStream* s, hsResMgr* mgr=nil); -// -// std::string AsStdString() const; -//}; - #endif // plNetServerSessionInfo_h_inc