ruby-changes:29651
From: nobu <ko1@a...>
Date: Sun, 30 Jun 2013 10:59:06 +0900 (JST)
Subject: [ruby-changes:29651] nobu:r41703 (trunk): win32.c: w32_stati64
nobu 2013-06-30 10:58:55 +0900 (Sun, 30 Jun 2013) New Revision: 41703 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41703 Log: win32.c: w32_stati64 * win32/win32.c (w32_stati64): extract codepage aware code from rb_w32_ustati64() and rb_w32_stati64(). Modified files: trunk/ChangeLog trunk/win32/win32.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41702) +++ ChangeLog (revision 41703) @@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Sun Jun 30 10:58:47 2013 Nobuyoshi Nakada <nobu@r...> +Sun Jun 30 10:58:53 2013 Nobuyoshi Nakada <nobu@r...> + + * win32/win32.c (w32_stati64): extract codepage aware code from + rb_w32_ustati64() and rb_w32_stati64(). * dln.h (DLN_FIND_EXTRA_ARG, DLN_FIND_EXTRA_ARG_DECL): allow extra arguments to dln_find_{exe,file}_r(). Index: win32/win32.c =================================================================== --- win32/win32.c (revision 41702) +++ win32/win32.c (revision 41703) @@ -49,6 +49,8 @@ https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L49 #include "win32/dir.h" #define isdirsep(x) ((x) == '/' || (x) == '\\') +static int w32_stati64(const char *path, struct stati64 *st, UINT cp); + #undef stat #undef fclose #undef close @@ -4892,24 +4894,24 @@ wstati64(const WCHAR *path, struct stati https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L4894 int rb_w32_ustati64(const char *path, struct stati64 *st) { - WCHAR *wpath; - int ret; - - if (!(wpath = utf8_to_wstr(path, NULL))) - return -1; - ret = wstati64(wpath, st); - free(wpath); - return ret; + return w32_stati64(path, st, CP_UTF8); } /* License: Ruby's */ int rb_w32_stati64(const char *path, struct stati64 *st) { + return w32_stati64(path, st, filecp()); +} + +/* License: Ruby's */ +static int +w32_stati64(const char *path, struct stati64 *st, UINT cp) +{ WCHAR *wpath; int ret; - if (!(wpath = filecp_to_wstr(path, NULL))) + if (!(wpath = mbstr_to_wstr(cp, path, -1, NULL))) return -1; ret = wstati64(wpath, st); free(wpath); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/