diff options
author | wm4 <wm4@mplayer2.org> | 2012-02-03 08:05:11 +0100 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2012-03-09 20:48:54 +0200 |
commit | a1244111a790bbc4bf91b078ebcad3f415da79da (patch) | |
tree | bbbb99a7364b7ee4eaa96a44930f84a88db25090 /sub | |
parent | 24be34f1e9e37111a06108c090324426aff6f1db (diff) |
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.
Diffstat (limited to 'sub')
-rw-r--r-- | sub/find_subfiles.c | 2 | ||||
-rw-r--r-- | sub/font_load.c | 10 |
2 files changed, 4 insertions, 8 deletions
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 <ctype.h> #include <assert.h> +#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 <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> + +#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 |