Skip to content

Commit

Permalink
Remove wide character formatting of WriteFile based output in wincolo…
Browse files Browse the repository at this point in the history
…r_sink
  • Loading branch information
DominikGrabiec committed Feb 13, 2024
1 parent 904e567 commit 6e65ac5
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions include/spdlog/sinks/wincolor_sink-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,10 @@ void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::print_range_(const memory_buf_t

template <typename ConsoleMutex>
void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::write_to_file_(const memory_buf_t &formatted) {
DWORD bytes_written = 0;
#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
wmemory_buf_t wformatted;
details::os::utf8_to_wstrbuf(string_view_t(formatted.data(), formatted.size()), wformatted);
auto size = static_cast<DWORD>(wformatted.size() * sizeof(WCHAR));
auto ignored = ::WriteFile(static_cast<HANDLE>(out_handle_), wformatted.data(), size,
&bytes_written, nullptr);
#else
auto size = static_cast<DWORD>(formatted.size());
DWORD bytes_written = 0;
auto ignored = ::WriteFile(static_cast<HANDLE>(out_handle_), formatted.data(), size,
&bytes_written, nullptr);
#endif
(void)(ignored);
}

Expand Down

0 comments on commit 6e65ac5

Please sign in to comment.