[前][次][番号順一覧][スレッド一覧]

ruby-changes:13568

From: usa <ko1@a...>
Date: Thu, 15 Oct 2009 15:03:01 +0900 (JST)
Subject: [ruby-changes:13568] Ruby:r25349 (win32-unicode-test): * file.c (win32_io_info): UTF-8 handling.

usa	2009-10-15 15:02:51 +0900 (Thu, 15 Oct 2009)

  New Revision: 25349

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25349

  Log:
    * file.c (win32_io_info): UTF-8 handling.

  Modified files:
    branches/win32-unicode-test/ChangeLog
    branches/win32-unicode-test/file.c

Index: win32-unicode-test/ChangeLog
===================================================================
--- win32-unicode-test/ChangeLog	(revision 25348)
+++ win32-unicode-test/ChangeLog	(revision 25349)
@@ -1,3 +1,7 @@
+Thu Oct 15 15:02:29 2009  NAKAMURA Usaku  <usa@r...>
+
+	* file.c (win32_io_info): UTF-8 handling.
+
 Thu Oct 15 14:52:34 2009  NAKAMURA Usaku  <usa@r...>
 
 	* file.c (rb_str_encode_ospath): no more gurantee that the returned
Index: win32-unicode-test/file.c
===================================================================
--- win32-unicode-test/file.c	(revision 25348)
+++ win32-unicode-test/file.c	(revision 25349)
@@ -806,9 +806,14 @@
     }
     else {
 	VALUE tmp;
+	WCHAR *ptr;
+	int len;
 	FilePathValue(*file);
 	tmp = rb_str_encode_ospath(*file);
-	f = CreateFileW((WCHAR *)RSTRING_PTR(tmp), 0,
+	len = MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, NULL, 0);
+	ptr = ALLOCA_N(WCHAR, len);
+	MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, ptr, len);
+	f = CreateFileW(ptr, 0,
 			FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
 			rb_w32_iswin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS,
 			NULL);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]