To: vim_dev@googlegroups.com Subject: Patch 8.0.1753 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1753 Problem: Various warnings from a static analyser Solution: Add type casts, remove unneeded conditions. (Christian Brabandt, closes #2770) Files: src/evalfunc.c, src/ex_cmds2.c, src/fileio.c, src/getchar.c, src/normal.c, src/os_unix.c, src/search.c, src/term.c *** ../vim-8.0.1752/src/evalfunc.c 2018-04-21 19:49:02.528104537 +0200 --- src/evalfunc.c 2018-04-24 15:05:36.175547566 +0200 *************** *** 10194,10200 **** } rettv->vval.v_number = 1; /* FAIL */ ! if (line == NULL || lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1) break; /* When coming here from Insert mode, sync undo, so that this can be --- 10194,10200 ---- } rettv->vval.v_number = 1; /* FAIL */ ! if (line == NULL || lnum > curbuf->b_ml.ml_line_count + 1) break; /* When coming here from Insert mode, sync undo, so that this can be *** ../vim-8.0.1752/src/ex_cmds2.c 2018-04-20 22:48:54.473394557 +0200 --- src/ex_cmds2.c 2018-04-24 15:05:36.175547566 +0200 *************** *** 1420,1426 **** if (balloonEval != NULL) general_beval_cb(balloonEval, 0); } ! else if (this_due > 0 && (next_due == -1 || next_due > this_due)) next_due = this_due; } #endif --- 1420,1426 ---- if (balloonEval != NULL) general_beval_cb(balloonEval, 0); } ! else if (next_due == -1 || next_due > this_due) next_due = this_due; } #endif *** ../vim-8.0.1752/src/fileio.c 2018-04-22 13:27:38.812672851 +0200 --- src/fileio.c 2018-04-24 15:05:36.175547566 +0200 *************** *** 1392,1398 **** /* If the crypt layer is buffering, not producing * anything yet, need to read more. */ ! if (size > 0 && decrypted_size == 0) continue; if (linerest == 0) --- 1392,1398 ---- /* If the crypt layer is buffering, not producing * anything yet, need to read more. */ ! if (decrypted_size == 0) continue; if (linerest == 0) *** ../vim-8.0.1752/src/getchar.c 2018-04-18 23:01:07.196520488 +0200 --- src/getchar.c 2018-04-24 15:05:36.179547545 +0200 *************** *** 4119,4125 **** mapblock_T *mp; int hash; # ifdef FEAT_LOCALMAP ! int expand_buffer = FALSE; validate_maphash(); --- 4119,4125 ---- mapblock_T *mp; int hash; # ifdef FEAT_LOCALMAP ! int exp_buffer = FALSE; validate_maphash(); *************** *** 4134,4147 **** if (hash > 0) /* there is only one abbr list */ break; #ifdef FEAT_LOCALMAP ! if (expand_buffer) mp = curbuf->b_first_abbr; else #endif mp = first_abbr; } # ifdef FEAT_LOCALMAP ! else if (expand_buffer) mp = curbuf->b_maphash[hash]; # endif else --- 4134,4147 ---- if (hash > 0) /* there is only one abbr list */ break; #ifdef FEAT_LOCALMAP ! if (exp_buffer) mp = curbuf->b_first_abbr; else #endif mp = first_abbr; } # ifdef FEAT_LOCALMAP ! else if (exp_buffer) mp = curbuf->b_maphash[hash]; # endif else *************** *** 4154,4162 **** } } # ifdef FEAT_LOCALMAP ! if (expand_buffer) break; ! expand_buffer = TRUE; } # endif --- 4154,4162 ---- } } # ifdef FEAT_LOCALMAP ! if (exp_buffer) break; ! exp_buffer = TRUE; } # endif *** ../vim-8.0.1752/src/normal.c 2018-03-04 20:14:08.248064341 +0100 --- src/normal.c 2018-04-24 15:05:36.179547545 +0200 *************** *** 2610,2616 **** end_visual_mode(); } } ! else if (c1 < 0) { tabpage_T *tp; --- 2610,2616 ---- end_visual_mode(); } } ! else { tabpage_T *tp; *** ../vim-8.0.1752/src/os_unix.c 2018-04-21 22:30:04.712058412 +0200 --- src/os_unix.c 2018-04-24 15:05:36.183547524 +0200 *************** *** 441,447 **** /* no character available within "wtime" */ return 0; ! if (wtime < 0) { /* no character available within 'updatetime' */ did_start_blocking = TRUE; --- 441,447 ---- /* no character available within "wtime" */ return 0; ! else { /* no character available within 'updatetime' */ did_start_blocking = TRUE; *** ../vim-8.0.1752/src/search.c 2018-03-04 18:07:04.280592270 +0100 --- src/search.c 2018-04-24 15:05:36.183547524 +0200 *************** *** 4071,4077 **** goto again; } ! if (do_include || r < 1) { /* Include up to the '>'. */ while (*ml_get_cursor() != '>') --- 4071,4077 ---- goto again; } ! if (do_include) { /* Include up to the '>'. */ while (*ml_get_cursor() != '>') *** ../vim-8.0.1752/src/term.c 2018-04-04 21:53:06.765891341 +0200 --- src/term.c 2018-04-24 15:05:36.183547524 +0200 *************** *** 2361,2367 **** return 0; } ! #ifdef FEAT_GUI int term_is_gui(char_u *name) { --- 2361,2367 ---- return 0; } ! #if defined(FEAT_GUI) || defined(PROTO) int term_is_gui(char_u *name) { *************** *** 2823,2829 **** winpos_x = prev_winpos_x; winpos_y = prev_winpos_y; ! if (timeout < 10 && prev_winpos_y >= 0 && prev_winpos_y >= 0) { /* Polling: return previous values if we have them. */ *x = winpos_x; --- 2823,2829 ---- winpos_x = prev_winpos_x; winpos_y = prev_winpos_y; ! if (timeout < 10 && prev_winpos_y >= 0 && prev_winpos_x >= 0) { /* Polling: return previous values if we have them. */ *x = winpos_x; *** ../vim-8.0.1752/src/version.c 2018-04-24 13:54:56.169455211 +0200 --- src/version.c 2018-04-24 15:04:57.763746497 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1753, /**/ -- hundred-and-one symptoms of being an internet addict: 266. You hear most of your jokes via e-mail instead of in person. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///