| 3551 | } |
| 3552 | |
| 3553 | static wchar_t *utf8_to_wide(const char *value) { |
| 3554 | if (!value) { |
| 3555 | return NULL; |
| 3556 | } |
| 3557 | int needed = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, NULL, 0); |
| 3558 | if (needed <= 0) { |
| 3559 | return NULL; |
| 3560 | } |
| 3561 | wchar_t *wide = malloc((size_t)needed * sizeof(*wide)); |
| 3562 | if (!wide || MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, wide, needed) <= 0) { |
| 3563 | free(wide); |
| 3564 | return NULL; |
| 3565 | } |
| 3566 | return wide; |
| 3567 | } |
| 3568 | |
| 3569 | static char *wide_to_utf8(const wchar_t *value) { |
| 3570 | if (!value) { |
no outgoing calls
no test coverage detected