To: vim_dev@googlegroups.com Subject: Patch 7.4.1194 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1194 Problem: Compiler warning for not using return value of fwrite(). Solution: Return OK/FAIL. (Charles Campbell) Files: src/channel.c, src/proto/channel.pro *** ../vim-7.4.1193/src/channel.c 2016-01-28 23:01:44.751932155 +0100 --- src/channel.c 2016-01-28 23:07:30.596288708 +0100 *************** *** 560,567 **** /* * Store "buf[len]" on channel "idx". */ ! void channel_save(int idx, char_u *buf, int len) { queue_T *node; --- 560,568 ---- /* * Store "buf[len]" on channel "idx". + * Returns OK or FAIL. */ ! int channel_save(int idx, char_u *buf, int len) { queue_T *node; *************** *** 569,580 **** node = (queue_T *)alloc(sizeof(queue_T)); if (node == NULL) ! return; /* out of memory */ node->buffer = alloc(len + 1); if (node->buffer == NULL) { vim_free(node); ! return; /* out of memory */ } mch_memmove(node->buffer, buf, (size_t)len); node->buffer[len] = NUL; --- 570,581 ---- node = (queue_T *)alloc(sizeof(queue_T)); if (node == NULL) ! return FAIL; /* out of memory */ node->buffer = alloc(len + 1); if (node->buffer == NULL) { vim_free(node); ! return FAIL; /* out of memory */ } mch_memmove(node->buffer, buf, (size_t)len); node->buffer[len] = NUL; *************** *** 594,602 **** if (debugfd != NULL) { fprintf(debugfd, "RECV on %d: ", idx); ! fwrite(buf, len, 1, debugfd); fprintf(debugfd, "\n"); } } /* --- 595,605 ---- if (debugfd != NULL) { fprintf(debugfd, "RECV on %d: ", idx); ! if (fwrite(buf, len, 1, debugfd) != 1) ! return FAIL; fprintf(debugfd, "\n"); } + return OK; } /* *** ../vim-7.4.1193/src/proto/channel.pro 2016-01-28 22:36:15.052065044 +0100 --- src/proto/channel.pro 2016-01-28 23:06:30.120925738 +0100 *************** *** 8,14 **** int channel_decode_json(char_u *msg, typval_T *tv); int channel_is_open(int idx); void channel_close(int idx); ! void channel_save(int idx, char_u *buf, int len); char_u *channel_peek(int idx); char_u *channel_get(int idx); int channel_collapse(int idx); --- 8,14 ---- int channel_decode_json(char_u *msg, typval_T *tv); int channel_is_open(int idx); void channel_close(int idx); ! int channel_save(int idx, char_u *buf, int len); char_u *channel_peek(int idx); char_u *channel_get(int idx); int channel_collapse(int idx); *** ../vim-7.4.1193/src/version.c 2016-01-28 23:01:44.755932113 +0100 --- src/version.c 2016-01-28 23:08:33.975621107 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 1194, /**/ -- hundred-and-one symptoms of being an internet addict: 64. The remote to the T.V. is missing...and you don't even care. /// 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 ///