| 6015 | |
| 6016 | #ifdef _WIN32 |
| 6017 | static wchar_t *cli_windows_utf8_to_wide(const char *value) { |
| 6018 | if (!value || !value[0]) { |
| 6019 | return NULL; |
| 6020 | } |
| 6021 | int needed = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, NULL, 0); |
| 6022 | if (needed <= 0) { |
| 6023 | return NULL; |
| 6024 | } |
| 6025 | wchar_t *wide = malloc((size_t)needed * sizeof(*wide)); |
| 6026 | if (!wide || MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, wide, needed) <= 0) { |
| 6027 | free(wide); |
| 6028 | return NULL; |
| 6029 | } |
| 6030 | return wide; |
| 6031 | } |
| 6032 | |
| 6033 | static bool cli_windows_path_segment_equal(const wchar_t *segment, size_t segment_length, |
| 6034 | const wchar_t *directory) { |
no outgoing calls
no test coverage detected