From 9da4fe086b3f7c0c2e310c3b6438ed131fb13ff2 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sun, 5 Dec 2010 09:04:34 +0000 Subject: [PATCH] allow gcc to check the format of args being passed to MsgAlert and GenericLog. Fixed nearly all warnings that arose from this, as well as some preexisting ones (some were actually crashes and/or bugs...) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6522 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/AudioCommon/Src/AlsaSoundStream.cpp | 2 +- Source/Core/AudioCommon/Src/WaveFile.cpp | 2 +- Source/Core/Common/Src/DynamicLibrary.cpp | 2 +- Source/Core/Common/Src/FileUtil.cpp | 2 +- Source/Core/Common/Src/Log.h | 6 ++++- Source/Core/Common/Src/MsgHandler.h | 6 ++++- Source/Core/Common/Src/OpenCL.cpp | 23 +++++++++++-------- Source/Core/Common/Src/SDCardUtil.cpp | 2 +- Source/Core/Common/Src/SysConf.cpp | 2 +- Source/Core/Core/Src/ActionReplay.cpp | 4 ++-- Source/Core/Core/Src/Core.cpp | 4 ++-- Source/Core/Core/Src/HW/DVDInterface.cpp | 6 +++-- .../Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp | 2 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp | 12 +++++----- Source/Core/Core/Src/LuaInterface.cpp | 6 ++--- Source/Core/Core/Src/MemTools.cpp | 2 +- .../Interpreter_SystemRegisters.cpp | 4 ++-- .../Core/Src/PowerPC/Jit64/JitRegCache.cpp | 2 +- Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp | 4 ++-- .../Src/PowerPC/JitCommon/JitBackpatch.cpp | 4 ++-- Source/Core/Core/Src/State.cpp | 4 ++-- .../DebuggerWX/Src/CodeWindowFunctions.cpp | 2 +- Source/Core/DiscIO/Src/CompressedBlob.cpp | 2 +- Source/Core/DiscIO/Src/FileMonitor.cpp | 4 ++-- Source/Core/DiscIO/Src/FileSystemGCWii.cpp | 3 ++- .../Src/MemoryCards/WiiSaveCrypted.cpp | 2 +- Source/Core/VideoCommon/Src/HiresTextures.cpp | 2 +- .../VideoCommon/Src/PixelShaderManager.cpp | 7 +++--- .../Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp | 6 ++--- .../Plugin_DSP_HLE/Src/UCodes/UCode_CARD.cpp | 2 +- Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp | 4 ++-- .../Plugin_VideoOGL/Src/PixelShaderCache.cpp | 8 +++---- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 4 ++-- .../Plugin_VideoOGL/Src/VertexShaderCache.cpp | 8 +++---- .../Plugin_VideoSoftware/Src/GLUtil.cpp | 4 ++-- 35 files changed, 88 insertions(+), 71 deletions(-) diff --git a/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp b/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp index 8d4b3ff521..da715e9811 100644 --- a/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp +++ b/Source/Core/AudioCommon/Src/AlsaSoundStream.cpp @@ -183,7 +183,7 @@ bool AlsaSound::AlsaInit() //it is probably a bad idea to try to send more than one buffer of data if ((unsigned int)frames_to_deliver > buffer_size) frames_to_deliver = buffer_size; - NOTICE_LOG(AUDIO, "ALSA gave us a %d sample \"hardware\" buffer with %d periods. Will send %d samples per fragments.\n", buffer_size, periods, frames_to_deliver); + NOTICE_LOG(AUDIO, "ALSA gave us a %ld sample \"hardware\" buffer with %d periods. Will send %d samples per fragments.\n", buffer_size, periods, frames_to_deliver); snd_pcm_sw_params_alloca(&swparams); diff --git a/Source/Core/AudioCommon/Src/WaveFile.cpp b/Source/Core/AudioCommon/Src/WaveFile.cpp index 5fddaa7fed..e481d84f16 100644 --- a/Source/Core/AudioCommon/Src/WaveFile.cpp +++ b/Source/Core/AudioCommon/Src/WaveFile.cpp @@ -74,7 +74,7 @@ bool WaveFileWriter::Start(const char *filename) // We are now at offset 44 if (ftello(file) != 44) - PanicAlert("wrong offset: %i", ftello(file)); + PanicAlert("wrong offset: %lli", ftello(file)); return true; } diff --git a/Source/Core/Common/Src/DynamicLibrary.cpp b/Source/Core/Common/Src/DynamicLibrary.cpp index 95ec340e71..ff2833a6b4 100644 --- a/Source/Core/Common/Src/DynamicLibrary.cpp +++ b/Source/Core/Common/Src/DynamicLibrary.cpp @@ -143,7 +143,7 @@ void* DynamicLibrary::Get(const char* funcname) const if (!library) { - ERROR_LOG(COMMON, "DL: Get failed %s - Library not loaded"); + ERROR_LOG(COMMON, "DL: Get failed %s - Library not loaded", funcname); return NULL; } diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index 2813eb6203..ee9fa6facd 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -337,7 +337,7 @@ u64 GetSize(const char *filename) // on windows it's actually _stat64 defined in commonFuncs struct stat64 buf; if (stat64(filename, &buf) == 0) { - DEBUG_LOG(COMMON, "GetSize: %s: %ld", filename, buf.st_size); + DEBUG_LOG(COMMON, "GetSize: %s: %lld", filename, buf.st_size); return buf.st_size; } diff --git a/Source/Core/Common/Src/Log.h b/Source/Core/Common/Src/Log.h index 36b4d292e2..a6289ec332 100644 --- a/Source/Core/Common/Src/Log.h +++ b/Source/Core/Common/Src/Log.h @@ -100,7 +100,11 @@ enum LOG_LEVELS { extern "C" { #endif void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, - const char *file, int line, const char *fmt, ...); + const char *file, int line, const char *fmt, ...) +#ifdef __GNUC__ + __attribute__((format(printf, 5, 6))) +#endif + ; #ifdef __cplusplus }; #endif diff --git a/Source/Core/Common/Src/MsgHandler.h b/Source/Core/Common/Src/MsgHandler.h index 32867a28a2..d5190ec0a9 100644 --- a/Source/Core/Common/Src/MsgHandler.h +++ b/Source/Core/Common/Src/MsgHandler.h @@ -28,7 +28,11 @@ enum MSG_TYPE typedef bool (*MsgAlertHandler)(const char* caption, const char* text, bool yes_no, int Style); void RegisterMsgAlertHandler(MsgAlertHandler handler); -extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...); +extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...) +#ifdef __GNUC__ + __attribute__((format(printf, 4, 5))) +#endif + ; void SetEnableAlert(bool enable); #ifndef GEKKO diff --git a/Source/Core/Common/Src/OpenCL.cpp b/Source/Core/Common/Src/OpenCL.cpp index 451d43ab48..c1a6e7166b 100644 --- a/Source/Core/Common/Src/OpenCL.cpp +++ b/Source/Core/Common/Src/OpenCL.cpp @@ -78,7 +78,8 @@ bool Initialize() } char pbuf[100]; - err = clGetPlatformInfo(platforms[0], CL_PLATFORM_VENDOR, sizeof(pbuf), pbuf, NULL); + err = clGetPlatformInfo(platforms[0], CL_PLATFORM_VENDOR, sizeof(pbuf), + pbuf, NULL); if (err != CL_SUCCESS) { @@ -95,7 +96,8 @@ bool Initialize() return false; } - cl_context_properties cps[3] = {CL_CONTEXT_PLATFORM, (cl_context_properties)platform, 0}; + cl_context_properties cps[3] = {CL_CONTEXT_PLATFORM, + (cl_context_properties)platform, 0}; cl_context_properties* cprops = (NULL == platform) ? NULL : cps; @@ -143,9 +145,10 @@ cl_command_queue GetCommandQueue() cl_program CompileProgram(const char *Kernel) { u32 compileStart = Common::Timer::GetTimeMs(); - int err; + cl_int err; cl_program program; - program = clCreateProgramWithSource(OpenCL::g_context, 1, (const char **) & Kernel, NULL, &err); + program = clCreateProgramWithSource(OpenCL::g_context, 1, + (const char **) & Kernel, NULL, &err); if (!program) { HandleCLError(err, "Error: Failed to create compute program!"); @@ -156,13 +159,14 @@ cl_program CompileProgram(const char *Kernel) err = clBuildProgram(program , 0, NULL, NULL, NULL, NULL); if(err != CL_SUCCESS) { char *errors[16384] = {0}; - err = clGetProgramBuildInfo(program, OpenCL::device_id, CL_PROGRAM_BUILD_LOG, sizeof(errors), - errors, NULL); - ERROR_LOG(COMMON, "Error log:\n%s\n", errors); + err = clGetProgramBuildInfo(program, OpenCL::device_id, + CL_PROGRAM_BUILD_LOG, sizeof(*errors), errors, NULL); + ERROR_LOG(COMMON, "Error log:\n%s\n", *errors); return NULL; } - NOTICE_LOG(COMMON, "OpenCL CompileProgram took %.3f seconds", (float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0); + NOTICE_LOG(COMMON, "OpenCL CompileProgram took %.3f seconds", + (float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0); return program; } @@ -180,7 +184,8 @@ cl_kernel CompileKernel(cl_program program, const char *Function) HandleCLError(err, buffer); return NULL; } - NOTICE_LOG(COMMON, "OpenCL CompileKernel took %.3f seconds", (float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0); + NOTICE_LOG(COMMON, "OpenCL CompileKernel took %.3f seconds", + (float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0); return kernel; } #endif diff --git a/Source/Core/Common/Src/SDCardUtil.cpp b/Source/Core/Common/Src/SDCardUtil.cpp index 856afaeace..27cfd5b170 100644 --- a/Source/Core/Common/Src/SDCardUtil.cpp +++ b/Source/Core/Common/Src/SDCardUtil.cpp @@ -196,7 +196,7 @@ bool SDCardCreate(u64 disk_size /*in MB*/, char* filename) disk_size *= 1024 * 1024; if (disk_size < 0x800000 || disk_size > 0x800000000ULL) { - ERROR_LOG(COMMON, "Trying to create SD Card image of size %iMB is out of range (8MB-32GB)", disk_size/(1024*1024)); + ERROR_LOG(COMMON, "Trying to create SD Card image of size %lliMB is out of range (8MB-32GB)", disk_size/(1024*1024)); return false; } diff --git a/Source/Core/Common/Src/SysConf.cpp b/Source/Core/Common/Src/SysConf.cpp index 8f3de9cd51..f874c77829 100644 --- a/Source/Core/Common/Src/SysConf.cpp +++ b/Source/Core/Common/Src/SysConf.cpp @@ -47,7 +47,7 @@ bool SysConf::LoadFromFile(const char *filename) return false; //most likely: file does not exist if (size != SYSCONF_SIZE) { - PanicAlert("Your SYSCONF file is the wrong size - should be 0x%04x (but is 0x%04x)", + PanicAlert("Your SYSCONF file is the wrong size - should be 0x%04x (but is 0x%04llx)", SYSCONF_SIZE, size); return false; } diff --git a/Source/Core/Core/Src/ActionReplay.cpp b/Source/Core/Core/Src/ActionReplay.cpp index 1ceac4cc1c..83a1f825ac 100644 --- a/Source/Core/Core/Src/ActionReplay.cpp +++ b/Source/Core/Core/Src/ActionReplay.cpp @@ -245,7 +245,7 @@ void LogInfo(const char *format, ...) va_start(args, format); CharArrayFromFormatV(temp, 512, format, args); va_end(args); - INFO_LOG(ACTIONREPLAY, temp); + INFO_LOG(ACTIONREPLAY, "%s", temp); if (logSelf) { @@ -798,7 +798,7 @@ bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr addr, const u32 data) else { LogInfo("Bad Value"); - PanicAlert("Action Replay Error: Invalid value (&08x) in Memory Copy (%s)", (data & ~0x7FFF), current_code->name.c_str()); + PanicAlert("Action Replay Error: Invalid value (%08x) in Memory Copy (%s)", (data & ~0x7FFF), current_code->name.c_str()); return false; } return true; diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index de4151b46e..76c9c1eb64 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -689,7 +689,7 @@ bool report_slow(int skipped) // WARNING - THIS IS EXECUTED FROM VIDEO THREAD void Callback_VideoLog(const TCHAR *_szMessage, int _bDoBreak) { - INFO_LOG(VIDEO, _szMessage); + INFO_LOG(VIDEO, "%s", _szMessage); } // Should be called from GPU thread when a frame is drawn @@ -710,7 +710,7 @@ void Callback_VideoRequestWindowSize(int& x, int& y, int& width, int& height) // WARNING - THIS MAY BE EXECUTED FROM DSP THREAD void Callback_DSPLog(const TCHAR* _szMessage, int _v) { - GENERIC_LOG(LogTypes::AUDIO, (LogTypes::LOG_LEVELS)_v, _szMessage); + GENERIC_LOG(LogTypes::AUDIO, (LogTypes::LOG_LEVELS)_v, "%s", _szMessage); } diff --git a/Source/Core/Core/Src/HW/DVDInterface.cpp b/Source/Core/Core/Src/HW/DVDInterface.cpp index 1f94fabfca..bf4322fc4c 100644 --- a/Source/Core/Core/Src/HW/DVDInterface.cpp +++ b/Source/Core/Core/Src/HW/DVDInterface.cpp @@ -529,8 +529,10 @@ void ExecuteCommand(UDICR& _DICR) if (GCAM) { - ERROR_LOG(DVDINTERFACE, "DVD: %08x, %08x, %08x, DMA=addr:%08x,len:%08x,ctrl:%08x", - m_DICMDBUF[0], m_DICMDBUF[1], m_DICMDBUF[2], m_DIMAR, m_DILENGTH, m_DICR); + ERROR_LOG(DVDINTERFACE, + "DVD: %08x, %08x, %08x, DMA=addr:%08x,len:%08x,ctrl:%08x", + m_DICMDBUF[0].Hex, m_DICMDBUF[1].Hex, m_DICMDBUF[2].Hex, + m_DIMAR.Hex, m_DILENGTH.Hex, m_DICR.Hex); // decrypt command. But we have a zero key, that simplifies things a lot. // If you get crazy dvd command errors, make sure 0x80000000 - 0x8000000c is zero'd m_DICMDBUF[0].Hex <<= 24; diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp index 61b4b35af2..72a860bc78 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp @@ -831,7 +831,7 @@ void Wiimote::InterruptChannel(const u16 _channelID, const void* _pData, u32 _Si break; default : - PanicAlert("HidInput: HID_TYPE_DATA - param 0x%02x", hidp->type, hidp->param); + PanicAlert("HidInput: HID_TYPE_DATA - param 0x%02x", hidp->param); break; } break; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp index ba8224dcbb..7f27148bb9 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp @@ -214,13 +214,13 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 const char *pFilename = m_pFileSystem->GetFileName(DVDAddress); if (pFilename != NULL) { - INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%x) - (DVDAddr: 0x%x, Size: 0x%x)", + INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%llx) - (DVDAddr: 0x%llx, 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 unkw - (DVDAddr: 0x%x, Size: 0x%x)", + INFO_LOG(WII_IPC_DVD, "DVDLowRead: file unkw - (DVDAddr: 0x%llx, Size: 0x%x)", DVDAddress, Size); } @@ -315,9 +315,9 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 return 2; } - u64 DVDAddress = (u64)(DVDAddress32 << 2); + u64 DVDAddress = (u64)DVDAddress32 << 2; - INFO_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: DVDAddr: 0x%08x, Size: 0x%x", DVDAddress, Size); + INFO_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: DVDAddr: 0x%08llx, Size: 0x%x", DVDAddress, Size); if (Size > _BufferOutSize) { @@ -350,12 +350,12 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 const char *pFilename = m_pFileSystem->GetFileName(DVDAddress); if (pFilename != NULL) { - INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%x) - (DVDAddr: 0x%x)", + INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%llx) - (DVDAddr: 0x%llx)", pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress); } else { - INFO_LOG(WII_IPC_DVD, "DVDLowSeek: file unkw - (DVDAddr: 0x%x)", + INFO_LOG(WII_IPC_DVD, "DVDLowSeek: file unkw - (DVDAddr: 0x%llx)", DVDAddress); } } diff --git a/Source/Core/Core/Src/LuaInterface.cpp b/Source/Core/Core/Src/LuaInterface.cpp index 6ace074c45..09e82560da 100644 --- a/Source/Core/Core/Src/LuaInterface.cpp +++ b/Source/Core/Core/Src/LuaInterface.cpp @@ -425,11 +425,11 @@ static int doPopup(lua_State* L, const char* deftype, const char* deficon) const char* answer = "ok"; if(itype == 1) - answer = PanicYesNo(str) ? "yes" : "no"; + answer = PanicYesNo("%s", str) ? "yes" : "no"; else if(iicon == 1) - SuccessAlert(str); + SuccessAlert("%s", str); else - PanicAlert(str); + PanicAlert("%s", str); lua_pushstring(L, answer); return 1; diff --git a/Source/Core/Core/Src/MemTools.cpp b/Source/Core/Core/Src/MemTools.cpp index dbbf69abf4..00d9ec8cad 100644 --- a/Source/Core/Core/Src/MemTools.cpp +++ b/Source/Core/Core/Src/MemTools.cpp @@ -211,7 +211,7 @@ void sigsegv_handler(int signal, siginfo_t *info, void *raw_context) u64 bad_address = (u64)fault_memory_ptr; u64 memspace_bottom = (u64)Memory::base; if (bad_address < memspace_bottom) { - PanicAlert("Exception handler - access below memory space. %08x%08x", + PanicAlert("Exception handler - access below memory space. %08llx%08llx", bad_address >> 32, bad_address); } u32 em_address = (u32)(bad_address - memspace_bottom); diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp index 3b553f097e..9828c1a43b 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp @@ -88,7 +88,7 @@ void FPSCRtoFPUSettings(UReg_FPSCR fp) FPU_ROUND_DOWN }; unsigned short mode; - asm ("fstcw %0" : : "m" (mode)); + asm ("fstcw %0" : "=m" (mode) : ); mode = (mode & ~FPU_ROUND_MASK) | table[fp.RN]; asm ("fldcw %0" : : "m" (mode)); #endif @@ -383,7 +383,7 @@ void Interpreter::mtspr(UGeckoInstruction _inst) break; case SPR_WPAR: - _assert_msg_(POWERPC, m_GPR[_inst.RD] == 0x0C008000, "Gather pipe @ %08x"); + _assert_msg_(POWERPC, m_GPR[_inst.RD] == 0x0C008000, "Gather pipe @ %08x", PC); GPFifo::ResetGatherPipe(); break; diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp index bfd9e4c1e4..27ae341b0a 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp @@ -80,7 +80,7 @@ void RegCache::Lock(int p1, int p2, int p3, int p4) void RegCache::LockX(int x1, int x2, int x3, int x4) { if (xlocks[x1]) { - PanicAlert("RegCache: x %i already locked!"); + PanicAlert("RegCache: x %i already locked!", x1); } xlocks[x1] = true; if (x2 != 0xFF) xlocks[x2] = true; diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp index 0c63179bc8..4d2a907408 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp @@ -1325,7 +1325,7 @@ void IRBuilder::WriteToFile(u64 codeHash) { if (isImm(*inst)) { fprintf(file, " 0x%08x", GetImmValue(inst)); } else { - fprintf(file, " %10lu", i - (I - inst)); + fprintf(file, " %10u", i - (I - inst)); } } @@ -1335,7 +1335,7 @@ void IRBuilder::WriteToFile(u64 codeHash) { if (isImm(*inst)) { fprintf(file, " 0x%08x", GetImmValue(inst)); } else { - fprintf(file, " %10lu", i - (I - inst)); + fprintf(file, " %10u", i - (I - inst)); } } diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp index dcd0ba636b..16ab4a915e 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp @@ -51,8 +51,8 @@ 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 %08x%08x", - text.c_str(), emAddress, disbuf, code_addr>>32, code_addr); + "Culprit instruction: \n%s\nat %#llx", + text.c_str(), emAddress, disbuf, code_addr); return; } diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index e827e23b22..5dd4b3ba29 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -341,7 +341,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate) if (res != LZO_E_OK) { // This doesn't seem to happen anymore. - PanicAlert("Internal LZO Error - decompression failed (%d) (%d, %d) \n" + PanicAlert("Internal LZO Error - decompression failed (%d) (%li, %li) \n" "Try loading the state again", res, i, new_len); fclose(f); delete[] buffer; @@ -440,7 +440,7 @@ void VerifyStateCallback(u64 userdata, int cyclesLate) if (res != LZO_E_OK) { // This doesn't seem to happen anymore. - PanicAlert("Internal LZO Error - decompression failed (%d) (%d, %d) \n" + PanicAlert("Internal LZO Error - decompression failed (%d) (%ld, %ld) \n" "Try verifying the state again", res, i, new_len); fclose(f); delete [] buffer; diff --git a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp index da313f7e1a..1010da6970 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp @@ -221,7 +221,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) switch (event.GetId()) { case IDM_CLEARSYMBOLS: - if(!AskYesNo("Do you want to clear the list of symbol names?", "Confirm", wxYES_NO)) return; + if(!AskYesNo("Do you want to clear the list of symbol names?")) return; g_symbolDB.Clear(); Host_NotifyMapLoaded(); break; diff --git a/Source/Core/DiscIO/Src/CompressedBlob.cpp b/Source/Core/DiscIO/Src/CompressedBlob.cpp index da6e0a2b26..00a2fe24aa 100644 --- a/Source/Core/DiscIO/Src/CompressedBlob.cpp +++ b/Source/Core/DiscIO/Src/CompressedBlob.cpp @@ -145,7 +145,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 %i - out of data and not at end.", block_num); + PanicAlert("Failure reading block %lli - out of data and not at end.", block_num); } inflateEnd(&z); if (uncomp_size != header.block_size) diff --git a/Source/Core/DiscIO/Src/FileMonitor.cpp b/Source/Core/DiscIO/Src/FileMonitor.cpp index c05bd3f22c..1b3ccb0be8 100644 --- a/Source/Core/DiscIO/Src/FileMonitor.cpp +++ b/Source/Core/DiscIO/Src/FileMonitor.cpp @@ -106,11 +106,11 @@ void CheckFile(std::string File, u64 Size) std::string Str = StringFromFormat("%s kB %s", ThousandSeparate(Size, 7).c_str(), File.c_str()); if (ShowSound(File)) { - NOTICE_LOG(FILEMON, Str.c_str()); + NOTICE_LOG(FILEMON, "%s", Str.c_str()); } else { - WARN_LOG(FILEMON, Str.c_str()); + WARN_LOG(FILEMON, "%s", Str.c_str()); } // Update the current file diff --git a/Source/Core/DiscIO/Src/FileSystemGCWii.cpp b/Source/Core/DiscIO/Src/FileSystemGCWii.cpp index 64d108071a..db9c8af2b0 100644 --- a/Source/Core/DiscIO/Src/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/Src/FileSystemGCWii.cpp @@ -82,7 +82,8 @@ u64 CFileSystemGCWii::ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _Max if (pFileInfo->m_FileSize > _MaxBufferSize) return 0; - DEBUG_LOG(DISCIO, "Filename: %s. Offset: %0x. Size: %0x",_rFullPath, pFileInfo->m_Offset, pFileInfo->m_FileSize); + DEBUG_LOG(DISCIO, "Filename: %s. Offset: %llx. Size: %llx",_rFullPath, + pFileInfo->m_Offset, pFileInfo->m_FileSize); m_rVolume->Read(pFileInfo->m_Offset, pFileInfo->m_FileSize, _pBuffer); return pFileInfo->m_FileSize; diff --git a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp index a5c8d59fa5..e81ae40e8b 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp +++ b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp @@ -209,7 +209,7 @@ void CWiiSaveCrypted::ReadBKHDR() if (_sizeOfFiles + FULL_CERT_SZ != _totalSize) WARN_LOG(CONSOLE, "Size(%x) + cert(%x) does not equal totalsize(%x)", _sizeOfFiles, FULL_CERT_SZ, _totalSize); if (_saveGameTitle != Common::swap64(bkhdr.SaveGameTitle)) - WARN_LOG(CONSOLE, "encrypted title (%x) does not match unencrypted title (%x)", _saveGameTitle, Common::swap64(bkhdr.SaveGameTitle)); + WARN_LOG(CONSOLE, "encrypted title (%llx) does not match unencrypted title (%llx)", _saveGameTitle, Common::swap64(bkhdr.SaveGameTitle)); } diff --git a/Source/Core/VideoCommon/Src/HiresTextures.cpp b/Source/Core/VideoCommon/Src/HiresTextures.cpp index 3d70cfcc18..1fcd996427 100644 --- a/Source/Core/VideoCommon/Src/HiresTextures.cpp +++ b/Source/Core/VideoCommon/Src/HiresTextures.cpp @@ -108,7 +108,7 @@ PC_TexFormat GetHiresTex(const char *fileName, unsigned int *pWidth, unsigned in if (temp == NULL) { - ERROR_LOG(VIDEO, "Custom texture %s failed to load", textureMap[key].c_str(), width, height); + ERROR_LOG(VIDEO, "Custom texture %s failed to load", textureMap[key].c_str()); SOIL_free_image_data(temp); return PC_TEX_FMT_NONE; } diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index 9d4f2d6cec..f787ffa3e7 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -183,9 +183,10 @@ void PixelShaderManager::SetConstants() bpmem.indmtx[i].col2.mf * fscale, fscale * 4.0f); - PRIM_LOG("indmtx%d: scale=%f, mat=(%f %f %f; %f %f %f)\n", i, - 1024.0f*fscale, bpmem.indmtx[i].col0.ma * fscale, bpmem.indmtx[i].col1.mc * fscale, bpmem.indmtx[i].col2.me * fscale, - bpmem.indmtx[i].col0.mb * fscale, bpmem.indmtx[i].col1.md * fscale, bpmem.indmtx[i].col2.mf * fscale, fscale); + PRIM_LOG("indmtx%d: scale=%f, mat=(%f %f %f; %f %f %f)\n", + i, 1024.0f*fscale, + bpmem.indmtx[i].col0.ma * fscale, bpmem.indmtx[i].col1.mc * fscale, bpmem.indmtx[i].col2.me * fscale, + bpmem.indmtx[i].col0.mb * fscale, bpmem.indmtx[i].col1.md * fscale, bpmem.indmtx[i].col2.mf * fscale); } } s_nIndTexMtxChanged = 0; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp index b56316c0a2..50df0108b9 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp @@ -343,7 +343,7 @@ bool CUCode_AX::AXTask(u32& _uMail) break; case 0x0003: - DEBUG_LOG(DSPHLE, "%08x : AXLIST command 0x0003 ????"); + DEBUG_LOG(DSPHLE, "%08x : AXLIST command 0x0003 ????", uAddress); break; case 0x0004: // AUX? @@ -377,7 +377,7 @@ bool CUCode_AX::AXTask(u32& _uMail) case 0x0009: Addr__9 = Memory_Read_U32(uAddress); uAddress += 4; - DEBUG_LOG(DSPHLE, "%08x : AXLIST 6 address: %08x", Addr__9); + DEBUG_LOG(DSPHLE, "%08x : AXLIST 6 address: %08x", uAddress, Addr__9); break; case AXLIST_COMPRESSORTABLE: // 0xa @@ -438,7 +438,7 @@ bool CUCode_AX::AXTask(u32& _uMail) num += 2; } - PanicAlert(szTemp); + PanicAlert("%s", szTemp); // bFirst = false; } diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_CARD.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_CARD.cpp index 22abf48bfe..057a9f074a 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_CARD.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_CARD.cpp @@ -52,7 +52,7 @@ void CUCode_CARD::HandleMail(u32 _uMail) } else { - DEBUG_LOG(DSPHLE, "CUCode_CARD - unknown cmd: %x (size %i)", _uMail); + DEBUG_LOG(DSPHLE, "CUCode_CARD - unknown cmd: %x", _uMail); } m_rMailHandler.PushMail(DSP_DONE); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index f02b8d8ba4..58050d9de1 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -515,8 +515,8 @@ void OpenGL_ReportARBProgramError() GLint loc = 0; glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &loc); ERROR_LOG(VIDEO, "program error at %d: ", loc); - ERROR_LOG(VIDEO, (char*)pstr); - ERROR_LOG(VIDEO, ""); + ERROR_LOG(VIDEO, "%s", (char*)pstr); + ERROR_LOG(VIDEO, "\n"); } } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp index cb92316058..84213b24f0 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp @@ -261,7 +261,7 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr if (!cgIsProgram(tempprog)) { cgDestroyProgram(tempprog); ERROR_LOG(VIDEO, "Failed to compile ps %s:", cgGetLastListing(g_cgcontext)); - ERROR_LOG(VIDEO, pstrprogram); + ERROR_LOG(VIDEO, "%s", pstrprogram); return false; } @@ -269,7 +269,7 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr if (cgGetError() != CG_NO_ERROR) { WARN_LOG(VIDEO, "Warnings on compile ps %s:", cgGetLastListing(g_cgcontext)); - WARN_LOG(VIDEO, pstrprogram); + WARN_LOG(VIDEO, "%s", pstrprogram); } // This looks evil - we modify the program through the const char * we got from cgGetProgramString! @@ -304,8 +304,8 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr ERROR_LOG(VIDEO, "Hit limit? %i", native_limit); // TODO } - ERROR_LOG(VIDEO, pstrprogram); - ERROR_LOG(VIDEO, pcompiledprog); + ERROR_LOG(VIDEO, "%s", pstrprogram); + ERROR_LOG(VIDEO, "%s", pcompiledprog); } cgDestroyProgram(tempprog); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index a4c05c61b8..fed6707ba2 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -247,8 +247,8 @@ Renderer::Renderer() } INFO_LOG(VIDEO, "Supported OpenGL Extensions:"); - INFO_LOG(VIDEO, ptoken); // write to the log file - INFO_LOG(VIDEO, ""); + INFO_LOG(VIDEO, "%s", ptoken); // write to the log file + INFO_LOG(VIDEO, "\n"); OSD::AddMessage(StringFromFormat("Video Info: %s, %s, %s", glGetString(GL_VENDOR), diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp index 8d549b6f0b..e4675f2794 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp @@ -169,14 +169,14 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr } cgDestroyProgram(tempprog); ERROR_LOG(VIDEO, "Failed to load vs %s:", cgGetLastListing(g_cgcontext)); - ERROR_LOG(VIDEO, pstrprogram); + ERROR_LOG(VIDEO, "%s", pstrprogram); return false; } if (cgGetError() != CG_NO_ERROR) { WARN_LOG(VIDEO, "Failed to load vs %s:", cgGetLastListing(g_cgcontext)); - WARN_LOG(VIDEO, pstrprogram); + WARN_LOG(VIDEO, "%s", pstrprogram); } // This looks evil - we modify the program through the const char * we got from cgGetProgramString! @@ -194,8 +194,8 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pcompiledprog), pcompiledprog); err = GL_REPORT_ERROR(); if (err != GL_NO_ERROR) { - ERROR_LOG(VIDEO, pstrprogram); - ERROR_LOG(VIDEO, pcompiledprog); + ERROR_LOG(VIDEO, "%s", pstrprogram); + ERROR_LOG(VIDEO, "%s", pcompiledprog); } cgDestroyProgram(tempprog); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp index 262fd8669c..5630cd6892 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp @@ -439,8 +439,8 @@ void OpenGL_ReportARBProgramError() GLint loc = 0; glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &loc); ERROR_LOG(VIDEO, "program error at %d: ", loc); - ERROR_LOG(VIDEO, (char*)pstr); - ERROR_LOG(VIDEO, ""); + ERROR_LOG(VIDEO, "%s", (char*)pstr); + ERROR_LOG(VIDEO, "\n"); } }