Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix format string warnings
  • Loading branch information
Tilka committed Nov 13, 2013
1 parent 39ad5a2 commit 268bdf1
Show file tree
Hide file tree
Showing 24 changed files with 75 additions and 41 deletions.
3 changes: 2 additions & 1 deletion Source/Core/Common/Src/SDCardUtil.cpp
Expand Up @@ -36,6 +36,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <cinttypes>

#ifndef _WIN32
#include <unistd.h> // for unlink()
Expand Down Expand Up @@ -196,7 +197,7 @@ bool SDCardCreate(u64 disk_size /*in MB*/, const char* filename)
disk_size *= 1024 * 1024;

if (disk_size < 0x800000 || disk_size > 0x800000000ULL) {
ERROR_LOG(COMMON, "Trying to create SD Card image of size %lliMB is out of range (8MB-32GB)", disk_size/(1024*1024));
ERROR_LOG(COMMON, "Trying to create SD Card image of size %" PRIu64 "MB is out of range (8MB-32GB)", disk_size/(1024*1024));
return false;
}

Expand Down
4 changes: 3 additions & 1 deletion Source/Core/Common/Src/SysConf.cpp
Expand Up @@ -5,6 +5,8 @@
#include "FileUtil.h"
#include "SysConf.h"

#include <cinttypes>

SysConf::SysConf()
: m_IsValid(false)
{
Expand Down Expand Up @@ -42,7 +44,7 @@ bool SysConf::LoadFromFile(const char *filename)
u64 size = File::GetSize(filename);
if (size != SYSCONF_SIZE)
{
if (AskYesNoT("Your SYSCONF file is the wrong size.\nIt should be 0x%04x (but is 0x%04llx)\nDo you want to generate a new one?",
if (AskYesNoT("Your SYSCONF file is the wrong size.\nIt should be 0x%04x (but is 0x%04" PRIx64 ")\nDo you want to generate a new one?",
SYSCONF_SIZE, size))
{
GenerateSysConf();
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/Common/Src/x64Emitter.cpp
Expand Up @@ -7,6 +7,8 @@
#include "x64ABI.h"
#include "CPUDetect.h"

#include <cinttypes>

namespace Gen
{

Expand Down Expand Up @@ -176,7 +178,7 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg,
_assert_msg_(DYNA_REC, (distance < 0x80000000LL
&& distance >= -0x80000000LL) ||
!warn_64bit_offset,
"WriteRest: op out of range (0x%llx uses 0x%llx)",
"WriteRest: op out of range (0x%" PRIx64 " uses 0x%" PRIx64 ")",
ripAddr, offset);
s32 offs = (s32)distance;
emit->Write32((u32)offs);
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/Core/Src/CoreParameter.cpp
Expand Up @@ -18,6 +18,8 @@
#include "Core.h" // for bWii
#include "FifoPlayer/FifoDataFile.h"

#include <cinttypes>

SCoreStartupParameter::SCoreStartupParameter()
: hInstance(0),
bEnableDebugging(false), bAutomaticStart(false), bBootToPause(false),
Expand Down Expand Up @@ -278,7 +280,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
// Use the TitleIDhex for name and/or unique ID if launching from nand folder
// or if it is not ascii characters (specifically sysmenu could potentially apply to other things)
char titleidstr[17];
snprintf(titleidstr, 17, "%016llx", ContentLoader.GetTitleID());
snprintf(titleidstr, 17, "%016" PRIx64, ContentLoader.GetTitleID());

if (!m_strName.length())
{
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/Src/CoreTiming.cpp
Expand Up @@ -3,6 +3,7 @@
// Refer to the license.txt file included.

#include <vector>
#include <cinttypes>

#include "Thread.h"
#include "PowerPC/PowerPC.h"
Expand Down Expand Up @@ -429,7 +430,7 @@ void LogPendingEvents()
Event *ptr = first;
while (ptr)
{
INFO_LOG(POWERPC, "PENDING: Now: %lld Pending: %lld Type: %d", globalTimer, ptr->time, ptr->type);
INFO_LOG(POWERPC, "PENDING: Now: %" PRId64 " Pending: %" PRId64 " Type: %d", globalTimer, ptr->time, ptr->type);
ptr = ptr->next;
}
}
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/Src/HW/DSPLLE/DSPLLEGlobals.cpp
Expand Up @@ -6,6 +6,7 @@
#include "FileUtil.h"
#include "DSP/DSPCore.h"
#include "DSPLLEGlobals.h"
#include <cinttypes>

#if PROFILE

Expand Down Expand Up @@ -37,12 +38,12 @@ void ProfilerDump(u64 count)
File::IOFile pFile("DSP_Prof.txt", "wt");
if (pFile)
{
fprintf(pFile.GetHandle(), "Number of DSP steps: %llu\n\n", count);
fprintf(pFile.GetHandle(), "Number of DSP steps: %" PRIu64 "\n\n", count);
for (int i=0; i<PROFILE_MAP_SIZE;i++)
{
if (g_profileMap[i] > 0)
{
fprintf(pFile.GetHandle(), "0x%04X: %llu\n", i, g_profileMap[i]);
fprintf(pFile.GetHandle(), "0x%04X: %" PRIu64 "\n", i, g_profileMap[i]);
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion Source/Core/Core/Src/HW/GCMemcard.cpp
Expand Up @@ -4,6 +4,9 @@

#include "GCMemcard.h"
#include "ColorUtil.h"

#include <cinttypes>

static void ByteSwap(u8 *valueA, u8 *valueB)
{
u8 tmp = *valueA;
Expand Down Expand Up @@ -173,7 +176,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
}
else
{
PanicAlertT("Failed to read block %d of the save data\nMemcard may be truncated\nFilePosition:%llx", i, mcdFile.Tell());
PanicAlertT("Failed to read block %d of the save data\nMemcard may be truncated\nFilePosition:%" PRIx64, i, mcdFile.Tell());
m_valid = false;
break;
}
Expand Down
14 changes: 8 additions & 6 deletions Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp
Expand Up @@ -19,6 +19,8 @@

#include "../../DiscIO/Src/FileMonitor.h"

#include <cinttypes>

using namespace DVDInterface;


Expand Down Expand Up @@ -108,7 +110,7 @@ bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress)
// Get TMD offset for requested partition...
u64 const TMDOffset = ((u64)Memory::Read_U32(CommandBuffer.InBuffer[0].m_Address + 4) << 2 ) + 0x2c0;

INFO_LOG(WII_IPC_DVD, "DVDLowOpenPartition: TMDOffset 0x%016llx", TMDOffset);
INFO_LOG(WII_IPC_DVD, "DVDLowOpenPartition: TMDOffset 0x%016" PRIx64, TMDOffset);

static u32 const TMDsz = 0x208; //CommandBuffer.PayloadBuffer[0].m_Size;
u8 pTMD[TMDsz];
Expand Down Expand Up @@ -204,13 +206,13 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
pFilename = m_pFileSystem->GetFileName(DVDAddress);
if (pFilename != NULL)
{
INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%llx) - (DVDAddr: 0x%llx, Size: 0x%x)",
INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ", Size: 0x%x)",
pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress, Size);
FileMon::CheckFile(std::string(pFilename), (int)m_pFileSystem->GetFileSize(pFilename));
}
else
{
INFO_LOG(WII_IPC_DVD, "DVDLowRead: file unknown - (DVDAddr: 0x%llx, Size: 0x%x)",
INFO_LOG(WII_IPC_DVD, "DVDLowRead: file unknown - (DVDAddr: 0x%" PRIx64 ", Size: 0x%x)",
DVDAddress, Size);
}
}
Expand Down Expand Up @@ -308,7 +310,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32

u64 DVDAddress = (u64)DVDAddress32 << 2;

INFO_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: DVDAddr: 0x%08llx, Size: 0x%x", DVDAddress, Size);
INFO_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: DVDAddr: 0x%08" PRIx64 ", Size: 0x%x", DVDAddress, Size);

if (Size > _BufferOutSize)
{
Expand Down Expand Up @@ -342,12 +344,12 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
pFilename = m_pFileSystem->GetFileName(DVDAddress);
if (pFilename != NULL)
{
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%llx) - (DVDAddr: 0x%llx)",
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ")",
pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress);
}
else
{
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: file unknown - (DVDAddr: 0x%llx)",
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: file unknown - (DVDAddr: 0x%" PRIx64 ")",
DVDAddress);
}
}
Expand Down
10 changes: 7 additions & 3 deletions Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp
Expand Up @@ -35,6 +35,10 @@

#include "WII_IPC_HLE_Device_es.h"

// need to include this before polarssl/aes.h,
// otherwise we may not get __STDC_FORMAT_MACROS
#include <cinttypes>

#include "../PowerPC/PowerPC.h"
#include "../VolumeHandler.h"
#include "FileUtil.h"
Expand Down Expand Up @@ -205,7 +209,7 @@ u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)

if (!Loader.IsValid())
{
WARN_LOG(WII_IPC_ES, "ES: loader not valid for %llx", TitleID);
WARN_LOG(WII_IPC_ES, "ES: loader not valid for %" PRIx64, TitleID);
return 0xffffffff;
}

Expand Down Expand Up @@ -940,7 +944,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
if (!bSuccess)
{
PanicAlertT("IOCTL_ES_LAUNCH: Game tried to reload a title that is not available in your NAND dump\n"
"TitleID %016llx.\n Dolphin will likely hang now.", TitleID);
"TitleID %016" PRIx64".\n Dolphin will likely hang now.", TitleID);
}
else
{
Expand Down Expand Up @@ -983,7 +987,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
//TODO: provide correct return code when bSuccess= false
Memory::Write_U32(0, _CommandAddress + 0x4);

ERROR_LOG(WII_IPC_ES, "IOCTL_ES_LAUNCH %016llx %08x %016llx %08x %016llx %04x", TitleID,view,ticketid,devicetype,titleid,access);
ERROR_LOG(WII_IPC_ES, "IOCTL_ES_LAUNCH %016" PRIx64 " %08x %016" PRIx64 " %08x %016" PRIx64 " %04x", TitleID,view,ticketid,devicetype,titleid,access);
// IOCTL_ES_LAUNCH 0001000248414341 00000001 0001c0fef3df2cfa 00000000 0001000248414341 ffff

// This is necessary because Reset(true) above deleted this object. Ew.
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp
Expand Up @@ -10,11 +10,11 @@
#include "../../Host.h"
#include "../../IPC_HLE/WII_IPC_HLE.h"


#ifdef USE_GDBSTUB
#include "../GDBStub.h"
#endif

#include <cinttypes>

namespace {
u32 last_pc;
Expand Down Expand Up @@ -79,7 +79,7 @@ void Trace( UGeckoInstruction &instCode )
std::string fregs = "";
for (int i=0; i<32; i++)
{
sprintf(freg, "f%02d: %08llx %08llx ", i, PowerPC::ppcState.ps[i][0], PowerPC::ppcState.ps[i][1]);
sprintf(freg, "f%02d: %08" PRIx64 " %08" PRIx64 " ", i, PowerPC::ppcState.ps[i][0], PowerPC::ppcState.ps[i][1]);
fregs.append(freg);
}

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.cpp
Expand Up @@ -3,6 +3,7 @@
// Refer to the license.txt file included.

#include <map>
#include <cinttypes>

#include "Common.h"
#include "../../HLE/HLE.h"
Expand Down Expand Up @@ -217,7 +218,7 @@ namespace JitILProfiler
const u64 totalElapsed = block.totalElapsed;
const u64 numberOfCalls = block.numberOfCalls;
const double elapsedPerCall = totalElapsed / (double)numberOfCalls;
fprintf(file.GetHandle(), "%016llx,%lld,%lld,%f\n", codeHash, totalElapsed, numberOfCalls, elapsedPerCall);
fprintf(file.GetHandle(), "%016" PRIx64 ",%" PRId64 ",%" PRId64 ",%f\n", codeHash, totalElapsed, numberOfCalls, elapsedPerCall);
}
}
};
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp
Expand Up @@ -3,6 +3,7 @@
// Refer to the license.txt file included.

#include <string>
#include <cinttypes>

#include "Common.h"
#include "disasm.h"
Expand Down Expand Up @@ -32,7 +33,7 @@ static void BackPatchError(const std::string &text, u8 *codePtr, u32 emAddress)
#endif
PanicAlert("%s\n\n"
"Error encountered accessing emulated address %08x.\n"
"Culprit instruction: \n%s\nat %#llx",
"Culprit instruction: \n%s\nat %#" PRIx64,
text.c_str(), emAddress, disbuf, code_addr);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/Src/PowerPC/JitILCommon/IR.cpp
Expand Up @@ -118,6 +118,7 @@ Fix profiled loads/stores to work safely. On 32-bit, one solution is to

#include <algorithm>
#include <memory>
#include <cinttypes>
#include <ctime>
#include <set>
#include "IR.h"
Expand Down Expand Up @@ -1279,7 +1280,7 @@ void IRBuilder::WriteToFile(u64 codeHash) {
}

FILE* const file = writer->file.GetHandle();
fprintf(file, "\ncode hash:%016llx\n", codeHash);
fprintf(file, "\ncode hash:%016" PRIx64 "\n", codeHash);

const InstLoc lastCurReadPtr = curReadPtr;
StartForwardPass();
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/Src/PowerPC/JitInterface.cpp
Expand Up @@ -3,6 +3,7 @@
// Refer to the license.txt file included.

#include <algorithm>
#include <cinttypes>

#ifdef _WIN32
#include <windows.h>
Expand Down Expand Up @@ -171,12 +172,12 @@ namespace JitInterface
double percent = 100.0 * (double)stat.cost / (double)cost_sum;
#ifdef _WIN32
double timePercent = 100.0 * (double)block->ticCounter / (double)timecost_sum;
fprintf(f.GetHandle(), "%08x\t%s\t%llu\t%llu\t%.2lf\t%llf\t%lf\t%i\n",
fprintf(f.GetHandle(), "%08x\t%s\t%" PRIu64 "\t%" PRIu64 "\t%.2lf\t%llf\t%lf\t%i\n",
block->originalAddress, name.c_str(), stat.cost,
block->ticCounter, percent, timePercent,
(double)block->ticCounter*1000.0/(double)countsPerSec, block->codeSize);
#else
fprintf(f.GetHandle(), "%08x\t%s\t%llu\t???\t%.2lf\t???\t???\t%i\n",
fprintf(f.GetHandle(), "%08x\t%s\t%" PRIu64 "\t???\t%.2lf\t???\t???\t%i\n",
block->originalAddress, name.c_str(), stat.cost, percent, block->codeSize);
#endif
}
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/Src/PowerPC/PPCTables.cpp
Expand Up @@ -4,6 +4,7 @@

#include <algorithm>
#include <vector>
#include <cinttypes>

#include "Common.h"
#include "PPCTables.h"
Expand Down Expand Up @@ -213,7 +214,7 @@ void LogCompiledInstructions()
{
if (m_allInstructions[i]->compileCount > 0)
{
fprintf(f.GetHandle(), "%s\t%i\t%lld\t%08x\n", m_allInstructions[i]->opname,
fprintf(f.GetHandle(), "%s\t%i\t%" PRId64 "\t%08x\n", m_allInstructions[i]->opname,
m_allInstructions[i]->compileCount, m_allInstructions[i]->runCount, m_allInstructions[i]->lastUse);
}
}
Expand All @@ -223,7 +224,7 @@ void LogCompiledInstructions()
{
if (m_allInstructions[i]->compileCount == 0)
{
fprintf(f.GetHandle(), "%s\t%i\t%lld\n", m_allInstructions[i]->opname,
fprintf(f.GetHandle(), "%s\t%i\t%" PRId64 "\n", m_allInstructions[i]->opname,
m_allInstructions[i]->compileCount, m_allInstructions[i]->runCount);
}
}
Expand Down
6 changes: 4 additions & 2 deletions Source/Core/DiscIO/Src/CompressedBlob.cpp
Expand Up @@ -9,6 +9,8 @@
#include <unistd.h>
#endif

#include <cinttypes>

#include "CompressedBlob.h"
#include "DiscScrubber.h"
#include "FileUtil.h"
Expand Down Expand Up @@ -99,7 +101,7 @@ void CompressedBlobReader::GetBlock(u64 block_num, u8 *out_ptr)
// First, check hash.
u32 block_hash = HashAdler32(source, comp_block_size);
if (block_hash != hashes[block_num])
PanicAlert("Hash of block %lli is %08x instead of %08x.\n"
PanicAlert("Hash of block %" PRIu64 " is %08x instead of %08x.\n"
"Your ISO, %s, is corrupt.",
block_num, block_hash, hashes[block_num],
file_name.c_str());
Expand Down Expand Up @@ -127,7 +129,7 @@ void CompressedBlobReader::GetBlock(u64 block_num, u8 *out_ptr)
{
// this seem to fire wrongly from time to time
// to be sure, don't use compressed isos :P
PanicAlert("Failure reading block %lli - out of data and not at end.", block_num);
PanicAlert("Failure reading block %" PRIu64 " - out of data and not at end.", block_num);
}
inflateEnd(&z);
if (uncomp_size != header.block_size)
Expand Down

0 comments on commit 268bdf1

Please sign in to comment.