1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:47:35 +00:00

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -15,14 +15,14 @@
#include <LibCore/Timer.h>
#include <stdio.h>
static u8 mac_part(const Vector<String>& parts, size_t index)
static u8 mac_part(Vector<String> const& parts, size_t index)
{
auto result = AK::StringUtils::convert_to_uint_from_hex(parts.at(index));
VERIFY(result.has_value());
return result.value();
}
static MACAddress mac_from_string(const String& str)
static MACAddress mac_from_string(String const& str)
{
auto chunks = str.split(':');
VERIFY(chunks.size() == 6); // should we...worry about this?
@ -32,7 +32,7 @@ static MACAddress mac_from_string(const String& str)
};
}
static bool send(const InterfaceDescriptor& iface, const DHCPv4Packet& packet, Core::Object*)
static bool send(InterfaceDescriptor const& iface, DHCPv4Packet const& packet, Core::Object*)
{
int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (fd < 0) {
@ -63,7 +63,7 @@ static bool send(const InterfaceDescriptor& iface, const DHCPv4Packet& packet, C
return true;
}
static void set_params(const InterfaceDescriptor& iface, const IPv4Address& ipv4_addr, const IPv4Address& netmask, const IPv4Address& gateway)
static void set_params(InterfaceDescriptor const& iface, IPv4Address const& ipv4_addr, IPv4Address const& netmask, IPv4Address const& gateway)
{
int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
if (fd < 0) {
@ -201,7 +201,7 @@ ErrorOr<DHCPv4Client::Interfaces> DHCPv4Client::get_discoverable_interfaces()
};
}
void DHCPv4Client::handle_offer(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options)
void DHCPv4Client::handle_offer(DHCPv4Packet const& packet, ParsedDHCPv4Options const& options)
{
dbgln("We were offered {} for {}", packet.yiaddr().to_string(), options.get<u32>(DHCPOption::IPAddressLeaseTime).value_or(0));
auto* transaction = const_cast<DHCPv4Transaction*>(m_ongoing_transactions.get(packet.xid()).value_or(nullptr));
@ -221,7 +221,7 @@ void DHCPv4Client::handle_offer(const DHCPv4Packet& packet, const ParsedDHCPv4Op
dhcp_request(*transaction, packet);
}
void DHCPv4Client::handle_ack(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options)
void DHCPv4Client::handle_ack(DHCPv4Packet const& packet, ParsedDHCPv4Options const& options)
{
if constexpr (DHCPV4CLIENT_DEBUG) {
dbgln("The DHCP server handed us {}", packet.yiaddr().to_string());
@ -250,7 +250,7 @@ void DHCPv4Client::handle_ack(const DHCPv4Packet& packet, const ParsedDHCPv4Opti
set_params(transaction->interface, new_ip, options.get<IPv4Address>(DHCPOption::SubnetMask).value(), options.get_many<IPv4Address>(DHCPOption::Router, 1).first());
}
void DHCPv4Client::handle_nak(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options)
void DHCPv4Client::handle_nak(DHCPv4Packet const& packet, ParsedDHCPv4Options const& options)
{
dbgln("The DHCP server told us to go chase our own tail about {}", packet.yiaddr().to_string());
dbgln("Here are the options: {}", options.to_string());
@ -271,7 +271,7 @@ void DHCPv4Client::handle_nak(const DHCPv4Packet& packet, const ParsedDHCPv4Opti
this);
}
void DHCPv4Client::process_incoming(const DHCPv4Packet& packet)
void DHCPv4Client::process_incoming(DHCPv4Packet const& packet)
{
auto options = packet.parse_options();
@ -307,7 +307,7 @@ void DHCPv4Client::process_incoming(const DHCPv4Packet& packet)
}
}
void DHCPv4Client::dhcp_discover(const InterfaceDescriptor& iface)
void DHCPv4Client::dhcp_discover(InterfaceDescriptor const& iface)
{
auto transaction_id = get_random<u32>();
@ -339,7 +339,7 @@ void DHCPv4Client::dhcp_discover(const InterfaceDescriptor& iface)
m_ongoing_transactions.set(transaction_id, make<DHCPv4Transaction>(iface));
}
void DHCPv4Client::dhcp_request(DHCPv4Transaction& transaction, const DHCPv4Packet& offer)
void DHCPv4Client::dhcp_request(DHCPv4Transaction& transaction, DHCPv4Packet const& offer)
{
auto& iface = transaction.interface;
dbgln("Leasing the IP {} for adapter {}", offer.yiaddr().to_string(), iface.ifname);