| 5795 | |
| 5796 | #ifdef _WIN32 |
| 5797 | static wchar_t *cli_windows_utf8_to_wide(const char *value) { |
| 5798 | if (!value || !value[0]) { |
| 5799 | return NULL; |
| 5800 | } |
| 5801 | int needed = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, NULL, 0); |
| 5802 | if (needed <= 0) { |
| 5803 | return NULL; |
| 5804 | } |
| 5805 | wchar_t *wide = malloc((size_t)needed * sizeof(*wide)); |
| 5806 | if (!wide || MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, wide, needed) <= 0) { |
| 5807 | free(wide); |
| 5808 | return NULL; |
| 5809 | } |
| 5810 | return wide; |
| 5811 | } |
| 5812 | |
| 5813 | static bool cli_windows_path_segment_equal(const wchar_t *segment, size_t segment_length, |
| 5814 | const wchar_t *directory) { |
no outgoing calls
no test coverage detected