X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=XMLTree.cpp;h=b5e53a78f0b2e4e8c4ce546c6251cbbcd267d21c;hb=1c3300373a43062be9bb8d23faf3c8446f9aa6c5;hp=ea12fad9080f4a09c3f864d694e40a149f6eb3e2;hpb=143f18091facab1154eb750b6ed530905bfed889;p=SXSI%2FXMLTree.git diff --git a/XMLTree.cpp b/XMLTree.cpp index ea12fad..b5e53a7 100644 --- a/XMLTree.cpp +++ b/XMLTree.cpp @@ -1,6 +1,5 @@ - #include "XMLTree.h" - +#include // functions to convert tag positions to the corresponding tree node and viceversa. // These are implemented in order to be able to change the tree and Tags representations, // without affecting the code so much. @@ -584,7 +583,7 @@ int XMLTree::OpenDocument(bool empty_texts, int sample_rate_text) setbit(par_aux,npar,OP); // marks a new opening parenthesis for the tree root npar++; - tags_aux = (TagType *)malloc(sizeof(TagType)); + tags_aux = (TagType *) malloc(sizeof(TagType)); if (!tags_aux) { fprintf(stderr, "Error: not enough memory\n"); return NULLT; @@ -665,6 +664,7 @@ int XMLTree::NewOpenTag(unsigned char *tagname) fprintf(stderr, "Error: not enough memory\n"); return NULLT; } + setbit(par_aux,npar,OP); // marks a new opening parenthesis // transforms the tagname into a tag identifier. If the tag is new, we insert @@ -684,9 +684,7 @@ int XMLTree::NewOpenTag(unsigned char *tagname) TagName[i] = (unsigned char *)malloc(sizeof(unsigned char)*(strlen((const char *)tagname)+1)); strcpy((char *)TagName[i], (const char *)tagname); } - - tags_aux = (TagType *)realloc(tags_aux, sizeof(TagType)*(npar + 1)); - + tags_aux = (TagType *) realloc(tags_aux, sizeof(TagType)*(npar + 1)); if (!tags_aux) { fprintf(stderr, "Error: not enough memory\n"); return NULLT;