Created
January 17, 2012 02:24
-
-
Save koron/1624170 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- a/src/gui_w48.c Tue Jan 10 22:31:32 2012 +0100 | |
| +++ b/src/gui_w48.c Wed Jan 11 19:03:20 2012 +0900 | |
| @@ -3275,28 +3276,24 @@ | |
| # if defined(FEAT_MBYTE) && defined(WIN3264) | |
| /* | |
| - * Wide version of convert_filter(). Keep in sync! | |
| + * Wide version of convert_filter(). Keep to using convert_filter(). | |
| */ | |
| static WCHAR * | |
| convert_filterW(char_u *s) | |
| { | |
| + /* Pre-declaration is required. */ | |
| + char_u * convert_filter(char_u *s); | |
| + | |
| WCHAR *res; | |
| - unsigned s_len = (unsigned)STRLEN(s); | |
| - unsigned i; | |
| - | |
| - res = (WCHAR *)alloc((s_len + 3) * sizeof(WCHAR)); | |
| - if (res != NULL) | |
| - { | |
| - for (i = 0; i < s_len; ++i) | |
| - if (s[i] == '\t' || s[i] == '\n') | |
| - res[i] = '\0'; | |
| - else | |
| - res[i] = s[i]; | |
| - res[s_len] = NUL; | |
| - /* Add two extra NULs to make sure it's properly terminated. */ | |
| - res[s_len + 1] = NUL; | |
| - res[s_len + 2] = NUL; | |
| - } | |
| + char_u *tmp; | |
| + int len; | |
| + | |
| + tmp = convert_filter(s); | |
| + if (tmp == NULL) | |
| + return NULL; | |
| + len = (int)STRLEN(s) + 3; | |
| + res = enc_to_utf16(tmp, &len); | |
| + vim_free(tmp); | |
| return res; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment