Skip to content

Commit 037a319

Browse files
daantimmerandreasbuhr
authored andcommitted
Support C++20, replace implicit capture of this with explicit captures
1 parent c5057bf commit 037a319

9 files changed

Lines changed: 9 additions & 9 deletions

lib/file_read_operation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ bool cppcoro::file_read_operation_impl::try_start(
6060
operation.m_res = -errno;
6161
return false;
6262
}
63-
operation.m_completeFunc = [=]() {
63+
operation.m_completeFunc = [operation, this]() {
6464
int res = read(m_fd, m_buffer, m_byteCount);
6565
operation.m_mq->remove_fd_watch(m_fd);
6666
return res;

lib/file_write_operation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ bool cppcoro::file_write_operation_impl::try_start(
6060
operation.m_res = -errno;
6161
return false;
6262
}
63-
operation.m_completeFunc = [=]() {
63+
operation.m_completeFunc = [operation, this]() {
6464
int res = write(m_fd, m_buffer, m_byteCount);
6565
operation.m_mq->remove_fd_watch(m_fd);
6666
return res;

lib/socket_accept_operation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ bool cppcoro::net::socket_accept_operation_impl::try_start(
138138
(sizeof(m_addressBuffer) / 2) >= (16 + sizeof(sockaddr_in6)),
139139
"AcceptEx requires address buffer to be at least 16 bytes more than largest address.");
140140

141-
operation.m_completeFunc = [=]() {
141+
operation.m_completeFunc = [operation, this]() {
142142
socklen_t len = sizeof(m_addressBuffer) / 2;
143143
int res = accept(m_listeningSocket.native_handle(), reinterpret_cast<sockaddr*>(m_addressBuffer), &len);
144144
operation.m_mq->remove_fd_watch(m_listeningSocket.native_handle());

lib/socket_connect_operation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ bool cppcoro::net::socket_connect_operation_impl::try_start(
194194
operation.m_res = -errno;
195195
return false;
196196
}
197-
operation.m_completeFunc = [=]() {
197+
operation.m_completeFunc = [operation, remoteSockaddrStorage, sockaddrNameLength, this]() {
198198
int res = connect(m_socket.native_handle(), reinterpret_cast<const sockaddr*>(&remoteSockaddrStorage), sockaddrNameLength);
199199
operation.m_mq->remove_fd_watch(m_socket.native_handle());
200200
return res;

lib/socket_disconnect_operation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void cppcoro::net::socket_disconnect_operation_impl::get_result(
112112
bool cppcoro::net::socket_disconnect_operation_impl::try_start(
113113
cppcoro::detail::linux_async_operation_base& operation) noexcept
114114
{
115-
operation.m_completeFunc = [=]() {
115+
operation.m_completeFunc = [operation, this]() {
116116
operation.m_mq->remove_fd_watch(m_socket.native_handle());
117117
int res = m_socket.close();
118118
return res;

lib/socket_recv_from_operation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ bool cppcoro::net::socket_recv_from_operation_impl::try_start(
109109
sockaddrStorageAlignment >= alignof(sockaddr_in6));
110110
m_sourceSockaddrLength = sizeof(m_sourceSockaddrStorage);
111111

112-
operation.m_completeFunc = [=]() {
112+
operation.m_completeFunc = [operation, this]() {
113113
int res = recvfrom(
114114
m_socket.native_handle(), m_buffer, m_byteCount, MSG_TRUNC,
115115
reinterpret_cast<sockaddr*>(&m_sourceSockaddrStorage),

lib/socket_recv_operation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void cppcoro::net::socket_recv_operation_impl::cancel(
7272
bool cppcoro::net::socket_recv_operation_impl::try_start(
7373
cppcoro::detail::linux_async_operation_base& operation) noexcept
7474
{
75-
operation.m_completeFunc = [=]() {
75+
operation.m_completeFunc = [operation, this]() {
7676
int res = recv(m_socket.native_handle(), m_buffer, m_byteCount, 0);
7777
operation.m_mq->remove_fd_watch(m_socket.native_handle());
7878
return res;

lib/socket_send_operation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void cppcoro::net::socket_send_operation_impl::cancel(
6969
bool cppcoro::net::socket_send_operation_impl::try_start(
7070
cppcoro::detail::linux_async_operation_base& operation) noexcept
7171
{
72-
operation.m_completeFunc = [=]() {
72+
operation.m_completeFunc = [operation, this]() {
7373
int res = send(m_socket.native_handle(), m_buffer, m_byteCount, 0);
7474
operation.m_mq->remove_fd_watch(m_socket.native_handle());
7575
return res;

lib/socket_send_to_operation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ bool cppcoro::net::socket_send_to_operation_impl::try_start(
8181
sockaddr_storage destinationAddress = {0};
8282
const socklen_t destinationLength = detail::ip_endpoint_to_sockaddr(
8383
m_destination, std::ref(destinationAddress));
84-
operation.m_completeFunc = [=]() {
84+
operation.m_completeFunc = [operation, this]() {
8585
int res = sendto(
8686
m_socket.native_handle(), m_buffer, m_byteCount, 0,
8787
reinterpret_cast<const sockaddr*>(&destinationAddress),

0 commit comments

Comments
 (0)