- Workaround: ASCII XFiles aren't as strict on separator chars as before anymore. Should allow some more files to be parsed correctly.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@825 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
ulfjorensen 2010-10-08 16:51:54 +00:00
parent 136ef7609d
commit 8aac702e1e
2 changed files with 23 additions and 4 deletions

View File

@ -1000,6 +1000,22 @@ void XFileParser::CheckForSeparator()
ThrowException( "Separator character (';' or ',') expected.");
}
// ------------------------------------------------------------------------------------------------
// tests and possibly consumes a separator char, but does nothing if there was no separator
void XFileParser::TestForSeparator()
{
if( mIsBinaryFormat)
return;
FindNextNoneWhiteSpace();
if( P >= End)
return;
// test and skip
if( *P == ';' || *P == ',')
P++;
}
// ------------------------------------------------------------------------------------------------
void XFileParser::readHeadOfDataObject( std::string* poName)
{
@ -1332,7 +1348,7 @@ aiVector2D XFileParser::ReadVector2()
aiVector2D vector;
vector.x = ReadFloat();
vector.y = ReadFloat();
CheckForSeparator();
TestForSeparator();
return vector;
}
@ -1344,7 +1360,7 @@ aiVector3D XFileParser::ReadVector3()
vector.x = ReadFloat();
vector.y = ReadFloat();
vector.z = ReadFloat();
CheckForSeparator();
TestForSeparator();
return vector;
}
@ -1357,7 +1373,7 @@ aiColor4D XFileParser::ReadRGBA()
color.g = ReadFloat();
color.b = ReadFloat();
color.a = ReadFloat();
CheckForSeparator();
TestForSeparator();
return color;
}
@ -1369,7 +1385,7 @@ aiColor3D XFileParser::ReadRGB()
color.r = ReadFloat();
color.g = ReadFloat();
color.b = ReadFloat();
CheckForSeparator();
TestForSeparator();
return color;
}

View File

@ -116,6 +116,9 @@ protected:
//! checks for a separator char, either a ',' or a ';'
void CheckForSeparator();
/// tests and possibly consumes a separator char, but does nothing if there was no separator
void TestForSeparator();
//! reads a x file style string
void GetNextTokenAsString( std::string& poString);