mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
spdlog: fix handling of too long logger names
`whitespace` overflows because the result implicitly is an unsigned value.
This commit is contained in:
parent
df93004720
commit
28a7f2a3ee
1 changed files with 2 additions and 1 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
|
||||
namespace spdlog
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ namespace
|
|||
class name_formatter:public flag_formatter
|
||||
{
|
||||
std::string center(std::string input, int width) {
|
||||
const auto whitespace = width - input.length();
|
||||
const int whitespace = std::max(int(width - input.length()), 0);
|
||||
return std::string(whitespace / 2, ' ')
|
||||
+ input
|
||||
+ std::string(whitespace / 2, ' ')
|
||||
|
|
Loading…
Add table
Reference in a new issue