strict-aliasing level 3 warnings fix

pull/3413/head
Isuru2000psn 2020-10-05 15:29:09 +05:30
parent 6a4c338625
commit f2b3ec2e0c
2 changed files with 6 additions and 3 deletions

View File

@ -197,12 +197,15 @@ M3D_INDEX addMaterial(const Assimp::M3DWrapper &m3d, const aiMaterial *mat) {
break; break;
case m3dpf_float: case m3dpf_float:
if (mat->Get(aiProps[k].pKey, aiProps[k].type, if (mat->Get(aiProps[k].pKey, aiProps[k].type,
aiProps[k].index, f) == AI_SUCCESS) aiProps[k].index, f) == AI_SUCCESS) {
uint32_t f_uint32;
memcpy(&f_uint32, &f, sizeof(uint32_t));
addProp(&m3d->material[mi], addProp(&m3d->material[mi],
m3d_propertytypes[k].id, m3d_propertytypes[k].id,
/* not (uint32_t)f, because we don't want to convert /* not (uint32_t)f, because we don't want to convert
* it, we want to see it as 32 bits of memory */ * it, we want to see it as 32 bits of memory */
*((uint32_t *)&f)); f_uint32);
}
break; break;
case m3dpf_uint8: case m3dpf_uint8:
if (mat->Get(aiProps[k].pKey, aiProps[k].type, if (mat->Get(aiProps[k].pKey, aiProps[k].type,

View File

@ -3590,7 +3590,7 @@ m3d_t *m3d_load(unsigned char *data, m3dread_t readfilecb, m3dfree_t freecb, m3d
case 4: f = (float)(*((float *)(data + 0))); break; case 4: f = (float)(*((float *)(data + 0))); break;
case 8: f = (float)(*((double *)(data + 0))); break; case 8: f = (float)(*((double *)(data + 0))); break;
} }
h->cmd[i].arg[k] = *((uint32_t *)&f); memcpy(&(h->cmd[i].arg[k]), &f, sizeof(uint32_t));
data += model->vc_s; data += model->vc_s;
break; break;
case m3dcp_hi_t: data = _m3d_getidx(data, model->hi_s, &h->cmd[i].arg[k]); break; case m3dcp_hi_t: data = _m3d_getidx(data, model->hi_s, &h->cmd[i].arg[k]); break;