Skip to content

Commit 405ba8c

Browse files
committed
🎨 Fix format
1 parent f0a8ab3 commit 405ba8c

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed

src/io_engine_generic_unix.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ namespace asyncpp::io::detail {
146146
throw std::system_error(std::make_error_code(std::errc::invalid_argument),
147147
"group and interface need to be of the same type");
148148
if (group.is_ipv4()) {
149-
struct ip_mreq mc_req{};
149+
struct ip_mreq mc_req {};
150150
mc_req.imr_multiaddr = group.ipv4().to_sockaddr_in().first.sin_addr;
151151
mc_req.imr_interface = iface.ipv4().to_sockaddr_in().first.sin_addr;
152152
auto res = setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mc_req, sizeof(mc_req));
153153
if (res < 0) throw std::system_error(errno, std::system_category(), "setsockopt failed");
154154
} else if (group.is_ipv6()) {
155-
struct ipv6_mreq mc_req{};
155+
struct ipv6_mreq mc_req {};
156156
mc_req.ipv6mr_multiaddr = group.ipv6().to_sockaddr_in6().first.sin6_addr;
157157
mc_req.ipv6mr_interface = iface.ipv6().to_sockaddr_in6().first.sin6_scope_id;
158158
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mc_req, sizeof(mc_req));
@@ -168,13 +168,13 @@ namespace asyncpp::io::detail {
168168
throw std::system_error(std::make_error_code(std::errc::invalid_argument),
169169
"group and interface need to be of the same type");
170170
if (group.is_ipv4()) {
171-
struct ip_mreq mc_req{};
171+
struct ip_mreq mc_req {};
172172
mc_req.imr_multiaddr = group.ipv4().to_sockaddr_in().first.sin_addr;
173173
mc_req.imr_interface = iface.ipv4().to_sockaddr_in().first.sin_addr;
174174
auto res = setsockopt(socket, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mc_req, sizeof(mc_req));
175175
if (res < 0) throw std::system_error(errno, std::system_category(), "setsockopt failed");
176176
} else if (group.is_ipv6()) {
177-
struct ipv6_mreq mc_req{};
177+
struct ipv6_mreq mc_req {};
178178
mc_req.ipv6mr_multiaddr = group.ipv6().to_sockaddr_in6().first.sin6_addr;
179179
mc_req.ipv6mr_interface = iface.ipv6().to_sockaddr_in6().first.sin6_scope_id;
180180
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &mc_req, sizeof(mc_req));
@@ -283,12 +283,12 @@ namespace asyncpp::io::detail {
283283

284284
uint64_t io_engine_generic_unix::file_size(file_handle_t fd) {
285285
#ifdef __APPLE__
286-
struct stat info{};
286+
struct stat info {};
287287
auto res = fstat(fd, &info);
288288
if (res < 0) throw std::system_error(errno, std::system_category());
289289
return info.st_size;
290290
#else
291-
struct stat64 info{};
291+
struct stat64 info {};
292292
auto res = fstat64(fd, &info);
293293
if (res < 0) throw std::system_error(errno, std::system_category());
294294
return info.st_size;

src/io_engine_iocp.cpp

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ namespace asyncpp::io::detail {
252252
if (setsockopt(listener, SOL_SOCKET, SO_REUSEADDR, (char*)&reuse, (socklen_t)sizeof(reuse)) == -1)
253253
close_and_throw("setsockopt", listener);
254254

255-
struct sockaddr_in inaddr{};
255+
struct sockaddr_in inaddr {};
256256
inaddr.sin_family = AF_INET;
257257
inaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
258258
if (bind(listener, reinterpret_cast<sockaddr*>(&inaddr), sizeof(inaddr)) == SOCKET_ERROR)
@@ -357,16 +357,18 @@ namespace asyncpp::io::detail {
357357
throw std::system_error(std::make_error_code(std::errc::invalid_argument),
358358
"group and interface need to be of the same type");
359359
if (group.is_ipv4()) {
360-
struct ip_mreq mc_req{};
360+
struct ip_mreq mc_req {};
361361
mc_req.imr_multiaddr = group.ipv4().to_sockaddr_in().first.sin_addr;
362362
mc_req.imr_interface = iface.ipv4().to_sockaddr_in().first.sin_addr;
363-
auto res = setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req), sizeof(mc_req));
363+
auto res = setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req),
364+
sizeof(mc_req));
364365
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
365366
} else if (group.is_ipv6()) {
366-
struct ipv6_mreq mc_req{};
367+
struct ipv6_mreq mc_req {};
367368
mc_req.ipv6mr_multiaddr = group.ipv6().to_sockaddr_in6().first.sin6_addr;
368369
mc_req.ipv6mr_interface = iface.ipv6().to_sockaddr_in6().first.sin6_scope_id;
369-
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req), sizeof(mc_req));
370+
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req),
371+
sizeof(mc_req));
370372
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
371373
} else {
372374
throw std::system_error(std::make_error_code(std::errc::not_supported),
@@ -379,16 +381,18 @@ namespace asyncpp::io::detail {
379381
throw std::system_error(std::make_error_code(std::errc::invalid_argument),
380382
"group and interface need to be of the same type");
381383
if (group.is_ipv4()) {
382-
struct ip_mreq mc_req{};
384+
struct ip_mreq mc_req {};
383385
mc_req.imr_multiaddr = group.ipv4().to_sockaddr_in().first.sin_addr;
384386
mc_req.imr_interface = iface.ipv4().to_sockaddr_in().first.sin_addr;
385-
auto res = setsockopt(socket, IPPROTO_IP, IP_DROP_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req), sizeof(mc_req));
387+
auto res = setsockopt(socket, IPPROTO_IP, IP_DROP_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req),
388+
sizeof(mc_req));
386389
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
387390
} else if (group.is_ipv6()) {
388-
struct ipv6_mreq mc_req{};
391+
struct ipv6_mreq mc_req {};
389392
mc_req.ipv6mr_multiaddr = group.ipv6().to_sockaddr_in6().first.sin6_addr;
390393
mc_req.ipv6mr_interface = iface.ipv6().to_sockaddr_in6().first.sin6_scope_id;
391-
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req), sizeof(mc_req));
394+
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, reinterpret_cast<const char*>(&mc_req),
395+
sizeof(mc_req));
392396
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
393397
} else {
394398
throw std::system_error(std::make_error_code(std::errc::not_supported),
@@ -399,12 +403,13 @@ namespace asyncpp::io::detail {
399403
void io_engine_iocp::socket_multicast_set_send_interface(socket_handle_t socket, address iface) {
400404
if (iface.is_ipv4()) {
401405
auto addr = iface.ipv4().to_sockaddr_in().first.sin_addr.s_addr;
402-
auto res = setsockopt(socket, IPPROTO_IP, IP_MULTICAST_IF, reinterpret_cast<const char*>(&addr), sizeof(addr));
406+
auto res =
407+
setsockopt(socket, IPPROTO_IP, IP_MULTICAST_IF, reinterpret_cast<const char*>(&addr), sizeof(addr));
403408
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
404409
} else if (iface.is_ipv6()) {
405410
auto scope = iface.ipv6().to_sockaddr_in6().first.sin6_scope_id;
406-
auto res =
407-
setsockopt(socket, IPPROTO_IPV6, IPV6_MULTICAST_IF, reinterpret_cast<const char*>(&scope), sizeof(scope));
411+
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_MULTICAST_IF, reinterpret_cast<const char*>(&scope),
412+
sizeof(scope));
408413
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
409414
} else {
410415
throw std::system_error(std::make_error_code(std::errc::not_supported),
@@ -417,11 +422,12 @@ namespace asyncpp::io::detail {
417422
if (ttl > (std::numeric_limits<int>::max)()) throw std::invalid_argument("ttl value out of range");
418423
int ittl = ttl;
419424
if (type == address_type::ipv4) {
420-
auto res = setsockopt(socket, IPPROTO_IP, IP_MULTICAST_TTL, reinterpret_cast<const char*>(&ittl), sizeof(ittl));
425+
auto res =
426+
setsockopt(socket, IPPROTO_IP, IP_MULTICAST_TTL, reinterpret_cast<const char*>(&ittl), sizeof(ittl));
421427
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
422428
} else if (type == address_type::ipv6) {
423-
auto res =
424-
setsockopt(socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, reinterpret_cast<const char*>(&ittl), sizeof(ittl));
429+
auto res = setsockopt(socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, reinterpret_cast<const char*>(&ittl),
430+
sizeof(ittl));
425431
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
426432
} else {
427433
throw std::system_error(std::make_error_code(std::errc::not_supported),
@@ -433,7 +439,8 @@ namespace asyncpp::io::detail {
433439
auto type = get_handle_type(socket);
434440
int val = enabled ? 1 : 0;
435441
if (type == address_type::ipv4) {
436-
auto res = setsockopt(socket, IPPROTO_IP, IP_MULTICAST_LOOP, reinterpret_cast<const char*>(&val), sizeof(val));
442+
auto res =
443+
setsockopt(socket, IPPROTO_IP, IP_MULTICAST_LOOP, reinterpret_cast<const char*>(&val), sizeof(val));
437444
if (res < 0) throw std::system_error(WSAGetLastError(), std::system_category(), "setsockopt failed");
438445
} else if (type == address_type::ipv6) {
439446
auto res =

src/io_engine_uring.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ namespace asyncpp::io::detail {
1919

2020
#ifndef __NR_io_uring_register
2121
#ifdef __alpha__
22-
#define __NR_io_uring_register 537
22+
#define __NR_io_uring_register 537
2323
#else
24-
#define __NR_io_uring_register 427
24+
#define __NR_io_uring_register 427
2525
#endif
2626
#endif
2727

0 commit comments

Comments
 (0)