Skip to content

Commit

Permalink
Fix Windows build after 8dcd65b
Browse files Browse the repository at this point in the history
  • Loading branch information
Martchus committed Aug 4, 2024
1 parent e8186bd commit da739f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion io/nativefilestream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ just "open failed: iostream error".
#elif defined(PLATFORM_WINDOWS)
#include <fcntl.h>
#include <io.h>
#include <limits>
#include <sys/stat.h> // yes, this is needed under Windows (https://msdn.microsoft.com/en-US/library/5yhhz3y7.aspx)
#include <windows.h>
#endif
Expand Down Expand Up @@ -346,7 +347,8 @@ void NativeFileStream::setData(FileBuffer data, std::ios_base::openmode openMode
std::unique_ptr<wchar_t[]> NativeFileStream::makeWidePath(std::string_view path)
{
auto ec = std::error_code();
auto widePath = ::CppUtilities::convertMultiByteToWide(ec, path);
auto size = path.size() < static_cast<std::size_t>(std::numeric_limits<int>::max() - 1) ? static_cast<int>(path.size() + 1) : -1;
auto widePath = ::CppUtilities::convertMultiByteToWide(ec, path.data(), size);
if (!widePath.first) {
throw std::ios_base::failure("converting path to UTF-16", ec);
}
Expand Down

0 comments on commit da739f3

Please # to comment.