Mercurial > dwindows
diff win/dw.c @ 997:dfa2204e231f
Fixes for dw_mle_import to make it function like the other platforms on Windows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 07 May 2011 20:04:34 +0000 |
parents | 87dc0f5f96d0 |
children | 1b40686277df |
line wrap: on
line diff
--- a/win/dw.c Sat May 07 19:55:05 2011 +0000 +++ b/win/dw.c Sat May 07 20:04:34 2011 +0000 @@ -6814,15 +6814,14 @@ int textlen, len = GetWindowTextLength(handle); char *tmpbuf; - if((textlen = strlen(buffer)) < 1) - return startpoint; - - startpoint++; - tmpbuf = calloc(1, len + textlen + startpoint + 2); - if(startpoint < 0) startpoint = 0; + if(!buffer || (textlen = strlen(buffer)) < 1) + return startpoint; + + tmpbuf = calloc(1, len + textlen + startpoint + 2); + if(len) { char *dest, *start; @@ -6830,7 +6829,7 @@ GetWindowText(handle, tmpbuf, len+1); - dest = &tmpbuf[startpoint+textlen-1]; + dest = &tmpbuf[startpoint+textlen]; start = &tmpbuf[startpoint]; if(copylen > 0) @@ -6841,7 +6840,7 @@ SetWindowText(handle, tmpbuf); free(tmpbuf); - return (startpoint + textlen - 1); + return (startpoint + textlen); } /*