Skip to content

Commit bc05aae

Browse files
committed
refactor: Remove or replace some superfluous empty C strings
1 parent 7751544 commit bc05aae

File tree

31 files changed

+44
-51
lines changed

31 files changed

+44
-51
lines changed

Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void GameSpyInfo::reset( void )
8585
m_localStagingRoomID = 0;
8686
m_localStagingRoom.reset();
8787
m_gotGroupRoomList = false;
88-
m_localName = "";
88+
m_localName.clear();
8989
m_localProfileID = 0;
9090
m_maxMessagesPerUpdate = 100;
9191

@@ -194,7 +194,7 @@ void GameSpyInfo::setGameOptions( void )
194194
req.gameOptions.numPlayers = 0;
195195
req.gameOptions.numObservers = 0;
196196
Int numOpenSlots = 0;
197-
AsciiString playerInfo = "";
197+
AsciiString playerInfo;
198198
for (i=0; i<MAX_SLOTS; ++i)
199199
{
200200
Int wins = 0, losses = 0, profileID = 0;

Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ class PeerThreadClass : public ThreadClass
197197
m_isConnecting = m_isConnected = false;
198198
m_groupRoomID = m_profileID = 0;
199199
m_nextStagingServer = 1; m_stagingServers.clear();
200-
m_pingStr = ""; m_mapName = ""; m_ladderIP = ""; m_isHosting = false;
200+
m_pingStr = "";
201+
m_mapName = "";
202+
m_ladderIP = "";
203+
m_isHosting = false;
201204
for (Int i=0; i<MAX_SLOTS; ++i)
202205
{
203206
m_playerNames[i] = "";
@@ -766,7 +769,7 @@ static void QRServerKeyCallback
766769
t->stopHostingAlready(peer);
767770

768771
#ifdef DEBUG_LOGGING
769-
AsciiString val = "";
772+
AsciiString val;
770773
#define ADD(x) { qr2_buffer_add(buffer, x); val = x; }
771774
#define ADDINT(x) { qr2_buffer_add_int(buffer, x); val.format("%d",x); }
772775
#else
@@ -860,7 +863,7 @@ static void QRPlayerKeyCallback
860863
#undef ADD
861864
#undef ADDINT
862865
#ifdef DEBUG_LOGGING
863-
AsciiString val = "";
866+
AsciiString val;
864867
#define ADD(x) { qr2_buffer_add(buffer, x); val = x; }
865868
#define ADDINT(x) { qr2_buffer_add_int(buffer, x); val.format("%d",x); }
866869
#else
@@ -1103,7 +1106,7 @@ static SerialAuthResult doCDKeyAuthentication( PEER peer )
11031106
if (!peer)
11041107
return retval;
11051108

1106-
AsciiString s = "";
1109+
AsciiString s;
11071110
if (GetStringFromRegistry("\\ergc", "", s) && s.isNotEmpty())
11081111
{
11091112
#ifdef SERVER_DEBUGGING

Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ PSPlayerStats GameSpyPSMessageQueueInterface::parsePlayerKVPairs( std::string kv
13181318
std::string GameSpyPSMessageQueueInterface::formatPlayerKVPairs( PSPlayerStats stats )
13191319
{
13201320
char kvbuf[256];
1321-
std::string s = "";
1321+
std::string s;
13221322
PerGeneralMap::iterator it;
13231323

13241324
ITERATE_OVER(wins);

Core/GameEngine/Source/GameNetwork/LANAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ void LANAPI::RequestGameJoin( LANGameInfo *game, UnsignedInt ip /* = 0 */ )
638638
msg.GameToJoin.exeCRC = TheGlobalData->m_exeCRC;
639639
msg.GameToJoin.iniCRC = TheGlobalData->m_iniCRC;
640640

641-
AsciiString s = "";
641+
AsciiString s;
642642
GetStringFromRegistry("\\ergc", "", s);
643643
strlcpy(msg.GameToJoin.serial, s.str(), ARRAY_SIZE(msg.GameToJoin.serial));
644644

Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,7 @@ void LANAPI::OnChat( UnicodeString player, UnsignedInt ip, UnicodeString message
686686
switch (format)
687687
{
688688
case LANAPIInterface::LANCHAT_SYSTEM:
689-
unicodeChat = L"";
690-
unicodeChat.concat(message);
691-
unicodeChat.concat(L"");
689+
unicodeChat = message;
692690
index =GadgetListBoxAddEntryText(chatWindow, unicodeChat, chatSystemColor, -1, -1);
693691
break;
694692
case LANAPIInterface::LANCHAT_EMOTE:

Core/GameEngine/Source/GameNetwork/LANGameInfo.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ void LANDisplayGameList( GameWindow *gameListbox, LANGameInfo *gameList )
216216
while (gameList)
217217
{
218218
UnicodeString txtGName;
219-
txtGName = L"";
220219
if( gameList->isGameInProgress() )
221220
{
222221
txtGName.concat(L"[");

Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ void StdBIGFileSystem::init() {
6363
AsciiString installPath;
6464
GetStringFromGeneralsRegistry("", "InstallPath", installPath );
6565
//@todo this will need to be ramped up to a crash for release
66-
DEBUG_ASSERTCRASH(installPath != "", ("Be 1337! Go install Generals!"));
67-
if (installPath!="")
66+
DEBUG_ASSERTCRASH(!installPath.isEmpty(), ("Be 1337! Go install Generals!"));
67+
if (!installPath.isEmpty())
6868
loadBigFilesFromDirectory(installPath, "*.big");
6969
#endif
7070
}

Core/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ void Win32BIGFileSystem::init() {
6464
AsciiString installPath;
6565
GetStringFromGeneralsRegistry("", "InstallPath", installPath );
6666
//@todo this will need to be ramped up to a crash for release
67-
DEBUG_ASSERTCRASH(installPath != "", ("Be 1337! Go install Generals!"));
68-
if (installPath!="")
67+
DEBUG_ASSERTCRASH(!installPath.isEmpty(), ("Be 1337! Go install Generals!"));
68+
if (!installPath.isEmpty())
6969
loadBigFilesFromDirectory(installPath, "*.big");
7070
#endif
7171
}

Core/Tools/CRCDiff/KVPair.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
std::string intToString(int val)
3333
{
34-
std::string s = "";
34+
std::string s;
3535
bool neg = (val < 0);
3636
if (val < 0)
3737
{
@@ -134,7 +134,7 @@ void KVPairClass::readFromFile( const std::string& in, const std::string& delim
134134
FILE *fp = fopen(in.c_str(), "rb");
135135
if (fp)
136136
{
137-
std::string s = "";
137+
std::string s;
138138
fseek(fp, 0, SEEK_END);
139139
int len = ftell(fp);
140140
fseek(fp, 0, SEEK_SET);

Core/Tools/CRCDiff/expander.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void Expander::expand( const std::string& input,
4545
std::string& output,
4646
bool stripUnknown )
4747
{
48-
output = "";
48+
output.clear();
4949
unsigned int pos = input.find(m_left);
5050
unsigned int lastpos = input.npos;
5151
while (pos != input.npos)
@@ -99,7 +99,7 @@ void Expander::expand( const std::string& input,
9999
else
100100
{
101101
std::string toExpand = it->second;
102-
std::string expanded = "";
102+
std::string expanded;
103103
//DEBUG_LOG(("###### expanding '%s'", toExpand.c_str()));
104104
expand(toExpand, expanded, stripUnknown);
105105
//DEBUG_LOG(("###### expanded '%s'", expanded.c_str()));

0 commit comments

Comments
 (0)