Skip to content

Commit

Permalink
Actually fix window title and new[].
Browse files Browse the repository at this point in the history
Now the correct string is used in the title.

And in C++ default operator new/new[] will throw a std::bad_alloc exception instead of returning a null pointer when failed. The nothrow variants as used in this commit does the opposite.
  • Loading branch information
aquanull committed Mar 13, 2013
1 parent a3ae8d3 commit 138316f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Windows/WindowsHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ void WindowsHost::SetWindowTitle(const char *message)
{
std::string title = std::string("PPSSPP ") + PPSSPP_GIT_VERSION + " - " + message;

int size = MultiByteToWideChar(CP_UTF8, 0, message, (int) title.size(), NULL, 0);
int size = MultiByteToWideChar(CP_UTF8, 0, title.c_str(), (int) title.size(), NULL, 0);
if (size > 0)
{
wchar_t *utf16_title = new wchar_t[size + 1];
// VC++6.0 any more?
wchar_t *utf16_title = new(std::nothrow) wchar_t[size + 1];
if (utf16_title)
size = MultiByteToWideChar(CP_UTF8, 0, message, (int) title.size(), utf16_title, size);
size = MultiByteToWideChar(CP_UTF8, 0, title.c_str(), (int) title.size(), utf16_title, size);
else
size = 0;

Expand Down

0 comments on commit 138316f

Please sign in to comment.