diff --git a/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchResultsEntry.C b/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchResultsEntry.C index 748db330c..d601b8de0 100644 --- a/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchResultsEntry.C +++ b/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchResultsEntry.C @@ -333,7 +333,7 @@ DtSR_SearchResultsEntry::create_matches() DtSrHitword* kwics = NULL; long n_kwics = 0; - char* parseout = NULL; + const char* parseout = NULL; // hack! overwrite f_language, since austext's value is wrong // In future, the next lines should be removed. diff --git a/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/TextParser.C b/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/TextParser.C index 000de4329..bc333fbd3 100644 --- a/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/TextParser.C +++ b/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/TextParser.C @@ -41,7 +41,7 @@ using namespace std; #define True 1 #endif -char * +const char * StringParser::brute_force(const char* text_in, int n_of_pats, const char* patterns, int sensitive) { @@ -238,18 +238,12 @@ StringParser::brute_force(const char* text_in, int n_of_pats, if (caped_text) delete[] caped_text; - string trunstr = text_run.str(); - char* ret_text = (char *)trunstr.c_str(); + static string trunstr = text_run.str(); - if (ret_text == NULL) - return NULL; - else if (*ret_text == '\0') { - delete[] ret_text; - return NULL; - } - else - return ret_text; + if (!trunstr.size()) + return NULL; + return trunstr.c_str(); } const char * @@ -332,16 +326,12 @@ StringParser::project_textrun(const char* org_textrun) const char * StringParser::hilite(const char* text, int n, const char* pats) { - char* textrun = brute_force(text, n, pats); + const char* textrun = brute_force(text, n, pats); if (textrun == NULL) return NULL; - delete[] textrun; - - const char* prjed_textrun = project_textrun(textrun); - - return prjed_textrun; + return project_textrun(textrun); } diff --git a/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/TextParser.hh b/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/TextParser.hh index 1997b1882..f94928ea8 100644 --- a/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/TextParser.hh +++ b/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/TextParser.hh @@ -12,7 +12,7 @@ public: static const char * hilite(const char* text, int n, const char* pats); - static char * + static const char * brute_force(const char* text, int, const char* pats, int sensitive = 0); static const char *