mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Replace use of locale dependent atoi(…) with locale-independent std::from_chars(…) (C++17)
test: Add test cases for LocaleIndependentAtoi fuzz: Assert legacy atoi(s) == LocaleIndependentAtoi<int>(s) fuzz: Assert legacy atoi64(s) == LocaleIndependentAtoi<int64_t>(s)
This commit is contained in:
@@ -83,7 +83,7 @@ void TorControlConnection::readcb(struct bufferevent *bev, void *ctx)
|
||||
if (s.size() < 4) // Short line
|
||||
continue;
|
||||
// <status>(-|+| )<data><CRLF>
|
||||
self->message.code = atoi(s.substr(0,3));
|
||||
self->message.code = LocaleIndependentAtoi<int>(s.substr(0,3));
|
||||
self->message.lines.push_back(s.substr(4));
|
||||
char ch = s[3]; // '-','+' or ' '
|
||||
if (ch == ' ') {
|
||||
|
||||
Reference in New Issue
Block a user