changeset 1252:575663435272

Fixed not accounting for the NULL terminator on Windows when converting to wide characters. Also fixed not initializing a variable with the new code.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 24 Oct 2011 03:44:24 +0000
parents 7809be48de7d
children 28c2c7e6671c
files win/dw.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Mon Oct 24 03:10:27 2011 +0000
+++ b/win/dw.c	Mon Oct 24 03:44:24 2011 +0000
@@ -402,7 +402,7 @@
       if ( access( file, 04 ) == 0 )
       {
          /* Convert to wide format */
-         MultiByteToWideChar(CP_ACP, 0, file, strlen(file), wfile, wclen);
+         MultiByteToWideChar(CP_ACP, 0, file, strlen(file)+1, wfile, wclen);
          if(!GdipCreateBitmapFromFile(wfile, &image))
              return image;
       }
@@ -5835,7 +5835,7 @@
 {
    HBITMAP hbitmap;
    HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0);
-   HICON icon;
+   HICON icon = 0;
    HICON oldicon = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 0);
 
    if(id)