Skip to content

Commit

Permalink
Support C++20, replace implicit capture of this with explicit captures
Browse files Browse the repository at this point in the history
  • Loading branch information
daantimmer authored Jan 7, 2025
1 parent 817121c commit c165b8f
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/file_read_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ bool cppcoro::file_read_operation_impl::try_start(
operation.m_res = -errno;
return false;
}
operation.m_completeFunc = [=]() {
operation.m_completeFunc = [operation, this]() {
int res = read(m_fd, m_buffer, m_byteCount);
operation.m_mq->remove_fd_watch(m_fd);
return res;
Expand Down
2 changes: 1 addition & 1 deletion lib/file_write_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ bool cppcoro::file_write_operation_impl::try_start(
operation.m_res = -errno;
return false;
}
operation.m_completeFunc = [=]() {
operation.m_completeFunc = [operation, this]() {
int res = write(m_fd, m_buffer, m_byteCount);
operation.m_mq->remove_fd_watch(m_fd);
return res;
Expand Down
2 changes: 1 addition & 1 deletion lib/socket_accept_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bool cppcoro::net::socket_accept_operation_impl::try_start(
(sizeof(m_addressBuffer) / 2) >= (16 + sizeof(sockaddr_in6)),
"AcceptEx requires address buffer to be at least 16 bytes more than largest address.");

operation.m_completeFunc = [=]() {
operation.m_completeFunc = [operation, this]() {
socklen_t len = sizeof(m_addressBuffer) / 2;
int res = accept(m_listeningSocket.native_handle(), reinterpret_cast<sockaddr*>(m_addressBuffer), &len);
operation.m_mq->remove_fd_watch(m_listeningSocket.native_handle());
Expand Down
2 changes: 1 addition & 1 deletion lib/socket_connect_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ bool cppcoro::net::socket_connect_operation_impl::try_start(
operation.m_res = -errno;
return false;
}
operation.m_completeFunc = [=]() {
operation.m_completeFunc = [operation, remoteSockaddrStorage, sockaddrNameLength, this]() {
int res = connect(m_socket.native_handle(), reinterpret_cast<const sockaddr*>(&remoteSockaddrStorage), sockaddrNameLength);
operation.m_mq->remove_fd_watch(m_socket.native_handle());
return res;
Expand Down
2 changes: 1 addition & 1 deletion lib/socket_disconnect_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void cppcoro::net::socket_disconnect_operation_impl::get_result(
bool cppcoro::net::socket_disconnect_operation_impl::try_start(
cppcoro::detail::linux_async_operation_base& operation) noexcept
{
operation.m_completeFunc = [=]() {
operation.m_completeFunc = [operation, this]() {
operation.m_mq->remove_fd_watch(m_socket.native_handle());
int res = m_socket.close();
return res;
Expand Down
2 changes: 1 addition & 1 deletion lib/socket_recv_from_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool cppcoro::net::socket_recv_from_operation_impl::try_start(
sockaddrStorageAlignment >= alignof(sockaddr_in6));
m_sourceSockaddrLength = sizeof(m_sourceSockaddrStorage);

operation.m_completeFunc = [=]() {
operation.m_completeFunc = [operation, this]() {
int res = recvfrom(
m_socket.native_handle(), m_buffer, m_byteCount, MSG_TRUNC,
reinterpret_cast<sockaddr*>(&m_sourceSockaddrStorage),
Expand Down
2 changes: 1 addition & 1 deletion lib/socket_recv_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void cppcoro::net::socket_recv_operation_impl::cancel(
bool cppcoro::net::socket_recv_operation_impl::try_start(
cppcoro::detail::linux_async_operation_base& operation) noexcept
{
operation.m_completeFunc = [=]() {
operation.m_completeFunc = [operation, this]() {
int res = recv(m_socket.native_handle(), m_buffer, m_byteCount, 0);
operation.m_mq->remove_fd_watch(m_socket.native_handle());
return res;
Expand Down
2 changes: 1 addition & 1 deletion lib/socket_send_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void cppcoro::net::socket_send_operation_impl::cancel(
bool cppcoro::net::socket_send_operation_impl::try_start(
cppcoro::detail::linux_async_operation_base& operation) noexcept
{
operation.m_completeFunc = [=]() {
operation.m_completeFunc = [operation, this]() {
int res = send(m_socket.native_handle(), m_buffer, m_byteCount, 0);
operation.m_mq->remove_fd_watch(m_socket.native_handle());
return res;
Expand Down
2 changes: 1 addition & 1 deletion lib/socket_send_to_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool cppcoro::net::socket_send_to_operation_impl::try_start(
sockaddr_storage destinationAddress = {0};
const socklen_t destinationLength = detail::ip_endpoint_to_sockaddr(
m_destination, std::ref(destinationAddress));
operation.m_completeFunc = [=]() {
operation.m_completeFunc = [operation, this]() {
int res = sendto(
m_socket.native_handle(), m_buffer, m_byteCount, 0,
reinterpret_cast<const sockaddr*>(&destinationAddress),
Expand Down

0 comments on commit c165b8f

Please sign in to comment.