Re: [PATCH I18N filenames v2 3/3] Provide compatibility with MinGW
- From
Peter Krefting <peter@softwolves.pp.se>
- Date
- Oct 29, 2009, 09:01 UTC
- Message-ID
- <alpine.DEB.2.00.0910290955530.8995@ds9.cixit.se>
- In-Reply-To
- <1256752900-2615-3-git-send-email-timur@iris-comp.ru>
Hi!
Timur Sufiev:
Show 22 quoted lines
> diff --git a/compat/mingw.c b/compat/mingw.c
> index 6b5b5b2..2a2ebcb 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -2,7 +2,7 @@
> #include "win32.h"
> #include <conio.h>
> #include "../strbuf.h"
> -
> +#include "../io-i18n.h"
> #include <shellapi.h>
>
> static int err_win_to_posix(DWORD winerr)
> @@ -132,7 +132,7 @@ int mingw_open (const char *filename, int oflags, ...)
> if (!strcmp(filename, "/dev/null"))
> filename = "nul";
>
> - fd = open(filename, oflags, mode);
> + fd = open_i18n(filename, oflags, mode);
>
> if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
> DWORD attrs = GetFileAttributes(filename);Instead of calling the open_i18n() which converts from UTF-8 to a local 8-bit character set, this should probably call a version that converts from UTF-8 to UTF-16 and uses _wopen().
Same thing for fopen_i18n() and _wfopen().
I created a small RFC patch for that that changed parts of the system earlier this year - http://kerneltrap.org/mailarchive/git/2009/3/2/5350814
I did not address readdir() and friends, I'm not sure if they are available in UTF-16 form or if they need to be rewritten using findfirst()/findnext().
-- \\// Peter - http://www.softwolves.pp.se/