summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-20 15:29:21 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-20 18:34:04 +0900
commit95862ae44046cfc66c474ce534c204d276ea704d (patch)
treed023a788c3891b9504293a6410c0f8ca81291c72 /win32
parent5b98b2ce39ed979aec614365a2dc3e1c30052bca (diff)
win32: Added rb_w32_ureaddir only for UTF-8 [Feature #12654]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3948
Diffstat (limited to 'win32')
-rw-r--r--win32/dir.h3
-rw-r--r--win32/win32.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/win32/dir.h b/win32/dir.h
index 28fbb6c..de12f79 100644
--- a/win32/dir.h
+++ b/win32/dir.h
@@ -32,6 +32,7 @@ typedef struct {
DIR* rb_w32_opendir(const char*);
DIR* rb_w32_uopendir(const char*);
struct direct* rb_w32_readdir(DIR *, rb_encoding *);
+struct direct* rb_w32_ureaddir(DIR *);
long rb_w32_telldir(DIR *);
void rb_w32_seekdir(DIR *, long);
void rb_w32_rewinddir(DIR *);
@@ -39,7 +40,7 @@ void rb_w32_closedir(DIR *);
char *rb_w32_ugetcwd(char *, int);
#define opendir(s) rb_w32_uopendir((s))
-#define readdir(d) rb_w32_readdir((d), 0)
+#define readdir(d) rb_w32_ureaddir((d))
#define telldir(d) rb_w32_telldir((d))
#define seekdir(d, l) rb_w32_seekdir((d), (l))
#define rewinddir(d) rb_w32_rewinddir((d))
diff --git a/win32/win32.c b/win32/win32.c
index 4f0c0d2..fcf1855 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2356,6 +2356,14 @@ rb_w32_readdir(DIR *dirp, rb_encoding *enc)
return readdir_internal(dirp, ruby_direct_conv, enc);
}
+/* License: Ruby's */
+struct direct *
+rb_w32_ureaddir(DIR *dirp)
+{
+ const UINT cp = CP_UTF8;
+ return readdir_internal(dirp, win32_direct_conv, &cp);
+}
+
//
// Telldir returns the current string pointer position
//