ruby-changes:64383
From: Nobuyoshi <ko1@a...>
Date: Sun, 20 Dec 2020 18:34:22 +0900 (JST)
Subject: [ruby-changes:64383] 95862ae440 (master): win32: Added rb_w32_ureaddir only for UTF-8 [Feature #12654]
https://git.ruby-lang.org/ruby.git/commit/?id=95862ae440 From 95862ae44046cfc66c474ce534c204d276ea704d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 20 Dec 2020 15:29:21 +0900 Subject: win32: Added rb_w32_ureaddir only for UTF-8 [Feature #12654] 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 { https://github.com/ruby/ruby/blob/trunk/win32/dir.h#L32 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 *); https://github.com/ruby/ruby/blob/trunk/win32/dir.h#L40 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) https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L2356 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 // -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/