cmXml.c : Fixed bug in _cmXmlNoteHasChildWithAttrAndValue().

This commit is contained in:
kevin 2016-02-11 19:22:43 -05:00
parent d7a7b3a895
commit 0bd988e2df

10
cmXml.c
View File

@ -1063,7 +1063,7 @@ bool cmXmlNodeHasChild( const cmXmlNode_t* np, const cmChar_t* label, ... )
bool _cmXmlNodeHasChildWithAttrAndValueV( const cmXmlNode_t* np, const cmChar_t* label, va_list vl0, bool valueFl ) bool _cmXmlNodeHasChildWithAttrAndValueV( const cmXmlNode_t* np, const cmChar_t* label, va_list vl0, bool valueFl )
{ {
unsigned argN = _cmXmlLabelCount(label,vl0); unsigned argN = _cmXmlLabelCount(label,vl0);
unsigned n = valueFl ? 2 : 1; unsigned n = valueFl ? 2 : 1;
va_list vl1; va_list vl1;
unsigned i; unsigned i;
@ -1072,15 +1072,17 @@ bool _cmXmlNodeHasChildWithAttrAndValueV( const cmXmlNode_t* np, const cmChar
if( argN <= n-1 ) if( argN <= n-1 )
return false; return false;
argN -= n;
va_copy(vl1,vl0); va_copy(vl1,vl0);
np = _cmXmlNodeHasChildV(np,label,vl1,argN-1); np = _cmXmlNodeHasChildV(np,label,vl1,argN);
va_end(vl1); va_end(vl1);
if( np == NULL ) if( np == NULL )
return false; return false;
// advance vl0 to the attribute label // advance vl0 to the attribute label
for(i=0; i<argN-1; ++i) for(i=1; i<argN; ++i)
{ {
label = va_arg(vl0,const cmChar_t*); label = va_arg(vl0,const cmChar_t*);
assert( label != NULL ); assert( label != NULL );