Replace LocaleIndependentAtoi with ToIntegral

No need for saturating behavior when the int is composed of 3 digits.
This commit is contained in:
MarcoFalke 2023-08-08 15:09:32 +02:00
parent faab76c1c0
commit fa32af22b3
No known key found for this signature in database

View file

@ -91,7 +91,7 @@ void TorControlConnection::readcb(struct bufferevent *bev, void *ctx)
if (s.size() < 4) // Short line
continue;
// <status>(-|+| )<data><CRLF>
self->message.code = LocaleIndependentAtoi<int>(s.substr(0,3));
self->message.code = ToIntegral<int>(s.substr(0, 3)).value_or(0);
self->message.lines.push_back(s.substr(4));
char ch = s[3]; // '-','+' or ' '
if (ch == ' ') {