diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-08-13 05:48:08 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-08-15 00:28:41 +0200 |
commit | 07cc72ad5d40882d3330677a8cd3fe61c5611b47 (patch) | |
tree | 76b7afaceffa946fcf72450a80b89896318935ac /src/nvim/os/pty_process_win.c | |
parent | 8727f7a6a4ef10ce7536fbc003ef13b768f1aa91 (diff) | |
download | rneovim-07cc72ad5d40882d3330677a8cd3fe61c5611b47.tar.gz rneovim-07cc72ad5d40882d3330677a8cd3fe61c5611b47.tar.bz2 rneovim-07cc72ad5d40882d3330677a8cd3fe61c5611b47.zip |
utf16_to_utf8: align with libuv
- take a size parameter
- return libuv error code
- handle error in caller only (avoid redundant messages)
https://github.com/libuv/libuv/commit/53995a3825d23eacd01e2bcfa35642c4a188d32b
https://github.com/libuv/libuv/commit/4c945f49365ab4d6e1b07bf0ef2893455dc04622
Diffstat (limited to 'src/nvim/os/pty_process_win.c')
-rw-r--r-- | src/nvim/os/pty_process_win.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/nvim/os/pty_process_win.c b/src/nvim/os/pty_process_win.c index ef48da953a..183219bd3e 100644 --- a/src/nvim/os/pty_process_win.c +++ b/src/nvim/os/pty_process_win.c @@ -51,26 +51,26 @@ int pty_process_spawn(PtyProcess *ptyproc) cfg = winpty_config_new(WINPTY_FLAG_ALLOW_CURPROC_DESKTOP_CREATION, &err); if (cfg == NULL) { - emsg = "Failed, winpty_config_new."; + emsg = "winpty_config_new failed"; goto cleanup; } winpty_config_set_initial_size(cfg, ptyproc->width, ptyproc->height); winpty_object = winpty_open(cfg, &err); if (winpty_object == NULL) { - emsg = "Failed, winpty_open."; + emsg = "winpty_open failed"; goto cleanup; } - status = utf16_to_utf8(winpty_conin_name(winpty_object), &in_name); + status = utf16_to_utf8(winpty_conin_name(winpty_object), -1, &in_name); if (status != 0) { - emsg = "Failed to convert in_name from utf16 to utf8."; + emsg = "utf16_to_utf8(winpty_conin_name) failed"; goto cleanup; } - status = utf16_to_utf8(winpty_conout_name(winpty_object), &out_name); + status = utf16_to_utf8(winpty_conout_name(winpty_object), -1, &out_name); if (status != 0) { - emsg = "Failed to convert out_name from utf16 to utf8."; + emsg = "utf16_to_utf8(winpty_conout_name) failed"; goto cleanup; } @@ -95,7 +95,7 @@ int pty_process_spawn(PtyProcess *ptyproc) if (proc->cwd != NULL) { status = utf8_to_utf16(proc->cwd, -1, &cwd); if (status != 0) { - emsg = "utf8_to_utf16 failed"; + emsg = "utf8_to_utf16(proc->cwd) failed"; goto cleanup; } } @@ -160,11 +160,11 @@ int pty_process_spawn(PtyProcess *ptyproc) cleanup: if (status) { // In the case of an error of MultiByteToWideChar or CreateProcessW. - ELOG("%s: error code: %d", emsg, status); + ELOG("pty_process_spawn: %s: error code: %d", emsg, status); status = os_translate_sys_error(status); } else if (err != NULL) { status = (int)winpty_error_code(err); - ELOG("%s: error code: %d", emsg, status); + ELOG("pty_process_spawn: %s: error code: %d", emsg, status); status = translate_winpty_error(status); } winpty_error_free(err); |