forked from aniani/vim
updated for version 7.2-049
This commit is contained in:
@@ -992,7 +992,7 @@ _WndProc(
|
||||
SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH,
|
||||
0, 500);
|
||||
|
||||
tt_text = enc_to_ucs2(str, NULL);
|
||||
tt_text = enc_to_utf16(str, NULL);
|
||||
lpdi->lpszText = tt_text;
|
||||
/* can't show tooltip if failed */
|
||||
}
|
||||
@@ -1935,7 +1935,7 @@ GetResultStr(HWND hwnd, int GCS, int *lenp)
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
||||
convbuf = ucs2_to_enc(buf, lenp);
|
||||
convbuf = utf16_to_enc(buf, lenp);
|
||||
pImmReleaseContext(hwnd, hIMC);
|
||||
vim_free(buf);
|
||||
return convbuf;
|
||||
@@ -2566,7 +2566,7 @@ gui_mch_add_menu(
|
||||
{
|
||||
/* 'encoding' differs from active codepage: convert menu name
|
||||
* and use wide function */
|
||||
wn = enc_to_ucs2(menu->name, NULL);
|
||||
wn = enc_to_utf16(menu->name, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
MENUITEMINFOW infow;
|
||||
@@ -2728,7 +2728,7 @@ gui_mch_add_menu_item(
|
||||
{
|
||||
/* 'encoding' differs from active codepage: convert menu item name
|
||||
* and use wide function */
|
||||
wn = enc_to_ucs2(menu->name, NULL);
|
||||
wn = enc_to_utf16(menu->name, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
n = InsertMenuW(parent->submenu_id, (UINT)idx,
|
||||
@@ -3570,7 +3570,7 @@ nCopyAnsiToWideChar(
|
||||
if (enc_codepage == 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
/* Not a codepage, use our own conversion function. */
|
||||
wn = enc_to_ucs2(lpAnsiIn, NULL);
|
||||
wn = enc_to_utf16(lpAnsiIn, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
wcscpy(lpWCStr, wn);
|
||||
|
@@ -547,7 +547,7 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
|
||||
else
|
||||
{
|
||||
len = 1;
|
||||
ws = ucs2_to_enc(wstring, &len);
|
||||
ws = utf16_to_enc(wstring, &len);
|
||||
if (ws == NULL)
|
||||
len = 0;
|
||||
else
|
||||
@@ -2128,7 +2128,7 @@ GetTextWidthEnc(HDC hdc, char_u *str, int len)
|
||||
{
|
||||
/* 'encoding' differs from active codepage: convert text and use wide
|
||||
* function */
|
||||
wstr = enc_to_ucs2(str, &wlen);
|
||||
wstr = enc_to_utf16(str, &wlen);
|
||||
if (wstr != NULL)
|
||||
{
|
||||
n = GetTextExtentPointW(hdc, wstr, wlen, &size);
|
||||
@@ -2252,7 +2252,7 @@ add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text)
|
||||
{
|
||||
/* 'encoding' differs from active codepage: convert menu name
|
||||
* and use wide function */
|
||||
wn = enc_to_ucs2(item_text, NULL);
|
||||
wn = enc_to_utf16(item_text, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
MENUITEMINFOW infow;
|
||||
@@ -2422,7 +2422,7 @@ gui_mch_update_tabline(void)
|
||||
if (use_unicode)
|
||||
{
|
||||
/* Need to go through Unicode. */
|
||||
wstr = enc_to_ucs2(NameBuff, NULL);
|
||||
wstr = enc_to_utf16(NameBuff, NULL);
|
||||
if (wstr != NULL)
|
||||
{
|
||||
TCITEMW tiw;
|
||||
@@ -2521,8 +2521,8 @@ set_window_title(HWND hwnd, char *title)
|
||||
WCHAR *wbuf;
|
||||
int n;
|
||||
|
||||
/* Convert the title from 'encoding' to ucs2. */
|
||||
wbuf = (WCHAR *)enc_to_ucs2((char_u *)title, NULL);
|
||||
/* Convert the title from 'encoding' to UTF-16. */
|
||||
wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL);
|
||||
if (wbuf != NULL)
|
||||
{
|
||||
n = SetWindowTextW(hwnd, wbuf);
|
||||
@@ -3222,7 +3222,7 @@ gui_mch_browseW(
|
||||
char_u *initdir,
|
||||
char_u *filter)
|
||||
{
|
||||
/* We always use the wide function. This means enc_to_ucs2() must work,
|
||||
/* We always use the wide function. This means enc_to_utf16() must work,
|
||||
* otherwise it fails miserably! */
|
||||
OPENFILENAMEW fileStruct;
|
||||
WCHAR fileBuf[MAXPATHL];
|
||||
@@ -3238,7 +3238,7 @@ gui_mch_browseW(
|
||||
fileBuf[0] = NUL;
|
||||
else
|
||||
{
|
||||
wp = enc_to_ucs2(dflt, NULL);
|
||||
wp = enc_to_utf16(dflt, NULL);
|
||||
if (wp == NULL)
|
||||
fileBuf[0] = NUL;
|
||||
else
|
||||
@@ -3263,11 +3263,11 @@ gui_mch_browseW(
|
||||
#endif
|
||||
|
||||
if (title != NULL)
|
||||
titlep = enc_to_ucs2(title, NULL);
|
||||
titlep = enc_to_utf16(title, NULL);
|
||||
fileStruct.lpstrTitle = titlep;
|
||||
|
||||
if (ext != NULL)
|
||||
extp = enc_to_ucs2(ext, NULL);
|
||||
extp = enc_to_utf16(ext, NULL);
|
||||
fileStruct.lpstrDefExt = extp;
|
||||
|
||||
fileStruct.lpstrFile = fileBuf;
|
||||
@@ -3278,7 +3278,7 @@ gui_mch_browseW(
|
||||
if (initdir != NULL && *initdir != NUL)
|
||||
{
|
||||
/* Must have backslashes here, no matter what 'shellslash' says */
|
||||
initdirp = enc_to_ucs2(initdir, NULL);
|
||||
initdirp = enc_to_utf16(initdir, NULL);
|
||||
if (initdirp != NULL)
|
||||
{
|
||||
for (wp = initdirp; *wp != NUL; ++wp)
|
||||
@@ -3318,7 +3318,7 @@ gui_mch_browseW(
|
||||
vim_free(extp);
|
||||
|
||||
/* Convert from UCS2 to 'encoding'. */
|
||||
p = ucs2_to_enc(fileBuf, NULL);
|
||||
p = utf16_to_enc(fileBuf, NULL);
|
||||
if (p != NULL)
|
||||
/* when out of memory we get garbage for non-ASCII chars */
|
||||
STRCPY(fileBuf, p);
|
||||
@@ -3518,7 +3518,7 @@ _OnDropFiles(
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0)
|
||||
fnames[i] = ucs2_to_enc(wszFile, NULL);
|
||||
fnames[i] = utf16_to_enc(wszFile, NULL);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
@@ -6101,7 +6101,7 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
|
||||
|
||||
/* 1. codepage/UTF-8 -> ucs-2. */
|
||||
if (vcp->vc_cpfrom == 0)
|
||||
tmp_len = utf8_to_ucs2(ptr, len, NULL, NULL);
|
||||
tmp_len = utf8_to_utf16(ptr, len, NULL, NULL);
|
||||
else
|
||||
tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, 0,
|
||||
ptr, len, 0, 0);
|
||||
@@ -6109,13 +6109,13 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
|
||||
if (tmp == NULL)
|
||||
break;
|
||||
if (vcp->vc_cpfrom == 0)
|
||||
utf8_to_ucs2(ptr, len, tmp, unconvlenp);
|
||||
utf8_to_utf16(ptr, len, tmp, unconvlenp);
|
||||
else
|
||||
MultiByteToWideChar(vcp->vc_cpfrom, 0, ptr, len, tmp, tmp_len);
|
||||
|
||||
/* 2. ucs-2 -> codepage/UTF-8. */
|
||||
if (vcp->vc_cpto == 0)
|
||||
retlen = ucs2_to_utf8(tmp, tmp_len, NULL);
|
||||
retlen = utf16_to_utf8(tmp, tmp_len, NULL);
|
||||
else
|
||||
retlen = WideCharToMultiByte(vcp->vc_cpto, 0,
|
||||
tmp, tmp_len, 0, 0, 0, 0);
|
||||
@@ -6123,7 +6123,7 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
|
||||
if (retval != NULL)
|
||||
{
|
||||
if (vcp->vc_cpto == 0)
|
||||
ucs2_to_utf8(tmp, tmp_len, retval);
|
||||
utf16_to_utf8(tmp, tmp_len, retval);
|
||||
else
|
||||
WideCharToMultiByte(vcp->vc_cpto, 0,
|
||||
tmp, tmp_len, retval, retlen, 0, 0);
|
||||
|
@@ -8728,7 +8728,7 @@ dos_expandpath(
|
||||
/* The active codepage differs from 'encoding'. Attempt using the
|
||||
* wide function. If it fails because it is not implemented fall back
|
||||
* to the non-wide version (for Windows 98) */
|
||||
wn = enc_to_ucs2(buf, NULL);
|
||||
wn = enc_to_utf16(buf, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
hFind = FindFirstFileW(wn, &wfb);
|
||||
@@ -8756,7 +8756,7 @@ dos_expandpath(
|
||||
#ifdef WIN3264
|
||||
# ifdef FEAT_MBYTE
|
||||
if (wn != NULL)
|
||||
p = ucs2_to_enc(wfb.cFileName, NULL); /* p is allocated here */
|
||||
p = utf16_to_enc(wfb.cFileName, NULL); /* p is allocated here */
|
||||
else
|
||||
# endif
|
||||
p = (char_u *)fb.cFileName;
|
||||
@@ -8830,7 +8830,7 @@ dos_expandpath(
|
||||
if (wn != NULL)
|
||||
{
|
||||
vim_free(wn);
|
||||
wn = enc_to_ucs2(buf, NULL);
|
||||
wn = enc_to_utf16(buf, NULL);
|
||||
if (wn != NULL)
|
||||
hFind = FindFirstFileW(wn, &wfb);
|
||||
}
|
||||
|
@@ -309,7 +309,7 @@ mch_settitle(
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
/* Convert the title from 'encoding' to the active codepage. */
|
||||
WCHAR *wp = enc_to_ucs2(title, NULL);
|
||||
WCHAR *wp = enc_to_utf16(title, NULL);
|
||||
int n;
|
||||
|
||||
if (wp != NULL)
|
||||
@@ -406,10 +406,10 @@ mch_FullName(
|
||||
* - invoke _wfullpath()
|
||||
* - convert the result from UCS2 to 'encoding'.
|
||||
*/
|
||||
wname = enc_to_ucs2(fname, NULL);
|
||||
wname = enc_to_utf16(fname, NULL);
|
||||
if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH - 1) != NULL)
|
||||
{
|
||||
cname = ucs2_to_enc((short_u *)wbuf, NULL);
|
||||
cname = utf16_to_enc((short_u *)wbuf, NULL);
|
||||
if (cname != NULL)
|
||||
{
|
||||
vim_strncpy(buf, cname, len - 1);
|
||||
@@ -507,7 +507,7 @@ vim_stat(const char *name, struct stat *stp)
|
||||
# endif
|
||||
)
|
||||
{
|
||||
WCHAR *wp = enc_to_ucs2(buf, NULL);
|
||||
WCHAR *wp = enc_to_utf16(buf, NULL);
|
||||
int n;
|
||||
|
||||
if (wp != NULL)
|
||||
@@ -668,7 +668,7 @@ mch_chdir(char *path)
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *p = enc_to_ucs2(path, NULL);
|
||||
WCHAR *p = enc_to_utf16(path, NULL);
|
||||
int n;
|
||||
|
||||
if (p != NULL)
|
||||
@@ -891,19 +891,20 @@ mch_libcall(
|
||||
|
||||
#if defined(FEAT_MBYTE) || defined(PROTO)
|
||||
/*
|
||||
* Convert an UTF-8 string to UCS-2.
|
||||
* Convert an UTF-8 string to UTF-16.
|
||||
* "instr[inlen]" is the input. "inlen" is in bytes.
|
||||
* When "outstr" is NULL only return the number of UCS-2 words produced.
|
||||
* When "outstr" is NULL only return the number of UTF-16 words produced.
|
||||
* Otherwise "outstr" must be a buffer of sufficient size.
|
||||
* Returns the number of UCS-2 words produced.
|
||||
* Returns the number of UTF-16 words produced.
|
||||
*/
|
||||
int
|
||||
utf8_to_ucs2(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
|
||||
utf8_to_utf16(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
|
||||
{
|
||||
int outlen = 0;
|
||||
char_u *p = instr;
|
||||
int todo = inlen;
|
||||
int l;
|
||||
int ch;
|
||||
|
||||
while (todo > 0)
|
||||
{
|
||||
@@ -917,8 +918,19 @@ utf8_to_ucs2(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
|
||||
break;
|
||||
}
|
||||
|
||||
if (outstr != NULL)
|
||||
*outstr++ = utf_ptr2char(p);
|
||||
ch = utf_ptr2char(p);
|
||||
if (ch >= 0x10000)
|
||||
{
|
||||
/* non-BMP character, encoding with surrogate pairs */
|
||||
++outlen;
|
||||
if (outstr != NULL)
|
||||
{
|
||||
*outstr++ = (0xD800 - (0x10000 >> 10)) + (ch >> 10);
|
||||
*outstr++ = 0xDC00 | (ch & 0x3FF);
|
||||
}
|
||||
}
|
||||
else if (outstr != NULL)
|
||||
*outstr++ = ch;
|
||||
++outlen;
|
||||
p += l;
|
||||
todo -= l;
|
||||
@@ -928,29 +940,42 @@ utf8_to_ucs2(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert an UCS-2 string to UTF-8.
|
||||
* The input is "instr[inlen]" with "inlen" in number of ucs-2 words.
|
||||
* Convert an UTF-16 string to UTF-8.
|
||||
* The input is "instr[inlen]" with "inlen" in number of UTF-16 words.
|
||||
* When "outstr" is NULL only return the required number of bytes.
|
||||
* Otherwise "outstr" must be a buffer of sufficient size.
|
||||
* Return the number of bytes produced.
|
||||
*/
|
||||
int
|
||||
ucs2_to_utf8(short_u *instr, int inlen, char_u *outstr)
|
||||
utf16_to_utf8(short_u *instr, int inlen, char_u *outstr)
|
||||
{
|
||||
int outlen = 0;
|
||||
int todo = inlen;
|
||||
short_u *p = instr;
|
||||
int l;
|
||||
int ch, ch2;
|
||||
|
||||
while (todo > 0)
|
||||
{
|
||||
ch = *p;
|
||||
if (ch >= 0xD800 && ch <= 0xDBFF && todo > 1)
|
||||
{
|
||||
/* surrogate pairs handling */
|
||||
ch2 = p[1];
|
||||
if (ch2 >= 0xDC00 && ch2 <= 0xDFFF)
|
||||
{
|
||||
ch = ((ch - 0xD800) << 10) + (ch2 & 0x3FF) + 0x10000;
|
||||
++p;
|
||||
--todo;
|
||||
}
|
||||
}
|
||||
if (outstr != NULL)
|
||||
{
|
||||
l = utf_char2bytes(*p, outstr);
|
||||
l = utf_char2bytes(ch, outstr);
|
||||
outstr += l;
|
||||
}
|
||||
else
|
||||
l = utf_char2len(*p);
|
||||
l = utf_char2len(ch);
|
||||
++p;
|
||||
outlen += l;
|
||||
--todo;
|
||||
@@ -1079,14 +1104,14 @@ crnl_to_nl(const char_u *str, int *size)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Convert "str" from 'encoding' to UCS-2.
|
||||
* Convert "str" from 'encoding' to UTF-16.
|
||||
* Input in "str" with length "*lenp". When "lenp" is NULL, use strlen().
|
||||
* Output is returned as an allocated string. "*lenp" is set to the length of
|
||||
* the result. A trailing NUL is always added.
|
||||
* Returns NULL when out of memory.
|
||||
*/
|
||||
short_u *
|
||||
enc_to_ucs2(char_u *str, int *lenp)
|
||||
enc_to_utf16(char_u *str, int *lenp)
|
||||
{
|
||||
vimconv_T conv;
|
||||
WCHAR *ret;
|
||||
@@ -1102,7 +1127,7 @@ enc_to_ucs2(char_u *str, int *lenp)
|
||||
|
||||
if (enc_codepage > 0)
|
||||
{
|
||||
/* We can do any CP### -> UCS-2 in one pass, and we can do it
|
||||
/* We can do any CP### -> UTF-16 in one pass, and we can do it
|
||||
* without iconv() (convert_* may need iconv). */
|
||||
MultiByteToWideChar_alloc(enc_codepage, 0, str, *lenp, &ret, &length);
|
||||
}
|
||||
@@ -1123,11 +1148,11 @@ enc_to_ucs2(char_u *str, int *lenp)
|
||||
}
|
||||
convert_setup(&conv, NULL, NULL);
|
||||
|
||||
length = utf8_to_ucs2(str, *lenp, NULL, NULL);
|
||||
length = utf8_to_utf16(str, *lenp, NULL, NULL);
|
||||
ret = (WCHAR *)alloc((unsigned)((length + 1) * sizeof(WCHAR)));
|
||||
if (ret != NULL)
|
||||
{
|
||||
utf8_to_ucs2(str, *lenp, (short_u *)ret, NULL);
|
||||
utf8_to_utf16(str, *lenp, (short_u *)ret, NULL);
|
||||
ret[length] = 0;
|
||||
}
|
||||
|
||||
@@ -1139,7 +1164,7 @@ enc_to_ucs2(char_u *str, int *lenp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert an UCS-2 string to 'encoding'.
|
||||
* Convert an UTF-16 string to 'encoding'.
|
||||
* Input in "str" with length (counted in wide characters) "*lenp". When
|
||||
* "lenp" is NULL, use wcslen().
|
||||
* Output is returned as an allocated string. If "*lenp" is not NULL it is
|
||||
@@ -1147,7 +1172,7 @@ enc_to_ucs2(char_u *str, int *lenp)
|
||||
* Returns NULL when out of memory.
|
||||
*/
|
||||
char_u *
|
||||
ucs2_to_enc(short_u *str, int *lenp)
|
||||
utf16_to_enc(short_u *str, int *lenp)
|
||||
{
|
||||
vimconv_T conv;
|
||||
char_u *utf8_str = NULL, *enc_str = NULL;
|
||||
@@ -1161,7 +1186,7 @@ ucs2_to_enc(short_u *str, int *lenp)
|
||||
|
||||
if (enc_codepage > 0)
|
||||
{
|
||||
/* We can do any UCS-2 -> CP### in one pass. */
|
||||
/* We can do any UTF-16 -> CP### in one pass. */
|
||||
int length;
|
||||
|
||||
WideCharToMultiByte_alloc(enc_codepage, 0, str, *lenp,
|
||||
@@ -1171,10 +1196,10 @@ ucs2_to_enc(short_u *str, int *lenp)
|
||||
}
|
||||
|
||||
/* Avoid allocating zero bytes, it generates an error message. */
|
||||
utf8_str = alloc(ucs2_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL));
|
||||
utf8_str = alloc(utf16_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL));
|
||||
if (utf8_str != NULL)
|
||||
{
|
||||
*lenp = ucs2_to_utf8(str, *lenp, utf8_str);
|
||||
*lenp = utf16_to_utf8(str, *lenp, utf8_str);
|
||||
|
||||
/* We might be called before we have p_enc set up. */
|
||||
conv.vc_type = CONV_NONE;
|
||||
@@ -1308,7 +1333,7 @@ clip_mch_request_selection(VimClipboard *cbd)
|
||||
if (hMemWstr[str_size] == NUL)
|
||||
break;
|
||||
}
|
||||
to_free = str = ucs2_to_enc((short_u *)hMemWstr, &str_size);
|
||||
to_free = str = utf16_to_enc((short_u *)hMemWstr, &str_size);
|
||||
GlobalUnlock(hMemW);
|
||||
}
|
||||
}
|
||||
@@ -1340,7 +1365,7 @@ clip_mch_request_selection(VimClipboard *cbd)
|
||||
|
||||
# if defined(FEAT_MBYTE) && defined(WIN3264)
|
||||
/* The text is in the active codepage. Convert to 'encoding',
|
||||
* going through UCS-2. */
|
||||
* going through UTF-16. */
|
||||
acp_to_enc(str, str_size, &to_free, &maxlen);
|
||||
if (to_free != NULL)
|
||||
{
|
||||
@@ -1404,7 +1429,7 @@ acp_to_enc(str, str_size, out, outlen)
|
||||
if (widestr != NULL)
|
||||
{
|
||||
++*outlen; /* Include the 0 after the string */
|
||||
*out = ucs2_to_enc((short_u *)widestr, outlen);
|
||||
*out = utf16_to_enc((short_u *)widestr, outlen);
|
||||
vim_free(widestr);
|
||||
}
|
||||
}
|
||||
@@ -1466,9 +1491,9 @@ clip_mch_set_selection(VimClipboard *cbd)
|
||||
WCHAR *out;
|
||||
int len = metadata.txtlen;
|
||||
|
||||
/* Convert the text to UCS-2. This is put on the clipboard as
|
||||
/* Convert the text to UTF-16. This is put on the clipboard as
|
||||
* CF_UNICODETEXT. */
|
||||
out = (WCHAR *)enc_to_ucs2(str, &len);
|
||||
out = (WCHAR *)enc_to_utf16(str, &len);
|
||||
if (out != NULL)
|
||||
{
|
||||
WCHAR *lpszMemW;
|
||||
@@ -1488,7 +1513,7 @@ clip_mch_set_selection(VimClipboard *cbd)
|
||||
WideCharToMultiByte(GetACP(), 0, out, len,
|
||||
str, metadata.txtlen, 0, 0);
|
||||
|
||||
/* Allocate memory for the UCS-2 text, add one NUL word to
|
||||
/* Allocate memory for the UTF-16 text, add one NUL word to
|
||||
* terminate the string. */
|
||||
hMemW = (LPSTR)GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,
|
||||
(len + 1) * sizeof(WCHAR));
|
||||
|
@@ -1587,7 +1587,7 @@ executable_exists(char *name)
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *p = enc_to_ucs2(name, NULL);
|
||||
WCHAR *p = enc_to_utf16(name, NULL);
|
||||
WCHAR fnamew[_MAX_PATH];
|
||||
WCHAR *dumw;
|
||||
long n;
|
||||
@@ -2440,7 +2440,7 @@ mch_dirname(
|
||||
|
||||
if (GetCurrentDirectoryW(_MAX_PATH, wbuf) != 0)
|
||||
{
|
||||
char_u *p = ucs2_to_enc(wbuf, NULL);
|
||||
char_u *p = utf16_to_enc(wbuf, NULL);
|
||||
|
||||
if (p != NULL)
|
||||
{
|
||||
@@ -2466,7 +2466,7 @@ mch_getperm(char_u *name)
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *p = enc_to_ucs2(name, NULL);
|
||||
WCHAR *p = enc_to_utf16(name, NULL);
|
||||
long n;
|
||||
|
||||
if (p != NULL)
|
||||
@@ -2495,7 +2495,7 @@ mch_setperm(
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *p = enc_to_ucs2(name, NULL);
|
||||
WCHAR *p = enc_to_utf16(name, NULL);
|
||||
long n;
|
||||
|
||||
if (p != NULL)
|
||||
@@ -2522,7 +2522,7 @@ mch_hide(char_u *name)
|
||||
WCHAR *p = NULL;
|
||||
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
p = enc_to_ucs2(name, NULL);
|
||||
p = enc_to_utf16(name, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -2590,7 +2590,7 @@ mch_is_linked(char_u *fname)
|
||||
WCHAR *wn = NULL;
|
||||
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
wn = enc_to_ucs2(fname, NULL);
|
||||
wn = enc_to_utf16(fname, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
hFile = CreateFileW(wn, /* file name */
|
||||
@@ -4239,7 +4239,7 @@ mch_remove(char_u *name)
|
||||
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
wn = enc_to_ucs2(name, NULL);
|
||||
wn = enc_to_utf16(name, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
SetFileAttributesW(wn, FILE_ATTRIBUTE_NORMAL);
|
||||
@@ -4382,8 +4382,8 @@ mch_rename(
|
||||
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
wold = enc_to_ucs2((char_u *)pszOldFile, NULL);
|
||||
wnew = enc_to_ucs2((char_u *)pszNewFile, NULL);
|
||||
wold = enc_to_utf16((char_u *)pszOldFile, NULL);
|
||||
wnew = enc_to_utf16((char_u *)pszNewFile, NULL);
|
||||
if (wold != NULL && wnew != NULL)
|
||||
retval = mch_wrename(wold, wnew);
|
||||
vim_free(wold);
|
||||
@@ -4492,7 +4492,7 @@ mch_access(char *n, int p)
|
||||
WCHAR *wn = NULL;
|
||||
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
wn = enc_to_ucs2(n, NULL);
|
||||
wn = enc_to_utf16(n, NULL);
|
||||
#endif
|
||||
|
||||
if (mch_isdir(n))
|
||||
@@ -4618,7 +4618,7 @@ getout:
|
||||
|
||||
#if defined(FEAT_MBYTE) || defined(PROTO)
|
||||
/*
|
||||
* Version of open() that may use ucs2 file name.
|
||||
* Version of open() that may use UTF-16 file name.
|
||||
*/
|
||||
int
|
||||
mch_open(char *name, int flags, int mode)
|
||||
@@ -4630,7 +4630,7 @@ mch_open(char *name, int flags, int mode)
|
||||
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
wn = enc_to_ucs2(name, NULL);
|
||||
wn = enc_to_utf16(name, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
f = _wopen(wn, flags, mode);
|
||||
@@ -4648,7 +4648,7 @@ mch_open(char *name, int flags, int mode)
|
||||
}
|
||||
|
||||
/*
|
||||
* Version of fopen() that may use ucs2 file name.
|
||||
* Version of fopen() that may use UTF-16 file name.
|
||||
*/
|
||||
FILE *
|
||||
mch_fopen(char *name, char *mode)
|
||||
@@ -4675,8 +4675,8 @@ mch_fopen(char *name, char *mode)
|
||||
else if (newMode == 'b')
|
||||
_set_fmode(_O_BINARY);
|
||||
# endif
|
||||
wn = enc_to_ucs2(name, NULL);
|
||||
wm = enc_to_ucs2(mode, NULL);
|
||||
wn = enc_to_utf16(name, NULL);
|
||||
wm = enc_to_utf16(mode, NULL);
|
||||
if (wn != NULL && wm != NULL)
|
||||
f = _wfopen(wn, wm);
|
||||
vim_free(wn);
|
||||
@@ -4776,8 +4776,8 @@ copy_infostreams(char_u *from, char_u *to)
|
||||
int len;
|
||||
|
||||
/* Convert the file names to wide characters. */
|
||||
fromw = enc_to_ucs2(from, NULL);
|
||||
tow = enc_to_ucs2(to, NULL);
|
||||
fromw = enc_to_utf16(from, NULL);
|
||||
tow = enc_to_utf16(to, NULL);
|
||||
if (fromw != NULL && tow != NULL)
|
||||
{
|
||||
/* Open the file for reading. */
|
||||
@@ -5122,7 +5122,7 @@ fix_arg_enc(void)
|
||||
for (i = 0; i < used_file_count; ++i)
|
||||
{
|
||||
idx = used_file_indexes[i];
|
||||
str = ucs2_to_enc(ArglistW[idx], NULL);
|
||||
str = utf16_to_enc(ArglistW[idx], NULL);
|
||||
if (str != NULL)
|
||||
{
|
||||
#ifdef FEAT_DIFF
|
||||
|
@@ -22,14 +22,14 @@ int mch_chdir __ARGS((char *path));
|
||||
int can_end_termcap_mode __ARGS((int give_msg));
|
||||
int mch_screenmode __ARGS((char_u *arg));
|
||||
int mch_libcall __ARGS((char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result));
|
||||
int utf8_to_ucs2 __ARGS((char_u *instr, int inlen, short_u *outstr, int *unconvlenp));
|
||||
int ucs2_to_utf8 __ARGS((short_u *instr, int inlen, char_u *outstr));
|
||||
int utf8_to_utf16 __ARGS((char_u *instr, int inlen, short_u *outstr, int *unconvlenp));
|
||||
int utf16_to_utf8 __ARGS((short_u *instr, int inlen, char_u *outstr));
|
||||
void MultiByteToWideChar_alloc __ARGS((UINT cp, DWORD flags, LPCSTR in, int inlen, LPWSTR *out, int *outlen));
|
||||
void WideCharToMultiByte_alloc __ARGS((UINT cp, DWORD flags, LPCWSTR in, int inlen, LPSTR *out, int *outlen, LPCSTR def, LPBOOL useddef));
|
||||
int clip_mch_own_selection __ARGS((VimClipboard *cbd));
|
||||
void clip_mch_lose_selection __ARGS((VimClipboard *cbd));
|
||||
short_u *enc_to_ucs2 __ARGS((char_u *str, int *lenp));
|
||||
char_u *ucs2_to_enc __ARGS((short_u *str, int *lenp));
|
||||
short_u *enc_to_utf16 __ARGS((char_u *str, int *lenp));
|
||||
char_u *utf16_to_enc __ARGS((short_u *str, int *lenp));
|
||||
void clip_mch_request_selection __ARGS((VimClipboard *cbd));
|
||||
void acp_to_enc __ARGS((char_u *str, int str_size, char_u **out, int *outlen));
|
||||
void clip_mch_set_selection __ARGS((VimClipboard *cbd));
|
||||
|
@@ -676,6 +676,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
49,
|
||||
/**/
|
||||
48,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user