1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:47:45 +00:00

Everywhere: Prefer {:#x} over 0x{:x} in format strings

The former automatically adapts the prefix to binary and octal
output, and is what we already use in the majority of cases.

Patch generated by:

    rg -l '0x\{' | xargs sed -i '' -e 's/0x{:/{:#/'

I ran it 4 times (until it stopped changing things) since each
invocation only converted one instance per line.

No behavior change.
This commit is contained in:
Nico Weber 2024-02-21 09:38:31 -05:00 committed by Andreas Kling
parent f963bb4f36
commit 24a469f521
18 changed files with 64 additions and 64 deletions

View file

@ -28,7 +28,7 @@ static void dump_exception_syndrome_register(Aarch64::ESR_EL1 const& esr_el1)
if (Aarch64::exception_class_is_data_abort(esr_el1.EC))
dbgln(" Data Fault Status Code: {}", Aarch64::data_fault_status_code_to_string(esr_el1.ISS));
if (Aarch64::exception_class_has_set_far(esr_el1.EC))
dbgln(" Faulting Virtual Address: 0x{:x}", Aarch64::FAR_EL1::read().virtual_address);
dbgln(" Faulting Virtual Address: {:#x}", Aarch64::FAR_EL1::read().virtual_address);
}
void dump_registers(RegisterState const& regs)
@ -40,9 +40,9 @@ void dump_registers(RegisterState const& regs)
Aarch64::SPSR_EL1 spsr_el1 = {};
memcpy(&spsr_el1, (u8 const*)&regs.spsr_el1, sizeof(u64));
dbgln("Saved Program Status: (NZCV({:#b}) DAIF({:#b}) M({:#b})) / 0x{:x}", ((regs.spsr_el1 >> 28) & 0b1111), ((regs.spsr_el1 >> 6) & 0b1111), regs.spsr_el1 & 0b1111, regs.spsr_el1);
dbgln("Exception Link Register: 0x{:x}", regs.elr_el1);
dbgln("Stack Pointer (EL0): 0x{:x}", regs.sp_el0);
dbgln("Saved Program Status: (NZCV({:#b}) DAIF({:#b}) M({:#b})) / {:#x}", ((regs.spsr_el1 >> 28) & 0b1111), ((regs.spsr_el1 >> 6) & 0b1111), regs.spsr_el1 & 0b1111, regs.spsr_el1);
dbgln("Exception Link Register: {:#x}", regs.elr_el1);
dbgln("Stack Pointer (EL0): {:#x}", regs.sp_el0);
dbgln(" x0={:p} x1={:p} x2={:p} x3={:p} x4={:p}", regs.x[0], regs.x[1], regs.x[2], regs.x[3], regs.x[4]);
dbgln(" x5={:p} x6={:p} x7={:p} x8={:p} x9={:p}", regs.x[5], regs.x[6], regs.x[7], regs.x[8], regs.x[9]);

View file

@ -686,7 +686,7 @@ void UHCIController::get_port_status(Badge<UHCIRootHub>, u8 port, HubStatus& hub
// UHCI ports are always powered.
hub_port_status.status |= PORT_STATUS_PORT_POWER;
dbgln_if(UHCI_DEBUG, "UHCI: get_port_status status=0x{:04x} change=0x{:04x}", hub_port_status.status, hub_port_status.change);
dbgln_if(UHCI_DEBUG, "UHCI: get_port_status status={:#04x} change={:#04x}", hub_port_status.status, hub_port_status.change);
}
void UHCIController::reset_port(u8 port)
@ -808,7 +808,7 @@ ErrorOr<void> UHCIController::clear_port_feature(Badge<UHCIRootHub>, u8 port, Hu
return EINVAL;
}
dbgln_if(UHCI_DEBUG, "UHCI: clear_port_feature: writing 0x{:04x} to portsc{}.", port_data, port + 1);
dbgln_if(UHCI_DEBUG, "UHCI: clear_port_feature: writing {:#04x} to portsc{}.", port_data, port + 1);
if (port == 0)
write_portsc1(port_data);

View file

@ -114,11 +114,11 @@ ErrorOr<size_t> UHCIRootHub::handle_control_transfer(Transfer& transfer)
if constexpr (UHCI_DEBUG) {
dbgln("UHCIRootHub: Received control transfer.");
dbgln("UHCIRootHub: Request Type: 0x{:02x}", request.request_type);
dbgln("UHCIRootHub: Request: 0x{:02x}", request.request);
dbgln("UHCIRootHub: Value: 0x{:04x}", request.value);
dbgln("UHCIRootHub: Index: 0x{:04x}", request.index);
dbgln("UHCIRootHub: Length: 0x{:04x}", request.length);
dbgln("UHCIRootHub: Request Type: {:#02x}", request.request_type);
dbgln("UHCIRootHub: Request: {:#02x}", request.request);
dbgln("UHCIRootHub: Value: {:#04x}", request.value);
dbgln("UHCIRootHub: Index: {:#04x}", request.index);
dbgln("UHCIRootHub: Length: {:#04x}", request.length);
}
size_t length = 0;

View file

@ -72,7 +72,7 @@ ErrorOr<void> Hub::enumerate_and_power_on_hub()
if constexpr (USB_DEBUG) {
dbgln("USB Hub Descriptor for {:04x}:{:04x}", m_vendor_id, m_product_id);
dbgln("Number of Downstream Ports: {}", descriptor.number_of_downstream_ports);
dbgln("Hub Characteristics: 0x{:04x}", static_cast<u16>(descriptor.hub_characteristics));
dbgln("Hub Characteristics: {:#04x}", static_cast<u16>(descriptor.hub_characteristics));
dbgln("Power On to Power Good Time: {} ms ({} * 2ms)", descriptor.power_on_to_power_good_time * 2, descriptor.power_on_to_power_good_time);
dbgln("Hub Controller Current: {} mA", descriptor.hub_controller_current);
}

View file

@ -63,7 +63,7 @@ UNMAP_AFTER_INIT void USBManagement::enumerate_controllers()
dmesgln("USBManagement: Direct attached device at {} is not currently supported.", device_identifier.address());
return;
}
dmesgln("USBManagement: Unknown/unsupported controller at {} with programming interface 0x{:02x}", device_identifier.address(), device_identifier.prog_if().value());
dmesgln("USBManagement: Unknown/unsupported controller at {} with programming interface {:#02x}", device_identifier.address(), device_identifier.prog_if().value());
}));
}