mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-12 17:00:25 +08:00
Simplify syslog sinks overflow check
This commit is contained in:
parent
dffc8df3e0
commit
847f7de003
@ -59,8 +59,14 @@ protected:
|
||||
payload = msg.payload;
|
||||
}
|
||||
|
||||
int length = std::min<std::common_type<int, std::size_t>::type>(std::numeric_limits<int>::max(), payload.size());
|
||||
::syslog(syslog_prio_from_level(msg), "%.*s", length, payload.data());
|
||||
size_t length = payload.size();
|
||||
// limit to max int
|
||||
if(length > std::numeric_limits<int>::max())
|
||||
{
|
||||
length = std::numeric_limits<int>::max();
|
||||
}
|
||||
|
||||
::syslog(syslog_prio_from_level(msg), "%.*s", static_cast<int>(length), payload.data());
|
||||
}
|
||||
|
||||
void flush_() override {}
|
||||
|
Loading…
Reference in New Issue
Block a user