diff options
author | James Ross-Gowan <rossymiles@gmail.com> | 2015-03-29 22:36:46 +1100 |
---|---|---|
committer | James Ross-Gowan <rossymiles@gmail.com> | 2015-04-11 14:27:25 +1000 |
commit | ac7ecbe30cdec598955471d2ed012f36296b78de (patch) | |
tree | cd62299e8df947fa73787a857e5019277ed5d952 /osdep | |
parent | 6f46bafbd06e6a107e55f35860744ed66c1b8426 (diff) | |
download | mpv-ac7ecbe30cdec598955471d2ed012f36296b78de.tar.bz2 mpv-ac7ecbe30cdec598955471d2ed012f36296b78de.tar.xz |
win32: use a platform-specific unicode entry-point
Add a platform-specific entry-point for Windows. This will allow some
platform-specific initialization to be added without the need for ugly
ifdeffery in main.c.
As an immediate advantage, mpv can now use a unicode entry-point and
convert the command line arguments to UTF-8 before passing them to
mpv_main, so osdep_preinit can be simplified a little bit.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/io.c | 26 | ||||
-rw-r--r-- | osdep/io.h | 2 |
2 files changed, 0 insertions, 28 deletions
diff --git a/osdep/io.c b/osdep/io.c index e63509a4f8..00cba27017 100644 --- a/osdep/io.c +++ b/osdep/io.c @@ -121,32 +121,6 @@ char *mp_to_utf8(void *talloc_ctx, const wchar_t *s) #include <fcntl.h> #include <pthread.h> -//http://git.libav.org/?p=libav.git;a=blob;f=cmdutils.c;h=ade3f10ce2fc030e32e375a85fbd06c26d43a433#l161 - -static char** win32_argv_utf8; -static int win32_argc; - -void mp_get_converted_argv(int *argc, char ***argv) -{ - if (!win32_argv_utf8) { - win32_argc = 0; - wchar_t **argv_w = CommandLineToArgvW(GetCommandLineW(), &win32_argc); - if (win32_argc <= 0 || !argv_w) - return; - - win32_argv_utf8 = talloc_zero_array(NULL, char*, win32_argc + 1); - - for (int i = 0; i < win32_argc; i++) { - win32_argv_utf8[i] = mp_to_utf8(NULL, argv_w[i]); - } - - LocalFree(argv_w); - } - - *argc = win32_argc; - *argv = win32_argv_utf8; -} - static void copy_stat(struct mp_stat *dst, struct _stat64 *src) { dst->st_dev = src->st_dev; diff --git a/osdep/io.h b/osdep/io.h index 0348d3d1a3..a116f3e566 100644 --- a/osdep/io.h +++ b/osdep/io.h @@ -65,8 +65,6 @@ char *mp_to_utf8(void *talloc_ctx, const wchar_t *s); #include <sys/stat.h> #include <fcntl.h> -void mp_get_converted_argv(int *argc, char ***argv); - int mp_printf(const char *format, ...); int mp_fprintf(FILE *stream, const char *format, ...); int mp_open(const char *filename, int oflag, ...); |