diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 0f3fefec7e..1abb93183f 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -54,13 +54,13 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar std::string StringFromFormat(const char* format, ...) { int writtenCount = -1; - size_t newSize = strlen(format) + 4; + size_t newSize = strlen(format) + 5; char *buf = NULL; va_list args; while (writtenCount < 0) { delete[] buf; - buf = new char[newSize + 1]; + buf = new char[newSize]; va_start(args, format); writtenCount = vsnprintf(buf, newSize, format, args); @@ -71,7 +71,7 @@ std::string StringFromFormat(const char* format, ...) // Instead it returns the size of the string we need. if (writtenCount > (int)newSize) { - newSize = writtenCount; + newSize = writtenCount + 1; writtenCount = -1; } #else diff --git a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp index 354a3bacac..0373b3d804 100644 --- a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp @@ -452,7 +452,7 @@ void ControlDialog::DetectControl(wxCommandEvent& event) btn->SetLabel(wxT("[ waiting ]")); // apparently, this makes the "waiting" text work on Linux - wxYield(); + wxTheApp->Yield(); m_plugin.controls_crit.Enter(); // enter ControllerInterface::Device::Control* const ctrl = control_reference->Detect(DETECT_WAIT_TIME, dev); @@ -477,7 +477,7 @@ void GamepadPage::DetectControl( wxCommandEvent& event ) btn->SetLabel(wxT("[ waiting ]")); // apparently, this makes the "waiting" text work on Linux - wxYield(); + wxTheApp->Yield(); m_plugin.controls_crit.Enter(); // enter ControllerInterface::Device::Control* const ctrl = btn->control_reference->Detect(DETECT_WAIT_TIME, dev);