unicorn: Be explicit about casting away const to const-incorrect APIs
Uses C++ casts which silence relevant warnings in Xcode 9.3 Also migrates relevant Read function equivalents over for consistency.
This commit is contained in:
parent
6bcfdba1ad
commit
ab58bbddc8
1 changed files with 8 additions and 4 deletions
|
@ -72,7 +72,8 @@ std::array<u64, 31> Unicorn::GetRegisters() const {
|
||||||
for (size_t i = 0; i < num_gprs; ++i)
|
for (size_t i = 0; i < num_gprs; ++i)
|
||||||
ptrs[i] = ®s[i];
|
ptrs[i] = ®s[i];
|
||||||
|
|
||||||
CHECKED(uc_reg_read_batch(uc, const_cast<int*>(gpr_ids.data()), (void**)ptrs.data(), num_gprs));
|
CHECKED(uc_reg_read_batch(uc, const_cast<int*>(gpr_ids.data()),
|
||||||
|
reinterpret_cast<void**>(ptrs.data()), num_gprs));
|
||||||
return regs;
|
return regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +82,8 @@ void Unicorn::SetRegisters(const std::array<u64, 31>& value) {
|
||||||
for (size_t i = 0; i < num_gprs; ++i)
|
for (size_t i = 0; i < num_gprs; ++i)
|
||||||
ptrs[i] = &value[i];
|
ptrs[i] = &value[i];
|
||||||
|
|
||||||
CHECKED(uc_reg_write_batch(uc, const_cast<int*>(gpr_ids.data()), (void**)ptrs.data(), num_gprs));
|
CHECKED(uc_reg_write_batch(uc, const_cast<int*>(gpr_ids.data()),
|
||||||
|
reinterpret_cast<void**>(const_cast<u64**>(ptrs.data())), num_gprs));
|
||||||
}
|
}
|
||||||
|
|
||||||
using Vector = Unicorn::Vector;
|
using Vector = Unicorn::Vector;
|
||||||
|
@ -99,7 +101,8 @@ std::array<Vector, 32> Unicorn::GetVectors() const {
|
||||||
for (size_t i = 0; i < num_vecs; ++i)
|
for (size_t i = 0; i < num_vecs; ++i)
|
||||||
ptrs[i] = &vecs[i];
|
ptrs[i] = &vecs[i];
|
||||||
|
|
||||||
CHECKED(uc_reg_read_batch(uc, const_cast<int*>(vec_ids.data()), (void**)ptrs.data(), num_vecs));
|
CHECKED(uc_reg_read_batch(uc, const_cast<int*>(vec_ids.data()),
|
||||||
|
reinterpret_cast<void**>(ptrs.data()), num_vecs));
|
||||||
|
|
||||||
return vecs;
|
return vecs;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +112,8 @@ void Unicorn::SetVectors(const std::array<Vector, 32>& value) {
|
||||||
for (size_t i = 0; i < num_vecs; ++i)
|
for (size_t i = 0; i < num_vecs; ++i)
|
||||||
ptrs[i] = &value[i];
|
ptrs[i] = &value[i];
|
||||||
|
|
||||||
CHECKED(uc_reg_write_batch(uc, const_cast<int*>(vec_ids.data()), (void**)ptrs.data(), num_vecs));
|
CHECKED(uc_reg_write_batch(uc, const_cast<int*>(vec_ids.data()),
|
||||||
|
reinterpret_cast<void* const *>(const_cast<Vector**>(ptrs.data())), num_vecs));
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Unicorn::GetFpcr() const {
|
u32 Unicorn::GetFpcr() const {
|
||||||
|
|
Loading…
Reference in a new issue