| 3510 | } |
| 3511 | |
| 3512 | static wchar_t *utf8_to_wide(const char *value) { |
| 3513 | if (!value) { |
| 3514 | return NULL; |
| 3515 | } |
| 3516 | int needed = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, NULL, 0); |
| 3517 | if (needed <= 0) { |
| 3518 | return NULL; |
| 3519 | } |
| 3520 | wchar_t *wide = malloc((size_t)needed * sizeof(*wide)); |
| 3521 | if (!wide || MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, wide, needed) <= 0) { |
| 3522 | free(wide); |
| 3523 | return NULL; |
| 3524 | } |
| 3525 | return wide; |
| 3526 | } |
| 3527 | |
| 3528 | static char *wide_to_utf8(const wchar_t *value) { |
| 3529 | if (!value) { |
no outgoing calls
no test coverage detected