summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/StringUtil.h9
-rw-r--r--Source/Core/Common/Timer.cpp2
-rw-r--r--Source/Core/Core/CoreTiming.cpp2
-rw-r--r--Source/Core/Core/HLE/HLE_OS.cpp2
-rw-r--r--Source/Core/Core/PowerPC/PPCTables.cpp2
5 files changed, 12 insertions, 5 deletions
diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h
index 46ed382724..7846cbee3d 100644
--- a/Source/Core/Common/StringUtil.h
+++ b/Source/Core/Common/StringUtil.h
@@ -14,7 +14,14 @@
#include "Common.h"
-std::string StringFromFormat(const char* format, ...);
+std::string StringFromFormat(const char* format, ...)
+#if !defined _WIN32
+// On compilers that support function attributes, this gives StringFromFormat
+// the same errors and warnings that printf would give.
+ __attribute__ ((__format__(printf, 1, 2)))
+#endif
+;
+
// Cheap!
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);
diff --git a/Source/Core/Common/Timer.cpp b/Source/Core/Common/Timer.cpp
index b7ae848970..267755fb17 100644
--- a/Source/Core/Common/Timer.cpp
+++ b/Source/Core/Common/Timer.cpp
@@ -113,7 +113,7 @@ std::string Timer::GetTimeElapsedFormatted() const
// Hours
u32 Hours = Minutes / 60;
- std::string TmpStr = StringFromFormat("%02i:%02i:%02i:%03i",
+ std::string TmpStr = StringFromFormat("%02i:%02i:%02i:%03lu",
Hours, Minutes % 60, Seconds % 60, Milliseconds % 1000);
return TmpStr;
}
diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp
index 5461692a22..ace2c9759c 100644
--- a/Source/Core/Core/CoreTiming.cpp
+++ b/Source/Core/Core/CoreTiming.cpp
@@ -469,7 +469,7 @@ std::string GetScheduledEventsSummary()
if (!name)
name = "[unknown]";
- text += StringFromFormat("%s : %i %08x%08x\n", name, ptr->time, ptr->userdata >> 32, ptr->userdata);
+ text += StringFromFormat("%s : %li %08lx%08lx\n", name, ptr->time, ptr->userdata >> 32, ptr->userdata);
ptr = ptr->next;
}
return text;
diff --git a/Source/Core/Core/HLE/HLE_OS.cpp b/Source/Core/Core/HLE/HLE_OS.cpp
index ed80a68154..ed02672110 100644
--- a/Source/Core/Core/HLE/HLE_OS.cpp
+++ b/Source/Core/Core/HLE/HLE_OS.cpp
@@ -155,7 +155,7 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg)
case 'p':
// Override, so 64bit dolphin prints 32bit pointers, since the ppc is 32bit :)
- _rOutBuffer += StringFromFormat("%x", Parameter);
+ _rOutBuffer += StringFromFormat("%x", (u32)Parameter);
break;
default:
diff --git a/Source/Core/Core/PowerPC/PPCTables.cpp b/Source/Core/Core/PowerPC/PPCTables.cpp
index 758fbae6c9..ce7d299f92 100644
--- a/Source/Core/Core/PowerPC/PPCTables.cpp
+++ b/Source/Core/Core/PowerPC/PPCTables.cpp
@@ -231,7 +231,7 @@ void LogCompiledInstructions()
}
#ifdef OPLOG
- f.Open(StringFromFormat("%s" OP_TO_LOG "_at.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w");
+ f.Open(StringFromFormat("%s" OP_TO_LOG "_at%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w");
for (auto& rsplocation : rsplocations)
{
fprintf(f.GetHandle(), OP_TO_LOG ": %08x\n", rsplocation);