Karsten Hopp 7ff731
To: vim_dev@googlegroups.com
Karsten Hopp 7ff731
Subject: Patch 7.3.428
Karsten Hopp 7ff731
Fcc: outbox
Karsten Hopp 7ff731
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 7ff731
Mime-Version: 1.0
Karsten Hopp 7ff731
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 7ff731
Content-Transfer-Encoding: 8bit
Karsten Hopp 7ff731
------------
Karsten Hopp 7ff731
Karsten Hopp 7ff731
Patch 7.3.428 
Karsten Hopp 7ff731
Problem:    Win32: an xpm file without a mask crashes Vim.
Karsten Hopp 7ff731
Solution:   Fail when the mask is missing. (Dave Bodenstab)
Karsten Hopp 7ff731
Files:      src/xpm_w32.c
Karsten Hopp 7ff731
 
Karsten Hopp 7ff731
Karsten Hopp 7ff731
*** ../vim-7.3.427/src/xpm_w32.c	2010-08-15 21:57:25.000000000 +0200
Karsten Hopp 7ff731
--- src/xpm_w32.c	2012-02-05 00:46:13.000000000 +0100
Karsten Hopp 7ff731
***************
Karsten Hopp 7ff731
*** 1,4 ****
Karsten Hopp 7ff731
! /*
Karsten Hopp 7ff731
   * Load XPM image.
Karsten Hopp 7ff731
   *
Karsten Hopp 7ff731
   * This function is placed in separate file because Xpm headers conflict with
Karsten Hopp 7ff731
--- 1,5 ----
Karsten Hopp 7ff731
! /* vi:set ts=8 sts=4 sw=4:
Karsten Hopp 7ff731
!  *
Karsten Hopp 7ff731
   * Load XPM image.
Karsten Hopp 7ff731
   *
Karsten Hopp 7ff731
   * This function is placed in separate file because Xpm headers conflict with
Karsten Hopp 7ff731
***************
Karsten Hopp 7ff731
*** 30,38 ****
Karsten Hopp 7ff731
  #include "xpm.h"
Karsten Hopp 7ff731
  
Karsten Hopp 7ff731
  /*
Karsten Hopp 7ff731
!  * Tries to load Xpm image from file 'filename'.
Karsten Hopp 7ff731
!  * If fails return -1.
Karsten Hopp 7ff731
!  * success - 0 and image and mask BITMAPS
Karsten Hopp 7ff731
   */
Karsten Hopp 7ff731
      int
Karsten Hopp 7ff731
  LoadXpmImage(filename, hImage, hShape)
Karsten Hopp 7ff731
--- 31,40 ----
Karsten Hopp 7ff731
  #include "xpm.h"
Karsten Hopp 7ff731
  
Karsten Hopp 7ff731
  /*
Karsten Hopp 7ff731
!  * Tries to load an Xpm image from the file "filename".
Karsten Hopp 7ff731
!  * Returns -1 on failure.
Karsten Hopp 7ff731
!  * Returns 0 on success and stores image and mask BITMAPS in "hImage" and
Karsten Hopp 7ff731
!  * "hShape".
Karsten Hopp 7ff731
   */
Karsten Hopp 7ff731
      int
Karsten Hopp 7ff731
  LoadXpmImage(filename, hImage, hShape)
Karsten Hopp 7ff731
***************
Karsten Hopp 7ff731
*** 40,46 ****
Karsten Hopp 7ff731
      HBITMAP *hImage;
Karsten Hopp 7ff731
      HBITMAP *hShape;
Karsten Hopp 7ff731
  {
Karsten Hopp 7ff731
!     XImage	    *img;   /* loaded image */
Karsten Hopp 7ff731
      XImage	    *shp;  /* shapeimage */
Karsten Hopp 7ff731
      XpmAttributes   attr;
Karsten Hopp 7ff731
      int		    res;
Karsten Hopp 7ff731
--- 42,48 ----
Karsten Hopp 7ff731
      HBITMAP *hImage;
Karsten Hopp 7ff731
      HBITMAP *hShape;
Karsten Hopp 7ff731
  {
Karsten Hopp 7ff731
!     XImage	    *img;  /* loaded image */
Karsten Hopp 7ff731
      XImage	    *shp;  /* shapeimage */
Karsten Hopp 7ff731
      XpmAttributes   attr;
Karsten Hopp 7ff731
      int		    res;
Karsten Hopp 7ff731
***************
Karsten Hopp 7ff731
*** 51,60 ****
Karsten Hopp 7ff731
      DeleteDC(hdc);
Karsten Hopp 7ff731
      if (res < 0)
Karsten Hopp 7ff731
  	return -1;
Karsten Hopp 7ff731
!     else
Karsten Hopp 7ff731
      {
Karsten Hopp 7ff731
! 	*hImage = img->bitmap;
Karsten Hopp 7ff731
! 	*hShape = shp->bitmap;
Karsten Hopp 7ff731
! 	return 0;
Karsten Hopp 7ff731
      }
Karsten Hopp 7ff731
  }
Karsten Hopp 7ff731
--- 53,65 ----
Karsten Hopp 7ff731
      DeleteDC(hdc);
Karsten Hopp 7ff731
      if (res < 0)
Karsten Hopp 7ff731
  	return -1;
Karsten Hopp 7ff731
!     if (shp == NULL)
Karsten Hopp 7ff731
      {
Karsten Hopp 7ff731
!         if (img)
Karsten Hopp 7ff731
! 	    XDestroyImage(img);
Karsten Hopp 7ff731
! 	return -1;
Karsten Hopp 7ff731
      }
Karsten Hopp 7ff731
+     *hImage = img->bitmap;
Karsten Hopp 7ff731
+     *hShape = shp->bitmap;
Karsten Hopp 7ff731
+     return 0;
Karsten Hopp 7ff731
  }
Karsten Hopp 7ff731
*** ../vim-7.3.427/src/version.c	2012-02-05 00:39:14.000000000 +0100
Karsten Hopp 7ff731
--- src/version.c	2012-02-05 00:47:08.000000000 +0100
Karsten Hopp 7ff731
***************
Karsten Hopp 7ff731
*** 716,717 ****
Karsten Hopp 7ff731
--- 716,719 ----
Karsten Hopp 7ff731
  {   /* Add new patch number below this line */
Karsten Hopp 7ff731
+ /**/
Karsten Hopp 7ff731
+     428,
Karsten Hopp 7ff731
  /**/
Karsten Hopp 7ff731
Karsten Hopp 7ff731
-- 
Karsten Hopp 7ff731
I'm not familiar with this proof, but I'm aware of a significant
Karsten Hopp 7ff731
following of toddlers who believe that peanut butter is the solution
Karsten Hopp 7ff731
to all of life's problems... 		-- Tim Hammerquist
Karsten Hopp 7ff731
Karsten Hopp 7ff731
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 7ff731
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 7ff731
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 7ff731
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///