To: vim-dev@vim.org Subject: Patch 6.3b.002 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.3b.002 Problem: Win32: conversion during file write fails when a double-byte character is split over two writes. Solution: Fix the conversion retry without a trailing byte. (Taro Muraoka) Files: src/fileio.c *** ../vim-6.3b.001/src/fileio.c Sun May 16 22:38:42 2004 --- src/fileio.c Fri May 21 13:36:11 2004 *************** *** 4685,4693 **** if (needed == 0) { /* When conversion fails there may be a trailing byte. */ - ip->bw_restlen = 1; needed = MultiByteToWideChar(enc_codepage, ! MB_ERR_INVALID_CHARS, (LPCSTR)from, fromlen, NULL, 0); if (needed == 0) { --- 4685,4692 ---- if (needed == 0) { /* When conversion fails there may be a trailing byte. */ needed = MultiByteToWideChar(enc_codepage, ! MB_ERR_INVALID_CHARS, (LPCSTR)from, fromlen - 1, NULL, 0); if (needed == 0) { *************** *** 4696,4702 **** return FAIL; } /* Save the trailing byte for the next call. */ ! *ip->bw_rest = from[fromlen - 1]; } needed = MultiByteToWideChar(enc_codepage, MB_ERR_INVALID_CHARS, (LPCSTR)from, fromlen - ip->bw_restlen, --- 4695,4702 ---- return FAIL; } /* Save the trailing byte for the next call. */ ! ip->bw_rest[0] = from[fromlen - 1]; ! ip->bw_restlen = 1; } needed = MultiByteToWideChar(enc_codepage, MB_ERR_INVALID_CHARS, (LPCSTR)from, fromlen - ip->bw_restlen, *** ../vim-6.3b.001/src/version.c Tue May 18 14:01:09 2004 --- src/version.c Fri May 21 13:38:55 2004 *************** *** 643,644 **** --- 643,646 ---- { /* Add new patch number below this line */ + /**/ + 2, /**/ -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///