diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 8b0aa111c..43563ec4d 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -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 p_bBE) { ai_assert(NULL != pCur && NULL != pCurOut); DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin"); @@ -458,9 +458,10 @@ bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut) SkipLine(&pCur); } } - // Is this needed ? it can't work as expected, if binary data start with values as space or line end. - // SkipSpacesAndLineEnd(pCur,&pCur); - *pCurOut = pCur; + if(!p_bBE) + { // 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"); return true; @@ -528,7 +529,7 @@ bool PLY::DOM::ParseInstanceBinary (const char* pCur,DOM* p_pcOut,bool p_bBE) DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin"); - if(!p_pcOut->ParseHeader(pCur,&pCur)) + if(!p_pcOut->ParseHeader(pCur,&pCur,p_bBE)) { DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure"); return false; @@ -551,7 +552,7 @@ bool PLY::DOM::ParseInstance (const char* pCur,DOM* p_pcOut) 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"); return false; diff --git a/code/PlyParser.h b/code/PlyParser.h index d02e39d85..47ea1c265 100644 --- a/code/PlyParser.h +++ b/code/PlyParser.h @@ -434,7 +434,7 @@ private: // ------------------------------------------------------------------- //! 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