clang-format

This commit is contained in:
Bernd Baumanns 2020-09-25 17:14:21 +02:00
parent f350cc3a38
commit fb58a7e8a2

View File

@ -23,15 +23,16 @@
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#include <io.h> # include <io.h>
FMT_BEGIN_NAMESPACE FMT_BEGIN_NAMESPACE
extern "C" { extern "C" {
int __stdcall WriteConsoleW(void* hConsoleOutput, const void* lpBuffer, uint32_t nNumberOfCharsToWrite, uint32_t* lpNumberOfCharsWritten, void* lpReserved); int __stdcall WriteConsoleW(void* hConsoleOutput, const void* lpBuffer,
} uint32_t nNumberOfCharsToWrite,
uint32_t* lpNumberOfCharsWritten, void* lpReserved);
}
FMT_END_NAMESPACE FMT_END_NAMESPACE
#endif #endif
// Dummy implementations of strerror_r and strerror_s called if corresponding // Dummy implementations of strerror_r and strerror_s called if corresponding
// system functions are not available. // system functions are not available.
inline fmt::detail::null<> strerror_r(int, char*, ...) { return {}; } inline fmt::detail::null<> strerror_r(int, char*, ...) { return {}; }
@ -2895,9 +2896,8 @@ FMT_FUNC void vprint(std::FILE* f, string_view format_str, format_args args) {
if (_isatty(fd)) { if (_isatty(fd)) {
detail::utf8_to_utf16 u16(string_view(buffer.data(), buffer.size())); detail::utf8_to_utf16 u16(string_view(buffer.data(), buffer.size()));
auto written = uint32_t(); auto written = uint32_t();
if (!WriteConsoleW(reinterpret_cast<void*>(_get_osfhandle(fd)), if (!WriteConsoleW(reinterpret_cast<void*>(_get_osfhandle(fd)), u16.c_str(),
u16.c_str(), static_cast<uint32_t>(u16.size()), &written, static_cast<uint32_t>(u16.size()), &written, nullptr)) {
nullptr)) {
FMT_THROW(format_error("failed to write to console")); FMT_THROW(format_error("failed to write to console"));
} }
return; return;