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