diff options
author | wm4 <wm4@mplayer2.org> | 2012-04-06 23:42:02 +0200 |
---|---|---|
committer | wm4 <wm4@mplayer2.org> | 2012-04-06 23:56:30 +0200 |
commit | a659429f865859d66f7fe27e45cb20cb897546ec (patch) | |
tree | c5c06f821282ee9e36e0c31a37a084848466b855 /osdep/io.c | |
parent | ce7562705e8adb9a8b567da10ae0d9d8df646d7d (diff) | |
download | mpv-a659429f865859d66f7fe27e45cb20cb897546ec.tar.bz2 mpv-a659429f865859d66f7fe27e45cb20cb897546ec.tar.xz |
win32: use more unicode functions
Use the *W variants instead of the implicit *A functions. (One could
define the UNICODE macro to switch the functions without suffix from
A to W, but I'm too lazy to figure out how portable that is, etc.)
Also make sure io.h defines a unicode aware printf().
Diffstat (limited to 'osdep/io.c')
-rw-r--r-- | osdep/io.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/osdep/io.c b/osdep/io.c index e3e750e30b..5531e3ce7c 100644 --- a/osdep/io.c +++ b/osdep/io.c @@ -92,13 +92,10 @@ int mp_stat(const char *path, struct stat *buf) return res; } -int mp_fprintf(FILE *stream, const char *format, ...) +static int mp_vfprintf(FILE *stream, const char *format, va_list args) { - va_list args; int done = 0; - va_start(args, format); - if (stream == stdout || stream == stderr) { HANDLE *wstream = GetStdHandle(stream == stdout ? @@ -146,9 +143,27 @@ int mp_fprintf(FILE *stream, const char *format, ...) else done = vfprintf(stream, format, args); + return done; +} + +int mp_fprintf(FILE *stream, const char *format, ...) +{ + int res; + va_list args; + va_start(args, format); + res = mp_vfprintf(stream, format, args); va_end(args); + return res; +} - return done; +int mp_printf(const char *format, ...) +{ + int res; + va_list args; + va_start(args, format); + res = mp_vfprintf(stdout, format, args); + va_end(args); + return res; } int mp_open(const char *filename, int oflag, ...) |