diff --git a/plugins/BinaryInfo/DialogHeader.cpp b/plugins/BinaryInfo/DialogHeader.cpp index 69450f588..4baaa7ca4 100644 --- a/plugins/BinaryInfo/DialogHeader.cpp +++ b/plugins/BinaryInfo/DialogHeader.cpp @@ -450,7 +450,7 @@ DialogHeader::DialogHeader(const std::shared_ptr ®ion, QWidget *pare if (auto elf32 = dynamic_cast(binary_info.get())) { - auto header = reinterpret_cast(elf32->header()); + auto header = static_cast(elf32->header()); auto root = new QTreeWidgetItem; root->setText(0, tr("ELF32")); @@ -471,7 +471,7 @@ DialogHeader::DialogHeader(const std::shared_ptr ®ion, QWidget *pare if (auto elf64 = dynamic_cast(binary_info.get())) { - auto header = reinterpret_cast(elf64->header()); + auto header = static_cast(elf64->header()); auto root = new QTreeWidgetItem; root->setText(0, tr("ELF64")); @@ -493,7 +493,7 @@ DialogHeader::DialogHeader(const std::shared_ptr ®ion, QWidget *pare if (auto pe32 = dynamic_cast(binary_info.get())) { Q_UNUSED(pe32) #if 0 - auto header = reinterpret_cast(pe32->header()); + auto header = static_cast(pe32->header()); #endif auto root = new QTreeWidgetItem; root->setText(0, tr("PE32")); diff --git a/plugins/BinaryInfo/symbols.cpp b/plugins/BinaryInfo/symbols.cpp index 6fb4a3f55..f59aa6d35 100644 --- a/plugins/BinaryInfo/symbols.cpp +++ b/plugins/BinaryInfo/symbols.cpp @@ -103,7 +103,7 @@ struct elf64_model : elf_model<64> { }; [[nodiscard]] bool is_elf32(const void *ptr) { - auto elf32_hdr = reinterpret_cast(ptr); + auto elf32_hdr = static_cast(ptr); if (std::memcmp(elf32_hdr->e_ident, ELFMAG, SELFMAG) == 0) { return elf32_hdr->e_ident[EI_CLASS] == ELFCLASS32; } @@ -111,7 +111,7 @@ struct elf64_model : elf_model<64> { } [[nodiscard]] bool is_elf64(const void *ptr) { - auto elf64_hdr = reinterpret_cast(ptr); + auto elf64_hdr = static_cast(ptr); if (std::memcmp(elf64_hdr->e_ident, ELFMAG, SELFMAG) == 0) { return elf64_hdr->e_ident[EI_CLASS] == ELFCLASS64; } @@ -434,7 +434,7 @@ void output_symbols(std::vector &symbols, std::ostream &os) { // Desc: //-------------------------------------------------------------------------- bool generate_symbols_internal(QFile &file, std::shared_ptr &debugFile, std::ostream &os) { - if (auto file_ptr = reinterpret_cast(file.map(0, file.size(), QFile::NoOptions))) { + if (auto file_ptr = static_cast(file.map(0, file.size(), QFile::NoOptions))) { if (is_elf64(file_ptr)) { using symbol = typename elf64_model::symbol; @@ -448,7 +448,7 @@ bool generate_symbols_internal(QFile &file, std::shared_ptr &debugFile, s if (debugFile->open(QIODevice::ReadOnly)) { // map it and include it with the symbols - if (auto debug_ptr = reinterpret_cast(debugFile->map(0, debugFile->size(), QFile::NoOptions))) { + if (auto debug_ptr = static_cast(debugFile->map(0, debugFile->size(), QFile::NoOptions))) { // this should never fail... but just being sure if (is_elf64(debug_ptr)) { @@ -475,7 +475,7 @@ bool generate_symbols_internal(QFile &file, std::shared_ptr &debugFile, s if (debugFile->open(QIODevice::ReadOnly)) { // map it and include it with the symbols - if (auto debug_ptr = reinterpret_cast(debugFile->map(0, debugFile->size(), QFile::NoOptions))) { + if (auto debug_ptr = static_cast(debugFile->map(0, debugFile->size(), QFile::NoOptions))) { // this should never fail... but just being sure if (is_elf32(debug_ptr)) { diff --git a/plugins/DebuggerCore/unix/linux/PlatformProcess.cpp b/plugins/DebuggerCore/unix/linux/PlatformProcess.cpp index ef5c35a68..6405275f5 100644 --- a/plugins/DebuggerCore/unix/linux/PlatformProcess.cpp +++ b/plugins/DebuggerCore/unix/linux/PlatformProcess.cpp @@ -355,7 +355,7 @@ std::size_t PlatformProcess::readBytes(edb::address_t address, void *buf, std::s } // store it - reinterpret_cast(buf)[index] = x; + static_cast(buf)[index] = x; ++read; } diff --git a/plugins/InstructionInspector/Plugin.cpp b/plugins/InstructionInspector/Plugin.cpp index 6fb8c2423..76dc9638e 100644 --- a/plugins/InstructionInspector/Plugin.cpp +++ b/plugins/InstructionInspector/Plugin.cpp @@ -66,7 +66,7 @@ std::string printBytes(const void *ptr, std::size_t size, bool printZeros = true std::ostringstream str; str << std::setfill('0') << std::uppercase << std::hex; - const auto bytes = reinterpret_cast(ptr); + const auto bytes = static_cast(ptr); for (std::size_t i = 0; i < size; ++i) { if (!str.str().empty()) { diff --git a/src/arch/x86-generic/ArchProcessor.cpp b/src/arch/x86-generic/ArchProcessor.cpp index d9c14055b..ddb18eda8 100644 --- a/src/arch/x86-generic/ArchProcessor.cpp +++ b/src/arch/x86-generic/ArchProcessor.cpp @@ -638,13 +638,15 @@ QString formatBCD(const edb::value80 &v) { } template -QString formatPackedFloat(const char *data, std::size_t size) { +QString formatPackedFloat(const void *data, std::size_t size) { + + auto ptr = static_cast(data); QString str; for (std::size_t offset = 0; offset < size; offset += sizeof(ValueType)) { ValueType value; - std::memcpy(&value, data + offset, sizeof(value)); + std::memcpy(&value, ptr + offset, sizeof(value)); if (!str.isEmpty()) { str += ", "; } @@ -773,9 +775,9 @@ void analyze_operands(const State &state, const edb::Instruction &inst, QStringL valueStr += " (decimal)"; } } else if (is_SIMD_PS(operand)) { - valueStr = formatPackedFloat(reinterpret_cast(&target), sizeof(edb::value64)); + valueStr = formatPackedFloat(&target, sizeof(edb::value64)); } else if (is_SIMD_PD(operand)) { - valueStr = formatPackedFloat(reinterpret_cast(&target), sizeof(edb::value64)); + valueStr = formatPackedFloat(&target, sizeof(edb::value64)); } else { valueStr = "0x" + value.toHexString(); } @@ -814,9 +816,9 @@ void analyze_operands(const State &state, const edb::Instruction &inst, QStringL case 16: { QString valueString; if (is_SIMD_PS(operand)) { - valueString = formatPackedFloat(reinterpret_cast(&target), sizeof(edb::value128)); + valueString = formatPackedFloat(&target, sizeof(edb::value128)); } else if (is_SIMD_PD(operand)) { - valueString = formatPackedFloat(reinterpret_cast(&target), sizeof(edb::value128)); + valueString = formatPackedFloat(&target, sizeof(edb::value128)); } else { valueString = "0x" + edb::value128(target).toHexString(); } @@ -826,9 +828,9 @@ void analyze_operands(const State &state, const edb::Instruction &inst, QStringL case 32: { QString valueString; if (is_SIMD_PS(operand)) { - valueString = formatPackedFloat(reinterpret_cast(&target), sizeof(edb::value256)); + valueString = formatPackedFloat(&target, sizeof(edb::value256)); } else if (is_SIMD_PD(operand)) { - valueString = formatPackedFloat(reinterpret_cast(&target), sizeof(edb::value256)); + valueString = formatPackedFloat(&target, sizeof(edb::value256)); } else { valueString = "0x" + edb::value256(target).toHexString(); }