]> granicus.if.org Git - vim/commitdiff
patch 8.0.0544: cppcheck warnings v8.0.0544
authorBram Moolenaar <Bram@vim.org>
Fri, 7 Apr 2017 12:02:01 +0000 (14:02 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 7 Apr 2017 12:02:01 +0000 (14:02 +0200)
Problem:    Cppcheck warnings.
Solution:   Use temp variable. Change NUL to NULL. Swap conditions. (Dominique
            Pelle)

src/channel.c
src/edit.c
src/farsi.c
src/version.c

index 410f9280097d6c31ee27edee6a0fee70a028472e..54a141c7d6d224b3159b1bf6397608fe27e2b11b 100644 (file)
@@ -2571,9 +2571,14 @@ may_invoke_callback(channel_T *channel, ch_part_T part)
            if (nl == NULL)
            {
                /* Flush remaining message that is missing a NL. */
-               buf = vim_realloc(buf, node->rq_buflen + 1);
-               if (buf == NULL)
+               char_u  *new_buf;
+
+               new_buf = vim_realloc(buf, node->rq_buflen + 1);
+               if (new_buf == NULL)
+                   /* This might fail over and over again, should the message
+                    * be dropped? */
                    return FALSE;
+               buf = new_buf;
                node->rq_buffer = buf;
                nl = buf + node->rq_buflen++;
                *nl = NUL;
index ad8b89a95b74aea6e1587a40a4fdf7cd43a05174..0153f3b9d5d01edd0624f0640416e97b6b716138 100644 (file)
@@ -9524,7 +9524,7 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
 #endif
            buf[idx++] = c;
        buf[idx] = NUL;
-       if (end != NUL && STRNCMP(buf, end, idx) == 0)
+       if (end != NULL && STRNCMP(buf, end, idx) == 0)
        {
            if (end[idx] == NUL)
                break; /* Found the end of paste code. */
index bac15109ec1e65877e9fe5358a9ea517fc422b5c..ebed47e6e2edb55497dd6c0305cdb0ef7c92c67e 100644 (file)
@@ -1695,7 +1695,7 @@ conv_to_pvim(void)
                ptr[i] = toF_leading(ptr[i]);
                ++i;
 
-               while (canF_Rjoin(ptr[i]) && i < llen)
+               while (i < llen && canF_Rjoin(ptr[i]))
                {
                    ptr[i] = toF_Rjoin(ptr[i]);
                    if (F_isterm(ptr[i]) || !F_isalpha(ptr[i]))
index 4e37cf31068a4a8696b3626d8e53ec203f723ef0..9db3ea007cc8fa86bb880aa3b417cdd57a672909 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    544,
 /**/
     543,
 /**/