summaryrefslogtreecommitdiffstats
path: root/src/win32/win32_util.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-12-10 22:22:44 -0500
committerDavid Robillard <d@drobilla.net>2024-12-11 00:22:12 -0500
commite41951c43a8f6a0bcf6b0fcceebec99f87f7d1e7 (patch)
tree20be9e945e56acedc3d91c4a36f0c36fab5bb05f /src/win32/win32_util.h
parentba2c2a08973cb5eae1feabbb9431c897cded03f6 (diff)
downloadzix-e41951c43a8f6a0bcf6b0fcceebec99f87f7d1e7.tar.gz
zix-e41951c43a8f6a0bcf6b0fcceebec99f87f7d1e7.tar.bz2
zix-e41951c43a8f6a0bcf6b0fcceebec99f87f7d1e7.zip
Support building for Windows with or without UNICODE
Diffstat (limited to 'src/win32/win32_util.h')
-rw-r--r--src/win32/win32_util.h31
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