Fix build issue with uclibc (#2625 #2631)

This commit is contained in:
a-ucontrol 2023-07-06 15:07:49 +03:00 committed by GitHub
parent 788915c7f7
commit c86e6ba3f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,7 +53,7 @@ void Parser::parse(const char *buf, size_t size) {
if (ptr == buf) {
auto blank = strchr(ptr, ' ');
CHECK(blank > ptr && blank < next_line);
_method = std::string(ptr, blank);
_method = std::string(ptr, blank - ptr);
auto next_blank = strchr(blank + 1, ' ');
CHECK(next_blank && next_blank < next_line);
_url.assign(blank + 1, next_blank);
@ -67,7 +67,7 @@ void Parser::parse(const char *buf, size_t size) {
} else {
auto pos = strchr(ptr, ':');
CHECK(pos > ptr && pos < next_line);
std::string key { ptr, pos };
std::string key { ptr, static_cast<std::size_t>(pos - ptr) };
std::string value;
if (pos[1] == ' ') {
value.assign(pos + 2, next_line);