vim-patch:8.0.1254: undefined left shift in gethexchrs()

Problem:    Undefined left shift in gethexchrs(). (geeknik)
Solution:   Use unsigned long. (idea by Christian Brabandt, closes vim/vim#2255)
4c22a91d20
This commit is contained in:
Jan Edmund Lazo 2018-08-10 09:42:07 -04:00
parent dd6c1a0a8f
commit f7f65f5a82
2 changed files with 11 additions and 12 deletions

View File

@ -1664,9 +1664,8 @@ static char_u *regpiece(int *flagp)
case Magic('@'): case Magic('@'):
{ {
int lop = END; int lop = END;
int nr; int64_t nr = getdecchrs();
nr = getdecchrs();
switch (no_Magic(getchr())) { switch (no_Magic(getchr())) {
case '=': lop = MATCH; break; /* \@= */ case '=': lop = MATCH; break; /* \@= */
case '!': lop = NOMATCH; break; /* \@! */ case '!': lop = NOMATCH; break; /* \@! */
@ -2087,7 +2086,7 @@ static char_u *regatom(int *flagp)
case 'u': /* %uabcd hex 4 */ case 'u': /* %uabcd hex 4 */
case 'U': /* %U1234abcd hex 8 */ case 'U': /* %U1234abcd hex 8 */
{ {
int i; int64_t i;
switch (c) { switch (c) {
case 'd': i = getdecchrs(); break; case 'd': i = getdecchrs(); break;
@ -2976,9 +2975,9 @@ static void ungetchr(void)
* The parameter controls the maximum number of input characters. This will be * The parameter controls the maximum number of input characters. This will be
* 2 when reading a \%x20 sequence and 4 when reading a \%u20AC sequence. * 2 when reading a \%x20 sequence and 4 when reading a \%u20AC sequence.
*/ */
static int gethexchrs(int maxinputlen) static int64_t gethexchrs(int maxinputlen)
{ {
int nr = 0; int64_t nr = 0;
int c; int c;
int i; int i;
@ -3000,9 +2999,9 @@ static int gethexchrs(int maxinputlen)
* Get and return the value of the decimal string immediately after the * Get and return the value of the decimal string immediately after the
* current position. Return -1 for invalid. Consumes all digits. * current position. Return -1 for invalid. Consumes all digits.
*/ */
static int getdecchrs(void) static int64_t getdecchrs(void)
{ {
int nr = 0; int64_t nr = 0;
int c; int c;
int i; int i;
@ -3029,9 +3028,9 @@ static int getdecchrs(void)
* blahblah\%o210asdf * blahblah\%o210asdf
* before-^ ^-after * before-^ ^-after
*/ */
static int getoctchrs(void) static int64_t getoctchrs(void)
{ {
int nr = 0; int64_t nr = 0;
int c; int c;
int i; int i;
@ -3055,7 +3054,7 @@ static int getoctchrs(void)
*/ */
static int coll_get_char(void) static int coll_get_char(void)
{ {
int nr = -1; int64_t nr = -1;
switch (*regparse++) { switch (*regparse++) {
case 'd': nr = getdecchrs(); break; case 'd': nr = getdecchrs(); break;

View File

@ -1409,7 +1409,7 @@ static int nfa_regatom(void)
case 'u': /* %uabcd hex 4 */ case 'u': /* %uabcd hex 4 */
case 'U': /* %U1234abcd hex 8 */ case 'U': /* %U1234abcd hex 8 */
{ {
int nr; int64_t nr;
switch (c) { switch (c) {
case 'd': nr = getdecchrs(); break; case 'd': nr = getdecchrs(); break;
@ -1859,7 +1859,7 @@ static int nfa_regpiece(void)
int greedy = TRUE; /* Braces are prefixed with '-' ? */ int greedy = TRUE; /* Braces are prefixed with '-' ? */
parse_state_T old_state; parse_state_T old_state;
parse_state_T new_state; parse_state_T new_state;
int c2; int64_t c2;
int old_post_pos; int old_post_pos;
int my_post_start; int my_post_start;
int quest; int quest;