Skip to content

Commit

Permalink
win32: Added rb_w32_ureaddir only for UTF-8 [Feature #12654]
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Dec 20, 2020
1 parent 5b98b2c commit 95862ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion win32/dir.h
Expand Up @@ -32,14 +32,15 @@ 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 *);
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))
Expand Down
8 changes: 8 additions & 0 deletions win32/win32.c
Expand Up @@ -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
//
Expand Down

0 comments on commit 95862ae

Please sign in to comment.