From 2f97d9bd8fe3e35599a0b8ec22050b86c623fa3d Mon Sep 17 00:00:00 2001 From: Dave Gargan Date: Fri, 31 Jan 2020 11:22:03 +0000 Subject: [PATCH] In PLY import consume comments that appear before format header --- wrap/ply/plylib.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/wrap/ply/plylib.cpp b/wrap/ply/plylib.cpp index d7af2f4c..8530349f 100644 --- a/wrap/ply/plylib.cpp +++ b/wrap/ply/plylib.cpp @@ -1052,6 +1052,24 @@ int PlyFile::OpenRead( const char * filename ) error = E_UNESPECTEDEOF; goto error; } + + while (!strcmp(token, COMMENT)) + { + comments.push_back(string(token + strlen(token) + 1)); + if (pb_fgets(buf, MAXB - 1, gzfp) == 0) + { + error = E_UNESPECTEDEOF; + goto error; + } + header.append(buf); + +#ifdef __MINGW32__ + token = strtok(buf, SEP); +#else + token = strtok_r(buf, SEP, &tokenPtr); +#endif + } + if( strcmp(token,FORMAT) ) { error = E_NOFORMAT;