Skip to content

Commit

Permalink
SString format string refactors only
Browse files Browse the repository at this point in the history
  • Loading branch information
Pirulax committed Nov 8, 2020
1 parent 7eadf5b commit 7d2e30b
Show file tree
Hide file tree
Showing 206 changed files with 1,255 additions and 1,255 deletions.
14 changes: 7 additions & 7 deletions Client/cefweb/CWebCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,13 @@ eURLState CWebCore::GetDomainState(const SString& strURL, bool bOutputDebug)
else
{
if (m_bTestmodeEnabled && bOutputDebug)
DebugOutputThreadsafe(SString("[BROWSER] Blocked page: %s", strURL.c_str()), 255, 0, 0);
DebugOutputThreadsafe(SString("[BROWSER] Blocked page: {}", strURL.c_str()), 255, 0, 0);
return eURLState::WEBPAGE_DISALLOWED;
}
}

if (m_bTestmodeEnabled && bOutputDebug)
DebugOutputThreadsafe(SString("[BROWSER] Blocked page: %s", strURL.c_str()), 255, 0, 0);
DebugOutputThreadsafe(SString("[BROWSER] Blocked page: {}", strURL.c_str()), 255, 0, 0);
return eURLState::WEBPAGE_NOT_LISTED;
}

Expand Down Expand Up @@ -560,16 +560,16 @@ bool CWebCore::UpdateListsFromMaster()
time_t currentTime;
time(&currentTime);

if (lastUpdateTime < SString("%d", (long long)currentTime - BROWSER_LIST_UPDATE_INTERVAL))
if (lastUpdateTime < SString("{}", (long long)currentTime - BROWSER_LIST_UPDATE_INTERVAL))
{
OutputDebugLine("Updating white- and blacklist...");
SHttpRequestOptions options;
options.uiConnectionAttempts = 3;
g_pCore->GetNetwork()
->GetHTTPDownloadManager(EDownloadModeType::WEBBROWSER_LISTS)
->QueueFile(SString("%s?type=getrev", BROWSER_UPDATE_URL), NULL, this, &CWebCore::StaticFetchRevisionFinished, options);
->QueueFile(SString("{}?type=getrev", BROWSER_UPDATE_URL), NULL, this, &CWebCore::StaticFetchRevisionFinished, options);

pLastUpdateNode->SetTagContent(SString("%d", (long long)currentTime));
pLastUpdateNode->SetTagContent(SString("{}", (long long)currentTime));
m_pXmlConfig->Write();
}
}
Expand Down Expand Up @@ -765,7 +765,7 @@ void CWebCore::StaticFetchRevisionFinished(const SHttpDownloadResult& result)
options.uiConnectionAttempts = 3;
g_pCore->GetNetwork()
->GetHTTPDownloadManager(EDownloadModeType::WEBBROWSER_LISTS)
->QueueFile(SString("%s?type=fetchwhite", BROWSER_UPDATE_URL), NULL, pWebCore, &CWebCore::StaticFetchWhitelistFinished, options);
->QueueFile(SString("{}?type=fetchwhite", BROWSER_UPDATE_URL), NULL, pWebCore, &CWebCore::StaticFetchWhitelistFinished, options);

pWebCore->m_iWhitelistRevision = iWhiteListRevision;
}
Expand All @@ -776,7 +776,7 @@ void CWebCore::StaticFetchRevisionFinished(const SHttpDownloadResult& result)
options.uiConnectionAttempts = 3;
g_pCore->GetNetwork()
->GetHTTPDownloadManager(EDownloadModeType::WEBBROWSER_LISTS)
->QueueFile(SString("%s?type=fetchblack", BROWSER_UPDATE_URL), NULL, pWebCore, &CWebCore::StaticFetchBlacklistFinished, options);
->QueueFile(SString("{}?type=fetchblack", BROWSER_UPDATE_URL), NULL, pWebCore, &CWebCore::StaticFetchBlacklistFinished, options);

pWebCore->m_iBlacklistRevision = iBlackListRevision;
}
Expand Down
2 changes: 1 addition & 1 deletion Client/core/CClientVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void CClientVariables::LoadDefaults()
{
RECT rect;
GetWindowRect(GetDesktopWindow(), &rect);
Set("display_resolution", SString("%dx%dx32", rect.right, rect.bottom));
Set("display_resolution", SString("{}x{}x32", rect.right, rect.bottom));
}

// We will default this one during CProxyDirect3DDevice9 constructor, because we need a valid direct3d device to give a proper default value.
Expand Down
8 changes: 4 additions & 4 deletions Client/core/CCommandFuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ void CCommandFuncs::Ver(const char* szParameters)
unsigned short usNetRel = CCore::GetSingleton().GetNetwork()->GetNetRel();
SString strVersion = BLUE_VERSION_STRING;
if (usNetRev > 0 || usNetRel > 0)
strVersion += SString(".%d", usNetRev);
strVersion += SString(".{}", usNetRev);
if (usNetRel > 0)
strVersion += SString(".%03d", usNetRel);
strVersion += SString(".{:03}", usNetRel);
strVersion += "\n";
strVersion += g_pCore->GetBlueCopyrightString();
CLocalGUI::GetSingleton().EchoConsole(strVersion);
Expand Down Expand Up @@ -164,7 +164,7 @@ void CCommandFuncs::Time(const char* szParameters)
time(&rawtime);
timeinfo = localtime(&rawtime);

SString strTimeAndDate(_("* The time is %d:%02d:%02d"), timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
SString strTimeAndDate(_("* The time is {}:{:02}:{:02}"), timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
CCore::GetSingleton().ChatEchoColor(strTimeAndDate, 255, 100, 100);
}

Expand Down Expand Up @@ -432,7 +432,7 @@ void CCommandFuncs::Test(const char* szParameters)
if (SStringX(szParameters) == "ca")
{
SString strStats = CCrashDumpWriter::GetCrashAvertedStatsSoFar();
SString strMsg = SString("Crash averted stats:\n%s", strStats.empty() ? "None" : *strStats);
SString strMsg = SString("Crash averted stats:\n{}", strStats.empty() ? "None" : *strStats);
CCore::GetSingleton().GetConsole()->Print(strMsg);
}
else if (SStringX(szParameters) == "crashme")
Expand Down
16 changes: 8 additions & 8 deletions Client/core/CConnectManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ bool CConnectManager::Connect(const char* szHost, unsigned short usPort, const c
SString strAddress = inet_ntoa(m_Address);
if (m_usPort && !pNet->StartNetwork(strAddress, m_usPort, CVARS_GET_VALUE<bool>("packet_tag")))
{
SString strBuffer(_("Connecting to %s at port %u failed!"), m_strHost.c_str(), m_usPort);
SString strBuffer(_("Connecting to {} at port {} failed!"), m_strHost.c_str(), m_usPort);
CCore::GetSingleton().ShowMessageBox(_("Error") + _E("CC22"), strBuffer, MB_BUTTON_OK | MB_ICON_ERROR); // Failed to connect
return false;
}
Expand All @@ -139,7 +139,7 @@ bool CConnectManager::Connect(const char* szHost, unsigned short usPort, const c

// Load server password
if (m_strPassword.empty())
m_strPassword = CServerBrowser::GetSingletonPtr()->GetServerPassword(m_strHost + ":" + SString("%u", m_usPort));
m_strPassword = CServerBrowser::GetSingletonPtr()->GetServerPassword(m_strHost + ":" + SString("{}", m_usPort));

// Start server version detection
SAFE_DELETE(m_pServerItem);
Expand All @@ -149,9 +149,9 @@ bool CConnectManager::Connect(const char* szHost, unsigned short usPort, const c
OpenServerFirewall(m_Address, CServerBrowser::GetSingletonPtr()->FindServerHttpPort(m_strHost, m_usPort), true);

// Display the status box
SString strBuffer(_("Connecting to %s:%u ..."), m_strHost.c_str(), m_usPort);
SString strBuffer(_("Connecting to {}:{} ..."), m_strHost.c_str(), m_usPort);
CCore::GetSingleton().ShowMessageBox(_("CONNECTING"), strBuffer, MB_BUTTON_CANCEL | MB_ICON_INFO, m_pOnCancelClick);
WriteDebugEvent(SString("Connecting to %s:%u ...", m_strHost.c_str(), m_usPort));
WriteDebugEvent(SString("Connecting to {}:{} ...", m_strHost.c_str(), m_usPort));

return true;
}
Expand Down Expand Up @@ -370,7 +370,7 @@ bool CConnectManager::StaticProcessPacket(unsigned char ucPacketID, NetBitStream
if (strModName != "")
{
// Populate the arguments to pass it (-c host port nick)
SString strArguments("%s %s", g_pConnectManager->m_strNick.c_str(), g_pConnectManager->m_strPassword.c_str());
SString strArguments("{} {}", g_pConnectManager->m_strNick.c_str(), g_pConnectManager->m_strPassword.c_str());

// Hide the messagebox we're currently showing
CCore::GetSingleton().RemoveMessageBox();
Expand Down Expand Up @@ -423,7 +423,7 @@ bool CConnectManager::StaticProcessPacket(unsigned char ucPacketID, NetBitStream
if (ucPacketID != PACKET_ID_SERVER_JOIN && ucPacketID != PACKET_ID_SERVER_JOIN_DATA)
{
// Show failed message and abort the attempt
CCore::GetSingleton().ShowNetErrorMessageBox(_("Error") + _E("CC33"), _("Bad server response (1)") + SString(" [%d]", ucPacketID));
CCore::GetSingleton().ShowNetErrorMessageBox(_("Error") + _E("CC33"), _("Bad server response (1)") + SString(" [{}]", ucPacketID));
g_pConnectManager->Abort();
}
}
Expand Down Expand Up @@ -481,7 +481,7 @@ void CConnectManager::OpenServerFirewall(in_addr Address, ushort usHttpPort, boo
SHttpRequestOptions options;
options.uiConnectionAttempts = 1;
options.uiConnectTimeoutMs = uiTimeOut;
SString strDummyUrl("http://%s:%d/mta_client_firewall_probe/", inet_ntoa(Address), usHttpPort);
SString strDummyUrl("http://{}:{}/mta_client_firewall_probe/", inet_ntoa(Address), usHttpPort);
g_pCore->GetNetwork()->GetHTTPDownloadManager(EDownloadMode::CONNECT_TCP_SEND)->QueueFile(strDummyUrl, NULL, NULL, NULL, options);
}
if (usHttpPort == 0 || bHighPriority)
Expand All @@ -490,7 +490,7 @@ void CConnectManager::OpenServerFirewall(in_addr Address, ushort usHttpPort, boo
SHttpRequestOptions options;
options.uiConnectionAttempts = 1;
options.uiConnectTimeoutMs = uiTimeOut;
SString strDummyUrl("http://%s/mta_client_firewall_probe/", inet_ntoa(Address));
SString strDummyUrl("http://{}/mta_client_firewall_probe/", inet_ntoa(Address));
g_pCore->GetNetwork()->GetHTTPDownloadManager(EDownloadMode::CONNECT_TCP_SEND)->QueueFile(strDummyUrl, NULL, NULL, NULL, options);
}
}
Expand Down
32 changes: 16 additions & 16 deletions Client/core/CCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,14 +666,14 @@ void CCore::ShowNetErrorMessageBox(const SString& strTitle, SString strMessage,
{
// Do anti-virus check soon
SetApplicationSettingInt("noav-user-says-skip", 1);
strMessage += SString(" \nCode: %08X", uiErrorCode);
strMessage += SString(" \nCode: {:08X}", uiErrorCode);
if (!strTroubleLink.empty())
strTroubleLink += SString("&neterrorcode=%08X", uiErrorCode);
strTroubleLink += SString("&neterrorcode={:08X}", uiErrorCode);
}
else if (bLinkRequiresErrorCode)
strTroubleLink = ""; // No link if no error code

AddReportLog(7100, SString("Core - NetError (%s) (%s)", *strTitle, *strMessage));
AddReportLog(7100, SString("Core - NetError ({}) ({})", *strTitle, *strMessage));
ShowErrorMessageBox(strTitle, strMessage, strTroubleLink);
}

Expand Down Expand Up @@ -702,8 +702,8 @@ bool CCore::CheckDiskSpace(uint uiResourcesPathMinMB, uint uiDataPathMinMB)
SString strDriveWithNoSpace = GetDriveNameWithNotEnoughSpace(uiResourcesPathMinMB, uiDataPathMinMB);
if (!strDriveWithNoSpace.empty())
{
SString strMessage(_("MTA:SA cannot continue because drive %s does not have enough space."), *strDriveWithNoSpace);
SString strTroubleLink(SString("low-disk-space&drive=%s", *strDriveWithNoSpace.Left(1)));
SString strMessage(_("MTA:SA cannot continue because drive {} does not have enough space."), *strDriveWithNoSpace);
SString strTroubleLink(SString("low-disk-space&drive={}", *strDriveWithNoSpace.Left(1)));
g_pCore->ShowErrorMessageBox(_("Fatal error") + _E("CC43"), strMessage, strTroubleLink);
return false;
}
Expand Down Expand Up @@ -823,7 +823,7 @@ void LoadModule(CModuleLoader& m_Loader, const SString& strName, const SString&
SString strDllDirectory = GetSystemDllDirectory();
if (CalcMTASAPath("mta").CompareI(strDllDirectory) == false)
{
AddReportLog(3119, SString("DllDirectory wrong: DllDirectory:'%s' Path:'%s'", *strDllDirectory, *CalcMTASAPath("mta")));
AddReportLog(3119, SString("DllDirectory wrong: DllDirectory:'{}' Path:'{}'", *strDllDirectory, *CalcMTASAPath("mta")));
SetDllDirectory(CalcMTASAPath("mta"));
}

Expand All @@ -840,7 +840,7 @@ void LoadModule(CModuleLoader& m_Loader, const SString& strName, const SString&

if (m_Loader.IsOk() == false)
{
SString strMessage("Error loading '%s' module!\n%s", *strName, *m_Loader.GetLastErrorMessage());
SString strMessage("Error loading '{}' module!\n{}", *strName, *m_Loader.GetLastErrorMessage());
SString strType = "module-not-loadable&name=" + strModuleName;

// Extra message if d3d9.dll exists
Expand Down Expand Up @@ -880,7 +880,7 @@ T* InitModule(CModuleLoader& m_Loader, const SString& strName, const SString& st

if (pfnInit == NULL)
{
MessageBoxUTF8(0, SString(_("%s module is incorrect!"), *strName), "Error" + _E("CC40"), MB_OK | MB_ICONERROR | MB_TOPMOST);
MessageBoxUTF8(0, SString(_("{} module is incorrect!"), *strName), "Error" + _E("CC40"), MB_OK | MB_ICONERROR | MB_TOPMOST);
TerminateProcess(GetCurrentProcess(), 1);
}

Expand Down Expand Up @@ -967,7 +967,7 @@ void CCore::CreateNetwork()
// net.dll doesn't like our version number
ulong ulNetModuleVersion = 0;
pfnCheckCompatibility(1, &ulNetModuleVersion);
SString strMessage("Network module not compatible! (Expected 0x%x, got 0x%x)", MTA_DM_CLIENT_NET_MODULE_VERSION, ulNetModuleVersion);
SString strMessage("Network module not compatible! (Expected 0x{:x}, got 0x{:x})", MTA_DM_CLIENT_NET_MODULE_VERSION, ulNetModuleVersion);
#if !defined(MTA_DM_CONNECT_TO_PUBLIC)
strMessage += "\n\n(Devs: Update source and run win-install-data.bat)";
#endif
Expand Down Expand Up @@ -1202,7 +1202,7 @@ void CCore::DoPostFramePulse()
// Try to load the mod
if (!m_pModManager->Load(szOptionValue, m_szCommandLineArgs))
{
SString strTemp(_("Error running mod specified in command line ('%s')"), szOptionValue);
SString strTemp(_("Error running mod specified in command line ('{}')"), szOptionValue);
ShowMessageBox(_("Error") + _E("CC42"), strTemp, MB_BUTTON_OK | MB_ICON_ERROR); // Command line Mod load failed
}
}
Expand Down Expand Up @@ -1667,7 +1667,7 @@ void CCore::UpdateRecentlyPlayed()

pServerBrowser->SaveRecentlyPlayedList();
if (!m_pConnectManager->m_strLastPassword.empty())
pServerBrowser->SetServerPassword(strHost + ":" + SString("%u", uiPort), m_pConnectManager->m_strLastPassword);
pServerBrowser->SetServerPassword(strHost + ":" + SString("{}", uiPort), m_pConnectManager->m_strLastPassword);
}
// Save our configuration file
CCore::GetSingleton().SaveConfig();
Expand Down Expand Up @@ -1730,9 +1730,9 @@ void CCore::RecalculateFrameRateLimit(uint uiServerFrameRateLimit, bool bLogToCo
// Print new limits to the console
if (bLogToConsole)
{
SString strStatus("Server FPS limit: %d", m_uiServerFrameRateLimit);
SString strStatus("Server FPS limit: {}", m_uiServerFrameRateLimit);
if (m_uiFrameRateLimit != m_uiServerFrameRateLimit)
strStatus += SString(" (Using %d)", m_uiFrameRateLimit);
strStatus += SString(" (Using {})", m_uiFrameRateLimit);
CCore::GetSingleton().GetConsole()->Print(strStatus);
}
}
Expand Down Expand Up @@ -2032,12 +2032,12 @@ void CCore::OnEnterCrashZone(uint uiId)
void CCore::LogEvent(uint uiDebugId, const char* szType, const char* szContext, const char* szBody, uint uiAddReportLogId)
{
if (uiAddReportLogId)
AddReportLog(uiAddReportLogId, SString("%s - %s", szContext, szBody));
AddReportLog(uiAddReportLogId, SString("{} - {}", szContext, szBody));

if (GetDebugIdEnabled(uiDebugId))
{
CCrashDumpWriter::LogEvent(szType, szContext, szBody);
OutputDebugLine(SString("[LogEvent] %d %s %s %s", uiDebugId, szType, szContext, szBody));
OutputDebugLine(SString("[LogEvent] {} {} {} {}", uiDebugId, szType, szContext, szBody));
}
}

Expand Down Expand Up @@ -2216,7 +2216,7 @@ void CCore::UpdateDummyProgress(int iValue, const char* szType)
// Compose message with amount
SString strMessage;
if (m_iDummyProgressValue)
strMessage = SString("%d%s", m_iDummyProgressValue, *m_strDummyProgressType);
strMessage = SString("{}{}", m_iDummyProgressValue, *m_strDummyProgressType);

CGraphics::GetSingleton().SetProgressMessage(strMessage);
}
Expand Down
Loading

0 comments on commit 7d2e30b

Please sign in to comment.