commit af63590e9e856545f6f6c0d0b4a1c1e3d9a67f32
Author: Roman Fomin <rfomin@gmail.com>
AuthorDate: Wed Sep 11 21:02:08 2024 +0700
Commit: Roman Fomin <rfomin@gmail.com>
CommitDate: Wed Sep 11 21:02:08 2024 +0700
Fix incorrect WideCharToMultiByte() parameters
This causes string encoding conversion to fail on Windows 7.
---
win32/win_opendir.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/win32/win_opendir.c b/win32/win_opendir.c
index a03489c9..c8fff83c 100644
--- a/win32/win_opendir.c
+++ b/win32/win_opendir.c
@@ -172,7 +172,6 @@ static DIR *__internal_opendir(wchar_t *wname, int size)
{
struct __dir *data = NULL;
struct dirent *tmp_entries = NULL;
- static char default_char = '?';
static wchar_t *prefix = L"\\\\?\\";
static wchar_t *suffix = L"\\*.*";
static int extra_prefix = 4; /* use prefix "\\?\" to handle long file names */
@@ -225,7 +224,7 @@ static DIR *__internal_opendir(wchar_t *wname, int size)
{
WideCharToMultiByte(CP_UTF8, 0, w32fd.cFileName, -1,
data->entries[data->index].d_name, NAME_MAX,
- &default_char, NULL);
+ NULL, NULL);
memcpy(wname + size, w32fd.cFileName, sizeof(wchar_t) * NAME_MAX);