Fix typo
[LibreOffice.git] / external / liborcus / win_path_utf16.patch
blob0a6781e728b3ed9726438c238d4b3126753c5364
1 diff --git a/src/parser/stream.cpp b/src/parser/stream.cpp
2 index 00395f59ff25..8f385fb8965a 100644
3 --- a/src/parser/stream.cpp
4 +++ b/src/parser/stream.cpp
5 @@ -147,6 +147,14 @@ std::tuple<std::string_view, size_t, size_t> find_line_with_offset(std::string_v
6 return std::make_tuple(line, line_num, offset_on_line);
9 +#ifdef _WIN32
10 +std::wstring to_wstring(std::string_view s)
12 + std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> conversion;
13 + return conversion.from_bytes(s.data(), s.data() + s.size());
15 +#endif
17 } // anonymous namespace
19 struct file_content::impl
20 @@ -162,8 +170,13 @@ struct file_content::impl
21 impl() : content_size(0), content(nullptr) {}
23 impl(std::string_view filepath) :
24 +#ifdef _WIN32
25 + content_size(fs::file_size(to_wstring(filepath))),
26 + mapped_file(to_wstring(filepath).c_str(), bip::read_only),
27 +#else
28 content_size(fs::file_size(std::string{filepath}.c_str())),
29 mapped_file(std::string{filepath}.c_str(), bip::read_only),
30 +#endif
31 mapped_region(mapped_file, bip::read_only, 0, content_size),
32 content(nullptr)