diff options
Diffstat (limited to 'src/win32/win32_util.h')
-rw-r--r-- | src/win32/win32_util.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/win32/win32_util.h b/src/win32/win32_util.h new file mode 100644 index 0000000..3123ef4 --- /dev/null +++ b/src/win32/win32_util.h @@ -0,0 +1,31 @@ +// Copyright 2019-2024 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#ifndef ZIX_WIN32_UTIL_H +#define ZIX_WIN32_UTIL_H + +#include <zix/allocator.h> + +#ifdef UNICODE +typedef wchar_t ArgPathChar; +#else +typedef const char ArgPathChar; +#endif + +/// Copy and convert a path argument if necessary +ArgPathChar* +arg_path_new(ZixAllocator* const allocator, const char* const path); + +/// Free a path from arg_path_new() if necessary +void +arg_path_free(ZixAllocator* const allocator, ArgPathChar* const path); + +/// Convert from (user) UTF-8 to (Windows) UTF-16 +wchar_t* +zix_utf8_to_wchar(ZixAllocator* allocator, const char* utf8); + +/// Convert from (Windows) UTF-16 to (user) UTF-8 +char* +zix_wchar_to_utf8(ZixAllocator* allocator, const wchar_t* wstr); + +#endif // ZIX_WIN32_UTIL_H |