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

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -18,14 +18,14 @@
#include <LibCore/Timer.h>
#include <stdio.h>
static u8 mac_part(Vector<DeprecatedString> const& parts, size_t index)
static u8 mac_part(Vector<ByteString> 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(DeprecatedString const& str)
static MACAddress mac_from_string(ByteString const& str)
{
auto chunks = str.split(':');
VERIFY(chunks.size() == 6); // should we...worry about this?
@ -117,7 +117,7 @@ static void set_params(InterfaceDescriptor const& iface, IPv4Address const& ipv4
}
}
DHCPv4Client::DHCPv4Client(Vector<DeprecatedString> interfaces_with_dhcp_enabled)
DHCPv4Client::DHCPv4Client(Vector<ByteString> interfaces_with_dhcp_enabled)
: m_interfaces_with_dhcp_enabled(move(interfaces_with_dhcp_enabled))
{
m_server = Core::UDPServer::construct(this);
@ -193,13 +193,13 @@ ErrorOr<DHCPv4Client::Interfaces> DHCPv4Client::get_discoverable_interfaces()
json.value().as_array().for_each([&ifnames_to_immediately_discover, &ifnames_to_attempt_later](auto& value) {
auto if_object = value.as_object();
if (if_object.get_deprecated_string("class_name"sv).value_or({}) == "LoopbackAdapter")
if (if_object.get_byte_string("class_name"sv).value_or({}) == "LoopbackAdapter")
return;
auto name = if_object.get_deprecated_string("name"sv).value_or({});
auto mac = if_object.get_deprecated_string("mac_address"sv).value_or({});
auto name = if_object.get_byte_string("name"sv).value_or({});
auto mac = if_object.get_byte_string("mac_address"sv).value_or({});
auto is_up = if_object.get_bool("link_up"sv).value_or(false);
auto ipv4_addr_maybe = IPv4Address::from_string(if_object.get_deprecated_string("ipv4_address"sv).value_or({}));
auto ipv4_addr_maybe = IPv4Address::from_string(if_object.get_byte_string("ipv4_address"sv).value_or({}));
auto ipv4_addr = ipv4_addr_maybe.has_value() ? ipv4_addr_maybe.value() : IPv4Address { 0, 0, 0, 0 };
if (is_up) {
dbgln_if(DHCPV4_DEBUG, "Found adapter '{}' with mac {}, and it was up!", name, mac);
@ -218,7 +218,7 @@ ErrorOr<DHCPv4Client::Interfaces> DHCPv4Client::get_discoverable_interfaces()
void DHCPv4Client::handle_offer(DHCPv4Packet const& packet, ParsedDHCPv4Options const& options)
{
dbgln("We were offered {} for {}", packet.yiaddr().to_deprecated_string(), options.get<u32>(DHCPOption::IPAddressLeaseTime).value_or(0));
dbgln("We were offered {} for {}", packet.yiaddr().to_byte_string(), options.get<u32>(DHCPOption::IPAddressLeaseTime).value_or(0));
auto* transaction = const_cast<DHCPv4Transaction*>(m_ongoing_transactions.get(packet.xid()).value_or(nullptr));
if (!transaction) {
dbgln("we're not looking for {}", packet.xid());
@ -239,8 +239,8 @@ void DHCPv4Client::handle_offer(DHCPv4Packet const& packet, ParsedDHCPv4Options
void DHCPv4Client::handle_ack(DHCPv4Packet const& packet, ParsedDHCPv4Options const& options)
{
if constexpr (DHCPV4CLIENT_DEBUG) {
dbgln("The DHCP server handed us {}", packet.yiaddr().to_deprecated_string());
dbgln("Here are the options: {}", options.to_deprecated_string());
dbgln("The DHCP server handed us {}", packet.yiaddr().to_byte_string());
dbgln("Here are the options: {}", options.to_byte_string());
}
auto* transaction = const_cast<DHCPv4Transaction*>(m_ongoing_transactions.get(packet.xid()).value_or(nullptr));
@ -273,8 +273,8 @@ void DHCPv4Client::handle_ack(DHCPv4Packet const& packet, ParsedDHCPv4Options co
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_deprecated_string());
dbgln("Here are the options: {}", options.to_deprecated_string());
dbgln("The DHCP server told us to go chase our own tail about {}", packet.yiaddr().to_byte_string());
dbgln("Here are the options: {}", options.to_byte_string());
// make another request a bit later :shrug:
auto* transaction = const_cast<DHCPv4Transaction*>(m_ongoing_transactions.get(packet.xid()).value_or(nullptr));
if (!transaction) {
@ -297,7 +297,7 @@ void DHCPv4Client::process_incoming(DHCPv4Packet const& packet)
{
auto options = packet.parse_options();
dbgln_if(DHCPV4CLIENT_DEBUG, "Here are the options: {}", options.to_deprecated_string());
dbgln_if(DHCPV4CLIENT_DEBUG, "Here are the options: {}", options.to_byte_string());
auto value_or_error = options.get<DHCPMessageType>(DHCPOption::DHCPMessageType);
if (!value_or_error.has_value())
@ -336,7 +336,7 @@ void DHCPv4Client::dhcp_discover(InterfaceDescriptor const& iface)
if constexpr (DHCPV4CLIENT_DEBUG) {
dbgln("Trying to lease an IP for {} with ID {}", iface.ifname, transaction_id);
if (!iface.current_ip_address.is_zero())
dbgln("going to request the server to hand us {}", iface.current_ip_address.to_deprecated_string());
dbgln("going to request the server to hand us {}", iface.current_ip_address.to_byte_string());
}
DHCPv4PacketBuilder builder;
@ -364,7 +364,7 @@ void DHCPv4Client::dhcp_discover(InterfaceDescriptor const& iface)
void DHCPv4Client::dhcp_request(DHCPv4Transaction& transaction, DHCPv4Packet const& offer)
{
auto& iface = transaction.interface;
dbgln("Leasing the IP {} for adapter {}", offer.yiaddr().to_deprecated_string(), iface.ifname);
dbgln("Leasing the IP {} for adapter {}", offer.yiaddr().to_byte_string(), iface.ifname);
DHCPv4PacketBuilder builder;
DHCPv4Packet& packet = builder.peek();