From a7b19e23b303a970f425d4e44ef01af598ea1feb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 2 Oct 2016 18:13:08 -0400 Subject: [PATCH 1/2] LogWindow: Convert #define macros into typed constants --- Source/Core/DolphinWX/LogWindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/DolphinWX/LogWindow.cpp b/Source/Core/DolphinWX/LogWindow.cpp index 1b47f16883..d72900924f 100644 --- a/Source/Core/DolphinWX/LogWindow.cpp +++ b/Source/Core/DolphinWX/LogWindow.cpp @@ -30,9 +30,9 @@ #include "DolphinWX/WxUtils.h" // Milliseconds between msgQueue flushes to wxTextCtrl -#define UPDATETIME 200 +constexpr int UPDATE_TIME_MS = 200; // Max size of msgQueue, old messages will be discarded when there are too many. -#define MSGQUEUE_MAX_SIZE 100 +constexpr size_t MSGQUEUE_MAX_SIZE = 100; CLogWindow::CLogWindow(CFrame* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) @@ -48,7 +48,7 @@ CLogWindow::CLogWindow(CFrame* parent, wxWindowID id, const wxPoint& pos, const CreateGUIControls(); m_LogTimer.SetOwner(this); - m_LogTimer.Start(UPDATETIME); + m_LogTimer.Start(UPDATE_TIME_MS); } void CLogWindow::CreateGUIControls() @@ -292,7 +292,7 @@ void CLogWindow::UpdateLog() // the GUI will lock up, which could be an issue if new messages are flooding in faster than // this function can render them to the screen. // So we limit this function to processing MSGQUEUE_MAX_SIZE messages each time it's called. - for (int num = 0; num < MSGQUEUE_MAX_SIZE; num++) + for (size_t num = 0; num < MSGQUEUE_MAX_SIZE; num++) { u8 log_level; wxString log_msg; From d8f72e9cdaa52ade2bfeb8c5aa794e3ff054bc75 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 2 Oct 2016 18:14:52 -0400 Subject: [PATCH 2/2] LogWindow: Use emplace instead of push for the message queue Same thing. --- Source/Core/DolphinWX/LogWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinWX/LogWindow.cpp b/Source/Core/DolphinWX/LogWindow.cpp index d72900924f..a971fe98e0 100644 --- a/Source/Core/DolphinWX/LogWindow.cpp +++ b/Source/Core/DolphinWX/LogWindow.cpp @@ -355,5 +355,5 @@ void CLogWindow::Log(LogTypes::LOG_LEVELS level, const char* text) if (msgQueue.size() >= MSGQUEUE_MAX_SIZE) msgQueue.pop(); - msgQueue.push(std::make_pair(u8(level), StrToWxStr(text))); + msgQueue.emplace(static_cast(level), StrToWxStr(text)); }