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

ruby-changes:41636

From: nobu <ko1@a...>
Date: Tue, 2 Feb 2016 00:05:13 +0900 (JST)
Subject: [ruby-changes:41636] nobu:r53710 (trunk): win32.c: w32_wopendir

nobu	2016-02-02 00:06:17 +0900 (Tue, 02 Feb 2016)

  New Revision: 53710

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53710

  Log:
    win32.c: w32_wopendir
    
    * win32/win32.c (w32_wopendir): remove filename parameter, and
      check the drive letter in wpath instead.  rename from
      opendir_internal.

  Modified files:
    trunk/win32/win32.c
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 53709)
+++ win32/win32.c	(revision 53710)
@@ -1912,7 +1912,7 @@ open_dir_handle(const WCHAR *filename, W https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1912
 
 /* License: Artistic or GPL */
 static DIR *
-opendir_internal(WCHAR *wpath, const char *filename)
+w32_wopendir(const WCHAR *wpath)
 {
     struct stati64 sbuf;
     WIN32_FIND_DATAW fd;
@@ -1932,8 +1932,8 @@ opendir_internal(WCHAR *wpath, const cha https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1932
 	return NULL;
     }
     if (!(sbuf.st_mode & S_IFDIR) &&
-	(!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' ||
-	 ((1 << ((filename[0] & 0x5f) - 'A')) & GetLogicalDrives()) == 0)) {
+	(!ISALPHA(wpath[0]) || wpath[1] != L':' || wpath[2] != L'\0' ||
+	 ((1 << ((wpath[0] & 0x5f) - 'A')) & GetLogicalDrives()) == 0)) {
 	errno = ENOTDIR;
 	return NULL;
     }
@@ -2055,7 +2055,7 @@ rb_w32_opendir(const char *filename) https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L2055
     WCHAR *wpath = filecp_to_wstr(filename, NULL);
     if (!wpath)
 	return NULL;
-    ret = opendir_internal(wpath, filename);
+    ret = w32_wopendir(wpath);
     free(wpath);
     return ret;
 }
@@ -2068,7 +2068,7 @@ rb_w32_uopendir(const char *filename) https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L2068
     WCHAR *wpath = utf8_to_wstr(filename, NULL);
     if (!wpath)
 	return NULL;
-    ret = opendir_internal(wpath, filename);
+    ret = w32_wopendir(wpath);
     free(wpath);
     return ret;
 }

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

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