From a1244111a790bbc4bf91b078ebcad3f415da79da Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 3 Feb 2012 08:05:11 +0100 Subject: windows support: unicode filenames Windows uses a legacy codepage for char* / runtime functions accepting char *. Using UTF-8 as the codepage with setlocale() is explicitly forbidden. Work this around by overriding the MSVCRT functions with wrapper macros, that assume UTF-8 and use "proper" API calls like _wopen etc. to deal with unicode filenames. All code that uses standard functions that take or return filenames must now include osdep/io.h. stat() can't be overridden, because MinGW-w64 itself defines "stat" as a macro. Change code to use use mp_stat() instead. This is not perfectly clean, but still somewhat sane, and much better than littering the rest of the mplayer code with MinGW specific hacks. It's also a bit fragile, but that's actually little different from the previous situation. Also, MinGW is unlikely to ever include a nice way of dealing with this. --- sub/find_subfiles.c | 2 ++ sub/font_load.c | 10 ++-------- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'sub') diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c index 3de8014ce1..6af599183f 100644 --- a/sub/find_subfiles.c +++ b/sub/find_subfiles.c @@ -4,6 +4,8 @@ #include #include +#include "osdep/io.h" + #include "mp_msg.h" #include "options.h" #include "path.h" diff --git a/sub/font_load.c b/sub/font_load.c index 7bf7775501..d8f9eafe34 100644 --- a/sub/font_load.c +++ b/sub/font_load.c @@ -21,9 +21,8 @@ #include #include #include -#include -#include -#include + +#include "osdep/io.h" #include "font_load.h" #include "mp_msg.h" @@ -72,7 +71,6 @@ unsigned char sor2[1024]; font_desc_t *desc; FILE *f = NULL; char *dn; -//struct stat fstate; char section[64]; int i,j; int chardb=0; @@ -93,10 +91,6 @@ if ((dn = malloc(i+1))){ desc->fpath = dn; // search in the same dir as fonts.desc -// desc->fpath=get_path("font/"); -// if (stat(desc->fpath, &fstate)!=0) desc->fpath=DATADIR"/font"; - - // set up some defaults, and erase table -- cgit v1.2.3