changeset 1641:cdbf4cc929fc

Fixed issue with dw_mle_import() in Unicode mode. Need to convert to Unicode before doing buffer manipulation.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 02 Apr 2012 19:44:45 +0000
parents b8604e5fc85e
children e21c70d75cb1
files win/dw.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Mon Apr 02 19:25:09 2012 +0000
+++ b/win/dw.c	Mon Apr 02 19:44:45 2012 +0000
@@ -7949,12 +7949,12 @@
 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint)
 {
    int textlen, len = GetWindowTextLength(handle);
-   TCHAR *tmpbuf;
+   TCHAR *tmpbuf, *srcbuf = UTF8toWide(buffer);
 
    if(startpoint < 0)
       startpoint = 0;
 
-   if(!buffer || (textlen = (int)strlen(buffer)) < 1)
+   if(!buffer || (textlen = (int)_tcslen(srcbuf)) < 1)
       return startpoint;
 
    tmpbuf = calloc(sizeof(TCHAR), len + textlen + startpoint + 2);
@@ -7972,7 +7972,7 @@
       if(copylen > 0)
          memcpy(dest, start, copylen*sizeof(TCHAR));
    }
-   memcpy(&tmpbuf[startpoint], UTF8toWide(buffer), textlen*sizeof(TCHAR));
+   memcpy(&tmpbuf[startpoint], srcbuf, textlen*sizeof(TCHAR));
 
    SetWindowText(handle, tmpbuf);