Fix dtinfo search engine

This commit is contained in:
Ulrich Wilkens
2014-04-01 04:45:33 +02:00
committed by Jon Trulson
parent 0254ebc0b4
commit 38dfc9e235
68 changed files with 252 additions and 135 deletions

View File

@@ -133,7 +133,7 @@ IcccmAgent::value_handler(Widget w, XtPointer ia, Atom *selection,
char* mbs = (char *)value;
wchar_t *wcs = (wchar_t*)malloc(strlen(mbs) + 1);
// check if value string can be valid in current locale
if (mbstowcs(wcs, mbs, strlen(mbs) + 1) < 0) { // invalid
if ((long)mbstowcs(wcs, mbs, strlen(mbs) + 1) < 0) { // invalid
const char* p = extract_ascii((char*)value);
XtFree((char*)value);
value = (XtPointer)p;

View File

@@ -26,7 +26,7 @@ public:
IcccmAgent(void*, data_handler_t);
IcccmAgent(void*, data_exporter_t);
~IcccmAgent();
virtual ~IcccmAgent();
data_handler_t set_string_handler(data_handler_t);
data_exporter_t set_string_exporter(data_exporter_t);

View File

@@ -1756,7 +1756,7 @@ LibraryAgent::library_removed (UAS_Pointer<UAS_Common> lib)
{
OutlineList &rootList = *(f_doc_tree_view->list());
unsigned int i;
for (i = rootList.length() - 1; i >= 0; i --) {
for (i = rootList.length() - 1; (int) i >= 0; i --) {
TOC_Element *te = (TOC_Element *) rootList[i];
if (te->toc()->get_library() == lib) {
if (f_tracking_hierarchy && f_tracking_hierarchy->f_toc == lib) {

View File

@@ -121,9 +121,9 @@ ListView::display()
if (f_shell == NULL)
{
create_ui_objects();
display_list();
}
display_list();
f_shell->Popup();
f_shell->DeIconify();
}

View File

@@ -40,7 +40,7 @@ public: // notification types
enum { ENTRY_ACTIVATE = FolioObjectLast, _LAST };
public: // functions
ListView (List *the_list = NULL, char *name = "ListView")
ListView (List *the_list = NULL, char *name = (char*)"ListView")
: f_the_list(NULL), f_shell (NULL), f_name (name)
{
list (the_list);

View File

@@ -2229,7 +2229,7 @@ NodeWindowAgent::search_on_selectionCB(Widget, XtPointer client_data,
void
NodeWindowAgent::text_callback(WCallback *wcb)
{
(XmAnyCallbackStruct*)wcb->CallData();
(void) (XmAnyCallbackStruct*)wcb->CallData();
char *text = XmTextGetString(wcb->GetWidget());
if (text == NULL)
return;
@@ -2846,7 +2846,7 @@ NodeWindowAgent::initialize_tabs()
{
List_Iterator<UAS_Pointer<UAS_Common> > tabs (g_tab_list);
List_Iterator<BookTab *> btns (f_tab_btn_list);
BookTab *current;
BookTab *current = NULL;
bool changed = FALSE;
static int old_count = -1;
int count = 0;

View File

@@ -533,7 +533,7 @@ OutlineListView::y_to_outline_element (Position y)
#endif
// Another Motif 1.2 bug. YToPos should return 0 for bogus position,
// but it doesn't check the range.
if (f_item_pos < 0 || (int) f_item_pos >= ItemCount())
if ((int) f_item_pos < 0 || (int) f_item_pos >= ItemCount())
return (NULL);
oe = item_at (f_item_pos);

View File

@@ -149,7 +149,10 @@ static WXmToggleButton f_print_hierarchy;
static Boolean print_hierarchy; // keep track of hierarchy vs section
#if defined(PRINTING_SUPPORTED)
static void PrintEverything(AppPrintData *p);
#endif /* PRINTING_SUPPORTED */
static void PrintOneUASCommon(UAS_Pointer<UAS_Common> &doc, Widget pshell, int *cur_pageP);
PrintPanelAgent::PrintPanelAgent()
@@ -431,9 +434,10 @@ void
PdmNotifyCB(Widget pr_shell, XtPointer client_data, XtPointer call_data)
{
RCS_DEBUG("PdmNotifyCB called.\n");
char *msg;
#if defined(PRINTING_SUPPORTED)
char *msg;
XmPrintShellCallbackStruct* pr_cbs =
(XmPrintShellCallbackStruct*) call_data;
@@ -463,10 +467,10 @@ PdmNotifyCB(Widget pr_shell, XtPointer client_data, XtPointer call_data)
void
CreatePrintShell(Widget widget, AppPrintData* p)
{
char buf[BUFSIZ];
RCS_DEBUG("CreatePrintShell called.\n");
#if defined(PRINTING_SUPPORTED)
char buf[BUFSIZ];
/*
* create a print_shell if none available. the print dialog callback
@@ -523,11 +527,10 @@ CreatePrintShell(Widget widget, AppPrintData* p)
void
PrintSetupCB(Widget print_dialog, XtPointer client_data, XtPointer call_data)
{
char *msg;
RCS_DEBUG("PrintSetupCB called.\n");
#if defined(PRINTING_SUPPORTED)
#if defined(PRINTING_SUPPORTED)
char *msg;
AppPrintData *p = (AppPrintData*)client_data;
DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct*)call_data;
@@ -925,6 +928,7 @@ DoPrint(Widget widget, AppPrintData * p)
}
#if defined(PRINTING_SUPPORTED)
/*
* ------------------------------------------------------------------------
* Name: PrintEverything
@@ -958,6 +962,7 @@ PrintEverything(AppPrintData *p)
RCS_DEBUG("PrintEverything exiting.\n");
}
#endif /* PRINTING_SUPPORTED */
static void
PrintOneUASCommon(UAS_Pointer<UAS_Common> &doc, Widget pshell, int *cur_pageP)

View File

@@ -267,8 +267,10 @@ SearchResultsAgent::compose_header()
void
SearchResultsAgent::resize()
{
UAS_Pointer<UAS_List<UAS_SearchResultsEntry> > tmpList =
f_results->results()->create_results(0, f_count);
UAS_List<UAS_SearchResultsEntry>& rlist =
*(f_results->results()->create_results(0, f_count));
*(UAS_List<UAS_SearchResultsEntry> *)tmpList;
fill_list(rlist);

View File

@@ -1252,7 +1252,7 @@ SearchScopeAgent::set_components (u_int mask)
#define ADD(LIST,STRING,CHILD,EXPANDED) \
oe = new OutlineString (STRING); \
if (CHILD) oe->set_children (CHILD); \
if ((bool)CHILD) oe->set_children (CHILD); \
if (EXPANDED) oe->set_expanded (0x1); \
LIST->append (*oe);

View File

@@ -24,6 +24,8 @@ class FolioObject;
class Iterator
{
public:
virtual ~Iterator() {}
// initialize iterator, find first element
virtual FolioObject *init() = 0;

View File

@@ -250,7 +250,7 @@ DtCvStrVccToIndex(_DtCvSegment* seg, unsigned int vcc)
unsigned int index = 0;
unsigned int rel_vcc;
if ((rel_vcc = vcc - ((SegClientData*)seg->client_use)->vcc()) < 0)
if ((int)(rel_vcc = vcc - ((SegClientData*)seg->client_use)->vcc()) < 0)
return (unsigned int)-1;
if (seg->type & _DtCvWIDE_CHAR) {

View File

@@ -439,16 +439,18 @@ GENCAT=gencat -m
GENCAT=gencat
#endif
#define MACRO_Messages @(messages=; \ @@\
for i in $(MSGS) ; \ @@\
do \ @@\
messages="$$messages $$i/$$i.msg"; \ @@\
done; \ @@\
cat $$messages > $(PROGRAM_NAME).cpp )
messages::
foreach_subdirs(messages, $(MSGS))
@echo "### Making msgs in src ###"
@$(RM) $(PROGRAM_NAME).msg.updated
@(messages=; \
for i in $(MSGS) ; \
do \
messages="$$messages $$i/$$i.msg"; \
done; \
cat $$messages > $(PROGRAM_NAME).cpp )
MACRO_Messages
$(CPP) -P -C $(PROGRAM_NAME)_msg.tmpl | $(TOOLS)/misc/msgsets > $(PROGRAM_NAME).msg.updated
@$(RM) $(PROGRAM_NAME).cpp

View File

@@ -41,6 +41,7 @@
*
*/
#include <limits.h>
#include <string.h>
#include <iostream>
using namespace std;

View File

@@ -133,7 +133,7 @@ WString::get_mbstr()
int buffer_size = MB_CUR_MAX * f_wstringrep->f_length + 1;
char* buffer = new char[buffer_size];
if (wcstombs(buffer, f_wstringrep->f_data, buffer_size) < 0)
if ((long)wcstombs(buffer, f_wstringrep->f_data, buffer_size) < 0)
*buffer = 0;
return buffer;

View File

@@ -2406,7 +2406,7 @@ TGDefn::build()
}
end_try;
unsigned int i, start_index;
unsigned int i, start_index = 0;
for (i = 0; i < num_columns; i++) {
if (grid[current_row][i] == NULL) {
start_index = i;

View File

@@ -241,7 +241,7 @@ PreferenceRecord::read_prefs()
if (*value == '\0') // Ignore bogus lines.
continue;
*value++ = '\0';
while (isspace (*value))
while (isspace ((unsigned char) *value))
value++;
int len = strlen(value);
value[len-1] = '\0';

View File

@@ -327,7 +327,7 @@ QueryTermView::create_ui()
void
QueryTermView::select_toggle (WCallback *wcb)
{
(XmToggleButtonCallbackStruct *) wcb->CallData();
(void) (XmToggleButtonCallbackStruct *) wcb->CallData();
// notify someone about selection state...
invert_colors();

View File

@@ -21,8 +21,8 @@
* Floor, Boston, MA 02110-1301 USA
*/
// $TOG: UAS_BookcaseEntry.C /main/5 1998/04/17 11:40:44 mgreess $
#include "UAS_BookcaseEntry.hh"
#include "UAS_Exceptions.hh"
#include "UAS_BookcaseEntry.hh"
#include "UAS_Collection.hh"
#include <string.h>

View File

@@ -12,6 +12,8 @@ class UAS_EmbeddedObject;
class UAS_Factory {
public:
virtual ~UAS_Factory() {}
static void initialize (UAS_List<UAS_String>&);
static void finalize ();
static UAS_List<UAS_String> getRootLocators ();

View File

@@ -24,7 +24,7 @@
/* Copyright (c) 1995 FUJITSU LIMITED */
/* All Rights Reserved */
#if defined(__uxp__) || defined(USL) || defined(linux)
#if defined(__uxp__) || defined(USL) || defined(linux) || defined(CSRG_BASED)
#include <string.h>
#else
#include <strings.h>
@@ -646,6 +646,7 @@ UAS_OQLParser::determine_caps()
}
end_try;
#if 0 /* not supported by libDtSearch */
caps |= 0x01 << OQL_WEIGHT;
mtry {
se_construct(WEIGHT, word, digits, "");
@@ -663,6 +664,7 @@ UAS_OQLParser::determine_caps()
caps &= ~(0x01 << OQL_COMPLETION);
}
end_try;
#endif
caps |= 0x01 << OQL_PHRASE;
mtry {

View File

@@ -22,6 +22,7 @@
*/
// $XConsortium: UAS_PtrList.cc /main/5 1996/08/06 09:23:58 rcs $
#include "UAS_Exceptions.hh"
#include "Managers/CatMgr.hh"
#include "Registration.hh"

View File

@@ -24,7 +24,7 @@ friend class UAS_Sender<T>;
protected:
// This is an abstract base class.
UAS_Receiver() { }
~UAS_Receiver();
virtual ~UAS_Receiver();
virtual void receive (T &message, void *client_data = 0) = 0;

View File

@@ -24,6 +24,7 @@
/* Copyright (c) 1995,1996 FUJITSU LIMITED */
/* All Rights Reserved */
#include "UAS_Exceptions.hh"
#include "DtSR_SearchEngine.hh"
#include "DtSR_SearchResultsEntry.hh"
#include "DtSR_SearchResults.hh"

View File

@@ -306,8 +306,8 @@ DtSR_SearchResultsEntry::create_matches()
}
end_try;
char* text = (char*)output.str().c_str();
*(text + output.str().size()) = '\0';
string outpstr = output.str();
char* text = (char*)outpstr.c_str();
#ifdef DUMP_NODES
{
@@ -350,8 +350,8 @@ DtSR_SearchResultsEntry::create_matches()
for (int i = 0; i < count; i++) {
stemsbuf << (f_search_res->stems(f_dbn)->stems())[i] << '\n';
}
char* stems = (char*)stemsbuf.str().c_str();
*(stems + stemsbuf.str().size()) = '\0';
string stemsbstr = stemsbuf.str();
char* stems = (char*)stemsbstr.c_str();
parseout = StringParser::hilite(text, count, stems);
@@ -383,17 +383,16 @@ DtSR_SearchResultsEntry::create_matches()
matches = new UAS_List<UAS_TextRun>;
// convert kwics to textrun
string textrbstr;
if (parseout == NULL && kwics) {
ostringstream textrunbuf;
for (int i = 0; i < n_kwics; i++)
textrunbuf << kwics[i].offset << '\t' << kwics[i].length << '\n';
parseout = (char*)textrunbuf.str().c_str();
*(parseout + textrunbuf.str().size()) = '\0';
textrbstr = textrunbuf.str();
parseout = (char*)textrbstr.c_str();
}
else if (parseout == NULL)
{
if (text)
delete[] text;
return matches;
}
@@ -438,8 +437,11 @@ DtSR_SearchResultsEntry::create_matches()
}
else {
scanned = mblen(cursor, MB_CUR_MAX);
assert( scanned >= 0 );
vcc++;
/* skip one byte in case of failure */
if (scanned < 0)
scanned = 1;
}
off -= scanned;
@@ -477,11 +479,6 @@ DtSR_SearchResultsEntry::create_matches()
matches->insert_item(textrun);
}
if (text)
delete[] text;
if (parseout)
delete[] parseout;
return matches;
}

View File

@@ -153,6 +153,7 @@ StringParser::brute_force(const char* text_in, int n_of_pats,
#endif
char* caped_text = NULL;
string capstr;
if (sensitive == False) { // case-insensitive search
unsigned char *p;
@@ -169,8 +170,8 @@ StringParser::brute_force(const char* text_in, int n_of_pats,
else
capitalized << *p;
}
text_in = caped_text = (char *)capitalized.str().c_str();
*(char*)(text_in + capitalized.str().size()) = '\0';
capstr = capitalized.str();
text_in = caped_text = (char *)capstr.c_str();
}
ostringstream text_run;
@@ -237,7 +238,8 @@ StringParser::brute_force(const char* text_in, int n_of_pats,
if (caped_text)
delete[] caped_text;
char* ret_text = (char *)text_run.str().c_str();
string trunstr = text_run.str();
char* ret_text = (char *)trunstr.c_str();
if (ret_text == NULL)
return NULL;
@@ -323,7 +325,8 @@ StringParser::project_textrun(const char* org_textrun)
ret_text << off << '\t' << len << '\n' << '\0';
return (char *)ret_text.str().c_str();
string rettstr = ret_text.str();
return (char *)rettstr.c_str();
}
char *

View File

@@ -55,8 +55,8 @@ main(int argc, char** argv)
char ch;
while (cin.get(ch)) text << ch;
char* buf = (char *)text.str().c_str();
*(buf + text.str().size()) = '\0';
string textstr = text.str();
char* buf = (char *)textstr.c_str();
char* p = buf;
if (buf == NULL || *buf == '\0') {

View File

@@ -63,8 +63,8 @@ main(int argc, char** argv)
char ch;
while (cin.get(ch)) text << ch;
char* buf = (char *)text.str().c_str();
*(buf + text.str().size()) = '\0';
string textstr = text.str();
char* buf = (char *)textstr.c_str();
char* match = StringParser::brute_force(buf, npat, patterns);

View File

@@ -22,6 +22,7 @@
*/
// $XConsortium: MMDB_Library.C /main/9 1996/09/14 13:10:52 cde-hal $
# include "UAS_Exceptions.hh"
# include "MMDB_Library.hh"
# include "MMDB_BookCase.hh"
# include "MMDB_Factory.hh"

View File

@@ -102,8 +102,13 @@ static char defaultTranslations[] =
<Key>Home: page(0,0) ";
static void ActionStart(), ActionStop(), ActionAbort(), ActionMove();
static void ActionPage(), ActionNotify(), ActionSet();
static void ActionStart(Widget, XEvent*, String*, Cardinal*);
static void ActionStop(Widget, XEvent*, String*, Cardinal*);
static void ActionAbort(Widget, XEvent*, String*, Cardinal*);
static void ActionMove(Widget, XEvent*, String*, Cardinal*);
static void ActionPage(Widget, XEvent*, String*, Cardinal*);
static void ActionSet(Widget, XEvent*, String*, Cardinal*);
static void ActionNotify(Widget, XEvent*, String*, Cardinal*);
static XtActionsRec actions[] = {
{ "start", ActionStart }, /* start tmp graphics */
@@ -467,7 +472,8 @@ static int parse_page_string (s, pagesize, canvassize, relative)
* syntax: spaces [+-] number spaces [pc\0] spaces
*/
for (; isascii(*s) && isspace(*s); s++) ; /* skip white space */
/* skip white space */
for (; isascii(*s) && isspace((unsigned char) *s); s++) ;
if (*s == '+' || *s == '-') { /* deal with signs */
rel = TRUE;
@@ -480,11 +486,11 @@ static int parse_page_string (s, pagesize, canvassize, relative)
}
/* skip over numbers */
for (cp = s; isascii(*s) && (isdigit(*s) || *s == '.'); s++) ;
for (cp = s; isascii(*s) && (isdigit((unsigned char)*s)|| *s == '.'); s++) ;
val *= atof (cp);
/* skip blanks */
for (; isascii(*s) && isspace(*s); s++) ;
for (; isascii(*s) && isspace((unsigned char) *s); s++) ;
if (*s) { /* if units */
switch (s[0]) {

View File

@@ -90,8 +90,12 @@ static XtResource resources[] = {
#undef offset
};
static void ClassPartInitialize(), ClassInitialize(),Realize(),ConvertCursor();
static Boolean SetValues(), ChangeSensitive();
static void ClassPartInitialize(WidgetClass);
static void ClassInitialize();
static void Realize(Widget, Mask*, XSetWindowAttributes*);
static void ConvertCursor(Widget);
static Boolean SetValues();
static Boolean ChangeSensitive(Widget);
SimpleClassRec simpleClassRec = {
{ /* core fields */

View File

@@ -98,9 +98,9 @@ static void Redisplay();
static XtGeometryResult QueryGeometry();
/* utility routines */
static void insert_node();
static void delete_node();
static void layout_tree();
static void insert_node(Widget, Widget);
static void delete_node(Widget, Widget);
static void layout_tree(TreeWidget, Boolean);
/*

View File

@@ -778,7 +778,7 @@ static int fontlist(dat_ptr, cmd_ptr, cgm_s)
}
}
/* zero out the rest of the fonts */
for (; i>MAX_FONTS; ++i) cgm_s->fontlist[i] = NULL;
for (; i<MAX_FONTS; ++i) cgm_s->fontlist[i] = NULL;
return 1;
}

View File

@@ -50,7 +50,7 @@ protected:
WCallback* cbList;
public:
WWL ();
~WWL ();
virtual ~WWL ();
void AddCb (WCallback *);
Boolean RemoveCb (WCallback *);