From 5a05e14e50728cb8bb6716b2a4ab36779a1ca125 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 23 Jan 2003 14:46:10 +0000 Subject: [PATCH] Fix to handling of comment records and longid's. --- src/osgPlugins/flt/flt2osg.cpp | 49 +++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/src/osgPlugins/flt/flt2osg.cpp b/src/osgPlugins/flt/flt2osg.cpp index 01cd8f7be..5bc6976f4 100644 --- a/src/osgPlugins/flt/flt2osg.cpp +++ b/src/osgPlugins/flt/flt2osg.cpp @@ -326,12 +326,9 @@ void ConvertFromFLT::visitLongID(osg::Group& osgParent, LongIDRecord* rec) { SLongID *pSLongID = (SLongID*)rec->getData(); - // these cout's are here for double checking whether handlng of the longID - // string is being managed corectly. - // std::cout << "ConvertFromFLT::visitLongID '"<szIdent,pSLongID->RecHeader.length()-4)<<"'"<szIdent<<"'"<szIdent,rec->getBodyLength())); + unsigned int stingLength = strlen(pSLongID->szIdent); + if (stingLength>rec->getBodyLength()) stingLength=rec->getBodyLength(); + osgParent.setName(std::string(pSLongID->szIdent,stingLength)); } @@ -342,20 +339,34 @@ void ConvertFromFLT::visitComment(osg::Group& osgParent, CommentRecord* rec) //std::cout << "ConvertFromFLT::visitComment '"<szComment,pSComment->RecHeader.length()-4)<<"'"<szComment<<"'"<szComment; - char* eol; - int lineno = 1; - // add all lines followed by \n - while ( commentline && (eol = strchr( commentline, '\n' ) ) ) { - *eol = '\0'; - osgParent.addDescription( commentline ); - //std::cerr << "Line " << lineno << ": " << commentline << "\n"; - ++lineno; - commentline = ++eol; + std::string commentfield(pSComment->szComment); + unsigned int front_of_line = 0; + unsigned int end_of_line = 0; + while (end_of_line