summaryrefslogtreecommitdiffstats
path: root/Alc/compat.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-28 00:37:42 -0700
committerChris Robinson <[email protected]>2014-03-28 00:37:42 -0700
commit20886059fd88724f724da8601a82e04fc3f03a53 (patch)
tree0f8c147ad311226ea9983d73e9ca18faade84e8f /Alc/compat.h
parent18620ab5e00fb4cba97f3aa2bfbc677dfe8376ef (diff)
Wrap fopen calls under Windows
The idea is that all filenames we deal with are encoded as UTF-8, but the Windows functions that take a char string interpret it using the ANSI codepage. So instead, we convert the UTF-8 string to a wchar string, and then use the wchar functions for proper extended character filename support.
Diffstat (limited to 'Alc/compat.h')
-rw-r--r--Alc/compat.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Alc/compat.h b/Alc/compat.h
index 1c80e7c5..426dad9d 100644
--- a/Alc/compat.h
+++ b/Alc/compat.h
@@ -23,6 +23,9 @@ inline int alsched_yield(void)
WCHAR *strdupW(const WCHAR *str);
+/* Opens a file with standard I/O. The filename is expected to be UTF-8. */
+FILE *al_fopen(const char *fname, const char *mode);
+
#define HAVE_DYNLOAD 1
#else
@@ -50,6 +53,8 @@ void Sleep(ALuint t);
#define alsched_yield sched_yield
+#define al_fopen(_n, _m) fopen((_n), (_m))
+
#if defined(HAVE_DLFCN_H) && !defined(IN_IDE_PARSER)
#define HAVE_DYNLOAD 1
#endif