Thread (6 messages) 6 messages, 4 authors, 2016-06-15

Re: [PATCH I18N filenames v2 3/3] Provide compatibility with MinGW

From: Peter Krefting <hidden>
Date: 2016-06-15 22:47:38

Hi!

Timur Sufiev:
quoted hunk ↗ jump to hunk
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/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help