Makefile should not include testTextCollection.o which is only a testing program
authorkim <kim@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Thu, 27 Nov 2008 07:17:07 +0000 (07:17 +0000)
committerkim <kim@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Thu, 27 Nov 2008 07:17:07 +0000 (07:17 +0000)
(and contains a main). XMLTree.h should contain <cstring> !

git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/XMLTree@18 3cdefd35-fc62-479d-8e8d-bae585ffb9ca

XMLTree.cpp
XMLTree.h
makefile

index ea12fad..b5e53a7 100644 (file)
@@ -1,6 +1,5 @@
-\r
 #include "XMLTree.h"\r
-\r
+#include <cstring>\r
 // functions to convert tag positions to the corresponding tree node and viceversa. \r
 // These are implemented in order to be able to change the tree and Tags representations, \r
 // without affecting the code so much.\r
@@ -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\r
     npar++;\r
     \r
-    tags_aux = (TagType *)malloc(sizeof(TagType));\r
+    tags_aux = (TagType *) malloc(sizeof(TagType));\r
     if (!tags_aux) {\r
        fprintf(stderr, "Error: not enough memory\n");\r
        return NULLT;\r
@@ -665,6 +664,7 @@ int XMLTree::NewOpenTag(unsigned char *tagname)
        fprintf(stderr, "Error: not enough memory\n");\r
        return NULLT;    \r
     }\r
+\r
     setbit(par_aux,npar,OP);  // marks a new opening parenthesis\r
 \r
     // transforms the tagname into a tag identifier. If the tag is new, we insert\r
@@ -684,9 +684,7 @@ int XMLTree::NewOpenTag(unsigned char *tagname)
        TagName[i] = (unsigned char *)malloc(sizeof(unsigned char)*(strlen((const char *)tagname)+1));\r
        strcpy((char *)TagName[i], (const char *)tagname);\r
     } \r
-    \r
-    tags_aux = (TagType *)realloc(tags_aux, sizeof(TagType)*(npar + 1));\r
-\r
+    tags_aux = (TagType *) realloc(tags_aux, sizeof(TagType)*(npar + 1));\r
     if (!tags_aux) {\r
        fprintf(stderr, "Error: not enough memory\n");\r
        return NULLT;\r
index c0dab2b..ba01941 100644 (file)
--- a/XMLTree.h
+++ b/XMLTree.h
@@ -333,7 +333,7 @@ public:
    /** GetText(d): returns the text corresponding to document with\r
     * id d. */\r
    uchar* GetText(DocID d) {\r
-      Text->GetText(d);\r
+      return Text->GetText(d);\r
    }\r
    \r
    /** Save: saves XML tree data structure to file. */\r
index 5db952e..c3a7e94 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,7 +1,7 @@
-FLAGS = -O9 -I./libcds/includes/\r
+FLAGS = -O3 -I./libcds/includes/\r
 \r
 OBJECTS=libcds/lib/libcds.a\r
-OBJECTS_TC= TextCollection/BitRank.o TextCollection/dynFMI.o TextCollection/rbtree.o TextCollection/Tools.o TextCollection/bittree.o TextCollection/handle.o TextCollection/testTextCollection.o TextCollection/CSA.o TextCollection/pos.o TextCollection/TextCollection.o\r
+OBJECTS_TC= TextCollection/BitRank.o TextCollection/dynFMI.o TextCollection/rbtree.o TextCollection/Tools.o TextCollection/bittree.o TextCollection/handle.o TextCollection/CSA.o TextCollection/pos.o TextCollection/TextCollection.o\r
 \r
 \r
 all: libcds text_collection XMLTree\r