# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1333395885 0 # Node ID cdbf4cc929fcf798336d8b0a1bb5742ae6899fa2 # Parent b8604e5fc85e616c6a392dbb859b8af90c81c653 Fixed issue with dw_mle_import() in Unicode mode. Need to convert to Unicode before doing buffer manipulation. diff -r b8604e5fc85e -r cdbf4cc929fc win/dw.c --- 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);