From 52916b094c331da5ea615d095adb8d5d3371e23e Mon Sep 17 00:00:00 2001 From: YoheiKakiuchi Date: Thu, 6 Feb 2014 12:55:52 +0900 Subject: [PATCH 1/3] remove SkipSpaceAndLineEnd after parsing end_header in PlyParser.cpp --- code/PlyParser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 792392511..8b0aa111c 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -458,7 +458,8 @@ bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut) SkipLine(&pCur); } } - SkipSpacesAndLineEnd(pCur,&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; DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded"); From 8e35ea59d520a3449793e50f678af3a14b8cd140 Mon Sep 17 00:00:00 2001 From: YoheiKakiuchi Date: Fri, 7 Feb 2014 10:38:49 +0900 Subject: [PATCH 2/3] check binary or not in ParseHeader in PlyParser --- code/PlyParser.cpp | 13 +++++++------ code/PlyParser.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) 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 From 99e4176576461409931c38ea81623b19fafc6d7b Mon Sep 17 00:00:00 2001 From: YoheiKakiuchi Date: Tue, 18 Feb 2014 02:14:07 +0900 Subject: [PATCH 3/3] fix using flag --- code/PlyParser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 43563ec4d..51a0379fe 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 p_bBE) +bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool isBinary) { ai_assert(NULL != pCur && NULL != pCurOut); DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin"); @@ -458,7 +458,7 @@ bool PLY::DOM::ParseHeader (const char* pCur,const char** pCurOut,bool p_bBE) SkipLine(&pCur); } } - if(!p_bBE) + if(!isBinary) { // it would occur an error, if binary data start with values as space or line end. SkipSpacesAndLineEnd(pCur,&pCur); } @@ -529,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,p_bBE)) + if(!p_pcOut->ParseHeader(pCur,&pCur,true)) { DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure"); return false;