diff options
author | Underground78 <underground78@users.sourceforge.net> | 2012-06-03 17:51:40 +0400 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2012-06-03 17:51:40 +0400 |
commit | 3eebb545fec4737aeefc173fa523e150e81ede8d (patch) | |
tree | fd2c340216b74eb43a1c9abe9332829746351d43 /src/DSUtil/text.cpp | |
parent | 2cb7553401de52d98e27364148919a8c3adbb8b2 (diff) |
MultiByteToWideChar: the destination size should be given in characters not in bytes (spotted with /analyze). Patch by XhmikosR.
Also ensure that the destination string is properly null terminated.
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4996 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/DSUtil/text.cpp')
-rw-r--r-- | src/DSUtil/text.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/DSUtil/text.cpp b/src/DSUtil/text.cpp index e71631bea..de62faca3 100644 --- a/src/DSUtil/text.cpp +++ b/src/DSUtil/text.cpp @@ -114,8 +114,8 @@ CStringA ConvertMBCS(CStringA str, DWORD SrcCharSet, DWORD DstCharSet) int len = MultiByteToWideChar(
CharSetToCodePage(SrcCharSet), 0,
- str.GetBuffer(str.GetLength()), str.GetLength(),
- utf16, (str.GetLength()+1)*sizeof(WCHAR));
+ str, -1, // null terminated string
+ utf16, str.GetLength()+1);
len = WideCharToMultiByte(
CharSetToCodePage(DstCharSet), 0,
|