2 Subject: Patch 7.2.049 (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: the clipboard doesn't support UTF-16.
12 Solution: Change UCS-2 support to UTF-16 support. (Jia Yanwei)
13 Files: src/gui_w32.c, src/gui_w48.c, src/mbyte.c, src/misc1.c,
14 src/os_mswin.c, src/os_win32.c, src/proto/os_mswin.pro
17 *** ../vim-7.2.048/src/gui_w32.c Tue Jun 24 23:46:14 2008
18 --- src/gui_w32.c Thu Nov 20 16:47:10 2008
21 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH,
24 ! tt_text = enc_to_ucs2(str, NULL);
25 lpdi->lpszText = tt_text;
26 /* can't show tooltip if failed */
29 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH,
32 ! tt_text = enc_to_utf16(str, NULL);
33 lpdi->lpszText = tt_text;
34 /* can't show tooltip if failed */
41 ! convbuf = ucs2_to_enc(buf, lenp);
42 pImmReleaseContext(hwnd, hIMC);
49 ! convbuf = utf16_to_enc(buf, lenp);
50 pImmReleaseContext(hwnd, hIMC);
56 /* 'encoding' differs from active codepage: convert menu name
57 * and use wide function */
58 ! wn = enc_to_ucs2(menu->name, NULL);
64 /* 'encoding' differs from active codepage: convert menu name
65 * and use wide function */
66 ! wn = enc_to_utf16(menu->name, NULL);
73 /* 'encoding' differs from active codepage: convert menu item name
74 * and use wide function */
75 ! wn = enc_to_ucs2(menu->name, NULL);
78 n = InsertMenuW(parent->submenu_id, (UINT)idx,
81 /* 'encoding' differs from active codepage: convert menu item name
82 * and use wide function */
83 ! wn = enc_to_utf16(menu->name, NULL);
86 n = InsertMenuW(parent->submenu_id, (UINT)idx,
89 if (enc_codepage == 0 && (int)GetACP() != enc_codepage)
91 /* Not a codepage, use our own conversion function. */
92 ! wn = enc_to_ucs2(lpAnsiIn, NULL);
97 if (enc_codepage == 0 && (int)GetACP() != enc_codepage)
99 /* Not a codepage, use our own conversion function. */
100 ! wn = enc_to_utf16(lpAnsiIn, NULL);
104 *** ../vim-7.2.048/src/gui_w48.c Wed Nov 12 13:35:31 2008
105 --- src/gui_w48.c Thu Nov 20 16:42:32 2008
111 ! ws = ucs2_to_enc(wstring, &len);
119 ! ws = utf16_to_enc(wstring, &len);
126 /* 'encoding' differs from active codepage: convert text and use wide
128 ! wstr = enc_to_ucs2(str, &wlen);
131 n = GetTextExtentPointW(hdc, wstr, wlen, &size);
134 /* 'encoding' differs from active codepage: convert text and use wide
136 ! wstr = enc_to_utf16(str, &wlen);
139 n = GetTextExtentPointW(hdc, wstr, wlen, &size);
143 /* 'encoding' differs from active codepage: convert menu name
144 * and use wide function */
145 ! wn = enc_to_ucs2(item_text, NULL);
151 /* 'encoding' differs from active codepage: convert menu name
152 * and use wide function */
153 ! wn = enc_to_utf16(item_text, NULL);
161 /* Need to go through Unicode. */
162 ! wstr = enc_to_ucs2(NameBuff, NULL);
169 /* Need to go through Unicode. */
170 ! wstr = enc_to_utf16(NameBuff, NULL);
179 ! /* Convert the title from 'encoding' to ucs2. */
180 ! wbuf = (WCHAR *)enc_to_ucs2((char_u *)title, NULL);
183 n = SetWindowTextW(hwnd, wbuf);
188 ! /* Convert the title from 'encoding' to UTF-16. */
189 ! wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL);
192 n = SetWindowTextW(hwnd, wbuf);
198 ! /* We always use the wide function. This means enc_to_ucs2() must work,
199 * otherwise it fails miserably! */
200 OPENFILENAMEW fileStruct;
201 WCHAR fileBuf[MAXPATHL];
206 ! /* We always use the wide function. This means enc_to_utf16() must work,
207 * otherwise it fails miserably! */
208 OPENFILENAMEW fileStruct;
209 WCHAR fileBuf[MAXPATHL];
215 ! wp = enc_to_ucs2(dflt, NULL);
223 ! wp = enc_to_utf16(dflt, NULL);
232 ! titlep = enc_to_ucs2(title, NULL);
233 fileStruct.lpstrTitle = titlep;
236 ! extp = enc_to_ucs2(ext, NULL);
237 fileStruct.lpstrDefExt = extp;
239 fileStruct.lpstrFile = fileBuf;
244 ! titlep = enc_to_utf16(title, NULL);
245 fileStruct.lpstrTitle = titlep;
248 ! extp = enc_to_utf16(ext, NULL);
249 fileStruct.lpstrDefExt = extp;
251 fileStruct.lpstrFile = fileBuf;
254 if (initdir != NULL && *initdir != NUL)
256 /* Must have backslashes here, no matter what 'shellslash' says */
257 ! initdirp = enc_to_ucs2(initdir, NULL);
258 if (initdirp != NULL)
260 for (wp = initdirp; *wp != NUL; ++wp)
262 if (initdir != NULL && *initdir != NUL)
264 /* Must have backslashes here, no matter what 'shellslash' says */
265 ! initdirp = enc_to_utf16(initdir, NULL);
266 if (initdirp != NULL)
268 for (wp = initdirp; *wp != NUL; ++wp)
273 /* Convert from UCS2 to 'encoding'. */
274 ! p = ucs2_to_enc(fileBuf, NULL);
276 /* when out of memory we get garbage for non-ASCII chars */
281 /* Convert from UCS2 to 'encoding'. */
282 ! p = utf16_to_enc(fileBuf, NULL);
284 /* when out of memory we get garbage for non-ASCII chars */
290 if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0)
291 ! fnames[i] = ucs2_to_enc(wszFile, NULL);
298 if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0)
299 ! fnames[i] = utf16_to_enc(wszFile, NULL);
303 *** ../vim-7.2.048/src/mbyte.c Thu Nov 20 11:55:53 2008
304 --- src/mbyte.c Thu Nov 20 16:47:41 2008
308 /* 1. codepage/UTF-8 -> ucs-2. */
309 if (vcp->vc_cpfrom == 0)
310 ! tmp_len = utf8_to_ucs2(ptr, len, NULL, NULL);
312 tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, 0,
316 /* 1. codepage/UTF-8 -> ucs-2. */
317 if (vcp->vc_cpfrom == 0)
318 ! tmp_len = utf8_to_utf16(ptr, len, NULL, NULL);
320 tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, 0,
326 if (vcp->vc_cpfrom == 0)
327 ! utf8_to_ucs2(ptr, len, tmp, unconvlenp);
329 MultiByteToWideChar(vcp->vc_cpfrom, 0, ptr, len, tmp, tmp_len);
331 /* 2. ucs-2 -> codepage/UTF-8. */
332 if (vcp->vc_cpto == 0)
333 ! retlen = ucs2_to_utf8(tmp, tmp_len, NULL);
335 retlen = WideCharToMultiByte(vcp->vc_cpto, 0,
336 tmp, tmp_len, 0, 0, 0, 0);
340 if (vcp->vc_cpfrom == 0)
341 ! utf8_to_utf16(ptr, len, tmp, unconvlenp);
343 MultiByteToWideChar(vcp->vc_cpfrom, 0, ptr, len, tmp, tmp_len);
345 /* 2. ucs-2 -> codepage/UTF-8. */
346 if (vcp->vc_cpto == 0)
347 ! retlen = utf16_to_utf8(tmp, tmp_len, NULL);
349 retlen = WideCharToMultiByte(vcp->vc_cpto, 0,
350 tmp, tmp_len, 0, 0, 0, 0);
355 if (vcp->vc_cpto == 0)
356 ! ucs2_to_utf8(tmp, tmp_len, retval);
358 WideCharToMultiByte(vcp->vc_cpto, 0,
359 tmp, tmp_len, retval, retlen, 0, 0);
363 if (vcp->vc_cpto == 0)
364 ! utf16_to_utf8(tmp, tmp_len, retval);
366 WideCharToMultiByte(vcp->vc_cpto, 0,
367 tmp, tmp_len, retval, retlen, 0, 0);
368 *** ../vim-7.2.048/src/misc1.c Sun Nov 9 13:43:25 2008
369 --- src/misc1.c Thu Nov 20 16:42:59 2008
372 /* The active codepage differs from 'encoding'. Attempt using the
373 * wide function. If it fails because it is not implemented fall back
374 * to the non-wide version (for Windows 98) */
375 ! wn = enc_to_ucs2(buf, NULL);
378 hFind = FindFirstFileW(wn, &wfb);
380 /* The active codepage differs from 'encoding'. Attempt using the
381 * wide function. If it fails because it is not implemented fall back
382 * to the non-wide version (for Windows 98) */
383 ! wn = enc_to_utf16(buf, NULL);
386 hFind = FindFirstFileW(wn, &wfb);
392 ! p = ucs2_to_enc(wfb.cFileName, NULL); /* p is allocated here */
395 p = (char_u *)fb.cFileName;
400 ! p = utf16_to_enc(wfb.cFileName, NULL); /* p is allocated here */
403 p = (char_u *)fb.cFileName;
409 ! wn = enc_to_ucs2(buf, NULL);
411 hFind = FindFirstFileW(wn, &wfb);
417 ! wn = enc_to_utf16(buf, NULL);
419 hFind = FindFirstFileW(wn, &wfb);
421 *** ../vim-7.2.048/src/os_mswin.c Sat Aug 9 19:37:30 2008
422 --- src/os_mswin.c Thu Nov 20 17:05:10 2008
425 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
427 /* Convert the title from 'encoding' to the active codepage. */
428 ! WCHAR *wp = enc_to_ucs2(title, NULL);
433 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
435 /* Convert the title from 'encoding' to the active codepage. */
436 ! WCHAR *wp = enc_to_utf16(title, NULL);
442 * - invoke _wfullpath()
443 * - convert the result from UCS2 to 'encoding'.
445 ! wname = enc_to_ucs2(fname, NULL);
446 if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH - 1) != NULL)
448 ! cname = ucs2_to_enc((short_u *)wbuf, NULL);
451 vim_strncpy(buf, cname, len - 1);
453 * - invoke _wfullpath()
454 * - convert the result from UCS2 to 'encoding'.
456 ! wname = enc_to_utf16(fname, NULL);
457 if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH - 1) != NULL)
459 ! cname = utf16_to_enc((short_u *)wbuf, NULL);
462 vim_strncpy(buf, cname, len - 1);
468 ! WCHAR *wp = enc_to_ucs2(buf, NULL);
476 ! WCHAR *wp = enc_to_utf16(buf, NULL);
483 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
485 ! WCHAR *p = enc_to_ucs2(path, NULL);
491 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
493 ! WCHAR *p = enc_to_utf16(path, NULL);
500 #if defined(FEAT_MBYTE) || defined(PROTO)
502 ! * Convert an UTF-8 string to UCS-2.
503 * "instr[inlen]" is the input. "inlen" is in bytes.
504 ! * When "outstr" is NULL only return the number of UCS-2 words produced.
505 * Otherwise "outstr" must be a buffer of sufficient size.
506 ! * Returns the number of UCS-2 words produced.
509 ! utf8_to_ucs2(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
520 #if defined(FEAT_MBYTE) || defined(PROTO)
522 ! * Convert an UTF-8 string to UTF-16.
523 * "instr[inlen]" is the input. "inlen" is in bytes.
524 ! * When "outstr" is NULL only return the number of UTF-16 words produced.
525 * Otherwise "outstr" must be a buffer of sufficient size.
526 ! * Returns the number of UTF-16 words produced.
529 ! utf8_to_utf16(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
544 ! if (outstr != NULL)
545 ! *outstr++ = utf_ptr2char(p);
553 ! ch = utf_ptr2char(p);
556 ! /* non-BMP character, encoding with surrogate pairs */
558 ! if (outstr != NULL)
560 ! *outstr++ = (0xD800 - (0x10000 >> 10)) + (ch >> 10);
561 ! *outstr++ = 0xDC00 | (ch & 0x3FF);
564 ! else if (outstr != NULL)
574 ! * Convert an UCS-2 string to UTF-8.
575 ! * The input is "instr[inlen]" with "inlen" in number of ucs-2 words.
576 * When "outstr" is NULL only return the required number of bytes.
577 * Otherwise "outstr" must be a buffer of sufficient size.
578 * Return the number of bytes produced.
581 ! ucs2_to_utf8(short_u *instr, int inlen, char_u *outstr)
592 ! l = utf_char2bytes(*p, outstr);
596 ! l = utf_char2len(*p);
604 ! * Convert an UTF-16 string to UTF-8.
605 ! * The input is "instr[inlen]" with "inlen" in number of UTF-16 words.
606 * When "outstr" is NULL only return the required number of bytes.
607 * Otherwise "outstr" must be a buffer of sufficient size.
608 * Return the number of bytes produced.
611 ! utf16_to_utf8(short_u *instr, int inlen, char_u *outstr)
622 + if (ch >= 0xD800 && ch <= 0xDBFF && todo > 1)
624 + /* surrogate pairs handling */
626 + if (ch2 >= 0xDC00 && ch2 <= 0xDFFF)
628 + ch = ((ch - 0xD800) << 10) + (ch2 & 0x3FF) + 0x10000;
635 ! l = utf_char2bytes(ch, outstr);
639 ! l = utf_char2len(ch);
648 ! * Convert "str" from 'encoding' to UCS-2.
649 * Input in "str" with length "*lenp". When "lenp" is NULL, use strlen().
650 * Output is returned as an allocated string. "*lenp" is set to the length of
651 * the result. A trailing NUL is always added.
652 * Returns NULL when out of memory.
655 ! enc_to_ucs2(char_u *str, int *lenp)
663 ! * Convert "str" from 'encoding' to UTF-16.
664 * Input in "str" with length "*lenp". When "lenp" is NULL, use strlen().
665 * Output is returned as an allocated string. "*lenp" is set to the length of
666 * the result. A trailing NUL is always added.
667 * Returns NULL when out of memory.
670 ! enc_to_utf16(char_u *str, int *lenp)
677 if (enc_codepage > 0)
679 ! /* We can do any CP### -> UCS-2 in one pass, and we can do it
680 * without iconv() (convert_* may need iconv). */
681 MultiByteToWideChar_alloc(enc_codepage, 0, str, *lenp, &ret, &length);
685 if (enc_codepage > 0)
687 ! /* We can do any CP### -> UTF-16 in one pass, and we can do it
688 * without iconv() (convert_* may need iconv). */
689 MultiByteToWideChar_alloc(enc_codepage, 0, str, *lenp, &ret, &length);
694 convert_setup(&conv, NULL, NULL);
696 ! length = utf8_to_ucs2(str, *lenp, NULL, NULL);
697 ret = (WCHAR *)alloc((unsigned)((length + 1) * sizeof(WCHAR)));
700 ! utf8_to_ucs2(str, *lenp, (short_u *)ret, NULL);
706 convert_setup(&conv, NULL, NULL);
708 ! length = utf8_to_utf16(str, *lenp, NULL, NULL);
709 ret = (WCHAR *)alloc((unsigned)((length + 1) * sizeof(WCHAR)));
712 ! utf8_to_utf16(str, *lenp, (short_u *)ret, NULL);
721 ! * Convert an UCS-2 string to 'encoding'.
722 * Input in "str" with length (counted in wide characters) "*lenp". When
723 * "lenp" is NULL, use wcslen().
724 * Output is returned as an allocated string. If "*lenp" is not NULL it is
729 ! * Convert an UTF-16 string to 'encoding'.
730 * Input in "str" with length (counted in wide characters) "*lenp". When
731 * "lenp" is NULL, use wcslen().
732 * Output is returned as an allocated string. If "*lenp" is not NULL it is
735 * Returns NULL when out of memory.
738 ! ucs2_to_enc(short_u *str, int *lenp)
741 char_u *utf8_str = NULL, *enc_str = NULL;
743 * Returns NULL when out of memory.
746 ! utf16_to_enc(short_u *str, int *lenp)
749 char_u *utf8_str = NULL, *enc_str = NULL;
753 if (enc_codepage > 0)
755 ! /* We can do any UCS-2 -> CP### in one pass. */
758 WideCharToMultiByte_alloc(enc_codepage, 0, str, *lenp,
761 if (enc_codepage > 0)
763 ! /* We can do any UTF-16 -> CP### in one pass. */
766 WideCharToMultiByte_alloc(enc_codepage, 0, str, *lenp,
771 /* Avoid allocating zero bytes, it generates an error message. */
772 ! utf8_str = alloc(ucs2_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL));
773 if (utf8_str != NULL)
775 ! *lenp = ucs2_to_utf8(str, *lenp, utf8_str);
777 /* We might be called before we have p_enc set up. */
778 conv.vc_type = CONV_NONE;
782 /* Avoid allocating zero bytes, it generates an error message. */
783 ! utf8_str = alloc(utf16_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL));
784 if (utf8_str != NULL)
786 ! *lenp = utf16_to_utf8(str, *lenp, utf8_str);
788 /* We might be called before we have p_enc set up. */
789 conv.vc_type = CONV_NONE;
792 if (hMemWstr[str_size] == NUL)
795 ! to_free = str = ucs2_to_enc((short_u *)hMemWstr, &str_size);
800 if (hMemWstr[str_size] == NUL)
803 ! to_free = str = utf16_to_enc((short_u *)hMemWstr, &str_size);
810 # if defined(FEAT_MBYTE) && defined(WIN3264)
811 /* The text is in the active codepage. Convert to 'encoding',
812 ! * going through UCS-2. */
813 acp_to_enc(str, str_size, &to_free, &maxlen);
818 # if defined(FEAT_MBYTE) && defined(WIN3264)
819 /* The text is in the active codepage. Convert to 'encoding',
820 ! * going through UTF-16. */
821 acp_to_enc(str, str_size, &to_free, &maxlen);
828 ++*outlen; /* Include the 0 after the string */
829 ! *out = ucs2_to_enc((short_u *)widestr, outlen);
836 ++*outlen; /* Include the 0 after the string */
837 ! *out = utf16_to_enc((short_u *)widestr, outlen);
844 int len = metadata.txtlen;
846 ! /* Convert the text to UCS-2. This is put on the clipboard as
848 ! out = (WCHAR *)enc_to_ucs2(str, &len);
854 int len = metadata.txtlen;
856 ! /* Convert the text to UTF-16. This is put on the clipboard as
858 ! out = (WCHAR *)enc_to_utf16(str, &len);
864 WideCharToMultiByte(GetACP(), 0, out, len,
865 str, metadata.txtlen, 0, 0);
867 ! /* Allocate memory for the UCS-2 text, add one NUL word to
868 * terminate the string. */
869 hMemW = (LPSTR)GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,
870 (len + 1) * sizeof(WCHAR));
872 WideCharToMultiByte(GetACP(), 0, out, len,
873 str, metadata.txtlen, 0, 0);
875 ! /* Allocate memory for the UTF-16 text, add one NUL word to
876 * terminate the string. */
877 hMemW = (LPSTR)GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,
878 (len + 1) * sizeof(WCHAR));
879 *** ../vim-7.2.048/src/os_win32.c Thu Jul 24 20:50:30 2008
880 --- src/os_win32.c Thu Nov 20 16:44:33 2008
884 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
886 ! WCHAR *p = enc_to_ucs2(name, NULL);
887 WCHAR fnamew[_MAX_PATH];
892 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
894 ! WCHAR *p = enc_to_utf16(name, NULL);
895 WCHAR fnamew[_MAX_PATH];
901 if (GetCurrentDirectoryW(_MAX_PATH, wbuf) != 0)
903 ! char_u *p = ucs2_to_enc(wbuf, NULL);
909 if (GetCurrentDirectoryW(_MAX_PATH, wbuf) != 0)
911 ! char_u *p = utf16_to_enc(wbuf, NULL);
918 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
920 ! WCHAR *p = enc_to_ucs2(name, NULL);
926 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
928 ! WCHAR *p = enc_to_utf16(name, NULL);
935 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
937 ! WCHAR *p = enc_to_ucs2(name, NULL);
943 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
945 ! WCHAR *p = enc_to_utf16(name, NULL);
953 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
954 ! p = enc_to_ucs2(name, NULL);
961 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
962 ! p = enc_to_utf16(name, NULL);
970 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
971 ! wn = enc_to_ucs2(fname, NULL);
974 hFile = CreateFileW(wn, /* file name */
978 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
979 ! wn = enc_to_utf16(fname, NULL);
982 hFile = CreateFileW(wn, /* file name */
986 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
988 ! wn = enc_to_ucs2(name, NULL);
991 SetFileAttributesW(wn, FILE_ATTRIBUTE_NORMAL);
994 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
996 ! wn = enc_to_utf16(name, NULL);
999 SetFileAttributesW(wn, FILE_ATTRIBUTE_NORMAL);
1003 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
1005 ! wold = enc_to_ucs2((char_u *)pszOldFile, NULL);
1006 ! wnew = enc_to_ucs2((char_u *)pszNewFile, NULL);
1007 if (wold != NULL && wnew != NULL)
1008 retval = mch_wrename(wold, wnew);
1012 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
1014 ! wold = enc_to_utf16((char_u *)pszOldFile, NULL);
1015 ! wnew = enc_to_utf16((char_u *)pszNewFile, NULL);
1016 if (wold != NULL && wnew != NULL)
1017 retval = mch_wrename(wold, wnew);
1023 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
1024 ! wn = enc_to_ucs2(n, NULL);
1031 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
1032 ! wn = enc_to_utf16(n, NULL);
1039 #if defined(FEAT_MBYTE) || defined(PROTO)
1041 ! * Version of open() that may use ucs2 file name.
1044 mch_open(char *name, int flags, int mode)
1047 #if defined(FEAT_MBYTE) || defined(PROTO)
1049 ! * Version of open() that may use UTF-16 file name.
1052 mch_open(char *name, int flags, int mode)
1056 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
1058 ! wn = enc_to_ucs2(name, NULL);
1061 f = _wopen(wn, flags, mode);
1064 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
1066 ! wn = enc_to_utf16(name, NULL);
1069 f = _wopen(wn, flags, mode);
1075 ! * Version of fopen() that may use ucs2 file name.
1078 mch_fopen(char *name, char *mode)
1083 ! * Version of fopen() that may use UTF-16 file name.
1086 mch_fopen(char *name, char *mode)
1089 else if (newMode == 'b')
1090 _set_fmode(_O_BINARY);
1092 ! wn = enc_to_ucs2(name, NULL);
1093 ! wm = enc_to_ucs2(mode, NULL);
1094 if (wn != NULL && wm != NULL)
1095 f = _wfopen(wn, wm);
1098 else if (newMode == 'b')
1099 _set_fmode(_O_BINARY);
1101 ! wn = enc_to_utf16(name, NULL);
1102 ! wm = enc_to_utf16(mode, NULL);
1103 if (wn != NULL && wm != NULL)
1104 f = _wfopen(wn, wm);
1110 /* Convert the file names to wide characters. */
1111 ! fromw = enc_to_ucs2(from, NULL);
1112 ! tow = enc_to_ucs2(to, NULL);
1113 if (fromw != NULL && tow != NULL)
1115 /* Open the file for reading. */
1119 /* Convert the file names to wide characters. */
1120 ! fromw = enc_to_utf16(from, NULL);
1121 ! tow = enc_to_utf16(to, NULL);
1122 if (fromw != NULL && tow != NULL)
1124 /* Open the file for reading. */
1127 for (i = 0; i < used_file_count; ++i)
1129 idx = used_file_indexes[i];
1130 ! str = ucs2_to_enc(ArglistW[idx], NULL);
1135 for (i = 0; i < used_file_count; ++i)
1137 idx = used_file_indexes[i];
1138 ! str = utf16_to_enc(ArglistW[idx], NULL);
1142 *** ../vim-7.2.048/src/proto/os_mswin.pro Sat May 5 19:07:50 2007
1143 --- src/proto/os_mswin.pro Thu Nov 20 16:41:00 2008
1146 int can_end_termcap_mode __ARGS((int give_msg));
1147 int mch_screenmode __ARGS((char_u *arg));
1148 int mch_libcall __ARGS((char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result));
1149 ! int utf8_to_ucs2 __ARGS((char_u *instr, int inlen, short_u *outstr, int *unconvlenp));
1150 ! int ucs2_to_utf8 __ARGS((short_u *instr, int inlen, char_u *outstr));
1151 void MultiByteToWideChar_alloc __ARGS((UINT cp, DWORD flags, LPCSTR in, int inlen, LPWSTR *out, int *outlen));
1152 void WideCharToMultiByte_alloc __ARGS((UINT cp, DWORD flags, LPCWSTR in, int inlen, LPSTR *out, int *outlen, LPCSTR def, LPBOOL useddef));
1153 int clip_mch_own_selection __ARGS((VimClipboard *cbd));
1154 void clip_mch_lose_selection __ARGS((VimClipboard *cbd));
1155 ! short_u *enc_to_ucs2 __ARGS((char_u *str, int *lenp));
1156 ! char_u *ucs2_to_enc __ARGS((short_u *str, int *lenp));
1157 void clip_mch_request_selection __ARGS((VimClipboard *cbd));
1158 void acp_to_enc __ARGS((char_u *str, int str_size, char_u **out, int *outlen));
1159 void clip_mch_set_selection __ARGS((VimClipboard *cbd));
1161 int can_end_termcap_mode __ARGS((int give_msg));
1162 int mch_screenmode __ARGS((char_u *arg));
1163 int mch_libcall __ARGS((char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result));
1164 ! int utf8_to_utf16 __ARGS((char_u *instr, int inlen, short_u *outstr, int *unconvlenp));
1165 ! int utf16_to_utf8 __ARGS((short_u *instr, int inlen, char_u *outstr));
1166 void MultiByteToWideChar_alloc __ARGS((UINT cp, DWORD flags, LPCSTR in, int inlen, LPWSTR *out, int *outlen));
1167 void WideCharToMultiByte_alloc __ARGS((UINT cp, DWORD flags, LPCWSTR in, int inlen, LPSTR *out, int *outlen, LPCSTR def, LPBOOL useddef));
1168 int clip_mch_own_selection __ARGS((VimClipboard *cbd));
1169 void clip_mch_lose_selection __ARGS((VimClipboard *cbd));
1170 ! short_u *enc_to_utf16 __ARGS((char_u *str, int *lenp));
1171 ! char_u *utf16_to_enc __ARGS((short_u *str, int *lenp));
1172 void clip_mch_request_selection __ARGS((VimClipboard *cbd));
1173 void acp_to_enc __ARGS((char_u *str, int str_size, char_u **out, int *outlen));
1174 void clip_mch_set_selection __ARGS((VimClipboard *cbd));
1175 *** ../vim-7.2.048/src/version.c Thu Nov 20 16:11:03 2008
1176 --- src/version.c Thu Nov 20 17:08:07 2008
1180 { /* Add new patch number below this line */
1186 FIRST HEAD: All right! All right! We'll kill him first and then have tea and
1188 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
1190 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
1191 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
1192 \\\ download, build and distribute -- http://www.A-A-P.org ///
1193 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///