Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions httplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -2910,9 +2910,12 @@ inline bool mmap::open(const char *path) {

#if defined(_WIN32)
std::wstring wpath;
for (size_t i = 0; i < strlen(path); i++) {
wpath += path[i];
}
int unicode_char_len = ::MultiByteToWideChar(CP_UTF8, 0, path, -1, nullptr, 0);
if (unicode_char_len <= 0) return false;
wpath.resize(unicode_char_len + 10);
if (::MultiByteToWideChar(CP_UTF8, 0, path, static_cast<int>(strlen(path)), &wpath[0],
static_cast<int>(wpath.size())) <= 0)
return false;

#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
hFile_ = ::CreateFile2(wpath.c_str(), GENERIC_READ, FILE_SHARE_READ,
Expand Down