mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 15:17:46 +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:
parent
f963bb4f36
commit
24a469f521
18 changed files with 64 additions and 64 deletions
|
@ -69,7 +69,7 @@ ErrorOr<void> AddressRangesV5::for_each_range(Function<void(Range)> callback)
|
|||
case RangeListEntryType::EndOfList:
|
||||
return {};
|
||||
default:
|
||||
dbgln("unsupported range list entry type: 0x{:x}", entry_type);
|
||||
dbgln("unsupported range list entry type: {:#x}", entry_type);
|
||||
return Error::from_string_literal("Unsupported range list entry type");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,19 +17,19 @@ bool validate_flattened_device_tree(FlattenedDeviceTreeHeader const& header, Rea
|
|||
{
|
||||
if (header.magic != 0xD00DFEEDU) {
|
||||
if (verbose == Verbose::Yes)
|
||||
warnln("FDT Header has invalid magic value 0x{:08x}. Are you sure it's a flattened device tree?", header.magic);
|
||||
warnln("FDT Header has invalid magic value {:#08x}. Are you sure it's a flattened device tree?", header.magic);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((header.off_mem_rsvmap & ~0x7) != header.off_mem_rsvmap) {
|
||||
if (verbose == Verbose::Yes)
|
||||
warnln("FDT Header's MemoryReservationBlock is not 8 byte aligned! Offset: 0x{:08x}", header.off_mem_rsvmap);
|
||||
warnln("FDT Header's MemoryReservationBlock is not 8 byte aligned! Offset: {:#08x}", header.off_mem_rsvmap);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((header.off_dt_struct & ~0x3) != header.off_dt_struct) {
|
||||
if (verbose == Verbose::Yes)
|
||||
warnln("FDT Header's StructureBlock is not 4 byte aligned! Offset: 0x{:08x}", header.off_dt_struct);
|
||||
warnln("FDT Header's StructureBlock is not 4 byte aligned! Offset: {:#08x}", header.off_dt_struct);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -116,16 +116,16 @@ bool validate_flattened_device_tree(FlattenedDeviceTreeHeader const& header, Rea
|
|||
ErrorOr<void> dump(FlattenedDeviceTreeHeader const& header, ReadonlyBytes raw_device_tree)
|
||||
{
|
||||
outln("/dts-v1/;");
|
||||
outln("// magic: 0x{:08x}", header.magic);
|
||||
outln("// totalsize: 0x{:08x} ({})", header.totalsize, header.totalsize);
|
||||
outln("// off_dt_struct: 0x{:08x}", header.off_dt_struct);
|
||||
outln("// off_dt_strings: 0x{:08x}", header.off_dt_strings);
|
||||
outln("// off_mem_rsvmap: 0x{:08x}", header.off_mem_rsvmap);
|
||||
outln("// version: 0x{:08x}", header.version);
|
||||
outln("// last_comp_version: 0x{:08x}", header.last_comp_version);
|
||||
outln("// boot_cpuid_phys: 0x{:08x}", header.boot_cpuid_phys);
|
||||
outln("// size_dt_strings: 0x{:08x}", header.size_dt_strings);
|
||||
outln("// size_dt_struct: 0x{:08x}", header.size_dt_struct);
|
||||
outln("// magic: {:#08x}", header.magic);
|
||||
outln("// totalsize: {:#08x} ({})", header.totalsize, header.totalsize);
|
||||
outln("// off_dt_struct: {:#08x}", header.off_dt_struct);
|
||||
outln("// off_dt_strings: {:#08x}", header.off_dt_strings);
|
||||
outln("// off_mem_rsvmap: {:#08x}", header.off_mem_rsvmap);
|
||||
outln("// version: {:#08x}", header.version);
|
||||
outln("// last_comp_version: {:#08x}", header.last_comp_version);
|
||||
outln("// boot_cpuid_phys: {:#08x}", header.boot_cpuid_phys);
|
||||
outln("// size_dt_strings: {:#08x}", header.size_dt_strings);
|
||||
outln("// size_dt_struct: {:#08x}", header.size_dt_struct);
|
||||
|
||||
if (!validate_flattened_device_tree(header, raw_device_tree, Verbose::Yes))
|
||||
return Error::from_errno(EINVAL);
|
||||
|
@ -134,7 +134,7 @@ ErrorOr<void> dump(FlattenedDeviceTreeHeader const& header, ReadonlyBytes raw_de
|
|||
auto const* mem_reserve_block = reinterpret_cast<FlattenedDeviceTreeReserveEntry const*>(&raw_device_tree[header.off_mem_rsvmap]);
|
||||
u64 next_block_offset = header.off_mem_rsvmap + sizeof(FlattenedDeviceTreeReserveEntry);
|
||||
while ((next_block_offset < header.off_dt_struct) && (*mem_reserve_block != FlattenedDeviceTreeReserveEntry {})) {
|
||||
outln("/memreserve/ 0x{:08x} 0x{:08x};", mem_reserve_block->address, mem_reserve_block->size);
|
||||
outln("/memreserve/ {:#08x} {:#08x};", mem_reserve_block->address, mem_reserve_block->size);
|
||||
++mem_reserve_block;
|
||||
next_block_offset += sizeof(FlattenedDeviceTreeReserveEntry);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ ErrorOr<void> FullBox::read_from_stream(BoxStream& stream)
|
|||
|
||||
void FullBox::dump(String const& prepend) const
|
||||
{
|
||||
outln("{}{} (version = {}, flags = 0x{:x})", prepend, box_type(), version, flags);
|
||||
outln("{}{} (version = {}, flags = {:#x})", prepend, box_type(), version, flags);
|
||||
}
|
||||
|
||||
static String add_indent(String const& string)
|
||||
|
|
|
@ -1171,7 +1171,7 @@ static ErrorOr<void> read_colour_encoding(JPEGStream& stream, [[maybe_unused]] J
|
|||
context.color_transform = ColorTransform::YCCK;
|
||||
break;
|
||||
default:
|
||||
dbgln("0x{:x} is not a specified transform flag value, ignoring", color_transform);
|
||||
dbgln("{:#x} is not a specified transform flag value, ignoring", color_transform);
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
@ -294,7 +294,7 @@ static ErrorOr<VP8XHeader> decode_webp_chunk_VP8X(RIFF::Chunk const& vp8x_chunk)
|
|||
// 3 bytes height minus one
|
||||
u32 height = (vp8x_chunk[7] | (vp8x_chunk[8] << 8) | (vp8x_chunk[9] << 16)) + 1;
|
||||
|
||||
dbgln_if(WEBP_DEBUG, "flags 0x{:x} --{}{}{}{}{}{}, width {}, height {}",
|
||||
dbgln_if(WEBP_DEBUG, "flags {:#x} --{}{}{}{}{}{}, width {}, height {}",
|
||||
flags,
|
||||
has_icc ? " icc" : "",
|
||||
has_alpha ? " alpha" : "",
|
||||
|
|
|
@ -328,7 +328,7 @@ ErrorOr<void, ValidationError> Validator::validate(Limits const& limits, size_t
|
|||
template<u64 opcode>
|
||||
ErrorOr<void, ValidationError> Validator::validate_instruction(Instruction const& instruction, Stack&, bool&)
|
||||
{
|
||||
return Errors::invalid(ByteString::formatted("instruction opcode (0x{:x}) (missing validation!)", instruction.opcode().value()));
|
||||
return Errors::invalid(ByteString::formatted("instruction opcode ({:#x}) (missing validation!)", instruction.opcode().value()));
|
||||
}
|
||||
|
||||
#define VALIDATE_INSTRUCTION(name) \
|
||||
|
@ -3774,7 +3774,7 @@ ErrorOr<void, ValidationError> Validator::validate(Instruction const& instructio
|
|||
#undef M
|
||||
default:
|
||||
is_constant = false;
|
||||
return Errors::invalid(ByteString::formatted("instruction opcode (0x{:x})", instruction.opcode().value()));
|
||||
return Errors::invalid(ByteString::formatted("instruction opcode ({:#x})", instruction.opcode().value()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@ Optional<StyleProperty> ResolvedCSSStyleDeclaration::property(PropertyID propert
|
|||
// FIXME: This is a stopgap until we implement shorthand -> longhand conversion.
|
||||
auto value = style->maybe_null_property(property_id);
|
||||
if (!value) {
|
||||
dbgln("FIXME: ResolvedCSSStyleDeclaration::property(property_id=0x{:x}) No value for property ID in newly computed style case.", to_underlying(property_id));
|
||||
dbgln("FIXME: ResolvedCSSStyleDeclaration::property(property_id={:#x}) No value for property ID in newly computed style case.", to_underlying(property_id));
|
||||
return {};
|
||||
}
|
||||
return StyleProperty {
|
||||
|
|
|
@ -129,7 +129,7 @@ void WebGLRenderingContextBase::active_texture(GLenum texture)
|
|||
if (m_context_lost)
|
||||
return;
|
||||
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::active_texture(texture=0x{:08x})", texture);
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::active_texture(texture={:#08x})", texture);
|
||||
m_context->gl_active_texture(texture);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ void WebGLRenderingContextBase::clear(GLbitfield mask)
|
|||
if (m_context_lost)
|
||||
return;
|
||||
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::clear(mask=0x{:08x})", mask);
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::clear(mask={:#08x})", mask);
|
||||
m_context->gl_clear(mask);
|
||||
|
||||
// FIXME: This should only be done if this is targeting the front buffer.
|
||||
|
@ -168,7 +168,7 @@ void WebGLRenderingContextBase::clear_stencil(GLint s)
|
|||
if (m_context_lost)
|
||||
return;
|
||||
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::clear_stencil(s=0x{:08x})", s);
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::clear_stencil(s={:#08x})", s);
|
||||
m_context->gl_clear_stencil(s);
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ void WebGLRenderingContextBase::cull_face(GLenum mode)
|
|||
if (m_context_lost)
|
||||
return;
|
||||
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::cull_face(mode=0x{:08x})", mode);
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::cull_face(mode={:#08x})", mode);
|
||||
m_context->gl_cull_face(mode);
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ void WebGLRenderingContextBase::depth_func(GLenum func)
|
|||
if (m_context_lost)
|
||||
return;
|
||||
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::depth_func(func=0x{:08x})", func);
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::depth_func(func={:#08x})", func);
|
||||
m_context->gl_depth_func(func);
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ void WebGLRenderingContextBase::front_face(GLenum mode)
|
|||
if (m_context_lost)
|
||||
return;
|
||||
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::front_face(mode=0x{:08x})", mode);
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::front_face(mode={:#08x})", mode);
|
||||
m_context->gl_front_face(mode);
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ void WebGLRenderingContextBase::stencil_op(GLenum fail, GLenum zfail, GLenum zpa
|
|||
if (m_context_lost)
|
||||
return;
|
||||
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::stencil_op(fail=0x{:08x}, zfail=0x{:08x}, zpass=0x{:08x})", fail, zfail, zpass);
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::stencil_op(fail={:#08x}, zfail={:#08x}, zpass={:#08x})", fail, zfail, zpass);
|
||||
m_context->gl_stencil_op_separate(GL_FRONT_AND_BACK, fail, zfail, zpass);
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ void WebGLRenderingContextBase::stencil_op_separate(GLenum face, GLenum fail, GL
|
|||
if (m_context_lost)
|
||||
return;
|
||||
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::stencil_op_separate(face=0x{:08x}, fail=0x{:08x}, zfail=0x{:08x}, zpass=0x{:08x})", face, fail, zfail, zpass);
|
||||
dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::stencil_op_separate(face={:#08x}, fail={:#08x}, zfail={:#08x}, zpass={:#08x})", face, fail, zfail, zpass);
|
||||
m_context->gl_stencil_op_separate(face, fail, zfail, zpass);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue