Karsten Hopp c53b4e
To: vim-dev@vim.org
Karsten Hopp c53b4e
Subject: Patch 7.2.057
Karsten Hopp c53b4e
Fcc: outbox
Karsten Hopp c53b4e
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp c53b4e
Mime-Version: 1.0
Karsten Hopp c53b4e
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp c53b4e
Content-Transfer-Encoding: 8bit
Karsten Hopp c53b4e
------------
Karsten Hopp c53b4e
Karsten Hopp c53b4e
Patch 7.2.057 (after 7.2.056)
Karsten Hopp c53b4e
Problem:    Combination of int and size_t may not work.
Karsten Hopp c53b4e
Solution:   Use size_t for variable.
Karsten Hopp c53b4e
Files:	    src/spell.c
Karsten Hopp c53b4e
Karsten Hopp c53b4e
Karsten Hopp c53b4e
*** ../vim-7.2.056/src/spell.c	Sat Nov 29 20:10:59 2008
Karsten Hopp c53b4e
--- src/spell.c	Sat Nov 29 20:15:43 2008
Karsten Hopp c53b4e
***************
Karsten Hopp c53b4e
*** 7926,7932 ****
Karsten Hopp c53b4e
      char_u	*p;
Karsten Hopp c53b4e
      int		rr;
Karsten Hopp c53b4e
      int		retval = OK;
Karsten Hopp c53b4e
!     int		fwv = 1;  /* collect return value of fwrite() to avoid
Karsten Hopp c53b4e
  			     warnings from picky compiler */
Karsten Hopp c53b4e
  
Karsten Hopp c53b4e
      fd = mch_fopen((char *)fname, "w");
Karsten Hopp c53b4e
--- 8028,8034 ----
Karsten Hopp c53b4e
      char_u	*p;
Karsten Hopp c53b4e
      int		rr;
Karsten Hopp c53b4e
      int		retval = OK;
Karsten Hopp c53b4e
!     size_t	fwv = 1;  /* collect return value of fwrite() to avoid
Karsten Hopp c53b4e
  			     warnings from picky compiler */
Karsten Hopp c53b4e
  
Karsten Hopp c53b4e
      fd = mch_fopen((char *)fname, "w");
Karsten Hopp c53b4e
***************
Karsten Hopp c53b4e
*** 7939,7944 ****
Karsten Hopp c53b4e
--- 8041,8050 ----
Karsten Hopp c53b4e
      /* <HEADER>: <fileID> <versionnr> */
Karsten Hopp c53b4e
  							    /* <fileID> */
Karsten Hopp c53b4e
      fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
Karsten Hopp c53b4e
+     if (fwv != (size_t)1)
Karsten Hopp c53b4e
+ 	/* Catch first write error, don't try writing more. */
Karsten Hopp c53b4e
+ 	goto theend;
Karsten Hopp c53b4e
+ 
Karsten Hopp c53b4e
      putc(VIMSPELLVERSION, fd);				    /* <versionnr> */
Karsten Hopp c53b4e
  
Karsten Hopp c53b4e
      /*
Karsten Hopp c53b4e
***************
Karsten Hopp c53b4e
*** 8300,8310 ****
Karsten Hopp c53b4e
      /* Write another byte to check for errors (file system full). */
Karsten Hopp c53b4e
      if (putc(0, fd) == EOF)
Karsten Hopp c53b4e
  	retval = FAIL;
Karsten Hopp c53b4e
! 
Karsten Hopp c53b4e
      if (fclose(fd) == EOF)
Karsten Hopp c53b4e
  	retval = FAIL;
Karsten Hopp c53b4e
  
Karsten Hopp c53b4e
!     if (fwv != 1)
Karsten Hopp c53b4e
  	retval = FAIL;
Karsten Hopp c53b4e
      if (retval == FAIL)
Karsten Hopp c53b4e
  	EMSG(_(e_write));
Karsten Hopp c53b4e
--- 8406,8416 ----
Karsten Hopp c53b4e
      /* Write another byte to check for errors (file system full). */
Karsten Hopp c53b4e
      if (putc(0, fd) == EOF)
Karsten Hopp c53b4e
  	retval = FAIL;
Karsten Hopp c53b4e
! theend:
Karsten Hopp c53b4e
      if (fclose(fd) == EOF)
Karsten Hopp c53b4e
  	retval = FAIL;
Karsten Hopp c53b4e
  
Karsten Hopp c53b4e
!     if (fwv != (size_t)1)
Karsten Hopp c53b4e
  	retval = FAIL;
Karsten Hopp c53b4e
      if (retval == FAIL)
Karsten Hopp c53b4e
  	EMSG(_(e_write));
Karsten Hopp c53b4e
***************
Karsten Hopp c53b4e
*** 9897,9903 ****
Karsten Hopp c53b4e
      char_u	*p;
Karsten Hopp c53b4e
      int		len;
Karsten Hopp c53b4e
      int		totlen;
Karsten Hopp c53b4e
!     int		x = 1;  /* collect return value of fwrite() */
Karsten Hopp c53b4e
  
Karsten Hopp c53b4e
      if (fd != NULL)
Karsten Hopp c53b4e
  	put_bytes(fd, (long_u)gap->ga_len, 2);	    /* <prefcondcnt> */
Karsten Hopp c53b4e
--- 10003,10009 ----
Karsten Hopp c53b4e
      char_u	*p;
Karsten Hopp c53b4e
      int		len;
Karsten Hopp c53b4e
      int		totlen;
Karsten Hopp c53b4e
!     size_t	x = 1;  /* collect return value of fwrite() */
Karsten Hopp c53b4e
  
Karsten Hopp c53b4e
      if (fd != NULL)
Karsten Hopp c53b4e
  	put_bytes(fd, (long_u)gap->ga_len, 2);	    /* <prefcondcnt> */
Karsten Hopp c53b4e
*** ../vim-7.2.056/src/version.c	Sat Nov 29 20:10:59 2008
Karsten Hopp c53b4e
--- src/version.c	Sat Nov 29 20:13:46 2008
Karsten Hopp c53b4e
***************
Karsten Hopp c53b4e
*** 678,679 ****
Karsten Hopp c53b4e
--- 678,681 ----
Karsten Hopp c53b4e
  {   /* Add new patch number below this line */
Karsten Hopp c53b4e
+ /**/
Karsten Hopp c53b4e
+     57,
Karsten Hopp c53b4e
  /**/
Karsten Hopp c53b4e
Karsten Hopp c53b4e
-- 
Karsten Hopp c53b4e
GUARD #1:  What -- a swallow carrying a coconut?
Karsten Hopp c53b4e
ARTHUR:    It could grip it by the husk!
Karsten Hopp c53b4e
GUARD #1:  It's not a question of where he grips it!  It's a simple question
Karsten Hopp c53b4e
           of weight ratios!  A five ounce bird could not carry a 1 pound
Karsten Hopp c53b4e
           coconut.
Karsten Hopp c53b4e
                                  The Quest for the Holy Grail (Monty Python)
Karsten Hopp c53b4e
Karsten Hopp c53b4e
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp c53b4e
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp c53b4e
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp c53b4e
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///