Browse Source

cmXml.c : Fixed bug in _cmXmlNoteHasChildWithAttrAndValue().

master
kevin 8 years ago
parent
commit
0bd988e2df
1 changed files with 6 additions and 4 deletions
  1. 6
    4
      cmXml.c

+ 6
- 4
cmXml.c View File

1063
 bool    _cmXmlNodeHasChildWithAttrAndValueV( const cmXmlNode_t* np, const cmChar_t* label, va_list vl0, bool valueFl )
1063
 bool    _cmXmlNodeHasChildWithAttrAndValueV( const cmXmlNode_t* np, const cmChar_t* label, va_list vl0, bool valueFl )
1064
 {
1064
 {
1065
   unsigned argN = _cmXmlLabelCount(label,vl0);
1065
   unsigned argN = _cmXmlLabelCount(label,vl0);
1066
-  unsigned    n = valueFl ? 2 : 1;
1066
+  unsigned    n = valueFl ? 2 : 1;  
1067
   va_list vl1;
1067
   va_list vl1;
1068
   unsigned i;
1068
   unsigned i;
1069
   
1069
   
1072
   if( argN <= n-1 )
1072
   if( argN <= n-1 )
1073
     return false;
1073
     return false;
1074
 
1074
 
1075
+  argN -= n;
1076
+
1075
   va_copy(vl1,vl0);
1077
   va_copy(vl1,vl0);
1076
-  np = _cmXmlNodeHasChildV(np,label,vl1,argN-1);
1078
+  np = _cmXmlNodeHasChildV(np,label,vl1,argN);
1077
   va_end(vl1);
1079
   va_end(vl1);
1078
 
1080
 
1079
   if( np == NULL )
1081
   if( np == NULL )
1080
     return false;
1082
     return false;
1081
-
1083
+  
1082
   // advance vl0 to the attribute label
1084
   // advance vl0 to the attribute label
1083
-  for(i=0; i<argN-1; ++i)
1085
+  for(i=1; i<argN; ++i)
1084
   {
1086
   {
1085
     label = va_arg(vl0,const cmChar_t*);
1087
     label = va_arg(vl0,const cmChar_t*);
1086
     assert( label != NULL );
1088
     assert( label != NULL );

Loading…
Cancel
Save