From: Ulrich Wilkens Date: Thu, 20 Feb 2014 18:48:56 +0000 (+0100) Subject: Fix for dtinfo segfaults X-Git-Tag: 2.2.1~5 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d0a57b6d57338d83a0cc5376a3f1a20d3e2ce106;p=oweals%2Fcde.git Fix for dtinfo segfaults --- diff --git a/cde/programs/dtinfo/dtinfo/src/Agents/IcccmAgent.C b/cde/programs/dtinfo/dtinfo/src/Agents/IcccmAgent.C index a7c912b1..0f3f14d6 100644 --- a/cde/programs/dtinfo/dtinfo/src/Agents/IcccmAgent.C +++ b/cde/programs/dtinfo/dtinfo/src/Agents/IcccmAgent.C @@ -141,11 +141,7 @@ IcccmAgent::value_handler(Widget w, XtPointer ia, Atom *selection, free(wcs); } #endif -#if 0 (((IcccmAgent*)ia)->*f_string_handler)((char*)value, *length); -#else - (((IcccmAgent*)f_real_object)->*f_string_handler)((char*)value, *length); -#endif XtFree((char*)value); } else if (*type == XA_COMPOUND_TEXT(XtDisplay(w))) { @@ -168,11 +164,7 @@ IcccmAgent::value_handler(Widget w, XtPointer ia, Atom *selection, *((char *) memcpy(mbs, string_list[i], len) + len) = '\0'; } XwcFreeStringList((wchar_t**)string_list); -#if 0 (((IcccmAgent*)ia)->*f_string_handler)(mbs, strlen(mbs)); -#else - (((IcccmAgent*)f_real_object)->*f_string_handler)(mbs, strlen(mbs)); -#endif free((void*)mbs); } else { diff --git a/cde/programs/dtinfo/dtinfo/src/Query/QueryGroup.C b/cde/programs/dtinfo/dtinfo/src/Query/QueryGroup.C index 09a09211..3be6fae4 100644 --- a/cde/programs/dtinfo/dtinfo/src/Query/QueryGroup.C +++ b/cde/programs/dtinfo/dtinfo/src/Query/QueryGroup.C @@ -383,7 +383,7 @@ QueryGroup::gen_query_internal (query_type_t query_type) int QueryGroup::format (query_type_t query_type, QueryTerm *term) { - char *s = (char*)"\001s", *tmp; + char *s = strdup("\001s"), *tmp; // Need two buffers for alternating writes. // Allocate a buffer with enough room for term plus operators. static char *buf[2]; diff --git a/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchEngine.C b/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchEngine.C index 137cc1f5..b2262f9c 100644 --- a/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchEngine.C +++ b/cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchEngine.C @@ -620,6 +620,11 @@ DtSR_SearchEngine::search(UAS_String oql, UAS_SearchScope& scope, UAS_String msg(CATGETS(Set_DtSR_SearchEngine, 1, "DtSearch does not support the query.")); DtSearchFreeMessages(); + + if (current_bc != 0) { + targets.remove(current_bc); + current_bc = NULL; + } throw(CASTUASEXCEPT UAS_Exception(msg)); continue; @@ -692,10 +697,10 @@ DtSR_SearchEngine::search(UAS_String oql, UAS_SearchScope& scope, UAS_Pointer stems = bookcases[index]->takeover_stems(); UAS_Pointer q = new UAS_String(oql); - UAS_Pointer n = new UAS_String(scope.name()); + UAS_Pointer s = new UAS_String(scope.name()); UAS_Pointer DtSR_res = - new DtSR_SearchResults(q, n, res, res->length(), + new DtSR_SearchResults(q, s, res, res->length(), stems, scope.search_zones(), stype); if (DtSR_result == (int)0) diff --git a/cde/programs/dtinfo/dtinfogen/infolib/etc/dtinfogen_worker.c b/cde/programs/dtinfo/dtinfogen/infolib/etc/dtinfogen_worker.c index 35b21484..1e8e96d1 100644 --- a/cde/programs/dtinfo/dtinfogen/infolib/etc/dtinfogen_worker.c +++ b/cde/programs/dtinfo/dtinfogen/infolib/etc/dtinfogen_worker.c @@ -1867,7 +1867,7 @@ buildTOC(int argc, char *argv[]) len = MIN(strlen(gStruct->id), MAXPATHLEN); *((char *) memcpy (idBuf, gStruct->id, len) + len) = '\0'; len = MIN(strlen(gStruct->title), MAXPATHLEN); - *((char *) memcpy (titleBuf, gStruct->id, len) + len) = '\0'; + *((char *) memcpy (titleBuf, gStruct->title, len) + len) = '\0'; if (checkStat(gStruct->outFile, FSTAT_IS_FILE)) {