From b53633fb64f387edb5cebefbb3308b6347b2389c Mon Sep 17 00:00:00 2001 From: fclaude Date: Sat, 21 Mar 2009 19:07:26 +0000 Subject: [PATCH] Fixes git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/XMLTree@263 3cdefd35-fc62-479d-8e8d-bae585ffb9ca --- XMLTree.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/XMLTree.cpp b/XMLTree.cpp index 2a1ca71..ae80fc2 100644 --- a/XMLTree.cpp +++ b/XMLTree.cpp @@ -1041,12 +1041,12 @@ int XMLTree::CloseDocument() // If we found an attribute then "<@>" is present in the tree // if we didn't then it is not. "<$>" is never present in the tree - uint max_tag = 0; - for(uint i=0;i<(uint)npar-1;i++) - max_tag = max(max_tag,tags_aux[i]); - max_tag++; - tags_aux = (TagType *) urealloc(tags_aux, sizeof(TagType)*(npar + 1)); - tags_aux[npar++] = max_tag; + //uint max_tag = 0; + //for(uint i=0;i<(uint)npar-1;i++) + // max_tag = max(max_tag,tags_aux[i]); + //max_tag++; + //tags_aux = (TagType *) urealloc(tags_aux, sizeof(TagType)*(npar + 1)); + //tags_aux[npar++] = max_tag; //int ntagsize = found_attributes ? 2*ntagnames-1 : 2*ntagnames - 2; int ntagsize = 2*ntagnames + 2; @@ -1253,7 +1253,7 @@ TagType XMLTree::GetTagId(unsigned char *tagname) // this should be changed for more efficient processing for (i=0; i= ntagnames) return NULL; // invalid tag identifier s = (unsigned char *)umalloc((strlen((const char *)TagName[tagid])+1)*sizeof(unsigned char)); strcpy((char *)s, (const char *)TagName[tagid]); @@ -1275,6 +1275,7 @@ unsigned char *XMLTree::GetTagName(TagType tagid) const unsigned char *XMLTree::GetTagNameByRef(TagType tagid) { + if(tagid==(uint)-1) return NULL; if (tagid >= ntagnames) return NULL; // invalid tag identifier return ((const unsigned char*) TagName[tagid]); } -- 2.17.1