| 3572 | } |
| 3573 | |
| 3574 | static wchar_t *utf8_to_wide(const char *value) { |
| 3575 | if (!value) { |
| 3576 | return NULL; |
| 3577 | } |
| 3578 | int needed = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, NULL, 0); |
| 3579 | if (needed <= 0) { |
| 3580 | return NULL; |
| 3581 | } |
| 3582 | wchar_t *wide = malloc((size_t)needed * sizeof(*wide)); |
| 3583 | if (!wide || MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, wide, needed) <= 0) { |
| 3584 | free(wide); |
| 3585 | return NULL; |
| 3586 | } |
| 3587 | return wide; |
| 3588 | } |
| 3589 | |
| 3590 | static char *wide_to_utf8(const wchar_t *value) { |
| 3591 | if (!value) { |
no outgoing calls
no test coverage detected