diff options
author | 2019-02-18 20:21:53 +0100 | |
---|---|---|
committer | 2019-02-18 20:22:16 +0100 | |
commit | 6207d7d2d3262718c78c143681a4c609a7e72452 (patch) | |
tree | 8488a45aa1d11c2649940886f5cc60ce170153ad /src/lib/netlist/plib/pfmtlog.cpp | |
parent | ccd5479997afeddedd133fe2baaac47247ef41da (diff) |
netlist: tick off some issues clang-tidy highlights. (nw)
Diffstat (limited to 'src/lib/netlist/plib/pfmtlog.cpp')
-rw-r--r-- | src/lib/netlist/plib/pfmtlog.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/netlist/plib/pfmtlog.cpp b/src/lib/netlist/plib/pfmtlog.cpp index f142a0cd73f..e4e7c3d1c5c 100644 --- a/src/lib/netlist/plib/pfmtlog.cpp +++ b/src/lib/netlist/plib/pfmtlog.cpp @@ -11,9 +11,11 @@ #include <algorithm> #include <cstdarg> #include <cstdlib> +#include <cstdio> #include <cstring> #include <iostream> #include <locale> +#include <array> namespace plib { @@ -23,7 +25,7 @@ pfmt &pfmt::format_element(const char *l, const unsigned cfmt_spec, ...) // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) va_start(ap, cfmt_spec); pstring fmt("%"); - char buf[2048]; // FIXME + std::array<char, 2048> buf; std::size_t sl; m_arg++; @@ -81,9 +83,9 @@ pfmt &pfmt::format_element(const char *l, const unsigned cfmt_spec, ...) } else fmt += cfmt_spec; - vsprintf(buf, fmt.c_str(), ap); + std::vsnprintf(buf.data(), buf.size(), fmt.c_str(), ap); if (p != pstring::npos) - m_str = m_str.substr(0, p) + pstring(buf) + m_str.substr(p + sl); + m_str = m_str.substr(0, p) + pstring(buf.data()) + m_str.substr(p + sl); va_end(ap); return *this; } |