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
This commit is contained in:
Soren Jorvang 2010-12-05 18:22:41 +00:00
parent d171f7277b
commit 738e5e55ee
11 changed files with 52 additions and 26 deletions

View File

@ -28,7 +28,7 @@ void SymbolDB::List()
iter->second.numCalls); iter->second.numCalls);
} }
INFO_LOG(OSHLE, "%lu functions known in this program above.", INFO_LOG(OSHLE, "%lu functions known in this program above.",
functions.size()); (unsigned long)functions.size());
} }
void SymbolDB::Clear(const char *prefix) void SymbolDB::Clear(const char *prefix)

View File

@ -448,7 +448,8 @@ ARCode GetARCode(size_t index)
{ {
if (index > arCodes.size()) 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 ARCode();
} }
return arCodes[index]; return arCodes[index];
@ -458,7 +459,8 @@ void SetARCode_IsActive(bool active, size_t index)
{ {
if (index > arCodes.size()) 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; return;
} }
arCodes[index].active = active; arCodes[index].active = active;

View File

@ -121,10 +121,10 @@ readFn64 hwReadWii64[NUMHWMEMFUN];
// Default read and write functions // Default read and write functions
template <class T> template <class T>
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 <class T> template <class T>
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_SHIFT 10
#define PAGE_SIZE (1 << PAGE_SHIFT) #define PAGE_SIZE (1 << PAGE_SHIFT)

View File

@ -218,7 +218,11 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
else else
{ {
Memory::Write_U32((u32)rNANDCOntent.GetContentSize(), _CommandAddress + 0x4); 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; 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); 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); Memory::Write_U32(0, _CommandAddress + 0x4);

View File

@ -151,7 +151,8 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
if ((CommandBuffer.InBuffer.size() == 1) && (CommandBuffer.PayloadBuffer.size() == 1)) if ((CommandBuffer.InBuffer.size() == 1) && (CommandBuffer.PayloadBuffer.size() == 1))
{ {
size_t numFile = FileSearch.GetFileNames().size(); 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); Memory::Write_U32((u32)numFile, CommandBuffer.PayloadBuffer[0].m_Address);
} }

View File

@ -361,8 +361,10 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
} }
else else
{ {
ERROR_LOG(WII_IPC_SD, "Read Failed - read %lx, error %i, eof? %i", ERROR_LOG(WII_IPC_SD, "Read Failed - "
nRead, ferror(m_Card), feof(m_Card)); "read %lx, error %i, eof? %i",
(unsigned long)nRead,
ferror(m_Card), feof(m_Card));
rwFail = 1; 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); size_t nWritten = fwrite(buffer, req.bsize, req.blocks, m_Card);
if (nWritten != req.blocks) if (nWritten != req.blocks)
{ {
ERROR_LOG(WII_IPC_SD, "Write Failed - wrote %lx, error %i, eof? %i", ERROR_LOG(WII_IPC_SD, "Write Failed - "
nWritten, ferror(m_Card), feof(m_Card)); "wrote %lx, error %i, eof? %i",
(unsigned long)nWritten,
ferror(m_Card), feof(m_Card));
rwFail = 1; rwFail = 1;
} }

View File

@ -300,7 +300,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendACLPacket(u16 _ConnectionHandle, u
} }
else 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)); 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 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); m_EventQueue.push(_event);
const SQueuedEvent& event = m_EventQueue.front(); const SQueuedEvent& event = m_EventQueue.front();
DEBUG_LOG(WII_IPC_WIIMOTE, "HCI event %x being written from queue(%lu) to %08x...", DEBUG_LOG(WII_IPC_WIIMOTE, "HCI event %x "
((hci_event_hdr_t*)event.m_buffer)->event, m_EventQueue.size()-1, m_HCIEndpoint.m_address); "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.FillBuffer(event.m_buffer, event.m_size);
m_HCIEndpoint.SetRetVal(event.m_size); m_HCIEndpoint.SetRetVal(event.m_size);
// Send a reply to indicate HCI buffer is filled // 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 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); 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. // an endpoint has become available, and we have a stored response.
const SQueuedEvent& event = m_EventQueue.front(); const SQueuedEvent& event = m_EventQueue.front();
DEBUG_LOG(WII_IPC_WIIMOTE, "HCI event %x being written from queue(%lu) to %08x...", DEBUG_LOG(WII_IPC_WIIMOTE,
((hci_event_hdr_t*)event.m_buffer)->event, m_EventQueue.size()-1, m_HCIEndpoint.m_address); "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.FillBuffer(event.m_buffer, event.m_size);
m_HCIEndpoint.SetRetVal(event.m_size); m_HCIEndpoint.SetRetVal(event.m_size);
// Send a reply to indicate HCI buffer is filled // 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()) if (!m_ACLQ.empty() && m_ACLEndpoint.IsValid() && m_EventQueue.empty())
{ {
const ACLQ& acl_data = m_ACLQ.front(); const ACLQ& acl_data = m_ACLQ.front();
DEBUG_LOG(WII_IPC_WIIMOTE, "ACL packet being written from queue(%lu) to %08x", DEBUG_LOG(WII_IPC_WIIMOTE, "ACL packet being written from "
m_ACLQ.size()-1, m_ACLEndpoint.m_address); "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); 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); pHeader->con_handle = HCI_MK_CON_HANDLE(acl_data.m_conn_handle, HCI_PACKET_START, HCI_POINT2POINT);

View File

@ -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, "%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() void SignatureDB::Clear()

View File

@ -357,7 +357,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
buffer = new u8[sz]; buffer = new u8[sz];
int x; int x;
if ((x = (int)fread(buffer, 1, sz, f)) != (int)sz) 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); fclose(f);
@ -457,7 +457,7 @@ void VerifyStateCallback(u64 userdata, int cyclesLate)
buffer = new u8[sz]; buffer = new u8[sz];
int x; int x;
if ((x = (int)fread(buffer, 1, sz, f)) != (int)sz) 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); fclose(f);

View File

@ -44,7 +44,8 @@ CBannerLoaderGC::CBannerLoaderGC(DiscIO::IFileSystem& _rFileSystem)
else m_IsValid = true; 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);
} }

View File

@ -240,7 +240,8 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
if (gcodes.size()) if (gcodes.size())
{ {
PanicAlert("Downloaded %lu codes.", gcodes.size()); PanicAlert("Downloaded %lu codes.",
(unsigned long)gcodes.size());
// append the codes to the code list // append the codes to the code list
std::vector<GeckoCode>::const_iterator std::vector<GeckoCode>::const_iterator