From: kim Date: Mon, 2 Mar 2009 00:54:24 +0000 (+0000) Subject: don't return .c_str() without copying it first X-Git-Url: http://git.nguyen.vg/gitweb/?a=commitdiff_plain;h=b6f779e236950176bab71fce980ac1685e8661c0;p=SXSI%2FXMLTree.git don't return .c_str() without copying it first git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/XMLTree@193 3cdefd35-fc62-479d-8e8d-bae585ffb9ca --- diff --git a/XMLTree.h b/XMLTree.h index d446ab1..c6542a0 100644 --- a/XMLTree.h +++ b/XMLTree.h @@ -401,7 +401,8 @@ public: } uchar* GetCachedText(DocID d) { - return (uchar*) (CachedText.at(d).c_str()); + uchar * str = (uchar*) calloc(sizeof(char),(CachedText.at(d).size() + 1)); + return (uchar*) (str); } TextCollection *getTextCollection() { diff --git a/makefile b/makefile index 1b3dc58..4f06f3b 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,4 @@ -FLAGS = -O3 -I./libcds/includes/ +FLAGS =-std=c++0x -O3 -I./libcds/includes/ OBJECTS=libcds/lib/libcds.a OBJECTS_TC= TextCollection/TextCollection.o TextCollection/CSA.o TextCollection/Tools.o TextCollection/BitRank.o TextCollection/bittree.o TextCollection/rbtree.o TextCollection/dynFMI.o TextCollection/RLWaveletTree.o TextCollection/GapEncode.o TextCollection/BSGAP.o