[wpiutil] Unbreak wpi::Format on Windows (#3242)

This function relies on the behavior of snprintf returning an error value
when the buffer is too small.  By default, _snprintf_s aborts on Windows
instead of returning an error value.

This caused Glass to fail when trying to print a large NT value to a string.
This commit is contained in:
Peter Johnson
2021-03-16 22:04:55 -07:00
committed by GitHub
parent 2e07902d76
commit 1032c9b917

View File

@@ -95,7 +95,7 @@ class format_object final : public format_object_base {
int snprint_tuple(char *Buffer, unsigned BufferSize,
std::index_sequence<Is...>) const {
#ifdef _MSC_VER
return _snprintf_s(Buffer, BufferSize, BufferSize, Fmt, std::get<Is>(Vals)...);
return _snprintf(Buffer, BufferSize, Fmt, std::get<Is>(Vals)...);
#else
#ifdef __GNUC__
#pragma GCC diagnostic push