Fix C-style casts

This commit is contained in:
Konstantinos Margaritis
2024-05-15 23:22:39 +03:00
parent db92a42681
commit e819cb1100
20 changed files with 108 additions and 92 deletions

View File

@@ -155,6 +155,7 @@ bytecode_ptr<HWLM> hwlmBuild(const HWLMProto &proto, const CompileContext &cc,
auto h = make_zeroed_bytecode_ptr<HWLM>(hwlm_len, 64);
h->type = proto.engType;
// cppcheck-suppress cstyleCast
memcpy(HWLM_DATA(h.get()), eng.get(), engSize);
return h;
@@ -218,10 +219,12 @@ size_t hwlmSize(const HWLM *h) {
switch (h->type) {
case HWLM_ENGINE_NOOD:
engSize = noodSize((const noodTable *)HWLM_C_DATA(h));
// cppcheck-suppress cstyleCast
engSize = noodSize(reinterpret_cast<const noodTable *>(HWLM_C_DATA(h)));
break;
case HWLM_ENGINE_FDR:
engSize = fdrSize((const FDR *)HWLM_C_DATA(h));
// cppcheck-suppress cstyleCast
engSize = fdrSize(reinterpret_cast<const FDR *>(HWLM_C_DATA(h)));
break;
}

View File

@@ -56,7 +56,7 @@ u64a make_u64a_mask(const vector<u8> &v) {
u64a mask = 0;
size_t len = v.size();
unsigned char *m = (unsigned char *)&mask;
u8 *m = reinterpret_cast<u8 *>(&mask);
DEBUG_PRINTF("making mask len %zu\n", len);
memcpy(m, &v[0], len);
return mask;