Merge pull request #218 from YoheiKakiuchi/fix-ply-parse

remove SkipSpaceAndLineEnd after parsing end_header in PlyParser.cpp
pull/228/head
Kim Kulling 2014-02-26 16:42:18 +01:00
commit fd4cd67edb
2 changed files with 8 additions and 6 deletions

View File

@ -427,7 +427,7 @@ bool PLY::DOM::SkipComments (const char* pCur,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut) bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool isBinary)
{ {
ai_assert(NULL != pCur && NULL != pCurOut); ai_assert(NULL != pCur && NULL != pCurOut);
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin"); DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin");
@ -458,8 +458,10 @@ bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut)
SkipLine(&pCur); SkipLine(&pCur);
} }
} }
SkipSpacesAndLineEnd(pCur,&pCur); if(!isBinary)
*pCurOut = pCur; { // it would occur an error, if binary data start with values as space or line end.
SkipSpacesAndLineEnd(pCur,&pCur);
}
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded"); DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded");
return true; return true;
@ -527,7 +529,7 @@ bool PLY::DOM::ParseInstanceBinary (const char* pCur,DOM* p_pcOut,bool p_bBE)
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin"); DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin");
if(!p_pcOut->ParseHeader(pCur,&pCur)) if(!p_pcOut->ParseHeader(pCur,&pCur,true))
{ {
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure"); DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure");
return false; return false;
@ -550,7 +552,7 @@ bool PLY::DOM::ParseInstance (const char* pCur,DOM* p_pcOut)
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() begin"); DefaultLogger::get()->debug("PLY::DOM::ParseInstance() begin");
if(!p_pcOut->ParseHeader(pCur,&pCur)) if(!p_pcOut->ParseHeader(pCur,&pCur,false))
{ {
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() failure"); DefaultLogger::get()->debug("PLY::DOM::ParseInstance() failure");
return false; return false;

View File

@ -434,7 +434,7 @@ private:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//! Handle the file header and read all element descriptions //! Handle the file header and read all element descriptions
bool ParseHeader (const char* pCur,const char** pCurOut); bool ParseHeader (const char* pCur,const char** pCurOut, bool p_bBE);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//! Read in all element instance lists //! Read in all element instance lists