Blame SOURCES/7.4.026

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.026
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.026
22c937
Problem:    Clang warning for int shift overflow.
22c937
Solution:   Use unsigned and cast back to int. (Dominique Pelle)
22c937
Files:	    src/misc2.c
22c937
22c937
22c937
*** ../vim-7.4.025/src/misc2.c	2013-07-07 16:03:35.000000000 +0200
22c937
--- src/misc2.c	2013-09-08 16:04:54.000000000 +0200
22c937
***************
22c937
*** 6496,6508 ****
22c937
  get4c(fd)
22c937
      FILE	*fd;
22c937
  {
22c937
!     int		n;
22c937
  
22c937
!     n = getc(fd);
22c937
!     n = (n << 8) + getc(fd);
22c937
!     n = (n << 8) + getc(fd);
22c937
!     n = (n << 8) + getc(fd);
22c937
!     return n;
22c937
  }
22c937
  
22c937
  /*
22c937
--- 6496,6510 ----
22c937
  get4c(fd)
22c937
      FILE	*fd;
22c937
  {
22c937
!     /* Use unsigned rather than int otherwise result is undefined
22c937
!      * when left-shift sets the MSB. */
22c937
!     unsigned	n;
22c937
  
22c937
!     n = (unsigned)getc(fd);
22c937
!     n = (n << 8) + (unsigned)getc(fd);
22c937
!     n = (n << 8) + (unsigned)getc(fd);
22c937
!     n = (n << 8) + (unsigned)getc(fd);
22c937
!     return (int)n;
22c937
  }
22c937
  
22c937
  /*
22c937
*** ../vim-7.4.025/src/version.c	2013-09-08 16:03:40.000000000 +0200
22c937
--- src/version.c	2013-09-08 16:05:40.000000000 +0200
22c937
***************
22c937
*** 740,741 ****
22c937
--- 740,743 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     26,
22c937
  /**/
22c937
22c937
-- 
22c937
A computer program does what you tell it to do, not what you want it to do.
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///