Skip to content

Commit

Permalink
WolfSSL: Use a custom UTF-8 aware _stat on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
CookiePLMonster committed Jan 15, 2022
1 parent 1d7e41f commit bfa1d2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion 3rdparty/wolfssl/extra/win32/user_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ extern FILE* wolfSSL_fopen_utf8(const char* name, const char* mode);
#define XFFLUSH fflush

#include <sys/stat.h>
#define XSTAT _stat
extern int wolfSSL_stat_utf8(const char* path, struct _stat* buffer);
#define XSTAT wolfSSL_stat_utf8
#define XSTATSTRUCT _stat
#define XS_ISREG(s) (s & _S_IFREG)
#define SEPARATOR_CHAR ';'

Expand Down
13 changes: 11 additions & 2 deletions rpcs3/rpcs3qt/curl_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,18 @@ std::string curl_handle::get_verbose_error(CURLcode code)
}

#ifdef _WIN32
// Function exported from our user_settings.h in WolfSSL, implemented in RPCS3
extern "C" FILE* wolfSSL_fopen_utf8(const char* name, const char* mode)
// Functions exported from our user_settings.h in WolfSSL, implemented in RPCS3
extern "C" {

FILE* wolfSSL_fopen_utf8(const char* name, const char* mode)
{
return _wfopen(utf8_to_wchar(name).c_str(), utf8_to_wchar(mode).c_str());
}

int wolfSSL_stat_utf8(const char* path, struct _stat* buffer)
{
return _wstat(utf8_to_wchar(path).c_str(), buffer);
}

}
#endif

0 comments on commit bfa1d2e

Please sign in to comment.