From 8fa9849c25bb80f8252a0248c2cfb371d094a4a0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 25 Jan 2018 22:40:05 -0500 Subject: [PATCH] unicorn: Use static_cast instead of reinterpret_cast It's well-defined to cast from void* back to the original pointer type. --- tests/A64/unicorn_emu/unicorn.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/A64/unicorn_emu/unicorn.cpp b/tests/A64/unicorn_emu/unicorn.cpp index 38a2332e..ae1d93c9 100644 --- a/tests/A64/unicorn_emu/unicorn.cpp +++ b/tests/A64/unicorn_emu/unicorn.cpp @@ -151,7 +151,7 @@ void Unicorn::DumpMemoryInformation() { } void Unicorn::InterruptHook(uc_engine* uc, u32 int_number, void* user_data) { - Unicorn* this_ = reinterpret_cast(user_data); + auto* this_ = static_cast(user_data); u32 esr; CHECKED(uc_reg_read(uc, UC_ARM64_REG_ESR, &esr)); @@ -169,7 +169,7 @@ void Unicorn::InterruptHook(uc_engine* uc, u32 int_number, void* user_data) { } bool Unicorn::UnmappedMemoryHook(uc_engine* uc, uc_mem_type /*type*/, u64 start_address, int size, u64 /*value*/, void* user_data) { - Unicorn* this_ = reinterpret_cast(user_data); + auto* this_ = static_cast(user_data); const auto generate_page = [&](u64 base_address) { // printf("generate_page(%" PRIx64 ")\n", base_address); @@ -212,7 +212,7 @@ bool Unicorn::UnmappedMemoryHook(uc_engine* uc, uc_mem_type /*type*/, u64 start_ } bool Unicorn::MemoryWriteHook(uc_engine* /*uc*/, uc_mem_type /*type*/, u64 start_address, int size, u64 value, void* user_data) { - Unicorn* this_ = reinterpret_cast(user_data); + auto* this_ = static_cast(user_data); switch (size) { case 1: