Skip to content

Commit 68d9f99

Browse files
authored
[GEN][ZH] Refactor non-trivial string objects as variadic function parameter (#1062)
1 parent d92834c commit 68d9f99

File tree

48 files changed

+97
-105
lines changed

Some content is hidden

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

48 files changed

+97
-105
lines changed

Core/Libraries/Source/WWVegas/WW3D2/seglinerenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void SegLineRendererClass::Set_Texture_Tile_Factor(float factor)
196196
///@todo: I raised this number and didn't see much difference on our min-spec. -MW
197197
const static float MAX_LINE_TILING_FACTOR = 50.0f;
198198
if (factor > MAX_LINE_TILING_FACTOR) {
199-
WWDEBUG_SAY(("Texture (%s) Tile Factor (%.2f) too large in SegLineRendererClass!\r\n", Get_Texture()->Get_Texture_Name(), TextureTileFactor));
199+
WWDEBUG_SAY(("Texture (%s) Tile Factor (%.2f) too large in SegLineRendererClass!\r\n", Get_Texture()->Get_Texture_Name().str(), TextureTileFactor));
200200
factor = MAX_LINE_TILING_FACTOR;
201201
} else {
202202
factor = MAX(factor, 0.0f);

Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ void WWProfileManager::End_Collecting(const char* filename)
590590
if (name[i]==',') name[i]='.';
591591
if (name[i]==';') name[i]=':';
592592
}
593-
str.Format("ID: %d %s\r\n",ite.Peek_Value(),name);
593+
str.Format("ID: %d %s\r\n",ite.Peek_Value(),name.str());
594594
file->Write(str.str(),str.Get_Length());
595595
}
596596

@@ -1039,7 +1039,7 @@ WWMemoryAndTimeLog::WWMemoryAndTimeLog(const char* name)
10391039
IntermediateAllocSizeStart=AllocSizeStart;
10401040
StringClass tmp(0,true);
10411041
for (unsigned i=0;i<TabCount;++i) tmp+="\t";
1042-
WWRELEASE_SAY(("%s%s {\n",tmp,name));
1042+
WWRELEASE_SAY(("%s%s {\n",tmp.str(),name));
10431043
TabCount++;
10441044
}
10451045

@@ -1048,13 +1048,13 @@ WWMemoryAndTimeLog::~WWMemoryAndTimeLog()
10481048
if (TabCount>0) TabCount--;
10491049
StringClass tmp(0,true);
10501050
for (unsigned i=0;i<TabCount;++i) tmp+="\t";
1051-
WWRELEASE_SAY(("%s} ",tmp));
1051+
WWRELEASE_SAY(("%s} ",tmp.str()));
10521052

10531053
unsigned current_time=WWProfile_Get_System_Time();
10541054
int current_alloc_count=FastAllocatorGeneral::Get_Allocator()->Get_Total_Allocation_Count();
10551055
int current_alloc_size=FastAllocatorGeneral::Get_Allocator()->Get_Total_Allocated_Size();
10561056
WWRELEASE_SAY(("IN TOTAL %s took %d.%3.3d s, did %d memory allocations of %d bytes\n",
1057-
Name,
1057+
Name.str(),
10581058
(current_time - TimeStart)/1000, (current_time - TimeStart)%1000,
10591059
current_alloc_count - AllocCountStart,
10601060
current_alloc_size - AllocSizeStart));
@@ -1071,7 +1071,7 @@ void WWMemoryAndTimeLog::Log_Intermediate(const char* text)
10711071
StringClass tmp(0,true);
10721072
for (unsigned i=0;i<TabCount;++i) tmp+="\t";
10731073
WWRELEASE_SAY(("%s%s took %d.%3.3d s, did %d memory allocations of %d bytes\n",
1074-
tmp,
1074+
tmp.str(),
10751075
text,
10761076
(current_time - IntermediateTimeStart)/1000, (current_time - IntermediateTimeStart)%1000,
10771077
current_alloc_count - IntermediateAllocCountStart,

Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -956,11 +956,7 @@ void CPUDetectClass::Init_Processor_Log()
956956
(OSVersionBuildNumber&0xff000000)>>24,
957957
(OSVersionBuildNumber&0xff0000)>>16,
958958
(OSVersionBuildNumber&0xffff)));
959-
#ifdef WIN32
960-
SYSLOG(("OS-Info: %s\r\n", OSVersionExtraInfo));
961-
#elif defined(_UNIX)
962-
SYSLOG(("OS-Info: %s\r\n", OSVersionExtraInfo.str()));
963-
#endif
959+
SYSLOG(("OS-Info: %s\r\n", OSVersionExtraInfo.str()));
964960

965961
SYSLOG(("Processor: %s\r\n",CPUDetectClass::Get_Processor_String()));
966962
SYSLOG(("Clock speed: ~%dMHz\r\n",CPUDetectClass::Get_Processor_Speed()));
@@ -971,11 +967,7 @@ void CPUDetectClass::Init_Processor_Log()
971967
case 2: cpu_type="Dual"; break;
972968
case 3: cpu_type="*Intel Reserved*"; break;
973969
}
974-
#ifdef WIN32
975-
SYSLOG(("Processor type: %s\r\n", cpu_type));
976-
#elif defined(_UNIX)
977-
SYSLOG(("Processor type: %s\r\n", cpu_type.str()));
978-
#endif
970+
SYSLOG(("Processor type: %s\r\n", cpu_type.str()));
979971

980972
SYSLOG(("\r\n"));
981973

Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ FileClass * SimpleFileFactoryClass::Get_File( char const *filename )
293293
}
294294
}
295295
} else {
296-
new_name.Format("%s%s",SubDirectory,stripped_name);
296+
new_name.Format("%s%s",SubDirectory.str(),stripped_name.str());
297297
}
298298
}
299299

Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which )
13911391
{
13921392

13931393
DEBUG_CRASH(( "Error saving block '%s' in file '%s'\n",
1394-
blockName.str(), xfer->getIdentifier() ));
1394+
blockName.str(), xfer->getIdentifier().str() ));
13951395
throw;
13961396

13971397
} // end catch
@@ -1468,7 +1468,7 @@ void GameState::xferSaveData( Xfer *xfer, SnapshotType which )
14681468
{
14691469

14701470
DEBUG_CRASH(( "Error loading block '%s' in file '%s'\n",
1471-
blockInfo->blockName.str(), xfer->getIdentifier() ));
1471+
blockInfo->blockName.str(), xfer->getIdentifier().str() ));
14721472
throw;
14731473

14741474
} // end catch

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void SendStatsToOtherPlayers(const GameInfo *game)
116116
subStats.locale = fullStats.locale;
117117
subStats.gamesAsRandom = fullStats.gamesAsRandom;
118118
GetAdditionalDisconnectsFromUserFile(&subStats);
119-
fullStr.format("%d %s", TheGameSpyInfo->getLocalProfileID(), TheGameSpyPSMessageQueue->formatPlayerKVPairs( subStats ));
119+
fullStr.format("%d %s", TheGameSpyInfo->getLocalProfileID(), TheGameSpyPSMessageQueue->formatPlayerKVPairs( subStats ).c_str());
120120
req.options = fullStr.str();
121121

122122
Int localIndex = game->getLocalSlotNum();

Generals/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ GameFont *FontLibrary::getFont( AsciiString name, Int pointSize, Bool bold )
213213
if( loadFontData( font ) == FALSE )
214214
{
215215

216-
DEBUG_CRASH(( "getFont: Unable to load font data pointer '%s'\n", name ));
216+
DEBUG_CRASH(( "getFont: Unable to load font data pointer '%s'\n", name.str() ));
217217
deleteInstance(font);
218218
return NULL;
219219

Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void HeaderTemplateManager::populateGameFonts( void )
241241
HeaderTemplate *hTemplate = *it;
242242
Real pointSize = TheGlobalLanguageData->adjustFontSize(hTemplate->m_point);
243243
GameFont *font = TheFontLibrary->getFont(hTemplate->m_fontName, pointSize,hTemplate->m_bold);
244-
DEBUG_ASSERTCRASH(font,("HeaderTemplateManager::populateGameFonts - Could not find font %s %d",hTemplate->m_fontName, hTemplate->m_point));
244+
DEBUG_ASSERTCRASH(font,("HeaderTemplateManager::populateGameFonts - Could not find font %s %d",hTemplate->m_fontName.str(), hTemplate->m_point));
245245

246246
hTemplate->m_font = font;
247247

Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ void Shell::push( AsciiString filename, Bool shutdownImmediate )
282282
{
283283

284284
DEBUG_LOG(( "Unable to load screen '%s', max '%d' reached\n",
285-
filename, MAX_SHELL_STACK ));
285+
filename.str(), MAX_SHELL_STACK ));
286286
return;
287287

288288
} // end if

Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ typedef MapDisplayToFileNameList::iterator MapDisplayToFileNameListIter;
857857
}
858858
*/
859859

860-
DEBUG_ASSERTCRASH(it != TheMapCache->end(), ("Map %s not found in map cache.", *tempit));
860+
DEBUG_ASSERTCRASH(it != TheMapCache->end(), ("Map %s not found in map cache.", tempit->str()));
861861
if (it->first.startsWithNoCase(mapDir.str()) && isMultiplayer == it->second.m_isMultiplayer && !it->second.m_displayName.isEmpty())
862862
{
863863
/// @todo: mapDisplayName = TheGameText->fetch(it->second.m_displayName.str());

0 commit comments

Comments
 (0)