]>
Commit | Line | Data |
---|---|---|
d8621708 | 1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.060 (extra) | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 6.2.060 (extra) | |
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. | |
16 | Files: src/os_mswin.c | |
17 | ||
18 | ||
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 | |
21 | *************** | |
22 | *** 944,950 **** | |
23 | char_u *ret; | |
24 | char_u *retp; | |
25 | ||
26 | ! ret = lalloc((long_u)str_len, TRUE); | |
27 | if (ret != NULL) | |
28 | { | |
29 | retp = ret; | |
30 | --- 944,951 ---- | |
31 | char_u *ret; | |
32 | char_u *retp; | |
33 | ||
34 | ! /* Avoid allocating zero bytes, it generates an error message. */ | |
35 | ! ret = lalloc((long_u)(str_len == 0 ? 1 : str_len), TRUE); | |
36 | if (ret != NULL) | |
37 | { | |
38 | retp = ret; | |
39 | *************** | |
40 | *** 1014,1020 **** | |
41 | convert_setup(&conv, NULL, NULL); | |
42 | ||
43 | length = utf8_to_ucs2(str, *lenp, NULL); | |
44 | ! ret = (WCHAR *)alloc((unsigned)(length * sizeof(WCHAR))); | |
45 | if (ret != NULL) | |
46 | utf8_to_ucs2(str, *lenp, (short_u *)ret); | |
47 | ||
48 | --- 1015,1022 ---- | |
49 | convert_setup(&conv, NULL, NULL); | |
50 | ||
51 | length = utf8_to_ucs2(str, *lenp, NULL); | |
52 | ! ret = (WCHAR *)alloc((unsigned)((length == 0 ? 1 : length) | |
53 | ! * sizeof(WCHAR))); | |
54 | if (ret != NULL) | |
55 | utf8_to_ucs2(str, *lenp, (short_u *)ret); | |
56 | ||
57 | *************** | |
58 | *** 1057,1063 **** | |
59 | return enc_str; | |
60 | } | |
61 | ||
62 | ! utf8_str = alloc(ucs2_to_utf8(str, *lenp, NULL)); | |
63 | if (utf8_str != NULL) | |
64 | { | |
65 | *lenp = ucs2_to_utf8(str, *lenp, utf8_str); | |
66 | --- 1059,1066 ---- | |
67 | return enc_str; | |
68 | } | |
69 | ||
70 | ! /* Avoid allocating zero bytes, it generates an error message. */ | |
71 | ! utf8_str = alloc(ucs2_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL)); | |
72 | if (utf8_str != NULL) | |
73 | { | |
74 | *lenp = ucs2_to_utf8(str, *lenp, utf8_str); | |
75 | *************** | |
76 | *** 1133,1140 **** | |
77 | } | |
78 | ||
79 | #if defined(FEAT_MBYTE) && defined(WIN3264) | |
80 | ! /* Try to get the clipboard in Unicode. */ | |
81 | ! if (IsClipboardFormatAvailable(CF_UNICODETEXT)) | |
82 | { | |
83 | HGLOBAL hMemW; | |
84 | ||
85 | --- 1136,1143 ---- | |
86 | } | |
87 | ||
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) | |
91 | { | |
92 | HGLOBAL hMemW; | |
93 | ||
94 | *************** | |
95 | *** 1277,1283 **** | |
96 | metadata.txtlen = WideCharToMultiByte(GetACP(), 0, out, len, | |
97 | NULL, 0, 0, 0); | |
98 | vim_free(str); | |
99 | ! str = (char_u *)alloc((unsigned)metadata.txtlen); | |
100 | if (str == NULL) | |
101 | { | |
102 | vim_free(out); | |
103 | --- 1280,1287 ---- | |
104 | metadata.txtlen = WideCharToMultiByte(GetACP(), 0, out, len, | |
105 | NULL, 0, 0, 0); | |
106 | vim_free(str); | |
107 | ! str = (char_u *)alloc((unsigned)(metadata.txtlen == 0 ? 1 | |
108 | ! : metadata.txtlen)); | |
109 | if (str == NULL) | |
110 | { | |
111 | vim_free(out); | |
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 | |
114 | *************** | |
115 | *** 632,633 **** | |
116 | --- 632,635 ---- | |
117 | { /* Add new patch number below this line */ | |
118 | + /**/ | |
119 | + 60, | |
120 | /**/ | |
121 | ||
122 | -- | |
123 | I wonder how much deeper the ocean would be without sponges. | |
124 | ||
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 /// |