Fixed UTF-8 paths support for the config file with Clang compiler on Windows ARM64.
This commit is contained in:
parent
faa3d55123
commit
3ff41f7c94
3 changed files with 9 additions and 9 deletions
|
@ -39,7 +39,7 @@
|
|||
namespace xmrig {
|
||||
|
||||
|
||||
#if defined(_MSC_VER) || (defined(__GNUC__) && !defined(__clang__))
|
||||
#if defined(_MSC_VER) || defined(__GNUC__)
|
||||
static std::wstring toUtf16(const char *str)
|
||||
{
|
||||
const int size = static_cast<int>(strlen(str));
|
||||
|
@ -56,13 +56,13 @@ static std::wstring toUtf16(const char *str)
|
|||
#endif
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) || defined(_LIBCPP_HAS_OPEN_WITH_WCHAR)
|
||||
# define OPEN_IFS(name) \
|
||||
std::ifstream ifs(toUtf16(name), std::ios_base::in | std::ios_base::binary); \
|
||||
std::ifstream ifs(toUtf16(name).c_str(), std::ios_base::in | std::ios_base::binary);\
|
||||
if (!ifs.is_open()) { \
|
||||
return false; \
|
||||
}
|
||||
#elif defined(__GNUC__) && !defined(__clang__)
|
||||
#elif defined(__GNUC__)
|
||||
# define OPEN_IFS(name) \
|
||||
const int fd = _wopen(toUtf16(name).c_str(), _O_RDONLY | _O_BINARY); \
|
||||
if (fd == -1) { \
|
||||
|
@ -98,12 +98,12 @@ bool xmrig::Json::save(const char *fileName, const rapidjson::Document &doc)
|
|||
using namespace rapidjson;
|
||||
constexpr const std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary | std::ios_base::trunc;
|
||||
|
||||
# if defined(_MSC_VER)
|
||||
std::ofstream ofs(toUtf16(fileName), mode);
|
||||
# if defined(_MSC_VER) || defined(_LIBCPP_HAS_OPEN_WITH_WCHAR)
|
||||
std::ofstream ofs(toUtf16(fileName).c_str(), mode);
|
||||
if (!ofs.is_open()) {
|
||||
return false;
|
||||
}
|
||||
# elif defined(__GNUC__) && !defined(__clang__)
|
||||
# elif defined(__GNUC__)
|
||||
const int fd = _wopen(toUtf16(fileName).c_str(), _O_WRONLY | _O_BINARY | _O_CREAT | _O_TRUNC, _S_IWRITE);
|
||||
if (fd == -1) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue