diff --git a/contrib/openddlparser/code/OpenDDLParser.cpp b/contrib/openddlparser/code/OpenDDLParser.cpp index 5ff314aa5..58ed87941 100644 --- a/contrib/openddlparser/code/OpenDDLParser.cpp +++ b/contrib/openddlparser/code/OpenDDLParser.cpp @@ -352,7 +352,8 @@ char *OpenDDLParser::parseStructureBody( char *in, char *end, bool &error ) { DataArrayList *dtArrayList( ddl_nullptr ); Value *values( ddl_nullptr ); if( 1 == arrayLen ) { - in = parseDataList( in, end, &values, &refs ); + size_t numRefs( 0 ), numValues( 0 ); + in = parseDataList( in, end, &values, numValues, &refs, numRefs ); setNodeValues( top(), values ); setNodeReferences( top(), refs ); } else if( arrayLen > 1 ) { @@ -797,8 +798,9 @@ char *OpenDDLParser::parseProperty( char *in, char *end, Property **prop ) { return in; } -char *OpenDDLParser::parseDataList( char *in, char *end, Value **data, Reference **refs ) { +char *OpenDDLParser::parseDataList( char *in, char *end, Value **data, size_t &numValues, Reference **refs, size_t &numRefs ) { *data = ddl_nullptr; + numValues = numRefs = 0; if( ddl_nullptr == in || in == end ) { return in; } @@ -824,6 +826,7 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value **data, Reference if( !names.empty() ) { Reference *ref = new Reference( names.size(), &names[ 0 ] ); *refs = ref; + numRefs = names.size(); } } @@ -835,6 +838,7 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value **data, Reference prev->setNext( current ); prev = current; } + numValues++; } in = getNextSeparator( in, end ); @@ -861,11 +865,13 @@ char *OpenDDLParser::parseDataArrayList( char *in, char *end, DataArrayList **da Reference *refs( ddl_nullptr ); DataArrayList *prev( ddl_nullptr ), *currentDataList( ddl_nullptr ); do { - in = parseDataList( in, end, ¤t, &refs ); + size_t numRefs( 0 ), numValues( 0 ); + in = parseDataList( in, end, ¤t, numValues, &refs, numRefs ); if( ddl_nullptr != current ) { if( ddl_nullptr == prev ) { *dataList = new DataArrayList; - (*dataList)->m_dataList = current; + ( *dataList )->m_dataList = current; + ( *dataList )->m_numItems = numValues; prev = *dataList; } else { currentDataList = new DataArrayList; diff --git a/contrib/openddlparser/include/openddlparser/OpenDDLParser.h b/contrib/openddlparser/include/openddlparser/OpenDDLParser.h index 00f2c2e58..67d3322e0 100644 --- a/contrib/openddlparser/include/openddlparser/OpenDDLParser.h +++ b/contrib/openddlparser/include/openddlparser/OpenDDLParser.h @@ -96,7 +96,7 @@ public: // static parser helpers static char *parseStringLiteral( char *in, char *end, Value **stringData ); static char *parseHexaLiteral( char *in, char *end, Value **data ); static char *parseProperty( char *in, char *end, Property **prop ); - static char *parseDataList( char *in, char *end, Value **data, Reference **refs ); + static char *parseDataList( char *in, char *end, Value **data, size_t &numValues, Reference **refs, size_t &numRefs ); static char *parseDataArrayList( char *in, char *end, DataArrayList **dataList ); static const char *getVersion();