Update XFileParser.cpp

Fix alignment for float and double.
pull/1767/head
Kim Kulling 2018-02-05 13:44:19 +01:00 committed by GitHub
parent ff556027ef
commit eb23946fe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -1349,20 +1349,20 @@ ai_real XFileParser::ReadFloat()
}
--mBinaryNumCount;
if( mBinaryFloatSize == 8)
{
if( mBinaryFloatSize == 8) {
if( mEnd - mP >= 8) {
ai_real result = (ai_real) (*(double*) mP);
double res;
::memcpy( &res, mP, 8 );
mP += 8;
return result;
} else {
mP = mEnd;
return 0;
}
} else
{
} else {
if( mEnd - mP >= 4) {
ai_real result = *(ai_real*) mP;
ai_real result;
::memcpy( &result, mP, 4 );
mP += 4;
return result;
} else {