diff options
author | marynate <mary.w.nate@gmail.com> | 2014-02-21 19:48:04 +0800 |
---|---|---|
committer | marynate <mary.w.nate@gmail.com> | 2014-03-11 13:09:24 +0800 |
commit | f7cef6d61723d4c395d4f8e2bd357e42f69d109c (patch) | |
tree | 5e8dfaf32109e71a9c98d8f0f370d2454f67010d /platform/windows | |
parent | 0552b76475bcc09fcbe33a0ebeedcc84158c7ea0 (diff) |
remove unnecessary error check when converting ascii to unicode
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/godot_win.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/platform/windows/godot_win.cpp b/platform/windows/godot_win.cpp index ddfadf98ca..fa573b9421 100644 --- a/platform/windows/godot_win.cpp +++ b/platform/windows/godot_win.cpp @@ -116,16 +116,13 @@ PCHAR* } char* mb_to_utf8(const char* mbs) { - int wlen = MultiByteToWideChar(CP_ACP,0,mbs,-1,NULL,0); - if (wlen < 0) - wlen = 0; + + int wlen = MultiByteToWideChar(CP_ACP,0,mbs,-1,NULL,0); // returns 0 if failed wchar_t *wbuf = new wchar_t[wlen + 1]; MultiByteToWideChar(CP_ACP,0,mbs,-1,wbuf,wlen); wbuf[wlen]=0; int ulen = WideCharToMultiByte(CP_UTF8,0,wbuf,-1,NULL,0,NULL,NULL); - if (ulen < 0) - ulen = 0; char * ubuf = new char[ulen + 1]; WideCharToMultiByte(CP_UTF8,0,wbuf,-1,ubuf,ulen,NULL,NULL); ubuf[ulen] = 0; |