fix some printf format specifiers (#76)

use the definition in cinttypes for portability
This commit is contained in:
Arne Morten Kvarving 2022-08-27 09:33:01 +02:00 committed by GitHub
parent 5cba1a1185
commit 8459cd928c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 15 deletions

View File

@ -13,6 +13,8 @@
#include "input/InputManager.h" #include "input/InputManager.h"
#include <cinttypes>
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
#include <Psapi.h> #include <Psapi.h>
#include <winternl.h> #include <winternl.h>
@ -405,16 +407,16 @@ void LatteOverlay_RenderNotifications(ImVec2& position, ImVec2& pivot, sint32 di
if (s_pipeline_count_async > 0) if (s_pipeline_count_async > 0)
{ {
if (s_pipeline_count > 1) if (s_pipeline_count > 1)
ImGui::Text("Compiled %d new pipelines... (%d async) TotalSync: %lldms", s_pipeline_count, s_pipeline_count_async, totalTime); ImGui::Text("Compiled %d new pipelines... (%d async) TotalSync: %" PRIu64 "ms", s_pipeline_count, s_pipeline_count_async, totalTime);
else else
ImGui::Text("Compiled %d new pipeline... (%d async) TotalSync: %lldms", s_pipeline_count, s_pipeline_count_async, totalTime); ImGui::Text("Compiled %d new pipeline... (%d async) TotalSync: %" PRIu64 "ms", s_pipeline_count, s_pipeline_count_async, totalTime);
} }
else else
{ {
if (s_pipeline_count > 1) if (s_pipeline_count > 1)
ImGui::Text("Compiled %d new pipelines... TotalSync: %lldms", s_pipeline_count, totalTime); ImGui::Text("Compiled %d new pipelines... TotalSync: %" PRIu64 "ms", s_pipeline_count, totalTime);
else else
ImGui::Text("Compiled %d new pipeline... TotalSync: %lldms", s_pipeline_count, totalTime); ImGui::Text("Compiled %d new pipeline... TotalSync: %" PRIu64 "ms", s_pipeline_count, totalTime);
} }
#else #else
if (s_pipeline_count_async > 0) if (s_pipeline_count_async > 0)

View File

@ -5,6 +5,7 @@
#include "Cafe/OS/libs/coreinit/coreinit_IOS.h" #include "Cafe/OS/libs/coreinit/coreinit_IOS.h"
#include "Cafe/OS/libs/coreinit/coreinit_Time.h" #include "Cafe/OS/libs/coreinit/coreinit_Time.h"
#include <cinttypes>
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
@ -102,7 +103,7 @@ namespace acp
{ {
// found the entry! -> update timestamp // found the entry! -> update timestamp
xml::XMLElement* timestamp = account->FirstChildElement("timestamp"); xml::XMLElement* timestamp = account->FirstChildElement("timestamp");
sprintf(tmp, "%016llx", _acpGetTimestamp()); sprintf(tmp, "%" PRIx64, _acpGetTimestamp());
if (timestamp) if (timestamp)
timestamp->SetText(tmp); timestamp->SetText(tmp);
else else
@ -125,7 +126,7 @@ namespace acp
tinyxml2::XMLElement* timestamp = doc.NewElement("timestamp"); tinyxml2::XMLElement* timestamp = doc.NewElement("timestamp");
{ {
sprintf(tmp, "%016llx", _acpGetTimestamp()); sprintf(tmp, "%" PRIx64, _acpGetTimestamp());
timestamp->SetText(tmp); timestamp->SetText(tmp);
} }

View File

@ -15,6 +15,7 @@
#include "Cafe/Filesystem/FST/FST.h" #include "Cafe/Filesystem/FST/FST.h"
#include "Cafe/TitleList/TitleList.h" #include "Cafe/TitleList/TitleList.h"
#include <cinttypes>
#include <charconv> #include <charconv>
#include <curl/curl.h> #include <curl/curl.h>
#include <pugixml.hpp> #include <pugixml.hpp>
@ -580,7 +581,7 @@ void DownloadManager::searchForIncompleteDownloads()
uint64 titleId; uint64 titleId;
uint32 version; uint32 version;
std::string name = p.path().filename().generic_string(); std::string name = p.path().filename().generic_string();
if( sscanf(name.c_str(), "cemu_%016llx_v%u", &titleId, &version) != 2) if( sscanf(name.c_str(), "cemu_% " PRIx64 "_v%u", &titleId, &version) != 2)
continue; continue;
std::unique_lock<std::recursive_mutex> _l(m_mutex); std::unique_lock<std::recursive_mutex> _l(m_mutex);
for (auto& itr : m_ticketCache) for (auto& itr : m_ticketCache)

View File

@ -400,7 +400,7 @@ void MemorySearcherTool::OnResultListClick(wxMouseEvent& event)
auto currValue = m_listResults->GetItemText(selectedIndex, 1); auto currValue = m_listResults->GetItemText(selectedIndex, 1);
char addressString[256]; char addressString[256];
sprintf(addressString, "0x%08x", address); sprintf(addressString, "0x%08lx", address);
// description, address, type, value, freeze // description, address, type, value, freeze
wxVector<wxVariant> data; wxVector<wxVariant> data;

View File

@ -5,6 +5,8 @@
#include "Cafe/OS/RPL/rpl.h" #include "Cafe/OS/RPL/rpl.h"
#include "Cafe/OS/RPL/rpl_symbol_storage.h" #include "Cafe/OS/RPL/rpl_symbol_storage.h"
#include <cinttypes>
enum enum
{ {
// options // options
@ -233,11 +235,11 @@ void DebugPPCThreadsWindow::RefreshThreadList()
m_thread_list->SetItem(i, 7, tempStr); m_thread_list->SetItem(i, 7, tempStr);
// last awake in cycles // last awake in cycles
uint64 lastWakeUpTime = cafeThread->wakeUpTime; uint64 lastWakeUpTime = cafeThread->wakeUpTime;
sprintf(tempStr, "%I64u", lastWakeUpTime); sprintf(tempStr, "%" PRIu64, lastWakeUpTime);
m_thread_list->SetItem(i, 8, tempStr); m_thread_list->SetItem(i, 8, tempStr);
// awake time in cycles // awake time in cycles
uint64 awakeTime = cafeThread->totalCycles; uint64 awakeTime = cafeThread->totalCycles;
sprintf(tempStr, "%I64u", awakeTime); sprintf(tempStr, "%" PRIu64, awakeTime);
m_thread_list->SetItem(i, 9, tempStr); m_thread_list->SetItem(i, 9, tempStr);
// thread name // thread name
const char* threadName = "NULL"; const char* threadName = "NULL";

View File

@ -1,6 +1,8 @@
#include "util/Zir/Core/IR.h" #include "util/Zir/Core/IR.h"
#include "util/Zir/Core/ZpIRDebug.h" #include "util/Zir/Core/ZpIRDebug.h"
#include <cinttypes>
namespace ZpIR namespace ZpIR
{ {
@ -201,15 +203,15 @@ namespace ZpIR
void DebugPrinter::debugPrintBlock(ZpIRBasicBlock* block) void DebugPrinter::debugPrintBlock(ZpIRBasicBlock* block)
{ {
// print name // print name
printf("IRBasicBlock %016llx\n", (uintptr_t)block); printf("IRBasicBlock %" PRIxPTR "\n", (uintptr_t)block);
// print imports // print imports
printf("Imports:\n"); printf("Imports:\n");
for(auto itr : block->m_imports) for(auto itr : block->m_imports)
printf(" reg: %s sym:0x%llx\n", getRegisterName(block, itr.reg).c_str(), itr.name); printf(" reg: %s sym:0x%lux\n", getRegisterName(block, itr.reg).c_str(), itr.name);
// print exports // print exports
printf("Exports:\n"); printf("Exports:\n");
for (auto itr : block->m_exports) for (auto itr : block->m_exports)
printf(" reg: %s sym:0x%llx\n", getRegisterName(block, itr.reg).c_str(), itr.name); printf(" reg: %s sym:0x%lux\n", getRegisterName(block, itr.reg).c_str(), itr.name);
// print instructions // print instructions
printf("Assembly:\n"); printf("Assembly:\n");
IR::__InsBase* instruction = block->m_instructionFirst; IR::__InsBase* instruction = block->m_instructionFirst;