Skip to content

Commit

Permalink
mac compile
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Jul 2, 2024
1 parent 280fec6 commit 495a602
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/ylt/standalone/cinatra/coro_http_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,10 +1053,10 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
char buf[32];
auto [ptr, _] = std::to_chars(buf, buf + 32, content_length);
if (headers.empty()) {
add_header("Content-Length", std::string{buf, ptr});
add_header("Content-Length", std::string(buf, ptr - buf));
}
else {
headers.emplace("Content-Length", std::string_view{buf, ptr});
headers.emplace("Content-Length", std::string_view(buf, ptr - buf));
}

std::string header_str =
Expand Down
5 changes: 3 additions & 2 deletions include/ylt/standalone/cinatra/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,11 @@ inline std::string_view get_chuncked_buffers(size_t length,
if constexpr (is_first_time) {
buffer[0] = '\r';
buffer[1] = '\n';
return std::string_view{buffer.data() + 2, ptr};
return std::string_view(buffer.data() + 2,
std::distance(buffer.data() + 2, ptr));
}
else {
return std::string_view{buffer.data(), ptr};
return std::string_view(buffer.data(), std::distance(buffer.data(), ptr));
}
}
}
Expand Down

0 comments on commit 495a602

Please sign in to comment.