From 51b915c97bcb375e2483cde6ed32575754f9fe90 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 19 Jun 2017 21:07:18 +0200 Subject: [PATCH] openddlparser: closes https://github.com/assimp/assimp/issues/1271. --- contrib/openddlparser/code/DDLNode.cpp | 16 ++- contrib/openddlparser/code/OpenDDLCommon.cpp | 44 +++++-- contrib/openddlparser/code/OpenDDLExport.cpp | 2 +- contrib/openddlparser/code/OpenDDLParser.cpp | 133 +++++++++++---------- contrib/openddlparser/code/Value.cpp | 31 +++-- .../openddlparser/include/openddlparser/DDLNode.h | 3 + .../include/openddlparser/OpenDDLCommon.h | 7 +- .../include/openddlparser/OpenDDLParser.h | 2 +- .../include/openddlparser/OpenDDLParserUtils.h | 44 +++++-- 9 files changed, 176 insertions(+), 106 deletions(-) diff --git a/contrib/openddlparser/code/DDLNode.cpp b/contrib/openddlparser/code/DDLNode.cpp index 0cc95bd..3955e3f 100644 --- a/contrib/openddlparser/code/DDLNode.cpp +++ b/contrib/openddlparser/code/DDLNode.cpp @@ -68,8 +68,8 @@ DDLNode::DDLNode( const std::string &type, const std::string &name, size_t idx, } DDLNode::~DDLNode() { - releaseDataType( m_properties ); - releaseDataType( m_value ); + delete m_properties; + delete m_value; releaseReferencedNames( m_references ); delete m_dtArrayList; @@ -77,6 +77,9 @@ DDLNode::~DDLNode() { if( s_allocatedNodes[ m_idx ] == this ) { s_allocatedNodes[ m_idx ] = ddl_nullptr; } + for ( size_t i = 0; i::iterator it; - it = std::find( m_parent->m_children.begin(), m_parent->m_children.end(), this ); + if( ddl_nullptr != m_parent ) { + DDLNodeIt it = std::find( m_parent->m_children.begin(), m_parent->m_children.end(), this ); if( m_parent->m_children.end() != it ) { m_parent->m_children.erase( it ); } @@ -126,6 +128,8 @@ const std::string &DDLNode::getName() const { } void DDLNode::setProperties( Property *prop ) { + if(m_properties!=ddl_nullptr) + delete m_properties; m_properties = prop; } @@ -197,7 +201,7 @@ DDLNode *DDLNode::create( const std::string &type, const std::string &name, DDLN void DDLNode::releaseNodes() { if( s_allocatedNodes.size() > 0 ) { - for( DllNodeList::iterator it = s_allocatedNodes.begin(); it != s_allocatedNodes.end(); it++ ) { + for( DDLNodeIt it = s_allocatedNodes.begin(); it != s_allocatedNodes.end(); it++ ) { if( *it ) { delete *it; } diff --git a/contrib/openddlparser/code/OpenDDLCommon.cpp b/contrib/openddlparser/code/OpenDDLCommon.cpp index 13a96f7..5c341a7 100644 --- a/contrib/openddlparser/code/OpenDDLCommon.cpp +++ b/contrib/openddlparser/code/OpenDDLCommon.cpp @@ -22,6 +22,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -----------------------------------------------------------------------------------------------*/ #include #include +#include BEGIN_ODDLPARSER_NS @@ -84,7 +85,14 @@ Name::~Name() { m_id = ddl_nullptr; } -Reference::Reference() +Name::Name( const Name &name ){ + m_type=name.m_type; + m_id=new Text(name.m_id->m_buffer,name.m_id->m_len); +} + + + + Reference::Reference() : m_numRefs( 0 ) , m_referencedName( ddl_nullptr ) { // empty @@ -96,8 +104,16 @@ Reference::Reference( size_t numrefs, Name **names ) if ( numrefs > 0 ) { m_referencedName = new Name *[ numrefs ]; for ( size_t i = 0; i < numrefs; i++ ) { - Name *name = new Name( names[ i ]->m_type, names[ i ]->m_id ); - m_referencedName[ i ] = name; + m_referencedName[ i ] = names[i]; + } + } +} +Reference::Reference(const Reference &ref) { + m_numRefs=ref.m_numRefs; + if(m_numRefs!=0){ + m_referencedName = new Name*[m_numRefs]; + for ( size_t i = 0; i < m_numRefs; i++ ) { + m_referencedName[i] = new Name(*ref.m_referencedName[i]); } } } @@ -107,6 +123,7 @@ Reference::~Reference() { delete m_referencedName[ i ]; } m_numRefs = 0; + delete [] m_referencedName; m_referencedName = ddl_nullptr; } @@ -135,21 +152,30 @@ Property::Property( Text *id ) } Property::~Property() { - m_key = ddl_nullptr; - m_value = ddl_nullptr; - m_ref = ddl_nullptr;; - m_next = ddl_nullptr;; + delete m_key; + if(m_value!=ddl_nullptr) + delete m_value; + if(m_ref!=ddl_nullptr) + delete(m_ref); + if(m_next!=ddl_nullptr) + delete m_next; } DataArrayList::DataArrayList() : m_numItems( 0 ) , m_dataList( ddl_nullptr ) -, m_next( ddl_nullptr ) { +, m_next( ddl_nullptr ) +, m_refs(ddl_nullptr) +, m_numRefs(0){ // empty } DataArrayList::~DataArrayList() { - // empty + delete m_dataList; + if(m_next!=ddl_nullptr) + delete m_next; + if(m_refs!=ddl_nullptr) + delete m_refs; } size_t DataArrayList::size() { diff --git a/contrib/openddlparser/code/OpenDDLExport.cpp b/contrib/openddlparser/code/OpenDDLExport.cpp index 49207c0..35036cc 100644 --- a/contrib/openddlparser/code/OpenDDLExport.cpp +++ b/contrib/openddlparser/code/OpenDDLExport.cpp @@ -280,7 +280,7 @@ bool OpenDDLExport::writeValueType( Value::ValueType type, size_t numItems, std: statement += "["; char buffer[ 256 ]; ::memset( buffer, '\0', 256 * sizeof( char ) ); - sprintf( buffer, "%d", int(numItems) ); + sprintf( buffer, "%d", static_cast( numItems ) ); statement += buffer; statement += "]"; } diff --git a/contrib/openddlparser/code/OpenDDLParser.cpp b/contrib/openddlparser/code/OpenDDLParser.cpp index 6f471be..e903298 100644 --- a/contrib/openddlparser/code/OpenDDLParser.cpp +++ b/contrib/openddlparser/code/OpenDDLParser.cpp @@ -36,7 +36,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. BEGIN_ODDLPARSER_NS -static const char *Version = "0.3.0"; +static const char *Version = "0.4.0"; namespace Grammar { static const char *OpenBracketToken = "{"; @@ -49,7 +49,7 @@ namespace Grammar { static const char *BoolFalse = "false"; static const char *CommaSeparator = ","; - static const char* PrimitiveTypeToken[ Value::ddl_types_max ] = { + static const char *PrimitiveTypeToken[ Value::ddl_types_max ] = { "bool", "int8", "int16", @@ -74,8 +74,8 @@ const char *getTypeToken( Value::ValueType type ) { static void logInvalidTokenError( char *in, const std::string &exp, OpenDDLParser::logCallback callback ) { std::stringstream stream; stream << "Invalid token \"" << *in << "\"" << " expected \"" << exp << "\"" << std::endl; - std::string full(in); - std::string part(full.substr(0,50)); + std::string full( in ); + std::string part( full.substr( 0, 50 ) ); stream << part; callback( ddl_error_msg, stream.str() ); } @@ -85,6 +85,7 @@ static bool isIntegerType( Value::ValueType integerType ) { integerType != Value::ddl_int32 && integerType != Value::ddl_int64 ) { return false; } + return true; } @@ -105,7 +106,7 @@ static DDLNode *createDDLNode( Text *id, OpenDDLParser *parser ) { const std::string type( id->m_buffer ); DDLNode *parent( parser->top() ); DDLNode *node = DDLNode::create( type, "", parent ); - + return node; } @@ -193,10 +194,11 @@ size_t OpenDDLParser::getBufferSize() const { void OpenDDLParser::clear() { m_buffer.resize( 0 ); if( ddl_nullptr != m_context ) { - m_context->m_root = ddl_nullptr; + delete m_context; + m_context=ddl_nullptr; } - DDLNode::releaseNodes(); +// DDLNode::releaseNodes(); } bool OpenDDLParser::parse() { @@ -212,11 +214,11 @@ bool OpenDDLParser::parse() { // do the main parsing char *current( &m_buffer[ 0 ] ); - char *end( &m_buffer[ m_buffer.size() - 1 ] + 1 ); + char *end( &m_buffer[m_buffer.size() - 1 ] + 1 ); size_t pos( current - &m_buffer[ 0 ] ); while( pos < m_buffer.size() ) { current = parseNextNode( current, end ); - if(current==ddl_nullptr) { + if ( current == ddl_nullptr ) { return false; } pos = current - &m_buffer[ 0 ]; @@ -245,7 +247,7 @@ static void dumpId( Identifier *id ) { if( ddl_nullptr != id ) { if ( ddl_nullptr != id->m_text.m_buffer ) { std::cout << id->m_text.m_buffer << std::endl; - } + } } } #endif @@ -271,14 +273,17 @@ char *OpenDDLParser::parseHeader( char *in, char *end ) { } else { std::cerr << "nullptr returned by creating DDLNode." << std::endl; } + delete id; Name *name(ddl_nullptr); in = OpenDDLParser::parseName(in, end, &name); if( ddl_nullptr != name && ddl_nullptr != node ) { const std::string nodeName( name->m_id->m_buffer ); node->setName( nodeName ); + delete name; } + Property *first(ddl_nullptr); in = lookForNextToken(in, end); if (*in == Grammar::OpenPropertyToken[0]) { @@ -303,7 +308,7 @@ char *OpenDDLParser::parseHeader( char *in, char *end ) { prev = prop; } } - in++; + ++in; } // set the properties @@ -330,9 +335,9 @@ char *OpenDDLParser::parseStructure( char *in, char *end ) { return ddl_nullptr; } } while ( *in != '}' ); - in++; + ++in; } else { - in++; + ++in; logInvalidTokenError( in, std::string( Grammar::OpenBracketToken ), m_logCallback ); error = true; return ddl_nullptr; @@ -373,7 +378,7 @@ static void setNodeDataArrayList( DDLNode *currentNode, DataArrayList *dtArrayLi char *OpenDDLParser::parseStructureBody( char *in, char *end, bool &error ) { if( !isNumeric( *in ) && !isCharacter( *in ) ) { - in++; + ++in; } in = lookForNextToken( in, end ); @@ -431,7 +436,6 @@ DDLNode *OpenDDLParser::popNode() { DDLNode *topNode( top() ); m_stack.pop_back(); - return topNode; } @@ -467,7 +471,14 @@ void OpenDDLParser::normalizeBuffer( std::vector &buffer) { for( size_t readIdx = 0; readIdx( c, end ) && !isNewLine( *c ) ) { + if (isCommentOpenTag(c, end)) { + ++readIdx; + while (!isCommentCloseTag(&buffer[readIdx], end)) { + ++readIdx; + } + ++readIdx; + ++readIdx; + } else if( !isComment( c, end ) && !isNewLine( *c ) ) { newBuffer.push_back( buffer[ readIdx ] ); } else { if( isComment( c, end ) ) { @@ -535,8 +546,7 @@ char *OpenDDLParser::parseIdentifier( char *in, char *end, Text **id ) { } const size_t len( idLen ); - Text *newId = new Text( start, len ); - *id = newId; + *id = new Text( start, len ); return in; } @@ -567,14 +577,14 @@ char *OpenDDLParser::parsePrimitiveDataType( char *in, char *end, Value::ValueTy bool ok( true ); if( *in == Grammar::OpenArrayToken[ 0 ] ) { ok = false; - in++; + ++in; char *start( in ); while ( in != end ) { - in++; + ++in; if( *in == Grammar::CloseArrayToken[ 0 ] ) { len = ::atoi( start ); ok = true; - in++; + ++in; break; } } @@ -623,10 +633,10 @@ char *OpenDDLParser::parseBooleanLiteral( char *in, char *end, Value **boolean ) char *start( in ); size_t len( 0 ); while( !isSeparator( *in ) && in != end ) { - in++; - len++; + ++in; + ++len; } - len++; + ++len; int res = ::strncmp( Grammar::BoolTrue, start, strlen( Grammar::BoolTrue ) ); if( 0 != res ) { res = ::strncmp( Grammar::BoolFalse, start, strlen( Grammar::BoolFalse ) ); @@ -657,7 +667,7 @@ char *OpenDDLParser::parseIntegerLiteral( char *in, char *end, Value **integer, in = lookForNextToken( in, end ); char *start( in ); while( !isSeparator( *in ) && in != end ) { - in++; + ++in; } if( isNumeric( *start ) ) { @@ -671,29 +681,29 @@ char *OpenDDLParser::parseIntegerLiteral( char *in, char *end, Value **integer, *integer = ValueAllocator::allocPrimData( integerType ); switch( integerType ) { case Value::ddl_int8: - ( *integer )->setInt8( (int8) value ); - break; + ( *integer )->setInt8( (int8) value ); + break; case Value::ddl_int16: - ( *integer )->setInt16( ( int16 ) value ); - break; + ( *integer )->setInt16( ( int16 ) value ); + break; case Value::ddl_int32: - ( *integer )->setInt32( ( int32 ) value ); - break; + ( *integer )->setInt32( ( int32 ) value ); + break; case Value::ddl_int64: - ( *integer )->setInt64( ( int64 ) value ); - break; + ( *integer )->setInt64( ( int64 ) value ); + break; case Value::ddl_unsigned_int8: - ( *integer )->setUnsignedInt8( (uint8) uvalue ); - break; + ( *integer )->setUnsignedInt8( (uint8) uvalue ); + break; case Value::ddl_unsigned_int16: - ( *integer )->setUnsignedInt16( ( uint16 ) uvalue ); - break; + ( *integer )->setUnsignedInt16( ( uint16 ) uvalue ); + break; case Value::ddl_unsigned_int32: - ( *integer )->setUnsignedInt32( ( uint32 ) uvalue ); - break; + ( *integer )->setUnsignedInt32( ( uint32 ) uvalue ); + break; case Value::ddl_unsigned_int64: - ( *integer )->setUnsignedInt64( ( uint64 ) uvalue ); - break; + ( *integer )->setUnsignedInt64( ( uint64 ) uvalue ); + break; default: break; } @@ -711,7 +721,7 @@ char *OpenDDLParser::parseFloatingLiteral( char *in, char *end, Value **floating in = lookForNextToken( in, end ); char *start( in ); while( !isSeparator( *in ) && in != end ) { - in++; + ++in; } // parse the float value @@ -732,8 +742,7 @@ char *OpenDDLParser::parseFloatingLiteral( char *in, char *end, Value **floating } if( ok ) { - if(floatType == Value::ddl_double) - { + if ( floatType == Value::ddl_double ) { const double value( atof( start ) ); *floating = ValueAllocator::allocPrimData( Value::ddl_double ); ( *floating )->setDouble( value ); @@ -757,17 +766,17 @@ char *OpenDDLParser::parseStringLiteral( char *in, char *end, Value **stringData size_t len( 0 ); char *start( in ); if( *start == '\"' ) { - start++; - in++; + ++start; + ++in; while( *in != '\"' && in != end ) { - in++; - len++; + ++in; + ++len; } *stringData = ValueAllocator::allocPrimData( Value::ddl_string, len ); ::strncpy( ( char* ) ( *stringData )->m_data, start, len ); ( *stringData )->m_data[len] = '\0'; - in++; + ++in; } return in; @@ -791,12 +800,12 @@ char *OpenDDLParser::parseHexaLiteral( char *in, char *end, Value **data ) { return in; } - in++; + ++in; if( *in != 'x' && *in != 'X' ) { return in; } - in++; + ++in; bool ok( true ); char *start( in ); int pos( 0 ); @@ -805,8 +814,8 @@ char *OpenDDLParser::parseHexaLiteral( char *in, char *end, Value **data ) { ok = false; break; } - pos++; - in++; + ++pos; + ++in; } if( !ok ) { @@ -816,9 +825,9 @@ char *OpenDDLParser::parseHexaLiteral( char *in, char *end, Value **data ) { int value( 0 ); while( pos > 0 ) { int v = hex2Decimal( *start ); - pos--; + --pos; value = ( value << 4 ) | v; - start++; + ++start; } *data = ValueAllocator::allocPrimData( Value::ddl_unsigned_int64 ); @@ -841,7 +850,7 @@ char *OpenDDLParser::parseProperty( char *in, char *end, Property **prop ) { if( ddl_nullptr != id ) { in = lookForNextToken( in, end ); if( *in == '=' ) { - in++; + ++in; in = getNextToken( in, end ); Value *primData( ddl_nullptr ); if( isInteger( in, end ) ) { @@ -862,6 +871,8 @@ char *OpenDDLParser::parseProperty( char *in, char *end, Property **prop ) { ( *prop )->m_ref = ref; } } + } else { + delete id; } } @@ -878,7 +889,7 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value::ValueType type, in = lookForNextToken( in, end ); if( *in == '{' ) { - in++; + ++in; Value *current( ddl_nullptr ), *prev( ddl_nullptr ); while( '}' != *in ) { current = ddl_nullptr; @@ -934,7 +945,7 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value::ValueType type, prev->setNext( current ); prev = current; } - numValues++; + ++numValues; } in = getNextSeparator( in, end ); @@ -942,7 +953,7 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value::ValueType type, break; } } - in++; + ++in; } return in; @@ -972,7 +983,7 @@ char *OpenDDLParser::parseDataArrayList( char *in, char *end,Value::ValueType ty in = lookForNextToken( in, end ); if( *in == Grammar::OpenBracketToken[ 0 ] ) { - in++; + ++in; Value *currentValue( ddl_nullptr ); Reference *refs( ddl_nullptr ); DataArrayList *prev( ddl_nullptr ), *currentDataList( ddl_nullptr ); @@ -995,7 +1006,7 @@ char *OpenDDLParser::parseDataArrayList( char *in, char *end,Value::ValueType ty } } while( Grammar::CommaSeparator[ 0 ] == *in && in != end ); in = lookForNextToken( in, end ); - in++; + ++in; } return in; diff --git a/contrib/openddlparser/code/Value.cpp b/contrib/openddlparser/code/Value.cpp index 3e251c5..408cdd4 100644 --- a/contrib/openddlparser/code/Value.cpp +++ b/contrib/openddlparser/code/Value.cpp @@ -110,7 +110,17 @@ Value::Value( ValueType type ) } Value::~Value() { - // empty + if(m_data!=ddl_nullptr) { + if (m_type == ddl_ref ) { + Reference *tmp = (Reference *) m_data; + if (tmp != ddl_nullptr) + delete tmp; + }else + delete[] m_data; + + } + if(m_next!=ddl_nullptr) + delete m_next; } void Value::setBool( bool value ) { @@ -273,13 +283,7 @@ void Value::setRef( Reference *ref ) { delete [] m_data; } - m_data = new unsigned char[ sizeof( Reference ) ]; - Reference *myRef = ( Reference * ) m_data; - myRef->m_numRefs = ref->m_numRefs; - myRef->m_referencedName = new Name *[ myRef->m_numRefs ]; - for ( size_t i = 0; i < myRef->m_numRefs; i++ ) { - myRef->m_referencedName[ i ] = new Name( ref->m_referencedName[ i ]->m_type, ref->m_referencedName[ i ]->m_id ); - } + m_data = (unsigned char*) new Reference(*ref); } } } @@ -366,7 +370,6 @@ Value *ValueAllocator::allocPrimData( Value::ValueType type, size_t len ) { } Value *data = new Value( type ); - data->m_type = type; switch( type ) { case Value::ddl_bool: data->m_size = sizeof( bool ); @@ -405,10 +408,10 @@ Value *ValueAllocator::allocPrimData( Value::ValueType type, size_t len ) { data->m_size = sizeof( double ); break; case Value::ddl_string: - data->m_size = sizeof( char ); + data->m_size = sizeof( char )*(len+1); break; case Value::ddl_ref: - data->m_size = sizeof( char ); + data->m_size = 0; break; case Value::ddl_none: case Value::ddl_types_max: @@ -417,12 +420,8 @@ Value *ValueAllocator::allocPrimData( Value::ValueType type, size_t len ) { } if( data->m_size ) { - size_t len1( len ); - if( Value::ddl_string == type ) { - len1++; - } - data->m_size *= len1; data->m_data = new unsigned char[ data->m_size ]; + ::memset(data->m_data,0,data->m_size); } return data; diff --git a/contrib/openddlparser/include/openddlparser/DDLNode.h b/contrib/openddlparser/include/openddlparser/DDLNode.h index 1371356..184cd01 100644 --- a/contrib/openddlparser/include/openddlparser/DDLNode.h +++ b/contrib/openddlparser/include/openddlparser/DDLNode.h @@ -53,6 +53,9 @@ public: /// @brief The child-node-list type. typedef std::vector DllNodeList; + /// @brief The child-node-list iterator. + typedef std::vector::iterator DDLNodeIt; + public: /// @brief The class destructor. ~DDLNode(); diff --git a/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h b/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h index d3e0fb4..bec62cc 100644 --- a/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h +++ b/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h @@ -148,12 +148,12 @@ struct DLL_ODDLPARSER_EXPORT Name { /// @param type [in] The name type. /// @param id [in] The id. Name( NameType type, Text *id ); - + Name( const Name &name ); /// @brief The destructor. ~Name(); private: - Name( const Name & ) ddl_no_copy; + Name &operator = ( const Name& ) ddl_no_copy; }; @@ -164,7 +164,7 @@ struct DLL_ODDLPARSER_EXPORT Reference { /// @brief The default constructor. Reference(); - + Reference( const Reference &ref ); /// @brief The constructor with an array of ref names. /// @param numrefs [in] The number of ref names. /// @param names [in] The ref names. @@ -178,7 +178,6 @@ struct DLL_ODDLPARSER_EXPORT Reference { size_t sizeInBytes(); private: - Reference( const Reference & ) ddl_no_copy; Reference &operator = ( const Reference & ) ddl_no_copy; }; diff --git a/contrib/openddlparser/include/openddlparser/OpenDDLParser.h b/contrib/openddlparser/include/openddlparser/OpenDDLParser.h index efeab60..7241c74 100644 --- a/contrib/openddlparser/include/openddlparser/OpenDDLParser.h +++ b/contrib/openddlparser/include/openddlparser/OpenDDLParser.h @@ -47,7 +47,7 @@ struct Property; template inline T *lookForNextToken( T *in, T *end ) { - while( ( isSpace( *in ) || isNewLine( *in ) || ',' == *in ) && ( in != end ) ) { + while( ( in != end ) && ( isSpace( *in ) || isNewLine( *in ) || ',' == *in ) ) { in++; } return in; diff --git a/contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h b/contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h index 778a1b4..6489743 100644 --- a/contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h +++ b/contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h @@ -84,7 +84,7 @@ static const unsigned char chartype_table[ 256 ] = { template inline bool isNumeric( const T in ) { - return ( chartype_table[ static_cast( in ) ] == 1 ); + return ( chartype_table[ static_cast( in ) ] == 1 ); } template @@ -98,7 +98,7 @@ inline bool isInteger( T *in, T *end ) { if( in != end ) { if( *in == '-' ) { - in++; + ++in; } } @@ -108,7 +108,7 @@ bool isInteger( T *in, T *end ) { if( !result ) { break; } - in++; + ++in; } return result; @@ -119,7 +119,7 @@ inline bool isFloat( T *in, T *end ) { if( in != end ) { if( *in == '-' ) { - in++; + ++in; } } @@ -134,12 +134,12 @@ bool isFloat( T *in, T *end ) { if( !result ) { return false; } - in++; + ++in; } // check for 1<.>0f if( *in == '.' ) { - in++; + ++in; } else { return false; } @@ -150,7 +150,7 @@ bool isFloat( T *in, T *end ) { if( !result ) { return false; } - in++; + ++in; } return result; @@ -208,7 +208,7 @@ template inline static T *getNextSeparator( T *in, T *end ) { while( !isSeparator( *in ) || in == end ) { - in++; + ++in; } return in; } @@ -250,5 +250,33 @@ bool isComment( T *in, T *end ) { return false; } +template +inline +bool isCommentOpenTag(T *in, T *end ) { + if (*in == '/') { + if (in + 1 != end) { + if (*(in + 1) == '*') { + return true; + } + } + } + + return false; +} + +template +inline +bool isCommentCloseTag(T *in, T *end) { + if (*in == '*') { + if (in + 1 != end) { + if (*(in + 1) == '/') { + return true; + } + } + } + + return false; +} + END_ODDLPARSER_NS -- 2.7.4