[vlc-commits] commit: MSN: (hopefully) correct non-ASCII characters (fixes #3952) ( Rémi Denis-Courmont )
git at videolan.org
git at videolan.org
Mon Jul 26 19:16:47 CEST 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jul 26 20:15:34 2010 +0300| [8744dc3050ea60d250de033d5b827ba2fb29b8bd] | committer: Rémi Denis-Courmont
MSN: (hopefully) correct non-ASCII characters (fixes #3952)
VLC code page is UTF-8, not ANSI.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8744dc3050ea60d250de033d5b827ba2fb29b8bd
---
modules/misc/notify/msn.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/modules/misc/notify/msn.c b/modules/misc/notify/msn.c
index fe6fadd..7a0d656 100644
--- a/modules/misc/notify/msn.c
+++ b/modules/misc/notify/msn.c
@@ -35,6 +35,7 @@
#include <vlc_meta.h>
#include <vlc_playlist.h>
#include <vlc_strings.h>
+#include <vlc_charset.h>
/*****************************************************************************
* intf_sys_t: description and status of log interface
@@ -181,20 +182,18 @@ static int SendToMSN( const char *psz_msg )
COPYDATASTRUCT msndata;
HWND msnui = NULL;
- wchar_t buffer[MSN_MAX_LENGTH];
-
- //mbstowcs( buffer, psz_msg, MSN_MAX_LENGTH );
- int nLen = MultiByteToWideChar(CP_ACP, 0, psz_msg, -1, NULL, 0);
- MultiByteToWideChar(CP_ACP, 0, psz_msg, -1, &buffer, nLen);
+ wchar_t *wmsg = ToWide( psz_msg );
+ if( unlikely(wmsg == NULL) )
+ return VLC_ENOMEM;
msndata.dwData = 0x547;
- msndata.lpData = &buffer;
- msndata.cbData = (lstrlenW(buffer)*2)+2;
+ msndata.lpData = wmsg;
+ msndata.cbData = (wcslen(wmsg) + 1) * 2;
while( ( msnui = FindWindowEx( NULL, msnui, "MsnMsgrUIManager", NULL ) ) )
{
SendMessage(msnui, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&msndata);
}
-
+ free( wmsg );
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list