]>
Commit | Line | Data |
---|---|---|
fe53742a AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.532 (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.532 (extra) | |
11 | Problem: Compiling for Win32s with VC 4.1 doesn't work. | |
12 | Solution: Don't use CP_UTF8 if it's not defined. Don't use CSIDL_COMMON* | |
13 | when not defined. | |
14 | Files: src/dosinst.h, src/fileio.c | |
15 | ||
16 | ||
17 | *** ../vim-6.2.531/src/dosinst.h Tue May 4 15:53:18 2004 | |
18 | --- src/dosinst.h Wed May 5 14:43:43 2004 | |
19 | *************** | |
20 | *** 227,240 **** | |
21 | --- 227,248 ---- | |
22 | if (strcmp(shell_folder_name, "desktop") == 0) | |
23 | { | |
24 | pcsidl = &desktop_csidl; | |
25 | + #ifdef CSIDL_COMMON_DESKTOPDIRECTORY | |
26 | csidl = CSIDL_COMMON_DESKTOPDIRECTORY; | |
27 | alt_csidl = CSIDL_DESKTOP; | |
28 | + #else | |
29 | + csidl = CSIDL_DESKTOP; | |
30 | + #endif | |
31 | } | |
32 | else if (strncmp(shell_folder_name, "Programs", 8) == 0) | |
33 | { | |
34 | pcsidl = &programs_csidl; | |
35 | + #ifdef CSIDL_COMMON_PROGRAMS | |
36 | csidl = CSIDL_COMMON_PROGRAMS; | |
37 | alt_csidl = CSIDL_PROGRAMS; | |
38 | + #else | |
39 | + csidl = CSIDL_PROGRAMS; | |
40 | + #endif | |
41 | } | |
42 | else | |
43 | { | |
44 | *** ../vim-6.2.531/src/fileio.c Sat May 1 21:04:31 2004 | |
45 | --- src/fileio.c Wed May 5 14:36:19 2004 | |
46 | *************** | |
47 | *** 1357,1385 **** | |
48 | int needed; | |
49 | char_u *p; | |
50 | int u8c; | |
51 | - int l, len; | |
52 | ||
53 | /* | |
54 | * 1. find out how many ucs-2 characters there are. | |
55 | */ | |
56 | if (FIO_GET_CP(fio_flags) == CP_UTF8) | |
57 | { | |
58 | /* Handle CP_UTF8 ourselves to be able to handle trailing | |
59 | * bytes properly. First find out the number of | |
60 | * characters and check for trailing bytes. */ | |
61 | needed = 0; | |
62 | p = ptr; | |
63 | ! for (len = from_size; len > 0; len -= l) | |
64 | { | |
65 | ! l = utf_ptr2len_check_len(p, len); | |
66 | ! if (l > len) /* incomplete char */ | |
67 | { | |
68 | if (l > CONV_RESTLEN) | |
69 | /* weird overlong byte sequence */ | |
70 | goto rewind_retry; | |
71 | ! mch_memmove(conv_rest, p, len); | |
72 | ! conv_restlen = len; | |
73 | ! from_size -= len; | |
74 | break; | |
75 | } | |
76 | if (l == 1 && *p >= 0x80) /* illegal byte */ | |
77 | --- 1357,1387 ---- | |
78 | int needed; | |
79 | char_u *p; | |
80 | int u8c; | |
81 | ||
82 | /* | |
83 | * 1. find out how many ucs-2 characters there are. | |
84 | */ | |
85 | + # ifdef CP_UTF8 /* VC 4.1 doesn't define CP_UTF8 */ | |
86 | if (FIO_GET_CP(fio_flags) == CP_UTF8) | |
87 | { | |
88 | + int l, flen; | |
89 | + | |
90 | /* Handle CP_UTF8 ourselves to be able to handle trailing | |
91 | * bytes properly. First find out the number of | |
92 | * characters and check for trailing bytes. */ | |
93 | needed = 0; | |
94 | p = ptr; | |
95 | ! for (flen = from_size; flen > 0; flen -= l) | |
96 | { | |
97 | ! l = utf_ptr2len_check_len(p, flen); | |
98 | ! if (l > flen) /* incomplete char */ | |
99 | { | |
100 | if (l > CONV_RESTLEN) | |
101 | /* weird overlong byte sequence */ | |
102 | goto rewind_retry; | |
103 | ! mch_memmove(conv_rest, p, flen); | |
104 | ! conv_restlen = flen; | |
105 | ! from_size -= flen; | |
106 | break; | |
107 | } | |
108 | if (l == 1 && *p >= 0x80) /* illegal byte */ | |
109 | *************** | |
110 | *** 1389,1394 **** | |
111 | --- 1391,1397 ---- | |
112 | } | |
113 | } | |
114 | else | |
115 | + # endif | |
116 | { | |
117 | /* We can't tell if the last byte of an MBCS string is | |
118 | * valid and MultiByteToWideChar() returns zero if it | |
119 | *************** | |
120 | *** 1425,1438 **** | |
121 | if (ucsp < ptr + size) | |
122 | goto rewind_retry; | |
123 | ||
124 | if (FIO_GET_CP(fio_flags) == CP_UTF8) | |
125 | { | |
126 | /* Convert from utf-8 to ucs-2. */ | |
127 | needed = 0; | |
128 | p = ptr; | |
129 | ! for (len = from_size; len > 0; len -= l) | |
130 | { | |
131 | ! l = utf_ptr2len_check_len(p, len); | |
132 | u8c = utf_ptr2char(p); | |
133 | ucsp[needed * 2] = (u8c & 0xff); | |
134 | ucsp[needed * 2 + 1] = (u8c >> 8); | |
135 | --- 1428,1444 ---- | |
136 | if (ucsp < ptr + size) | |
137 | goto rewind_retry; | |
138 | ||
139 | + # ifdef CP_UTF8 /* VC 4.1 doesn't define CP_UTF8 */ | |
140 | if (FIO_GET_CP(fio_flags) == CP_UTF8) | |
141 | { | |
142 | + int l, flen; | |
143 | + | |
144 | /* Convert from utf-8 to ucs-2. */ | |
145 | needed = 0; | |
146 | p = ptr; | |
147 | ! for (flen = from_size; flen > 0; flen -= l) | |
148 | { | |
149 | ! l = utf_ptr2len_check_len(p, flen); | |
150 | u8c = utf_ptr2char(p); | |
151 | ucsp[needed * 2] = (u8c & 0xff); | |
152 | ucsp[needed * 2 + 1] = (u8c >> 8); | |
153 | *************** | |
154 | *** 1441,1446 **** | |
155 | --- 1447,1453 ---- | |
156 | } | |
157 | } | |
158 | else | |
159 | + # endif | |
160 | needed = MultiByteToWideChar(FIO_GET_CP(fio_flags), | |
161 | MB_ERR_INVALID_CHARS, (LPCSTR)ptr, | |
162 | from_size, (LPWSTR)ucsp, needed); | |
163 | *************** | |
164 | *** 4705,4710 **** | |
165 | --- 4712,4718 ---- | |
166 | ||
167 | fromlen = to - ip->bw_conv_buf; | |
168 | buf = to; | |
169 | + # ifdef CP_UTF8 /* VC 4.1 doesn't define CP_UTF8 */ | |
170 | if (FIO_GET_CP(flags) == CP_UTF8) | |
171 | { | |
172 | /* Convert from UCS-2 to UTF-8, using the remainder of the | |
173 | *************** | |
174 | *** 4723,4728 **** | |
175 | --- 4731,4737 ---- | |
176 | len = to - buf; | |
177 | } | |
178 | else | |
179 | + #endif | |
180 | { | |
181 | /* Convert from UCS-2 to the codepage, using the remainder of | |
182 | * the conversion buffer. If the conversion uses the default | |
183 | *************** | |
184 | *** 5064,5072 **** | |
185 | --- 5073,5083 ---- | |
186 | cp = encname2codepage(ptr); | |
187 | if (cp == 0) | |
188 | { | |
189 | + # ifdef CP_UTF8 /* VC 4.1 doesn't define CP_UTF8 */ | |
190 | if (STRCMP(ptr, "utf-8") == 0) | |
191 | cp = CP_UTF8; | |
192 | else | |
193 | + # endif | |
194 | return 0; | |
195 | } | |
196 | return FIO_PUT_CP(cp) | FIO_CODEPAGE; | |
197 | *** ../vim-6.2.531/src/version.c Wed May 5 12:38:40 2004 | |
198 | --- src/version.c Wed May 5 14:45:21 2004 | |
199 | *************** | |
200 | *** 643,644 **** | |
201 | --- 643,646 ---- | |
202 | { /* Add new patch number below this line */ | |
203 | + /**/ | |
204 | + 532, | |
205 | /**/ | |
206 | ||
207 | -- | |
208 | An actual excerpt from a classified section of a city newspaper: | |
209 | "Illiterate? Write today for free help!" | |
210 | ||
211 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
212 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
213 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
214 | \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html /// |