utf16_to_utf8: align with libuv

- take a size parameter
- return libuv error code
- handle error in caller only (avoid redundant messages)

53995a3825
4c945f4936
This commit is contained in:
Justin M. Keyes
2019-08-13 05:48:08 +02:00
parent 8727f7a6a4
commit 07cc72ad5d
5 changed files with 49 additions and 42 deletions

View File

@@ -237,7 +237,7 @@ int main(int argc, char **argv)
char **argv = xmalloc((size_t)argc * sizeof(char *));
for (int i = 0; i < argc; i++) {
char *buf = NULL;
utf16_to_utf8(argv_w[i], &buf);
utf16_to_utf8(argv_w[i], -1, &buf);
assert(buf);
argv[i] = buf;
}