From 5e0f8141d222a23e9f46bb607c455af430b9d70d Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Tue, 30 May 2017 13:52:29 +0200 Subject: [PATCH] Corrections, some %i->%d around other code as well. --- Common/ArmCPUDetect.cpp | 4 ++-- Common/CPUDetect.cpp | 4 ++-- Common/Timer.cpp | 2 +- Core/ELF/ParamSFO.cpp | 2 +- Core/MIPS/JitCommon/JitCommon.cpp | 12 ++++++------ Core/PSPLoaders.cpp | 24 +++++++++++------------- Core/SaveState.cpp | 2 +- UI/PauseScreen.cpp | 2 +- 8 files changed, 25 insertions(+), 27 deletions(-) diff --git a/Common/ArmCPUDetect.cpp b/Common/ArmCPUDetect.cpp index 8aa3fd3a50..a7b333fe8d 100644 --- a/Common/ArmCPUDetect.cpp +++ b/Common/ArmCPUDetect.cpp @@ -274,9 +274,9 @@ std::string CPUInfo::Summarize() { std::string sum; if (num_cores == 1) - sum = StringFromFormat("%s, %i core", cpu_string, num_cores); + sum = StringFromFormat("%s, %d core", cpu_string, num_cores); else - sum = StringFromFormat("%s, %i cores", cpu_string, num_cores); + sum = StringFromFormat("%s, %d cores", cpu_string, num_cores); if (bSwp) sum += ", SWP"; if (bHalf) sum += ", Half"; if (bThumb) sum += ", Thumb"; diff --git a/Common/CPUDetect.cpp b/Common/CPUDetect.cpp index 4f4304320b..cb50ce8079 100644 --- a/Common/CPUDetect.cpp +++ b/Common/CPUDetect.cpp @@ -267,10 +267,10 @@ std::string CPUInfo::Summarize() { std::string sum; if (num_cores == 1) - sum = StringFromFormat("%s, %i core", cpu_string, num_cores); + sum = StringFromFormat("%s, %d core", cpu_string, num_cores); else { - sum = StringFromFormat("%s, %i cores", cpu_string, num_cores); + sum = StringFromFormat("%s, %d cores", cpu_string, num_cores); if (HTT) sum += StringFromFormat(" (%i logical threads per physical core)", logical_cpu_count); } if (bSSE) sum += ", SSE"; diff --git a/Common/Timer.cpp b/Common/Timer.cpp index 4c8969c1d3..9c34ee151a 100644 --- a/Common/Timer.cpp +++ b/Common/Timer.cpp @@ -143,7 +143,7 @@ std::string Timer::GetTimeElapsedFormatted() const // Hours u32 Hours = Minutes / 60; - std::string TmpStr = StringFromFormat("%02i:%02i:%02i:%03i", + std::string TmpStr = StringFromFormat("%02d:%02d:%02d:%03d", Hours, Minutes % 60, Seconds % 60, Milliseconds % 1000); return TmpStr; } diff --git a/Core/ELF/ParamSFO.cpp b/Core/ELF/ParamSFO.cpp index 7db7ca0e2d..6c164db355 100644 --- a/Core/ELF/ParamSFO.cpp +++ b/Core/ELF/ParamSFO.cpp @@ -288,6 +288,6 @@ std::string ParamSFOData::GenerateFakeID(std::string filename) { } file = file.substr(0, 4); - std::string fakeID = file + StringFromFormat("%05i", sumOfAllLetters); + std::string fakeID = file + StringFromFormat("%05d", sumOfAllLetters); return fakeID; } diff --git a/Core/MIPS/JitCommon/JitCommon.cpp b/Core/MIPS/JitCommon/JitCommon.cpp index c3764fce5e..7c0289f07e 100644 --- a/Core/MIPS/JitCommon/JitCommon.cpp +++ b/Core/MIPS/JitCommon/JitCommon.cpp @@ -95,14 +95,14 @@ std::vector DisassembleArm2(const u8 *data, int size) { bkpt_count++; } else { if (bkpt_count) { - lines.push_back(StringFromFormat("BKPT 1 (x%i)", bkpt_count)); + lines.push_back(StringFromFormat("BKPT 1 (x%d)", bkpt_count)); bkpt_count = 0; } lines.push_back(buf); } } if (bkpt_count) { - lines.push_back(StringFromFormat("BKPT 1 (x%i)", bkpt_count)); + lines.push_back(StringFromFormat("BKPT 1 (x%d)", bkpt_count)); } return lines; } @@ -157,7 +157,7 @@ std::vector DisassembleArm64(const u8 *data, int size) { bkpt_count++; } else { if (bkpt_count) { - lines.push_back(StringFromFormat("BKPT 1 (x%i)", bkpt_count)); + lines.push_back(StringFromFormat("BKPT 1 (x%d)", bkpt_count)); bkpt_count = 0; } if (true) { @@ -167,7 +167,7 @@ std::vector DisassembleArm64(const u8 *data, int size) { } } if (bkpt_count) { - lines.push_back(StringFromFormat("BKPT 1 (x%i)", bkpt_count)); + lines.push_back(StringFromFormat("BKPT 1 (x%d)", bkpt_count)); } return lines; } @@ -235,14 +235,14 @@ std::vector DisassembleX86(const u8 *data, int size) { int3_count++; } else { if (int3_count) { - lines.push_back(StringFromFormat("int3 (x%i)", int3_count)); + lines.push_back(StringFromFormat("int3 (x%d)", int3_count)); int3_count = 0; } lines.push_back(str); } } if (int3_count) { - lines.push_back(StringFromFormat("int3 (x%i)", int3_count)); + lines.push_back(StringFromFormat("int3 (x%d)", int3_count)); } return lines; } diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index dbebac183f..f87ea7f64b 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -188,10 +188,9 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) { std::vector paramsfo; pspFileSystem.ReadEntireFile(sfoPath, paramsfo); if (g_paramSFO.ReadSFO(paramsfo)) { - char title[1024]; - sprintf(title, "%s : %s", g_paramSFO.GetValueString("DISC_ID").c_str(), g_paramSFO.GetValueString("TITLE").c_str()); - INFO_LOG(LOADER, "%s", title); - host->SetWindowTitle(title); + std::string title = StringFromFormat("%s : %s", g_paramSFO.GetValueString("DISC_ID").c_str(), g_paramSFO.GetValueString("TITLE").c_str()); + INFO_LOG(LOADER, "%s", title.c_str()); + host->SetWindowTitle(title.c_str()); } } @@ -326,13 +325,12 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) { std::string homebrewName = PSP_CoreParameter().fileToStart; std::size_t lslash = homebrewName.find_last_of("/"); - homebrewName = homebrewName.substr(lslash +1); + homebrewName = homebrewName.substr(lslash + 1); std::string madeUpID = g_paramSFO.GenerateFakeID(); - char title[1024]; - sprintf(title, "%s : %s", madeUpID.c_str(), homebrewName.c_str()); - INFO_LOG(LOADER, "%s", title); - host->SetWindowTitle(title); + std::string title = StringFromFormat("%s : %s", madeUpID.c_str(), homebrewName.c_str()); + INFO_LOG(LOADER, "%s", title.c_str()); + host->SetWindowTitle(title.c_str()); // Temporary code // TODO: Remove this after ~ 1.6 @@ -344,16 +342,16 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) { savestateDir = ReplaceAll(savestateDir, "/", "\\"); #endif for (int i = 0; i < 5; i += 1) { - std::string oldName = StringFromFormat("%s%s_%i.ppst", savestateDir.c_str(), homebrewName.c_str(), i); + std::string oldName = StringFromFormat("%s%s_%d.ppst", savestateDir.c_str(), homebrewName.c_str(), i); if (File::Exists(oldName)) { - std::string newName = StringFromFormat("%s%s_1.00_%i.ppst", savestateDir.c_str(), madeUpID.c_str(), i); + std::string newName = StringFromFormat("%s%s_1.00_%d.ppst", savestateDir.c_str(), madeUpID.c_str(), i); File::Rename(oldName, newName); } } for (int i = 0; i < 5; i += 1) { - std::string oldName = StringFromFormat("%s%s_%i.jpg", savestateDir.c_str(), homebrewName.c_str(), i); + std::string oldName = StringFromFormat("%s%s_%d.jpg", savestateDir.c_str(), homebrewName.c_str(), i); if (File::Exists(oldName)) { - std::string newName = StringFromFormat("%s%s_1.00_%i.jpg", savestateDir.c_str(), madeUpID.c_str(), i); + std::string newName = StringFromFormat("%s%s_1.00_%d.jpg", savestateDir.c_str(), madeUpID.c_str(), i); File::Rename(oldName, newName); } } diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index d0e492035f..4b5a4a5426 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -371,7 +371,7 @@ namespace SaveState } fullDiscId = StringFromFormat("%s_%s", discId.c_str(), discVer.c_str()); - std::string temp = StringFromFormat("ms0:/PSP/PPSSPP_STATE/%s_%i.%s", fullDiscId.c_str(), slot, extension); + std::string temp = StringFromFormat("ms0:/PSP/PPSSPP_STATE/%s_%d.%s", fullDiscId.c_str(), slot, extension); std::string hostPath; if (pspFileSystem.GetHostPath(temp, hostPath)) { return hostPath; diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index ff2e5035c3..60b7f5a94f 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -188,7 +188,7 @@ SaveSlotView::SaveSlotView(const std::string &gameFilename, int slot, UI::Layout Add(new Spacer(5)); AsyncImageFileView *fv = Add(new AsyncImageFileView(screenshotFilename_, IS_DEFAULT, wq, new UI::LayoutParams(82 * 2, 47 * 2))); - fv->SetOverlayText(StringFromFormat("%i", slot_ + 1)); + fv->SetOverlayText(StringFromFormat("%d", slot_ + 1)); I18NCategory *pa = GetI18NCategory("Pause");