Mercurial > hg > RemoteEditor > vim7
diff src/xpm_w32.c @ 48:67300faee616 v7-3-618
v7-3-618
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 01 Aug 2012 18:08:28 +0900 |
parents | 76efa0be13f1 |
children |
line wrap: on
line diff
--- a/src/xpm_w32.c Wed Aug 01 18:03:06 2012 +0900 +++ b/src/xpm_w32.c Wed Aug 01 18:08:28 2012 +0900 @@ -1,4 +1,5 @@ -/* +/* vi:set ts=8 sts=4 sw=4: + * * Load XPM image. * * This function is placed in separate file because Xpm headers conflict with @@ -30,9 +31,10 @@ #include "xpm.h" /* - * Tries to load Xpm image from file 'filename'. - * If fails return -1. - * success - 0 and image and mask BITMAPS + * Tries to load an Xpm image from the file "filename". + * Returns -1 on failure. + * Returns 0 on success and stores image and mask BITMAPS in "hImage" and + * "hShape". */ int LoadXpmImage(filename, hImage, hShape) @@ -40,7 +42,7 @@ HBITMAP *hImage; HBITMAP *hShape; { - XImage *img; /* loaded image */ + XImage *img; /* loaded image */ XImage *shp; /* shapeimage */ XpmAttributes attr; int res; @@ -51,10 +53,13 @@ DeleteDC(hdc); if (res < 0) return -1; - else + if (shp == NULL) { - *hImage = img->bitmap; - *hShape = shp->bitmap; - return 0; + if (img) + XDestroyImage(img); + return -1; } + *hImage = img->bitmap; + *hShape = shp->bitmap; + return 0; }