Browse Source

Clean up some miscellaneous non-optimal string uses

Michael Hansen 12 years ago
parent
commit
5fa72a086f
  1. 14
      Sources/Plasma/CoreLib/plString.h
  2. 2
      Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp
  3. 2
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp
  4. 2
      Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp
  5. 2
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp
  6. 2
      Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp
  7. 2
      Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.h
  8. 2
      Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp
  9. 8
      Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp
  10. 7
      Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp
  11. 2
      Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp

14
Sources/Plasma/CoreLib/plString.h

@ -658,15 +658,11 @@ size_t ustrlen(const UniChar *ustr, size_t max = plString::kSizeAuto);
#if HS_BUILD_FOR_WIN32
# define PATH_SEPARATOR '\\'
# define WPATH_SEPARATOR L'\\'
# define PATH_SEPARATOR_STR "\\"
# define WPATH_SEPARATOR_STR L"\\"
# define PATH_SEPARATOR '\\'
# define PATH_SEPARATOR_STR "\\"
#else
# define PATH_SEPARATOR '/'
# define WPATH_SEPARATOR L'/'
# define PATH_SEPARATOR_STR "/"
# define WPATH_SEPARATOR_STR L"/"
# define PATH_SEPARATOR '/'
# define PATH_SEPARATOR_STR "/"
#endif
/* plFileName - custom extension of plString for manipulating filenames */
@ -687,7 +683,7 @@ public:
static plFileName Join(const plFileName &base, const plFileName &path);
// VS doesn't do variadic templates, and we don't want to use const char *
// TODO: Make this more efficient
static plFileName Join(const plFileName &base, const plFileName &path,
const plFileName& path2)
{ return Join(Join(base, path), path2); }

2
Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp

@ -275,7 +275,7 @@ void plSoundBuffer::Write( hsStream *s, hsResMgr *mgr )
s->WriteSafeString( fFileName );
}
else
s->WriteSafeString( nil );
s->WriteSafeString( "" );
s->WriteLE( fHeader.fFormatTag );
s->WriteLE( fHeader.fNumChannels );

2
Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp

@ -1735,7 +1735,7 @@ void plArmatureMod::Write(hsStream *stream, hsResMgr *mgr)
stream->WriteLEFloat(fPhysHeight);
stream->WriteLEFloat(fPhysWidth);
stream->WriteSafeString(fAnimationPrefix.c_str());
stream->WriteSafeString(fAnimationPrefix);
stream->WriteSafeString(fBodyAgeName.c_str());
stream->WriteSafeString(fBodyFootstepSoundPage.c_str());
}

2
Sources/Plasma/PubUtilLib/plContainer/plConfigInfo.cpp

@ -1116,7 +1116,7 @@ bool plWWWAuthenticateConfigSource::ReadInto(plConfigInfo & configInfo, KAddValu
end = i;
plString buf = fAuth.Substr(begin, end-begin);
if(!ReadString(buf.c_str()))
if (!ReadString(buf))
{
// TODO log warning here
}

2
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp

@ -601,7 +601,7 @@ static void INetCliAuthAgeRequestCallback (
LogMsg(
kLogPerf,
L"Connecting to game server %s, ageInstId %s",
L"Connecting to game server %S, ageInstId %S",
gameAddrStr.c_str(),
ageInstIdStr.c_str()
);

2
Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp

@ -472,7 +472,7 @@ void D3DSURF_MEMDEL(IDirect3DCubeTexture9* cTex) {}
#endif // PLASMA_EXTERNAL_RELEASE
#ifndef PLASMA_EXTERNAL_RELEASE
void plDXPipeline::ProfilePoolMem(D3DPOOL poolType, uint32_t size, bool add, char *id)
void plDXPipeline::ProfilePoolMem(D3DPOOL poolType, uint32_t size, bool add, const char *id)
{
switch( poolType )
{

2
Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.h

@ -709,7 +709,7 @@ public:
static void AllocManagedVertex(uint32_t sz) { fVtxManaged += sz; }
#ifndef PLASMA_EXTERNAL_RELEASE
static void ProfilePoolMem(D3DPOOL poolType, uint32_t size, bool add, char *id);
static void ProfilePoolMem(D3DPOOL poolType, uint32_t size, bool add, const char *id);
#endif // PLASMA_EXTERNAL_RELEASE
// From a D3DFORMAT enumeration, return the bit depth associated with it.

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

@ -310,7 +310,7 @@ bool plSDLParser::IParseVarDesc(const char* fileName, hsStream* stream, char tok
}
}
DebugMsg((char*)dbgStr.c_str());
DebugMsg(dbgStr.c_str());
return skipNext;
}

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

@ -116,7 +116,7 @@ void plStateVarNotificationInfo::Write(hsStream* s, uint32_t writeOptions) const
{
uint8_t saveFlags=0; // unused
s->WriteLE(saveFlags);
s->WriteSafeString(fHintString.c_str());
s->WriteSafeString(fHintString);
}
/////////////////////////////////////////////////////
@ -2325,7 +2325,7 @@ void plSimpleStateVariable::DumpToStream(hsStream* stream, bool dirtyOnly, int l
plString logMsg = plString::Format( "%sSimpleVar, name:%s[%d]", pad.c_str(), GetName().c_str(), GetCount());
if (GetCount()>1)
{
stream->WriteString(logMsg.c_str()); // it's going to be a long msg, so print it on its own line
stream->WriteString(logMsg); // it's going to be a long msg, so print it on its own line
logMsg = "";
}
@ -2348,7 +2348,7 @@ void plSimpleStateVariable::DumpToStream(hsStream* stream, bool dirtyOnly, int l
if ( !dirtyOnly )
logMsg += plString::Format( " dirty:%d", IsDirty() );
stream->WriteString(logMsg.c_str());
stream->WriteString(logMsg);
logMsg = "";
}
}
@ -2704,7 +2704,7 @@ void plSDStateVariable::DumpToStream(hsStream* stream, bool dirtyOnly, int level
int cnt = dirtyOnly ? GetDirtyCount() : GetUsedCount();
stream->WriteString(plString::Format( "%sSDVar, name:%s dirtyOnly:%d count:%d",
pad.c_str(), GetName().c_str(), dirtyOnly, cnt).c_str());
pad.c_str(), GetName().c_str(), dirtyOnly, cnt));
for(i=0;i<GetCount();i++)
{

7
Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp

@ -145,13 +145,13 @@ void plStatusLogMgr::IPathAppend( wchar_t *base, const wchar_t *extra, unsign
bool needsSeparator = false;
if (baseLen >= 1)
needsSeparator = (base[baseLen - 1] != WPATH_SEPARATOR);
needsSeparator = (base[baseLen - 1] != PATH_SEPARATOR);
if (needsSeparator)
{
if ((baseLen + 1 + 1) >= maxLen)
return; // abort, buffer isn't big enough
base[baseLen] = WPATH_SEPARATOR;
base[baseLen] = PATH_SEPARATOR;
++baseLen;
base[baseLen] = '\0';
}
@ -533,12 +533,11 @@ void plStatusLog::IFini( void )
delete [] fColors;
}
void plStatusLog::IParseFileName(wchar_t* file, size_t fnsize, wchar_t* fileNoExt, wchar_t** ext) const
{
const wchar_t *base = plStatusLogMgr::IGetBasePath();
if( wcslen( base ) != nil )
hsSnwprintf( file, fnsize, L"%s%s%s", base, WPATH_SEPARATOR_STR, fFilename.c_str() );
hsSnwprintf( file, fnsize, L"%s%S%s", base, PATH_SEPARATOR_STR, fFilename.c_str() );
else
wcscpy( file, fFilename.c_str() );

2
Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp

@ -455,7 +455,7 @@ void VaultAgeLinkNode::AddSpawnPoint (const plSpawnPointInfo & point) {
plSpawnPointVec points;
GetSpawnPoints( &points );
if ( std::find_if( points.begin(), points.end(), MatchesSpawnPointTitle( point.fTitle.c_str() ) )!=points.end() )
if ( std::find_if( points.begin(), points.end(), MatchesSpawnPointTitle( point.fTitle ) )!=points.end() )
return;
// only check to see if the titles are the same...

Loading…
Cancel
Save