From 0aa5725f72b1aae3bfcd653305ac43ca8fc082f4 Mon Sep 17 00:00:00 2001 From: Rummskartoffel Date: Sun, 16 Jan 2022 14:16:09 +0100 Subject: [PATCH] disasm: Convert to east-const and C++-style casts --- Userland/Utilities/disasm.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Userland/Utilities/disasm.cpp b/Userland/Utilities/disasm.cpp index 6b6c0b1df2..02ccda6089 100644 --- a/Userland/Utilities/disasm.cpp +++ b/Userland/Utilities/disasm.cpp @@ -18,7 +18,7 @@ ErrorOr serenity_main(Main::Arguments args) { - const char* path = nullptr; + char const* path = nullptr; Core::ArgsParser args_parser; args_parser.set_general_help( @@ -41,28 +41,28 @@ ErrorOr serenity_main(Main::Arguments args) }; Vector symbols; - const u8* asm_data = (const u8*)file->data(); + u8 const* asm_data = static_cast(file->data()); size_t asm_size = file->size(); size_t file_offset = 0; Vector::Iterator current_symbol = symbols.begin(); OwnPtr symbol_provider; // nullptr for non-ELF disassembly. OwnPtr elf; - if (asm_size >= 4 && strncmp((const char*)asm_data, "\u007fELF", 4) == 0) { + if (asm_size >= 4 && strncmp(reinterpret_cast(asm_data), "\u007fELF", 4) == 0) { elf = make(asm_data, asm_size); if (elf->is_valid()) { symbol_provider = make(*elf); - elf->for_each_section_of_type(SHT_PROGBITS, [&](const ELF::Image::Section& section) { + elf->for_each_section_of_type(SHT_PROGBITS, [&](ELF::Image::Section const& section) { // FIXME: Disassemble all SHT_PROGBITS sections, not just .text. if (section.name() != ".text") return IterationDecision::Continue; - asm_data = (const u8*)section.raw_data(); + asm_data = reinterpret_cast(section.raw_data()); asm_size = section.size(); file_offset = section.address(); return IterationDecision::Break; }); symbols.ensure_capacity(elf->symbol_count() + 1); symbols.append({ 0, 0, StringView() }); // Sentinel. - elf->for_each_symbol([&](const ELF::Image::Symbol& symbol) { + elf->for_each_symbol([&](ELF::Image::Symbol const& symbol) { symbols.append({ symbol.value(), symbol.size(), symbol.name() }); return IterationDecision::Continue; });