To: vim-dev@vim.org Subject: Patch 6.1.210 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.210 Problem: When there is an iconv() conversion error when reading a file there can be an error the next time iconv() is used. Solution: Reset the state of the iconv() descriptor. (Yasuhiro Matsumoto) Files: src/fileio.c *** ../vim61.209/src/fileio.c Mon Sep 16 21:53:32 2002 --- src/fileio.c Sun Oct 6 20:32:06 2002 *************** *** 1178,1183 **** --- 1179,1185 ---- char *top; size_t from_size; size_t to_size; + size_t ret; fromp = (char *)ptr; from_size = size; *************** *** 1189,1196 **** * If there is conversion error or not enough room try using * another conversion. */ ! if ((iconv(iconv_fd, &fromp, &from_size, &top, &to_size) ! == (size_t)-1 && ICONV_ERRNO != EINVAL) || from_size > CONV_RESTLEN) goto rewind_retry; --- 1191,1201 ---- * If there is conversion error or not enough room try using * another conversion. */ ! ret = iconv(iconv_fd, &fromp, &from_size, &top, &to_size); ! if (ret == (size_t)-1) ! /* need to reset the state after an error */ ! (void)iconv(iconv_fd, NULL, NULL, NULL, NULL); ! if ((ret == (size_t)-1 && ICONV_ERRNO != EINVAL) || from_size > CONV_RESTLEN) goto rewind_retry; *** ../vim61.209/src/version.c Sun Oct 6 18:30:28 2002 --- src/version.c Mon Oct 7 20:06:51 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 210, /**/ -- We are the Borg of GNU GPL. We will assimilate your source code. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///