mirror of
https://github.com/neovim/neovim.git
synced 2024-12-25 21:55:17 -07:00
utf16_to_utf8: minor fixes
This commit is contained in:
parent
9153062095
commit
76562fa192
@ -1375,6 +1375,7 @@ int utf8_to_utf16(const char *str, wchar_t **strw)
|
|||||||
int utf16_to_utf8(const wchar_t *strw, char **str)
|
int utf16_to_utf8(const wchar_t *strw, char **str)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
|
*str = NULL;
|
||||||
// Compute the space required to store the string as UTF-8.
|
// Compute the space required to store the string as UTF-8.
|
||||||
DWORD utf8_len = WideCharToMultiByte(CP_UTF8,
|
DWORD utf8_len = WideCharToMultiByte(CP_UTF8,
|
||||||
0,
|
0,
|
||||||
@ -1400,7 +1401,7 @@ int utf16_to_utf8(const wchar_t *strw, char **str)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
if (utf8_len == 0) {
|
if (utf8_len == 0) {
|
||||||
free(*str);
|
xfree(*str);
|
||||||
*str = NULL;
|
*str = NULL;
|
||||||
return GetLastError();
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ void *xmalloc(size_t size)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// free wrapper that returns delegates to the backing memory manager
|
/// free() wrapper that delegates to the backing memory manager
|
||||||
void xfree(void *ptr)
|
void xfree(void *ptr)
|
||||||
{
|
{
|
||||||
free(ptr);
|
free(ptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user