summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-30 01:58:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-30 01:58:55 +0000
commitcc3ec30ac91b420277fdb06e0656eb3599961434 (patch)
treef8756390cb0956f0869e391e05c7be0d136bb43d /win32
parent1f500f03685c9e6de1d44e0fef858b066b3cdf8b (diff)
win32.c: w32_stati64
* win32/win32.c (w32_stati64): extract codepage aware code from rb_w32_ustati64() and rb_w32_stati64(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/win32/win32.c b/win32/win32.c
index a6ce3120db..6a69a97092 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -49,6 +49,8 @@
#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 stati64 *st)
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);