]> granicus.if.org Git - vim/commitdiff
patch 8.0.1753: various warnings from a static analyser v8.0.1753
authorBram Moolenaar <Bram@vim.org>
Tue, 24 Apr 2018 13:19:04 +0000 (15:19 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 24 Apr 2018 13:19:04 +0000 (15:19 +0200)
Problem:    Various warnings from a static analyser
Solution:   Add type casts, remove unneeded conditions. (Christian Brabandt,
            closes #2770)

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
src/version.c

index 62dc40e1d7eb3b7e177dc61cd7b8c4521c789373..dd4462d4f813d25c7c17c061a1093b47e03d577e 100644 (file)
@@ -10194,7 +10194,7 @@ set_buffer_lines(buf_T *buf, linenr_T lnum, typval_T *lines, typval_T *rettv)
        }
 
        rettv->vval.v_number = 1;       /* FAIL */
-       if (line == NULL || lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1)
+       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
index b11bff43c747f83d14ef08b1d5cfb9423cf3e2b6..3e369a8a4fd2f8d5cf8531990b73de53a90a4c74 100644 (file)
@@ -1420,7 +1420,7 @@ check_due_timer(void)
            if (balloonEval != NULL)
                general_beval_cb(balloonEval, 0);
        }
-       else if (this_due > 0 && (next_due == -1 || next_due > this_due))
+       else if (next_due == -1 || next_due > this_due)
            next_due = this_due;
     }
 #endif
index 700bd3ea53de80e74624e771383526f1443fb689..35f4fd2c2b26ace9183300a1dea5645fe89547ee 100644 (file)
@@ -1392,7 +1392,7 @@ retry:
 
                        /* If the crypt layer is buffering, not producing
                         * anything yet, need to read more. */
-                       if (size > 0 && decrypted_size == 0)
+                       if (decrypted_size == 0)
                            continue;
 
                        if (linerest == 0)
index 285d5d5d06b744b5b3950218366405f1deb6eeb2..623440ecf98266f22f857075c5ae11421a1bec86 100644 (file)
@@ -4119,7 +4119,7 @@ map_to_exists_mode(char_u *rhs, int mode, int abbr)
     mapblock_T *mp;
     int                hash;
 # ifdef FEAT_LOCALMAP
-    int                expand_buffer = FALSE;
+    int                exp_buffer = FALSE;
 
     validate_maphash();
 
@@ -4134,14 +4134,14 @@ map_to_exists_mode(char_u *rhs, int mode, int abbr)
                if (hash > 0)           /* there is only one abbr list */
                    break;
 #ifdef FEAT_LOCALMAP
-               if (expand_buffer)
+               if (exp_buffer)
                    mp = curbuf->b_first_abbr;
                else
 #endif
                    mp = first_abbr;
            }
 # ifdef FEAT_LOCALMAP
-           else if (expand_buffer)
+           else if (exp_buffer)
                mp = curbuf->b_maphash[hash];
 # endif
            else
@@ -4154,9 +4154,9 @@ map_to_exists_mode(char_u *rhs, int mode, int abbr)
            }
        }
 # ifdef FEAT_LOCALMAP
-       if (expand_buffer)
+       if (exp_buffer)
            break;
-       expand_buffer = TRUE;
+       exp_buffer = TRUE;
     }
 # endif
 
index 89b2dc02a079a27a2c2214f579915b363411e399..84867b52f85ca50318bfc8b93eb9ff85a76fec94 100644 (file)
@@ -2610,7 +2610,7 @@ do_mouse(
                        end_visual_mode();
                }
            }
-           else if (c1 < 0)
+           else
            {
                tabpage_T       *tp;
 
index 56465601edfcbea60124be18e20a932d2e170c5a..c89131fa3ea87a7dc38fee7cb98c8d37e933c7b8 100644 (file)
@@ -441,7 +441,7 @@ mch_inchar(
                    /* no character available within "wtime" */
                    return 0;
 
-               if (wtime < 0)
+               else
                {
                    /* no character available within 'updatetime' */
                    did_start_blocking = TRUE;
index a4b272224c4e9d5e96e05d612b9f3e2225315f54..a34636227a8436143fabcd474ff44085b9cd3a84 100644 (file)
@@ -4071,7 +4071,7 @@ again:
        goto again;
     }
 
-    if (do_include || r < 1)
+    if (do_include)
     {
        /* Include up to the '>'. */
        while (*ml_get_cursor() != '>')
index 3a27fa691d77ca6526029553e60cda5435d4590e..1739f5bc53bc2eae594cc29d28ddb6cd4a3729b9 100644 (file)
@@ -2361,7 +2361,7 @@ term_7to8bit(char_u *p)
     return 0;
 }
 
-#ifdef FEAT_GUI
+#if defined(FEAT_GUI) || defined(PROTO)
     int
 term_is_gui(char_u *name)
 {
@@ -2823,7 +2823,7 @@ term_get_winpos(int *x, int *y, varnumber_T timeout)
 
     winpos_x = prev_winpos_x;
     winpos_y = prev_winpos_y;
-    if (timeout < 10 && prev_winpos_y >= 0 && prev_winpos_y >= 0)
+    if (timeout < 10 && prev_winpos_y >= 0 && prev_winpos_x >= 0)
     {
        /* Polling: return previous values if we have them. */
        *x = winpos_x;
index fda91e2938a61ac8da349e943c62c971caa75dc9..6a4c97dda0747113385d09e589b9e95cdb5cccb9 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1753,
 /**/
     1752,
 /**/