home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.2.060 (extra)
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- ------------
-
- Patch 6.2.060 (extra)
- Problem: Win32: When 'encoding' is set to "iso-8859-7" copy/paste to/from
- the clipboard gives a lalloc(0) error. (Kriton Kyrimis)
- Solution: When the string length is zero allocate one byte. Also fix that
- when the length of the Unicode text is zero (conversion from
- 'encoding' to UCS-2 was not possible) the normal text is used.
- Files: src/os_mswin.c
-
-
- *** ../vim-6.2.059/src/os_mswin.c Sat Jul 26 19:49:46 2003
- --- src/os_mswin.c Mon Aug 4 21:58:37 2003
- ***************
- *** 944,950 ****
- char_u *ret;
- char_u *retp;
-
- ! ret = lalloc((long_u)str_len, TRUE);
- if (ret != NULL)
- {
- retp = ret;
- --- 944,951 ----
- char_u *ret;
- char_u *retp;
-
- ! /* Avoid allocating zero bytes, it generates an error message. */
- ! ret = lalloc((long_u)(str_len == 0 ? 1 : str_len), TRUE);
- if (ret != NULL)
- {
- retp = ret;
- ***************
- *** 1014,1020 ****
- convert_setup(&conv, NULL, NULL);
-
- length = utf8_to_ucs2(str, *lenp, NULL);
- ! ret = (WCHAR *)alloc((unsigned)(length * sizeof(WCHAR)));
- if (ret != NULL)
- utf8_to_ucs2(str, *lenp, (short_u *)ret);
-
- --- 1015,1022 ----
- convert_setup(&conv, NULL, NULL);
-
- length = utf8_to_ucs2(str, *lenp, NULL);
- ! ret = (WCHAR *)alloc((unsigned)((length == 0 ? 1 : length)
- ! * sizeof(WCHAR)));
- if (ret != NULL)
- utf8_to_ucs2(str, *lenp, (short_u *)ret);
-
- ***************
- *** 1057,1063 ****
- return enc_str;
- }
-
- ! utf8_str = alloc(ucs2_to_utf8(str, *lenp, NULL));
- if (utf8_str != NULL)
- {
- *lenp = ucs2_to_utf8(str, *lenp, utf8_str);
- --- 1059,1066 ----
- return enc_str;
- }
-
- ! /* Avoid allocating zero bytes, it generates an error message. */
- ! utf8_str = alloc(ucs2_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL));
- if (utf8_str != NULL)
- {
- *lenp = ucs2_to_utf8(str, *lenp, utf8_str);
- ***************
- *** 1133,1140 ****
- }
-
- #if defined(FEAT_MBYTE) && defined(WIN3264)
- ! /* Try to get the clipboard in Unicode. */
- ! if (IsClipboardFormatAvailable(CF_UNICODETEXT))
- {
- HGLOBAL hMemW;
-
- --- 1136,1143 ----
- }
-
- #if defined(FEAT_MBYTE) && defined(WIN3264)
- ! /* Try to get the clipboard in Unicode if it's not an empty string. */
- ! if (IsClipboardFormatAvailable(CF_UNICODETEXT) && metadata.ucslen != 0)
- {
- HGLOBAL hMemW;
-
- ***************
- *** 1277,1283 ****
- metadata.txtlen = WideCharToMultiByte(GetACP(), 0, out, len,
- NULL, 0, 0, 0);
- vim_free(str);
- ! str = (char_u *)alloc((unsigned)metadata.txtlen);
- if (str == NULL)
- {
- vim_free(out);
- --- 1280,1287 ----
- metadata.txtlen = WideCharToMultiByte(GetACP(), 0, out, len,
- NULL, 0, 0, 0);
- vim_free(str);
- ! str = (char_u *)alloc((unsigned)(metadata.txtlen == 0 ? 1
- ! : metadata.txtlen));
- if (str == NULL)
- {
- vim_free(out);
- *** ../vim-6.2.059/src/version.c Mon Aug 4 20:55:46 2003
- --- src/version.c Mon Aug 4 22:02:57 2003
- ***************
- *** 632,633 ****
- --- 632,635 ----
- { /* Add new patch number below this line */
- + /**/
- + 60,
- /**/
-
- --
- I wonder how much deeper the ocean would be without sponges.
-
- /// 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 ///
- \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
-