2 Subject: Patch 6.2.060 (extra)
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Win32: When 'encoding' is set to "iso-8859-7" copy/paste to/from
12 the clipboard gives a lalloc(0) error. (Kriton Kyrimis)
13 Solution: When the string length is zero allocate one byte. Also fix that
14 when the length of the Unicode text is zero (conversion from
15 'encoding' to UCS-2 was not possible) the normal text is used.
19 *** ../vim-6.2.059/src/os_mswin.c Sat Jul 26 19:49:46 2003
20 --- src/os_mswin.c Mon Aug 4 21:58:37 2003
26 ! ret = lalloc((long_u)str_len, TRUE);
34 ! /* Avoid allocating zero bytes, it generates an error message. */
35 ! ret = lalloc((long_u)(str_len == 0 ? 1 : str_len), TRUE);
41 convert_setup(&conv, NULL, NULL);
43 length = utf8_to_ucs2(str, *lenp, NULL);
44 ! ret = (WCHAR *)alloc((unsigned)(length * sizeof(WCHAR)));
46 utf8_to_ucs2(str, *lenp, (short_u *)ret);
49 convert_setup(&conv, NULL, NULL);
51 length = utf8_to_ucs2(str, *lenp, NULL);
52 ! ret = (WCHAR *)alloc((unsigned)((length == 0 ? 1 : length)
55 utf8_to_ucs2(str, *lenp, (short_u *)ret);
62 ! utf8_str = alloc(ucs2_to_utf8(str, *lenp, NULL));
65 *lenp = ucs2_to_utf8(str, *lenp, utf8_str);
70 ! /* Avoid allocating zero bytes, it generates an error message. */
71 ! utf8_str = alloc(ucs2_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL));
74 *lenp = ucs2_to_utf8(str, *lenp, utf8_str);
79 #if defined(FEAT_MBYTE) && defined(WIN3264)
80 ! /* Try to get the clipboard in Unicode. */
81 ! if (IsClipboardFormatAvailable(CF_UNICODETEXT))
88 #if defined(FEAT_MBYTE) && defined(WIN3264)
89 ! /* Try to get the clipboard in Unicode if it's not an empty string. */
90 ! if (IsClipboardFormatAvailable(CF_UNICODETEXT) && metadata.ucslen != 0)
96 metadata.txtlen = WideCharToMultiByte(GetACP(), 0, out, len,
99 ! str = (char_u *)alloc((unsigned)metadata.txtlen);
104 metadata.txtlen = WideCharToMultiByte(GetACP(), 0, out, len,
107 ! str = (char_u *)alloc((unsigned)(metadata.txtlen == 0 ? 1
108 ! : metadata.txtlen));
112 *** ../vim-6.2.059/src/version.c Mon Aug 4 20:55:46 2003
113 --- src/version.c Mon Aug 4 22:02:57 2003
117 { /* Add new patch number below this line */
123 I wonder how much deeper the ocean would be without sponges.
125 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
126 /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
127 \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
128 \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///