ruby-changes:37971
From: nobu <ko1@a...>
Date: Sun, 22 Mar 2015 11:28:10 +0900 (JST)
Subject: [ruby-changes:37971] nobu:r50052 (trunk): win32.c: path_drive
nobu 2015-03-22 11:26:54 +0900 (Sun, 22 Mar 2015) New Revision: 50052 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50052 Log: win32.c: path_drive * win32/win32.c (path_drive): extract from winnt_stat, return the drive number in the path, or the current drive. Modified files: trunk/win32/win32.c Index: win32/win32.c =================================================================== --- win32/win32.c (revision 50051) +++ win32/win32.c (revision 50052) @@ -5073,6 +5073,14 @@ stat_by_find(const WCHAR *path, struct s https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L5073 /* License: Ruby's */ static int +path_drive(const WCHAR *path) +{ + return (iswalpha(path[0]) && path[1] == L':') ? + towupper(path[0]) - L'A' : _getdrive() - 1; +} + +/* License: Ruby's */ +static int winnt_stat(const WCHAR *path, struct stati64 *st) { WIN32_FILE_ATTRIBUTE_DATA wfa; @@ -5103,8 +5111,7 @@ winnt_stat(const WCHAR *path, struct sta https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L5111 if (stat_by_find(path, st)) return -1; } - st->st_dev = st->st_rdev = (iswalpha(path[0]) && path[1] == L':') ? - towupper(path[0]) - L'A' : _getdrive() - 1; + st->st_dev = st->st_rdev = path_drive(path); return 0; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/