HLLib: bypass strict-aliasing rules using union

Suppress the strict-aliasing warning by accessing the FourCC array via a
union.
This commit is contained in:
Ondřej Hošek 2013-11-22 01:56:08 +01:00
parent d2fdc13491
commit 57e6a9b5bb
1 changed files with 3 additions and 1 deletions

View File

@ -443,7 +443,9 @@ hlBool CVBSPFile::GetItemAttributeInternal(const CDirectoryItem *pItem, HLPackag
} }
case HL_VBSP_ITEM_FOUR_CC: case HL_VBSP_ITEM_FOUR_CC:
{ {
hlAttributeSetUnsignedInteger(&Attribute, this->lpItemAttributeNames[eAttribute], *(hlUInt *)this->pHeader->lpLumps[uiID].lpFourCC, hlTrue); union { const hlChar *c; const hlUInt *u; } fourCC;
fourCC.c = this->pHeader->lpLumps[uiID].lpFourCC;
hlAttributeSetUnsignedInteger(&Attribute, this->lpItemAttributeNames[eAttribute], *fourCC.u, hlTrue);
return hlTrue; return hlTrue;
} }
default: default: