From 738e5e55ee5a699d1a781d993fdb6915f9d74ad4 Mon Sep 17 00:00:00 2001 From: Soren Jorvang Date: Sun, 5 Dec 2010 18:22:41 +0000 Subject: [PATCH] Cast size_t to unsigned long for printf to deal with (32-bit) systems where size_t is typedef int. It's either this or use the C99 %zu but while we can probably safely assume C99 compilers, I am not at all sure that that's the case for stdio libraries and this solution is fairly low-impact. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6535 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/SymbolDB.cpp | 2 +- Source/Core/Core/Src/ActionReplay.cpp | 6 ++-- Source/Core/Core/Src/HW/Memmap.cpp | 4 +-- .../Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 9 ++++-- .../Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp | 3 +- .../IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp | 12 +++++--- .../Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 29 +++++++++++++------ Source/Core/Core/Src/PowerPC/SignatureDB.cpp | 3 +- Source/Core/Core/Src/State.cpp | 4 +-- Source/Core/DiscIO/Src/BannerLoaderGC.cpp | 3 +- Source/Core/DolphinWX/Src/GeckoCodeDiag.cpp | 3 +- 11 files changed, 52 insertions(+), 26 deletions(-) diff --git a/Source/Core/Common/Src/SymbolDB.cpp b/Source/Core/Common/Src/SymbolDB.cpp index 93ec43ff24..ca71e9bb24 100644 --- a/Source/Core/Common/Src/SymbolDB.cpp +++ b/Source/Core/Common/Src/SymbolDB.cpp @@ -28,7 +28,7 @@ void SymbolDB::List() iter->second.numCalls); } INFO_LOG(OSHLE, "%lu functions known in this program above.", - functions.size()); + (unsigned long)functions.size()); } void SymbolDB::Clear(const char *prefix) diff --git a/Source/Core/Core/Src/ActionReplay.cpp b/Source/Core/Core/Src/ActionReplay.cpp index 1261100af4..8957ac3235 100644 --- a/Source/Core/Core/Src/ActionReplay.cpp +++ b/Source/Core/Core/Src/ActionReplay.cpp @@ -448,7 +448,8 @@ ARCode GetARCode(size_t index) { if (index > arCodes.size()) { - PanicAlert("GetARCode: Index is greater than ar code list size %lu", index); + PanicAlert("GetARCode: Index is greater than " + "ar code list size %lu", (unsigned long)index); return ARCode(); } return arCodes[index]; @@ -458,7 +459,8 @@ void SetARCode_IsActive(bool active, size_t index) { if (index > arCodes.size()) { - PanicAlert("SetARCode_IsActive: Index is greater than ar code list size %lu", index); + PanicAlert("SetARCode_IsActive: Index is greater than " + "ar code list size %lu", (unsigned long)index); return; } arCodes[index].active = active; diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index 36bc8eacb4..da9f80bc0b 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -121,10 +121,10 @@ readFn64 hwReadWii64[NUMHWMEMFUN]; // Default read and write functions template -void HW_Default_Write(const T _Data, const u32 _Address){ ERROR_LOG(MASTER_LOG, "Illegal HW Write%lu %08x", sizeof(T)*8, _Address);_dbg_assert_(MEMMAP, 0);} +void HW_Default_Write(const T _Data, const u32 _Address){ ERROR_LOG(MASTER_LOG, "Illegal HW Write%lu %08x", (unsigned long)sizeof(T)*8, _Address);_dbg_assert_(MEMMAP, 0);} template -void HW_Default_Read(T _Data, const u32 _Address){ ERROR_LOG(MASTER_LOG, "Illegal HW Read%lu %08x", sizeof(T)*8, _Address); _dbg_assert_(MEMMAP, 0);} +void HW_Default_Read(T _Data, const u32 _Address){ ERROR_LOG(MASTER_LOG, "Illegal HW Read%lu %08x", (unsigned long)sizeof(T)*8, _Address); _dbg_assert_(MEMMAP, 0);} #define PAGE_SHIFT 10 #define PAGE_SIZE (1 << PAGE_SHIFT) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index cfab8fef96..d5ebfcb620 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -218,7 +218,11 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) else { Memory::Write_U32((u32)rNANDCOntent.GetContentSize(), _CommandAddress + 0x4); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECONTENTS: Unable to open content %lu", rNANDCOntent.GetContentSize()); + INFO_LOG(WII_IPC_ES, + "IOCTL_ES_GETTITLECONTENTS: " + "Unable to open content %lu", + (unsigned long)rNANDCOntent.\ + GetContentSize()); } return true; @@ -399,7 +403,8 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) Memory::Write_U32((u32)m_TitleIDs.size(), Buffer.PayloadBuffer[0].m_Address); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECNT: Number of Titles %lu", m_TitleIDs.size()); + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECNT: Number of Titles %lu", + (unsigned long)m_TitleIDs.size()); Memory::Write_U32(0, _CommandAddress + 0x4); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp index a7a2dbc7ac..9b260267be 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp @@ -151,7 +151,8 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress) if ((CommandBuffer.InBuffer.size() == 1) && (CommandBuffer.PayloadBuffer.size() == 1)) { size_t numFile = FileSearch.GetFileNames().size(); - INFO_LOG(WII_IPC_FILEIO, "\t%lu Files found", numFile); + INFO_LOG(WII_IPC_FILEIO, "\t%lu Files found", + (unsigned long)numFile); Memory::Write_U32((u32)numFile, CommandBuffer.PayloadBuffer[0].m_Address); } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp index 9738869867..2ff877514d 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp @@ -361,8 +361,10 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS } else { - ERROR_LOG(WII_IPC_SD, "Read Failed - read %lx, error %i, eof? %i", - nRead, ferror(m_Card), feof(m_Card)); + ERROR_LOG(WII_IPC_SD, "Read Failed - " + "read %lx, error %i, eof? %i", + (unsigned long)nRead, + ferror(m_Card), feof(m_Card)); rwFail = 1; } @@ -396,8 +398,10 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS size_t nWritten = fwrite(buffer, req.bsize, req.blocks, m_Card); if (nWritten != req.blocks) { - ERROR_LOG(WII_IPC_SD, "Write Failed - wrote %lx, error %i, eof? %i", - nWritten, ferror(m_Card), feof(m_Card)); + ERROR_LOG(WII_IPC_SD, "Write Failed - " + "wrote %lx, error %i, eof? %i", + (unsigned long)nWritten, + ferror(m_Card), feof(m_Card)); rwFail = 1; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index aebd1a9069..6bc9b0185b 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -300,7 +300,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendACLPacket(u16 _ConnectionHandle, u } else { - DEBUG_LOG(WII_IPC_WIIMOTE, "ACL endpoint not currently valid, queueing(%lu)...", m_ACLQ.size()); + DEBUG_LOG(WII_IPC_WIIMOTE, "ACL endpoint not currently valid, " + "queueing(%lu)...", (unsigned long)m_ACLQ.size()); m_ACLQ.push(ACLQ(_pData, _Size, _ConnectionHandle)); } } @@ -330,11 +331,16 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::AddEventToQueue(const SQueuedEvent& _e } else // push new one, pop oldest { - DEBUG_LOG(WII_IPC_WIIMOTE, "HCI endpoint not currently valid, queueing(%lu)...", m_EventQueue.size()); + DEBUG_LOG(WII_IPC_WIIMOTE, "HCI endpoint not " + "currently valid, queueing(%lu)...", + (unsigned long)m_EventQueue.size()); m_EventQueue.push(_event); const SQueuedEvent& event = m_EventQueue.front(); - DEBUG_LOG(WII_IPC_WIIMOTE, "HCI event %x being written from queue(%lu) to %08x...", - ((hci_event_hdr_t*)event.m_buffer)->event, m_EventQueue.size()-1, m_HCIEndpoint.m_address); + DEBUG_LOG(WII_IPC_WIIMOTE, "HCI event %x " + "being written from queue(%lu) to %08x...", + ((hci_event_hdr_t*)event.m_buffer)->event, + (unsigned long)m_EventQueue.size()-1, + m_HCIEndpoint.m_address); m_HCIEndpoint.FillBuffer(event.m_buffer, event.m_size); m_HCIEndpoint.SetRetVal(event.m_size); // Send a reply to indicate HCI buffer is filled @@ -345,7 +351,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::AddEventToQueue(const SQueuedEvent& _e } else { - DEBUG_LOG(WII_IPC_WIIMOTE, "HCI endpoint not currently valid, queueing(%lu)...", m_EventQueue.size()); + DEBUG_LOG(WII_IPC_WIIMOTE, "HCI endpoint not currently valid, " + "queueing(%lu)...", (unsigned long)m_EventQueue.size()); m_EventQueue.push(_event); } } @@ -357,8 +364,11 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() { // an endpoint has become available, and we have a stored response. const SQueuedEvent& event = m_EventQueue.front(); - DEBUG_LOG(WII_IPC_WIIMOTE, "HCI event %x being written from queue(%lu) to %08x...", - ((hci_event_hdr_t*)event.m_buffer)->event, m_EventQueue.size()-1, m_HCIEndpoint.m_address); + DEBUG_LOG(WII_IPC_WIIMOTE, + "HCI event %x being written from queue(%lu) to %08x...", + ((hci_event_hdr_t*)event.m_buffer)->event, + (unsigned long)m_EventQueue.size()-1, + m_HCIEndpoint.m_address); m_HCIEndpoint.FillBuffer(event.m_buffer, event.m_size); m_HCIEndpoint.SetRetVal(event.m_size); // Send a reply to indicate HCI buffer is filled @@ -373,8 +383,9 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() if (!m_ACLQ.empty() && m_ACLEndpoint.IsValid() && m_EventQueue.empty()) { const ACLQ& acl_data = m_ACLQ.front(); - DEBUG_LOG(WII_IPC_WIIMOTE, "ACL packet being written from queue(%lu) to %08x", - m_ACLQ.size()-1, m_ACLEndpoint.m_address); + DEBUG_LOG(WII_IPC_WIIMOTE, "ACL packet being written from " + "queue(%lu) to %08x", (unsigned long)m_ACLQ.size()-1, + m_ACLEndpoint.m_address); hci_acldata_hdr_t* pHeader = (hci_acldata_hdr_t*)Memory::GetPointer(m_ACLEndpoint.m_buffer); pHeader->con_handle = HCI_MK_CON_HANDLE(acl_data.m_conn_handle, HCI_PACKET_START, HCI_POINT2POINT); diff --git a/Source/Core/Core/Src/PowerPC/SignatureDB.cpp b/Source/Core/Core/Src/PowerPC/SignatureDB.cpp index 6888b688f1..138a9a50a2 100644 --- a/Source/Core/Core/Src/PowerPC/SignatureDB.cpp +++ b/Source/Core/Core/Src/PowerPC/SignatureDB.cpp @@ -103,7 +103,8 @@ void SignatureDB::List() { INFO_LOG(OSHLE, "%s : %i bytes, hash = %08x", iter->second.name.c_str(), iter->second.size, iter->first); } - INFO_LOG(OSHLE, "%lu functions known in current database.", database.size()); + INFO_LOG(OSHLE, "%lu functions known in current database.", + (unsigned long)database.size()); } void SignatureDB::Clear() diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index f93d1d614a..7ca429dd3a 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -357,7 +357,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate) buffer = new u8[sz]; int x; if ((x = (int)fread(buffer, 1, sz, f)) != (int)sz) - PanicAlert("wtf? %d %lu", x, sz); + PanicAlert("wtf? %d %lu", x, (unsigned long)sz); } fclose(f); @@ -457,7 +457,7 @@ void VerifyStateCallback(u64 userdata, int cyclesLate) buffer = new u8[sz]; int x; if ((x = (int)fread(buffer, 1, sz, f)) != (int)sz) - PanicAlert("wtf? %d %lu", x, sz); + PanicAlert("wtf? %d %lu", x, (unsigned long)sz); } fclose(f); diff --git a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp index d8b8917795..1e341468c6 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp +++ b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp @@ -44,7 +44,8 @@ CBannerLoaderGC::CBannerLoaderGC(DiscIO::IFileSystem& _rFileSystem) else m_IsValid = true; } } - else WARN_LOG(DISCIO, "Invalid opening.bnr size: %0lx", FileSize); + else WARN_LOG(DISCIO, "Invalid opening.bnr size: %0lx", + (unsigned long)FileSize); } diff --git a/Source/Core/DolphinWX/Src/GeckoCodeDiag.cpp b/Source/Core/DolphinWX/Src/GeckoCodeDiag.cpp index b75bef8524..753503d440 100644 --- a/Source/Core/DolphinWX/Src/GeckoCodeDiag.cpp +++ b/Source/Core/DolphinWX/Src/GeckoCodeDiag.cpp @@ -240,7 +240,8 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&) if (gcodes.size()) { - PanicAlert("Downloaded %lu codes.", gcodes.size()); + PanicAlert("Downloaded %lu codes.", + (unsigned long)gcodes.size()); // append the codes to the code list std::vector::const_iterator