To: vim_dev@googlegroups.com Subject: Patch 8.0.0544 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0544 Problem: Cppcheck warnings. Solution: Use temp variable. Change NUL to NULL. Swap conditions. (Dominique Pelle) Files: src/channel.c, src/edit.c, src/farsi.c *** ../vim-8.0.0543/src/channel.c 2017-02-28 21:26:12.822899342 +0100 --- src/channel.c 2017-04-07 13:57:11.009887327 +0200 *************** *** 2571,2579 **** if (nl == NULL) { /* Flush remaining message that is missing a NL. */ ! buf = vim_realloc(buf, node->rq_buflen + 1); ! if (buf == NULL) return FALSE; node->rq_buffer = buf; nl = buf + node->rq_buflen++; *nl = NUL; --- 2571,2584 ---- if (nl == NULL) { /* Flush remaining message that is missing a NL. */ ! 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; *** ../vim-8.0.0543/src/edit.c 2017-04-03 21:35:38.701127879 +0200 --- src/edit.c 2017-04-07 13:52:06.915781966 +0200 *************** *** 9524,9530 **** #endif buf[idx++] = c; buf[idx] = NUL; ! if (end != NUL && STRNCMP(buf, end, idx) == 0) { if (end[idx] == NUL) break; /* Found the end of paste code. */ --- 9524,9530 ---- #endif buf[idx++] = c; buf[idx] = NUL; ! if (end != NULL && STRNCMP(buf, end, idx) == 0) { if (end[idx] == NUL) break; /* Found the end of paste code. */ *** ../vim-8.0.0543/src/farsi.c 2017-03-16 17:23:26.819815897 +0100 --- src/farsi.c 2017-04-07 13:52:06.915781966 +0200 *************** *** 1695,1701 **** ptr[i] = toF_leading(ptr[i]); ++i; ! while (canF_Rjoin(ptr[i]) && i < llen) { ptr[i] = toF_Rjoin(ptr[i]); if (F_isterm(ptr[i]) || !F_isalpha(ptr[i])) --- 1695,1701 ---- ptr[i] = toF_leading(ptr[i]); ++i; ! while (i < llen && canF_Rjoin(ptr[i])) { ptr[i] = toF_Rjoin(ptr[i]); if (F_isterm(ptr[i]) || !F_isalpha(ptr[i])) *** ../vim-8.0.0543/src/version.c 2017-04-04 22:41:04.732342875 +0200 --- src/version.c 2017-04-07 13:53:35.827227909 +0200 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 544, /**/ -- press CTRL-ALT-DEL for more information /// 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 ///