Mercurial > vim
comparison src/fileio.c @ 12698:6d3d64be7945 v8.0.1227
patch 8.0.1227: undefined left shift in readfile()
commit https://github.com/vim/vim/commit/dc1c98129484e7879bc6dbf38e523beb730988b6
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Oct 27 22:15:24 2017 +0200
patch 8.0.1227: undefined left shift in readfile()
Problem: Undefined left shift in readfile(). (Brian 'geeknik' Carpenter)
Solution: Add cast to unsigned. (Dominique Pelle, closes https://github.com/vim/vim/issues/2253)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 27 Oct 2017 22:30:06 +0200 |
parents | 0a9dacb8826a |
children | 351cf7c67bbe |
comparison
equal
deleted
inserted
replaced
12697:6d76bde47f3e | 12698:6d3d64be7945 |
---|---|
1954 } | 1954 } |
1955 else if (fio_flags & FIO_UCS4) | 1955 else if (fio_flags & FIO_UCS4) |
1956 { | 1956 { |
1957 if (fio_flags & FIO_ENDIAN_L) | 1957 if (fio_flags & FIO_ENDIAN_L) |
1958 { | 1958 { |
1959 u8c = (*--p << 24); | 1959 u8c = (unsigned)*--p << 24; |
1960 u8c += (*--p << 16); | 1960 u8c += (unsigned)*--p << 16; |
1961 u8c += (*--p << 8); | 1961 u8c += (unsigned)*--p << 8; |
1962 u8c += *--p; | 1962 u8c += *--p; |
1963 } | 1963 } |
1964 else /* big endian */ | 1964 else /* big endian */ |
1965 { | 1965 { |
1966 u8c = *--p; | 1966 u8c = *--p; |
1967 u8c += (*--p << 8); | 1967 u8c += (unsigned)*--p << 8; |
1968 u8c += (*--p << 16); | 1968 u8c += (unsigned)*--p << 16; |
1969 u8c += (*--p << 24); | 1969 u8c += (unsigned)*--p << 24; |
1970 } | 1970 } |
1971 } | 1971 } |
1972 else /* UTF-8 */ | 1972 else /* UTF-8 */ |
1973 { | 1973 { |
1974 if (*--p < 0x80) | 1974 if (*--p < 0x80) |