Skip to content

Commit 1ee44db

Browse files
authored
refactor: Remove or replace some superfluous empty C strings (#1929)
1 parent 29bf57a commit 1ee44db

File tree

46 files changed

+52
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+52
-68
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
m_disallowAsainText = FALSE;
@@ -186,7 +186,7 @@ void GameSpyInfo::setGameOptions( void )
186186
req.gameOptions.numPlayers = 0;
187187
req.gameOptions.numObservers = 0;
188188
Int numOpenSlots = 0;
189-
AsciiString playerInfo = "";
189+
AsciiString playerInfo;
190190
for (i=0; i<MAX_SLOTS; ++i)
191191
{
192192
Int wins = 0, losses = 0, profileID = 0;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ class PeerThreadClass : public ThreadClass
193193
m_sawCompleteGameList = FALSE;
194194
m_isConnecting = m_isConnected = false;
195195
m_groupRoomID = m_profileID = 0;
196-
m_nextStagingServer = 1; m_stagingServers.clear();
197-
m_pingStr = ""; m_mapName = ""; m_ladderIP = ""; m_isHosting = false;
196+
m_nextStagingServer = 1;
197+
m_stagingServers.clear();
198+
m_isHosting = false;
198199
for (Int i=0; i<MAX_SLOTS; ++i)
199200
{
200-
m_playerNames[i] = "";
201201
m_playerColors[i] = 0;
202202
m_playerFactions[i] = 0;
203203
m_playerLosses[i] = 0;
@@ -758,7 +758,7 @@ static void QRServerKeyCallback
758758
t->stopHostingAlready(peer);
759759

760760
#ifdef DEBUG_LOGGING
761-
AsciiString val = "";
761+
AsciiString val;
762762
#define ADD(x) { qr2_buffer_add(buffer, x); val = x; }
763763
#define ADDINT(x) { qr2_buffer_add_int(buffer, x); val.format("%d",x); }
764764
#else
@@ -852,7 +852,7 @@ static void QRPlayerKeyCallback
852852
#undef ADD
853853
#undef ADDINT
854854
#ifdef DEBUG_LOGGING
855-
AsciiString val = "";
855+
AsciiString val;
856856
#define ADD(x) { qr2_buffer_add(buffer, x); val = x; }
857857
#define ADDINT(x) { qr2_buffer_add_int(buffer, x); val.format("%d",x); }
858858
#else
@@ -1095,7 +1095,7 @@ static SerialAuthResult doCDKeyAuthentication( PEER peer )
10951095
if (!peer)
10961096
return retval;
10971097

1098-
AsciiString s = "";
1098+
AsciiString s;
10991099
if (GetStringFromRegistry("\\ergc", "", s) && s.isNotEmpty())
11001100
{
11011101
#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
@@ -1315,7 +1315,7 @@ PSPlayerStats GameSpyPSMessageQueueInterface::parsePlayerKVPairs( std::string kv
13151315
std::string GameSpyPSMessageQueueInterface::formatPlayerKVPairs( PSPlayerStats stats )
13161316
{
13171317
char kvbuf[256];
1318-
std::string s = "";
1318+
std::string s;
13191319
PerGeneralMap::iterator it;
13201320

13211321
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
@@ -213,7 +213,6 @@ void LANDisplayGameList( GameWindow *gameListbox, LANGameInfo *gameList )
213213
while (gameList)
214214
{
215215
UnicodeString txtGName;
216-
txtGName = L"";
217216
if( gameList->isGameInProgress() )
218217
{
219218
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)