1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtinfo subdirectory dtinfo

This commit is contained in:
Ulrich Wilkens 2013-08-28 19:45:57 +02:00 committed by Jon Trulson
parent fbd81ef151
commit aef2830df2
142 changed files with 1042 additions and 900 deletions

View file

@ -8,9 +8,9 @@ SUBDIRS=wwl src install
XCOMM redefine TopLevelProject to build DtInfo with standard CDE config dir XCOMM redefine TopLevelProject to build DtInfo with standard CDE config dir
#undef TopLevelProject #undef TopLevelProject
#define TopLevelProject DtInfo #define TopLevelProject DtInfo
IMAKE_DEFINES = -DTopLevelProject=TopLevelProject \ IMAKE_DEF_DTINFO = -DTopLevelProject=TopLevelProject \
-DProjectTmplFile='<DtInfo.tmpl>' \ -DProjectTmplFile='<DtInfo.tmpl>' \
-DProjectRulesFile='<DtInfo.rules>' -DProjectRulesFile='<DtInfo.rules>'
MakeSubdirs($(SUBDIRS)) MakeSubdirs($(SUBDIRS))

View file

@ -8,9 +8,9 @@ SUBDIRS = lib
XCOMM redefine TopLevelProject to build DtInfo with standard CDE config dir XCOMM redefine TopLevelProject to build DtInfo with standard CDE config dir
#undef TopLevelProject #undef TopLevelProject
#define TopLevelProject DtInfo #define TopLevelProject DtInfo
IMAKE_DEFINES = -DTopLevelProject=TopLevelProject \ IMAKE_DEF_DTINFO = -DTopLevelProject=TopLevelProject \
-DProjectTmplFile='<DtInfo.tmpl>' \ -DProjectTmplFile='<DtInfo.tmpl>' \
-DProjectRulesFile='<DtInfo.rules>' -DProjectRulesFile='<DtInfo.rules>'
MakeSubdirs($(SUBDIRS)) MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS))

View file

@ -207,6 +207,7 @@ AddLibraryAgent::pick_dir () {
if( !f_file_sel ) if( !f_file_sel )
{ {
Arg args[20]; Arg args[20];
unsigned int len, slen;
int n; int n;
XmString title_str = XmStringCreateLocalized( XmString title_str = XmStringCreateLocalized(
@ -217,20 +218,23 @@ AddLibraryAgent::pick_dir () {
XmString infolibs_str = XmStringCreateLocalized( (char*)"Infolibs" ); XmString infolibs_str = XmStringCreateLocalized( (char*)"Infolibs" );
// default initial directory on first entry // default initial directory on first entry
char *buf = new char[256]; unsigned int buflen = 256;
char *buf = new char[buflen];
// Note: infolibs need to be placed in platform-portably-named // Note: infolibs need to be placed in platform-portably-named
// LANG-type subdirectories, so the normalized CDE language // LANG-type subdirectories, so the normalized CDE language
// string can be used for lookup. For now, must assume the // string can be used for lookup. For now, must assume the
// user environment LANG is OK ... // user environment LANG is OK ...
char *tmpstr; char *tmpstr;
if( tmpstr = getenv("LANG") ) if( (tmpstr = getenv("LANG")) )
sprintf( buf, "/usr/dt/infolib/%s/", tmpstr ); snprintf( buf, buflen, "/usr/dt/infolib/%s/", tmpstr );
else else
sprintf( buf, "/usr/dt/infolib/%s/", env().lang() ); snprintf( buf, buflen, "/usr/dt/infolib/%s/", env().lang() );
// //
XmString basedir_str = XmStringCreateLocalized( buf ); XmString basedir_str = XmStringCreateLocalized( buf );
strcat( buf, "*.dti" ); slen = strlen(buf);
len = MIN(5, buflen - 1 - slen);
*((char *) memcpy(buf + slen, "*.dti", len) + len) = '\0';
XmString initdir_str = XmStringCreateLocalized( buf ); XmString initdir_str = XmStringCreateLocalized( buf );
delete [] buf; delete [] buf;

View file

@ -32,7 +32,7 @@ class AddLibraryAgent: public WWL {
WXmForm f_form; WXmForm f_form;
WXmPushButton f_ok; WXmPushButton f_ok;
WXmPushButton f_clr; WXmPushButton f_clr;
Widget f_file_sel;
bool f_done; bool f_done;
bool f_cancelled; bool f_cancelled;
Widget f_file_sel;
}; };

View file

@ -82,13 +82,14 @@ AnchorCanvas::AnchorCanvas (const char *locator, MarkInfo& mi)
/* -------- Now form the anchor string -------- */ /* -------- Now form the anchor string -------- */
for (int i = 0; i < mi.length(); i++) { for (unsigned int i = 0; i < mi.length(); i++) {
UAS_Pointer<MarkUnitInfo> mui_t = mi[i]; UAS_Pointer<MarkUnitInfo> mui_t = mi[i];
MarkUnitInfo& mui = *mui_t; MarkUnitInfo& mui = *mui_t;
char buf[64]; char buf[64];
if (i > 0) if (i > 0)
location = location + ","; location = location + ",";
sprintf(buf, "%u\t%u\t%u", mui.vcc(), mui.offset(), mui.length()); snprintf(buf, sizeof(buf),
"%u\t%u\t%u", mui.vcc(), mui.offset(), mui.length());
location = location + buf; location = location + buf;
} }

View file

@ -78,8 +78,8 @@ BookTab::BookTab (const WComposite &parent)
BookTab::BookTab (NodeWindowAgent *nwa, BookTab::BookTab (NodeWindowAgent *nwa,
const WComposite &parent, UAS_Pointer<UAS_Common> &tab_ptr) const WComposite &parent, UAS_Pointer<UAS_Common> &tab_ptr)
: f_node_window_agent (nwa), : WXyzTab ((Widget) NULL),
WXyzTab ((Widget) NULL), f_node_window_agent (nwa),
f_selected (FALSE) f_selected (FALSE)
{ {
widget = XyzCreateTabButton (parent, "tab", NULL, 0); widget = XyzCreateTabButton (parent, "tab", NULL, 0);

View file

@ -500,7 +500,7 @@ GraphicAgent::create_ui()
else else
{ {
#if !defined(VF_DEBUG) #if !defined(VF_DEBUG)
for (int i = 0 ; i < view_menu.NumChildren(); i++) for (unsigned int i = 0 ; i < view_menu.NumChildren(); i++)
WRect(view_menu.Children()[i]).SetSensitive(False); WRect(view_menu.Children()[i]).SetSensitive(False);
#endif #endif
mtfstring = CATGETS(Set_GraphicAgent, 3, mtfstring = CATGETS(Set_GraphicAgent, 3,
@ -637,9 +637,12 @@ GraphicAgent::visit_node()
extern char g_top_locator[]; extern char g_top_locator[];
extern bool g_scroll_to_locator; extern bool g_scroll_to_locator;
const char *glocator = f_graphic->locator(); const char *glocator = f_graphic->locator();
int len = 0;
ON_DEBUG (printf ("Graphic jumping to <%s>\n", glocator)); ON_DEBUG (printf ("Graphic jumping to <%s>\n", glocator));
ON_DEBUG (printf (" copying to %p\n", g_top_locator)); ON_DEBUG (printf (" copying to %p\n", g_top_locator));
strcpy (g_top_locator, &glocator[8]); len = MIN(strlen(&glocator[8]), 4096 - 1);
*((char *) memcpy(g_top_locator, &glocator[8], len) + len) = '\0';
g_scroll_to_locator = TRUE; g_scroll_to_locator = TRUE;
f_node_ptr->retrieve(); f_node_ptr->retrieve();
} }
@ -827,8 +830,10 @@ GraphicAgent::zoom_callback(WCallback *wcb)
{ {
ON_DEBUG (puts ("GraphicAgent::zoom_callback() called")); ON_DEBUG (puts ("GraphicAgent::zoom_callback() called"));
WXmToggleButton button(wcb->GetWidget()); WXmToggleButton button(wcb->GetWidget());
#if DEBUG
XmToggleButtonCallbackStruct &cbs = XmToggleButtonCallbackStruct &cbs =
*(XmToggleButtonCallbackStruct*)wcb->CallData(); *(XmToggleButtonCallbackStruct*)wcb->CallData();
#endif
ON_DEBUG(cerr << "cbs.set = " << cbs.set << endl); ON_DEBUG(cerr << "cbs.set = " << cbs.set << endl);
ON_DEBUG(cerr << "cbs.rsn = " << cbs.reason << endl); ON_DEBUG(cerr << "cbs.rsn = " << cbs.reason << endl);
@ -862,7 +867,7 @@ GraphicAgent::zoom_callback(WCallback *wcb)
(Widget)f_shell); (Widget)f_shell);
ON_DEBUG(cerr << "scale value is " << scale << endl); ON_DEBUG(cerr << "scale value is " << scale << endl);
if (scale == -1) if ((int)scale == -1)
{ {
// unset Custom option in list // unset Custom option in list
if (((Widget)*f_scale_button) != ((Widget)button)) if (((Widget)*f_scale_button) != ((Widget)button))
@ -949,14 +954,17 @@ GraphicAgent::fit_graphic_to_window_callback(WCallback *)
Dimension gr_width; Dimension gr_width;
Dimension gr_height; Dimension gr_height;
int wscale, hscale; int wscale, hscale;
#if 0
unsigned int scale_factor; unsigned int scale_factor;
int dx, dy;
#endif
// get size of graphic // get size of graphic
gr_width = f_graphic->pixmap_graphic()->width(); gr_width = f_graphic->pixmap_graphic()->width();
gr_height = f_graphic->pixmap_graphic()->height(); gr_height = f_graphic->pixmap_graphic()->height();
int dx, dy;
WXawPorthole porthole(XtParent(*f_pixmap_widget)); WXawPorthole porthole(XtParent(*f_pixmap_widget));
#if 0
dx = abs(porthole.Width() - f_graphic->pixmap_graphic()->width()); dx = abs(porthole.Width() - f_graphic->pixmap_graphic()->width());
dy = abs(porthole.Height() - f_graphic->pixmap_graphic()->height()); dy = abs(porthole.Height() - f_graphic->pixmap_graphic()->height());
if (dx < dy) if (dx < dy)
@ -965,6 +973,7 @@ GraphicAgent::fit_graphic_to_window_callback(WCallback *)
else else
scale_factor = scale_factor =
(100 * porthole.Height()) / f_graphic->pixmap_graphic()->height(); (100 * porthole.Height()) / f_graphic->pixmap_graphic()->height();
#endif
wscale = (100 * porthole.Width()) / gr_width; wscale = (100 * porthole.Width()) / gr_width;

View file

@ -91,9 +91,9 @@ private:
void unset_scale_buttons(); void unset_scale_buttons();
private: private:
UAS_Pointer<UAS_Common> f_node_ptr ;
UAS_Pointer<Graphic> f_graphic ;
WTopLevelShell f_shell; WTopLevelShell f_shell;
UAS_Pointer<UAS_Common> f_node_ptr ;
UAS_Pointer<Graphic> f_graphic ;
WXawPanner *f_panner; WXawPanner *f_panner;
WXmLabel *f_label; WXmLabel *f_label;
WPixmap *f_pixmap_widget ; WPixmap *f_pixmap_widget ;

View file

@ -408,7 +408,6 @@ HelpAgent::get_locator_id(const Widget w)
res.default_type = XtRString; res.default_type = XtRString;
res.default_addr = (void*)NULL_LOCATORID; res.default_addr = (void*)NULL_LOCATORID;
char *wname = XtName(w); // Just for gdb
String string; String string;
XtGetApplicationResources(w, &string, &res, 1, NULL, 0); XtGetApplicationResources(w, &string, &res, 1, NULL, 0);

View file

@ -158,12 +158,14 @@ IcccmAgent::value_handler(Widget w, XtPointer ia, Atom *selection,
prop.format = 8; prop.format = 8;
prop.nitems = *length; prop.nitems = *length;
char** string_list; char** string_list;
int count; int count, len, slen;
XmbTextPropertyToTextList(XtDisplay(w), &prop, &string_list, &count); XmbTextPropertyToTextList(XtDisplay(w), &prop, &string_list, &count);
char *mbs = strdup(""); char *mbs = strdup("");
for (int i=0; i<count; i++) { for (int i=0; i<count; i++) {
mbs = (char*)realloc(mbs, strlen(mbs) + strlen(string_list[i]) + 1); slen = strlen(mbs);
mbs = strcat(mbs, string_list[i]); len = strlen(string_list[i]);
mbs = (char*)realloc(mbs, slen + len + 1);
*((char *) memcpy(mbs, string_list[i], len) + len) = '\0';
} }
XwcFreeStringList((wchar_t**)string_list); XwcFreeStringList((wchar_t**)string_list);
#if 0 #if 0
@ -493,7 +495,7 @@ IcccmAgent::convert_handler(Widget w, Atom selection, Atom target,
target_list[1] = XA_STRING; target_list[1] = XA_STRING;
target_list[2] = XA_TEXT(XtDisplay(w)); target_list[2] = XA_TEXT(XtDisplay(w));
target_list[3] = XA_LENGTH(XtDisplay(w)); target_list[3] = XA_LENGTH(XtDisplay(w));
for (int i = OLIAS_SUPPORT_TARGETS; i < length_return; i++) for (unsigned int i = OLIAS_SUPPORT_TARGETS; i < length_return; i++)
target_list[i] = xmu_targets[i - OLIAS_SUPPORT_TARGETS]; target_list[i] = xmu_targets[i - OLIAS_SUPPORT_TARGETS];
XtFree((char*)xmu_targets); XtFree((char*)xmu_targets);
xmu_targets = NULL; xmu_targets = NULL;

View file

@ -103,6 +103,7 @@ private:
static const char* extract_ascii(const char*); static const char* extract_ascii(const char*);
void* f_real_object;
data_handler_t f_string_handler; data_handler_t f_string_handler;
#if 0 #if 0
data_handler_t f_eps_handler; data_handler_t f_eps_handler;
@ -111,7 +112,6 @@ private:
data_exporter_t f_string_exporter; data_exporter_t f_string_exporter;
static Time f_paste_activated_time; static Time f_paste_activated_time;
void* f_real_object;
// Need this flag to know if we lost the selection to ourself or // Need this flag to know if we lost the selection to ourself or
// to another application in the lose_selection procedure. // to another application in the lose_selection procedure.

View file

@ -5,8 +5,10 @@
Dtinfo Dtinfo
deleteResponse: do_nothing deleteResponse: do_nothing
allowShellResize: false allowShellResize: false
minWidth: 371 ! geometry values are added to the min sizes!
minHeight: 184 geometry: 120x400
minWidth: 380
minHeight: 200
mainw mainw
!------ Menus !------ Menus
menu_bar menu_bar

View file

@ -671,7 +671,7 @@ LibraryAgent::create_ui()
#endif #endif
Widget on_overview, on_tasks, on_reference; Widget on_overview, on_tasks, on_reference;
Widget on_item, on_help, on_about, sep; Widget on_item, on_help, on_about;
on_overview = XtCreateManagedWidget("on_overview", xmPushButtonGadgetClass, on_overview = XtCreateManagedWidget("on_overview", xmPushButtonGadgetClass,
helpM, 0, 0); helpM, 0, 0);
@ -682,7 +682,7 @@ LibraryAgent::create_ui()
*CATGETS(Set_AgentLabel, 258, ""), *CATGETS(Set_AgentLabel, 258, ""),
NULL); NULL);
sep = XtCreateManagedWidget("sep", xmSeparatorGadgetClass, XtCreateManagedWidget("sep", xmSeparatorGadgetClass,
helpM, 0, 0); helpM, 0, 0);
on_tasks = XtCreateManagedWidget("on_tasks", xmPushButtonGadgetClass, on_tasks = XtCreateManagedWidget("on_tasks", xmPushButtonGadgetClass,
helpM, 0, 0); helpM, 0, 0);
@ -709,7 +709,7 @@ LibraryAgent::create_ui()
XmNmnemonic, XmNmnemonic,
*CATGETS(Set_AgentLabel, 51, ""), *CATGETS(Set_AgentLabel, 51, ""),
NULL); NULL);
sep = XtCreateManagedWidget("sep", xmSeparatorGadgetClass, XtCreateManagedWidget("sep", xmSeparatorGadgetClass,
helpM, 0, 0); helpM, 0, 0);
on_help = XtCreateManagedWidget("on_help", xmPushButtonGadgetClass, on_help = XtCreateManagedWidget("on_help", xmPushButtonGadgetClass,
helpM, 0, 0); helpM, 0, 0);
@ -719,7 +719,7 @@ LibraryAgent::create_ui()
XmNmnemonic, XmNmnemonic,
*CATGETS(Set_AgentLabel, 254, ""), *CATGETS(Set_AgentLabel, 254, ""),
NULL); NULL);
sep = XtCreateManagedWidget("sep", xmSeparatorGadgetClass, XtCreateManagedWidget("sep", xmSeparatorGadgetClass,
helpM, 0, 0); helpM, 0, 0);
on_about = XtCreateManagedWidget("on_about", xmPushButtonGadgetClass, on_about = XtCreateManagedWidget("on_about", xmPushButtonGadgetClass,
helpM, 0, 0); helpM, 0, 0);
@ -1026,7 +1026,9 @@ LibraryAgent::quick_helpEH (Widget w, XtPointer client_data,
void void
LibraryAgent::text_callback(WCallback *wcb) LibraryAgent::text_callback(WCallback *wcb)
{ {
#if 0
XmAnyCallbackStruct *cbs = (XmAnyCallbackStruct*)wcb->CallData(); XmAnyCallbackStruct *cbs = (XmAnyCallbackStruct*)wcb->CallData();
#endif
char *text = XmTextGetString(wcb->GetWidget()); char *text = XmTextGetString(wcb->GetWidget());
if (*text != '\0') if (*text != '\0')
@ -1077,9 +1079,9 @@ LibraryAgent::search_help (Widget, XtPointer client_data,
UAS_SearchScope *scope = agent->f_scope_menu->current_scope(); UAS_SearchScope *scope = agent->f_scope_menu->current_scope();
char buffer[128]; char buffer[128];
if (scope != NULL) if (scope != NULL)
sprintf (buffer, help_text, (char *) scope->name()); snprintf (buffer, sizeof(buffer), help_text, (char *) scope->name());
else else
sprintf (buffer, help_text, default_scope); snprintf (buffer, sizeof(buffer), help_text, default_scope);
// Finally, display it in the quick help field. // Finally, display it in the quick help field.
XmTextFieldSetString(agent->f_status_text, buffer); XmTextFieldSetString(agent->f_status_text, buffer);
@ -1161,6 +1163,7 @@ int
LibraryAgent::add_library(char* newLib, Widget parent) LibraryAgent::add_library(char* newLib, Widget parent)
{ {
int sts = ID_SUCCESS ; int sts = ID_SUCCESS ;
int bufferlen;
if( (newLib == NULL) || if( (newLib == NULL) ||
((newLib != NULL) && ( *newLib == '\0' )) ) ((newLib != NULL) && ( *newLib == '\0' )) )
@ -1183,9 +1186,9 @@ LibraryAgent::add_library(char* newLib, Widget parent)
else if( *newLib == '/' ) { else if( *newLib == '/' ) {
// assume given absolute path to an infolib. // assume given absolute path to an infolib.
// construct the fully-qualified form and pass it on. // construct the fully-qualified form and pass it on.
char *buffer = bufferlen = strlen("mmdb:INFOLIB=") + strlen(newLib) + 1;
new char[strlen("mmdb:INFOLIB=") + strlen(newLib) + 1]; char *buffer = new char[bufferlen];
sprintf (buffer, "mmdb:INFOLIB=%s", newLib); snprintf (buffer, bufferlen, "mmdb:INFOLIB=%s", newLib);
d = UAS_Common::create (buffer); d = UAS_Common::create (buffer);
delete [] buffer; delete [] buffer;
} }
@ -1197,9 +1200,9 @@ LibraryAgent::add_library(char* newLib, Widget parent)
if (pathname != NULL) if (pathname != NULL)
{ {
// construct the fully-qualified form and pass it on. // construct the fully-qualified form and pass it on.
char *buffer = bufferlen = strlen("mmdb:INFOLIB=") + strlen(pathname) + 1;
new char[strlen("mmdb:INFOLIB=") + strlen(pathname) + 1]; char *buffer = new char[bufferlen];
sprintf (buffer, "mmdb:INFOLIB=%s", pathname); snprintf (buffer, bufferlen, "mmdb:INFOLIB=%s", pathname);
XtFree(pathname); XtFree(pathname);
d = UAS_Common::create (buffer); d = UAS_Common::create (buffer);
delete [] buffer; delete [] buffer;
@ -1338,7 +1341,7 @@ LibraryAgent::entry_selected (void *, u_int notify_type)
int removeSensitive = 0; int removeSensitive = 0;
if (rootList.length() > 1) { // don't let 'em remove the last one... if (rootList.length() > 1) { // don't let 'em remove the last one...
if (((TOC_Element *) f_oe)->toc()->type() == UAS_LIBRARY) { if (((TOC_Element *) f_oe)->toc()->type() == UAS_LIBRARY) {
for (int i = 0; i < rootList.length(); i ++) { for (unsigned int i = 0; i < rootList.length(); i ++) {
if (((TOC_Element *) f_oe)->toc() == if (((TOC_Element *) f_oe)->toc() ==
((TOC_Element *) rootList[i])->toc()) { ((TOC_Element *) rootList[i])->toc()) {
removeSensitive = 1; removeSensitive = 1;
@ -1376,9 +1379,9 @@ LibraryAgent::entry_selected (void *, u_int notify_type)
{ {
// Get the list of selections. // Get the list of selections.
List *select_list = f_doc_tree_view->selected_item_list(); List *select_list = f_doc_tree_view->selected_item_list();
Xassert (selected_item_count == select_list->length()); Xassert (selected_item_count == (int) select_list->length());
for (int i = 0; i < select_list->length(); i++) for (unsigned int i = 0; i < select_list->length(); i++)
{ {
if (((TOC_Element *) (*select_list)[i])->toc()->data_length() == 0) if (((TOC_Element *) (*select_list)[i])->toc()->data_length() == 0)
{ {
@ -1442,7 +1445,7 @@ LibraryAgent::print_asCB(Widget w, XtPointer client_data, XtPointer)
List *select_list = agent->f_doc_tree_view->selected_item_list(); List *select_list = agent->f_doc_tree_view->selected_item_list();
xList<UAS_Pointer<UAS_Common> > * print_list = new xList<UAS_Pointer<UAS_Common> >; xList<UAS_Pointer<UAS_Common> > * print_list = new xList<UAS_Pointer<UAS_Common> >;
for (int i = 0; i < select_list->length(); i++) { for (unsigned int i = 0; i < select_list->length(); i++) {
print_list->append (((TOC_Element *) (*select_list)[i])->toc()); print_list->append (((TOC_Element *) (*select_list)[i])->toc());
} }
@ -1480,7 +1483,7 @@ LibraryAgent::printCB(Widget w, XtPointer client_data, XtPointer)
List *select_list = agent->f_doc_tree_view->selected_item_list(); List *select_list = agent->f_doc_tree_view->selected_item_list();
xList<UAS_Pointer<UAS_Common> > * print_list = new xList<UAS_Pointer<UAS_Common> >; xList<UAS_Pointer<UAS_Common> > * print_list = new xList<UAS_Pointer<UAS_Common> >;
for (int i = 0; i < select_list->length(); i++) { for (unsigned int i = 0; i < select_list->length(); i++) {
print_list->append (((TOC_Element *) (*select_list)[i])->toc()); print_list->append (((TOC_Element *) (*select_list)[i])->toc());
} }
@ -1547,17 +1550,21 @@ LibraryAgent::track_to (UAS_Pointer<UAS_Common> &node_ptr)
OutlineList &rootList = *(f_doc_tree_view->list()); OutlineList &rootList = *(f_doc_tree_view->list());
bool in_subtree = FALSE; bool in_subtree = FALSE;
UAS_Pointer<UAS_Common> doc_root = node_ptr; UAS_Pointer<UAS_Common> doc_root = node_ptr;
#ifdef DEBUG
int inum; int inum;
#endif
// Trace up to the root. // Trace up to the root.
free_tracking_hierarchy(); free_tracking_hierarchy();
while (doc_root != (const int)NULL && !in_subtree) while (doc_root != (const int)NULL && !in_subtree)
{ {
f_tracking_hierarchy = new TrackingEntry(doc_root, f_tracking_hierarchy); f_tracking_hierarchy = new TrackingEntry(doc_root, f_tracking_hierarchy);
for (int i = 0; i < rootList.length(); i ++) { for (unsigned int i = 0; i < rootList.length(); i ++) {
if (doc_root == ((TOC_Element *) rootList[i])->toc()) { if (doc_root == ((TOC_Element *) rootList[i])->toc()) {
in_subtree = TRUE; in_subtree = TRUE;
#ifdef DEBUG
inum = i; inum = i;
#endif
break; break;
} }
} }
@ -1598,9 +1605,9 @@ LibraryAgent::track (bool scroll)
// that we can ultimately highlight the right entry in the list. // that we can ultimately highlight the right entry in the list.
unsigned int list_location = 0; unsigned int list_location = 0;
// Make sure the roots match up, just to be safe. // Make sure the roots match up, just to be safe.
TrackingEntry *t; TrackingEntry *t = NULL;
OutlineElement *oe; OutlineElement *oe = NULL;
for (int cnt = 0; cnt < rootList.length(); cnt ++) { for (unsigned int cnt = 0; cnt < rootList.length(); cnt ++) {
list_location ++; list_location ++;
t = f_tracking_hierarchy->f_child; t = f_tracking_hierarchy->f_child;
oe = (OutlineElement *) rootList[cnt]; oe = (OutlineElement *) rootList[cnt];
@ -1624,7 +1631,7 @@ LibraryAgent::track (bool scroll)
// If the entry is expanded, it MUST have children. // If the entry is expanded, it MUST have children.
Xassert (oe->has_children()); Xassert (oe->has_children());
OutlineList &kids = *(oe->children()); OutlineList &kids = *(oe->children());
int i; unsigned int i;
for (i = 0; i < kids.length(); i++) for (i = 0; i < kids.length(); i++)
{ {
// Keep track of how many expanded items we skip over. // Keep track of how many expanded items we skip over.
@ -1677,18 +1684,18 @@ LibraryAgent::track (bool scroll)
ON_DEBUG (printf ("top = %d, bottom = %d, old = %d\n", ON_DEBUG (printf ("top = %d, bottom = %d, old = %d\n",
top_position, bottom_position, old_selection)); top_position, bottom_position, old_selection));
if (list_location < top_position || if ((int)list_location < top_position ||
list_location > bottom_position) (int)list_location > bottom_position)
{ {
ON_DEBUG (puts ("* About to scroll list")); ON_DEBUG (puts ("* About to scroll list"));
if (old_selection == top_position && if ((int)old_selection == top_position &&
list_location == top_position - 1) (int)list_location == top_position - 1)
{ {
// Scroll up one item. // Scroll up one item.
f_doc_tree_view->TopItemPosition (top_position - 1); f_doc_tree_view->TopItemPosition (top_position - 1);
} }
else if (old_selection == bottom_position && else if ((int)old_selection == bottom_position &&
list_location == bottom_position + 1) (int)list_location == bottom_position + 1)
{ {
// Scroll down one item. // Scroll down one item.
f_doc_tree_view->TopItemPosition (top_position + 1); f_doc_tree_view->TopItemPosition (top_position + 1);
@ -1748,7 +1755,7 @@ void
LibraryAgent::library_removed (UAS_Pointer<UAS_Common> lib) LibraryAgent::library_removed (UAS_Pointer<UAS_Common> lib)
{ {
OutlineList &rootList = *(f_doc_tree_view->list()); OutlineList &rootList = *(f_doc_tree_view->list());
int i; unsigned int i;
for (i = rootList.length() - 1; i >= 0; i --) { for (i = rootList.length() - 1; i >= 0; i --) {
TOC_Element *te = (TOC_Element *) rootList[i]; TOC_Element *te = (TOC_Element *) rootList[i];
if (te->toc()->get_library() == lib) { if (te->toc()->get_library() == lib) {
@ -1767,7 +1774,6 @@ LibraryAgent::library_removed (UAS_Pointer<UAS_Common> lib)
//BitHandle handle = rootList.get_data_handle(); //BitHandle handle = rootList.get_data_handle();
BitHandle handle = f_doc_tree_view->data_handle(); BitHandle handle = f_doc_tree_view->data_handle();
int level = ((OutlineElement *) rootList[0])->level();
for (i = 0; i < rootList.length(); i ++) for (i = 0; i < rootList.length(); i ++)
{ {
((OutlineElement *) rootList[i])->set_expanded (handle); ((OutlineElement *) rootList[i])->set_expanded (handle);
@ -1778,7 +1784,7 @@ LibraryAgent::library_removed (UAS_Pointer<UAS_Common> lib)
List *bclist = oe->children(); List *bclist = oe->children();
for(int b = 0; b < bclist->length(); b++) for(unsigned int b = 0; b < bclist->length(); b++)
{ {
OutlineElement *coe = (OutlineElement *)(*bclist)[b]; OutlineElement *coe = (OutlineElement *)(*bclist)[b];
if (coe->is_expanded(handle)) if (coe->is_expanded(handle))
@ -2020,7 +2026,7 @@ LibraryAgent::copy_to_clipbd()
Wait_Cursor bob; Wait_Cursor bob;
UAS_String nl("\n"); UAS_String nl("\n");
for (int i = 0; i < select_list->length(); i++) for (unsigned int i = 0; i < select_list->length(); i++)
{ {
UAS_Pointer<UAS_Common> toc; UAS_Pointer<UAS_Common> toc;
toc = ((TOC_Element *) (*select_list)[i])->toc(); toc = ((TOC_Element *) (*select_list)[i])->toc();

View file

@ -103,6 +103,10 @@ private: // variables
Widget f_shell; Widget f_shell;
OutlineListView *f_doc_tree_view; OutlineListView *f_doc_tree_view;
OutlineElement *f_oe; OutlineElement *f_oe;
bool f_keep_forever;
WCallback *f_wm_delete_callback;
TrackingEntry *f_tracking_hierarchy;
bool f_popped_down;
Widget f_close; Widget f_close;
Widget f_copy; Widget f_copy;
Widget f_detach; Widget f_detach;
@ -115,10 +119,6 @@ private: // variables
Widget f_remove; Widget f_remove;
Widget f_remove2; Widget f_remove2;
Widget f_auto_track; Widget f_auto_track;
bool f_keep_forever;
WCallback *f_wm_delete_callback;
TrackingEntry *f_tracking_hierarchy;
bool f_popped_down;
bool f_close_sensitive; bool f_close_sensitive;
Widget f_status_text; Widget f_status_text;
ScopeMenu *f_scope_menu; ScopeMenu *f_scope_menu;

View file

@ -154,8 +154,9 @@ ListView::create_ui_objects()
(XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 48, "Help")), NULL); (XmString)XmStringLocalized(CATGETS(Set_AgentLabel, 48, "Help")), NULL);
// 7/30/93 rtp - bear with this hack, it's a little bogus // 7/30/93 rtp - bear with this hack, it's a little bogus
char *help_name = new char[strlen(f_name) + strlen("_help") + 1]; int help_namelen = strlen(f_name) + strlen("_help") + 1;
sprintf(help_name, "%s%s", f_name, "_help"); char *help_name = new char[help_namelen];
snprintf(help_name, help_namelen, "%s%s", f_name, "_help");
// What i've done is appended '_help' to the widget name and added // What i've done is appended '_help' to the widget name and added
// a help callback to the help button that will reference this name // a help callback to the help button that will reference this name
help_agent().add_activate_help (help, help_name); help_agent().add_activate_help (help, help_name);
@ -212,7 +213,7 @@ ListView::display_list()
if (f_shell == NULL || f_the_list == NULL) if (f_shell == NULL || f_the_list == NULL)
return; return;
int i; unsigned int i;
// NOTE: There should be a wwl object for string tables!! 6/19/92 djb // NOTE: There should be a wwl object for string tables!! 6/19/92 djb
XmStringTable st = (XmStringTable) XmStringTable st = (XmStringTable)

View file

@ -74,8 +74,8 @@ protected: // view variables
List *f_the_list; List *f_the_list;
protected: // ui variables protected: // ui variables
char *f_name;
WTopLevelShell *f_shell; WTopLevelShell *f_shell;
char *f_name;
WXmList *f_list; WXmList *f_list;
WCallback *f_wm_delete_callback; WCallback *f_wm_delete_callback;
int f_selected_item; int f_selected_item;

View file

@ -92,6 +92,7 @@ class MapButton : public WWL
public: public:
MapButton (WComposite &parent, const UAS_Pointer<UAS_Common> &doc_ptr, MapButton (WComposite &parent, const UAS_Pointer<UAS_Common> &doc_ptr,
MapButton *ancestor); MapButton *ancestor);
virtual ~MapButton() {}
void activate(); void activate();
void expand(); void expand();
@ -193,7 +194,7 @@ MapButton::expand()
// Create a button for each child. // Create a button for each child.
UAS_List<UAS_Common> kids (f_doc_ptr->children()); UAS_List<UAS_Common> kids (f_doc_ptr->children());
WXawTree tree (XtParent (f_form)); WXawTree tree (XtParent (f_form));
for (int i = 0; i < kids.length(); i++) for (unsigned int i = 0; i < kids.length(); i++)
new MapButton (tree, kids[i], this); new MapButton (tree, kids[i], this);
ON_DEBUG (puts ("managing kids")); ON_DEBUG (puts ("managing kids"));
MapButton::ManageKids(); MapButton::ManageKids();

View file

@ -38,7 +38,7 @@ class MarkCanvas : public Destructable,
public: public:
MarkCanvas (UAS_Pointer<Mark>, Agent *agent, MarkCanvas (UAS_Pointer<Mark>, Agent *agent,
unsigned int offset, unsigned int ypos); unsigned int offset, unsigned int ypos);
~MarkCanvas(); virtual ~MarkCanvas();
STATIC_SENDER_HH (MarkSelectionChanged); STATIC_SENDER_HH (MarkSelectionChanged);
@ -78,8 +78,8 @@ private: // functions
private: // variables private: // variables
UAS_Pointer<Mark> f_mark_ptr; UAS_Pointer<Mark> f_mark_ptr;
unsigned int f_full_offset;
MarkIcon *f_mark_icon; MarkIcon *f_mark_icon;
unsigned int f_full_offset;
unsigned int f_y_position ; unsigned int f_y_position ;
Agent *f_agent ; Agent *f_agent ;

View file

@ -84,8 +84,6 @@ using namespace std;
WTimeOut *g_timeout; WTimeOut *g_timeout;
static void register_actions();
// ///////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////
// class constructor // class constructor

View file

@ -39,7 +39,7 @@ class MarkIcon : public WWL, public WXmPushButton
public: public:
MarkIcon (Widget parent, Widget chooser_parent, MarkIcon (Widget parent, Widget chooser_parent,
MarkCanvas *, int ypos, int scrollbar_offset); MarkCanvas *, int ypos, int scrollbar_offset);
~MarkIcon(); virtual ~MarkIcon();
void append (MarkCanvas *); void append (MarkCanvas *);
void insert (MarkCanvas *); void insert (MarkCanvas *);

View file

@ -283,7 +283,7 @@ MarkListView::view()
{ {
Xassert (f_selected_item > 0); Xassert (f_selected_item > 0);
Xassert (f_selected_item <= f_mark_list.length()); Xassert (f_selected_item <= (int) f_mark_list.length());
List_Iterator<UAS_Pointer<Mark> > m (f_mark_list); List_Iterator<UAS_Pointer<Mark> > m (f_mark_list);
int i = 1; int i = 1;
@ -311,7 +311,7 @@ void
MarkListView::remove() MarkListView::remove()
{ {
Xassert (f_selected_item > 0); Xassert (f_selected_item > 0);
Xassert (f_selected_item <= f_mark_list.length()); Xassert (f_selected_item <= (int) f_mark_list.length());
List_Iterator<UAS_Pointer<Mark> > m (f_mark_list); List_Iterator<UAS_Pointer<Mark> > m (f_mark_list);
int i = 1; int i = 1;
@ -335,7 +335,7 @@ void
MarkListView::edit() MarkListView::edit()
{ {
Xassert (f_selected_item > 0); Xassert (f_selected_item > 0);
Xassert (f_selected_item <= f_mark_list.length()); Xassert (f_selected_item <= (int) f_mark_list.length());
List_Iterator<UAS_Pointer<Mark> > m (f_mark_list); List_Iterator<UAS_Pointer<Mark> > m (f_mark_list);
int i = 1; int i = 1;

View file

@ -43,7 +43,7 @@ class MarkListView : public WWL,
public: public:
MarkListView(); MarkListView();
~MarkListView(); virtual ~MarkListView();
void display(); void display();

View file

@ -143,9 +143,9 @@ MessageAgent::position_dialog (WCallback *)
int win_x, win_y; int win_x, win_y;
unsigned int mask; unsigned int mask;
#ifdef BOGUS
static int sizesSet = 0; static int sizesSet = 0;
#ifdef BOGUS
if (!sizesSet) { if (!sizesSet) {
WXmDialogShell theShell (XtParent (*f_dialog)); WXmDialogShell theShell (XtParent (*f_dialog));
theShell.MinHeight (theShell.Height()); theShell.MinHeight (theShell.Height());
@ -600,7 +600,7 @@ MessageAgent::get_integer (const char *message, const char* title,
mtfstring = CATGETS(Set_AgentLabel, 162, "Cancel"); mtfstring = CATGETS(Set_AgentLabel, 162, "Cancel");
XtVaSetValues((Widget)f_dialog->CancelPB(), XmNlabelString, (XmString)mtfstring, NULL); XtVaSetValues((Widget)f_dialog->CancelPB(), XmNlabelString, (XmString)mtfstring, NULL);
sprintf (buffer, "%d", default_value); snprintf (buffer, sizeof(buffer), "%d", default_value);
f_text->Value (buffer); f_text->Value (buffer);
f_text->Manage(); f_text->Manage();
@ -734,7 +734,8 @@ MessageAgent::get_string (const char *msg, const char* title,
g_active = FALSE; g_active = FALSE;
f_text->Unmanage(); f_text->Unmanage();
char *value = f_text->Value(); char *value = f_text->Value();
strcpy (buffer, value); int len = MIN(strlen(value), 256 - 1);
*((char *) memcpy(buffer, value, len) + len) = '\0';
ON_DEBUG (printf ("User entered <%s>\n", value)); ON_DEBUG (printf ("User entered <%s>\n", value));

View file

@ -40,7 +40,7 @@ public: // functions
NodeHistoryAgent() NodeHistoryAgent()
: f_shell (NULL), f_selected_item (0) : f_shell (NULL), f_selected_item (0)
{ } { }
~NodeHistoryAgent(); virtual ~NodeHistoryAgent();
void display(); void display();
private: // functions private: // functions

View file

@ -124,6 +124,7 @@ using namespace std;
#include "Registration.hh" #include "Registration.hh"
// for DtCanvas Help stuff // for DtCanvas Help stuff
#include <DtI/Access.h>
#include <DtI/XUICreateI.h> #include <DtI/XUICreateI.h>
#include <DtI/SetListI.h> #include <DtI/SetListI.h>
#include <DtI/CallbacksI.h> #include <DtI/CallbacksI.h>
@ -364,7 +365,7 @@ NodePrintAgent::create_ui(Widget parent)
// Create a right attached label for the book number // Create a right attached label for the book number
sprintf(buf, "%d", 1); snprintf(buf, sizeof(buf), "%d", 1);
label = XmStringCreate(buf, XmFONTLIST_DEFAULT_TAG); label = XmStringCreate(buf, XmFONTLIST_DEFAULT_TAG);
n = 0; n = 0;
XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++;
@ -417,7 +418,7 @@ NodePrintAgent::display(UAS_Pointer<UAS_Common> &node_ptr)
// ui // ui
if ((f_help_dsp_area == NULL) || (gHelpDisplayArea == 0)) { if ((f_help_dsp_area == NULL) || (gHelpDisplayArea == 0)) {
DtHelpDispAreaStruct *displayArea = create_ui(f_print_shell); create_ui(f_print_shell);
first_time = TRUE; first_time = TRUE;
} }
@ -433,7 +434,7 @@ NodePrintAgent::display(UAS_Pointer<UAS_Common> &node_ptr)
// update page number in footer // update page number in footer
n = 0; n = 0;
sprintf(buf, "%d", 1); snprintf(buf, sizeof(buf), "%d", 1);
label = XmStringCreate(buf, XmFONTLIST_DEFAULT_TAG); label = XmStringCreate(buf, XmFONTLIST_DEFAULT_TAG);
XtSetArg(args[n], XmNlabelString, label); n++; XtSetArg(args[n], XmNlabelString, label); n++;

View file

@ -133,6 +133,7 @@ using namespace std;
#include "Registration.hh" #include "Registration.hh"
// for DtCanvas Help stuff // for DtCanvas Help stuff
#include <DtI/Access.h>
#include <DtI/XUICreateI.h> #include <DtI/XUICreateI.h>
#include <DtI/SetListI.h> #include <DtI/SetListI.h>
#include <DtI/CallbacksI.h> #include <DtI/CallbacksI.h>
@ -461,7 +462,7 @@ NodeWindowAgent::popup_menu(XButtonPressedEvent* event)
gr_type++; gr_type++;
char buff[40]; char buff[40];
sprintf(buff,"%s graphic",gr_type); snprintf(buff, sizeof(buff), "%s graphic", gr_type);
XmTextFieldSetString(f_status_text, buff); XmTextFieldSetString(f_status_text, buff);
break; break;
@ -499,16 +500,15 @@ NodeWindowAgent::popup_menu(XButtonPressedEvent* event)
char preview_buffer[256]; char preview_buffer[256];
UAS_String pt = doc_ptr->title(); UAS_String pt = doc_ptr->title();
strncpy (title, (char *) pt, 127); *((char *) memcpy(title, (char *) pt, 127) + 127) = '\0';
title[127] = '\0';
UAS_String bn = doc_ptr->book_name(UAS_SHORT_TITLE); UAS_String bn = doc_ptr->book_name(UAS_SHORT_TITLE);
const char *book_name = (char *) bn; const char *book_name = (char *) bn;
if (book_name != NULL && *book_name != '\0') if (book_name != NULL && *book_name != '\0')
sprintf (preview_buffer, CATGETS(Set_Messages, 8, "Link to %s: %s"), snprintf (preview_buffer, sizeof(preview_buffer),
book_name, title); CATGETS(Set_Messages, 8, "Link to %s: %s"), book_name, title);
else else
sprintf (preview_buffer, CATGETS(Set_Messages, 9, "Link to %s"), snprintf (preview_buffer, sizeof(preview_buffer),
title); CATGETS(Set_Messages, 9, "Link to %s"), title);
WXmLabel lb = WXmLabel(f_preview_label); WXmLabel lb = WXmLabel(f_preview_label);
lb.LabelString(WXmString(title)); lb.LabelString(WXmString(title));
@ -692,16 +692,16 @@ public:
NULL)); NULL));
} }
} }
~Ancestor() virtual ~Ancestor()
{ {
f_button.Destroy(); f_button.Destroy();
} }
void update (const char *title, UAS_Pointer<UAS_Common> toc_ptr); void update (const char *title, UAS_Pointer<UAS_Common> toc_ptr);
void activate(); void activate();
NodeWindowAgent *f_node_window_agent;
WXmPushButton f_button; WXmPushButton f_button;
UAS_Pointer<UAS_Common> f_toc_ptr; UAS_Pointer<UAS_Common> f_toc_ptr;
NodeWindowAgent *f_node_window_agent;
}; };
void void
@ -765,21 +765,21 @@ Ancestor::activate()
// ///////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////
NodeWindowAgent::NodeWindowAgent (u_int serial_no) NodeWindowAgent::NodeWindowAgent (u_int serial_no)
: f_shell (NULL), : IcccmAgent((void*)this,(data_handler_t)&NodeWindowAgent::do_search_selection),
f_help_dsp_area (NULL),
f_node_view_info (NULL), f_node_view_info (NULL),
f_shell (NULL),
f_help_dsp_area (NULL),
f_close(NULL),
f_current_ancestor (NULL),
f_form(NULL),
f_preview_timeout (NULL), f_preview_timeout (NULL),
f_serial_number(serial_no), f_serial_number(serial_no),
f_current_ancestor (NULL),
f_history_display (FALSE), f_history_display (FALSE),
f_form(NULL),
f_graphics_handler(NULL),
IcccmAgent((void*)this, (data_handler_t)&NodeWindowAgent::do_search_selection),
f_close(NULL),
f_close_sensitive(FALSE),
f_vscrollbar_offset(0), f_vscrollbar_offset(0),
f_hscrollbar_offset(0), f_hscrollbar_offset(0),
f_graphic_segment(NULL) f_graphic_segment(NULL),
f_graphics_handler(NULL),
f_close_sensitive(FALSE)
{ {
UAS_Common::request ((UAS_Receiver<UAS_LibraryDestroyedMsg> *) this); UAS_Common::request ((UAS_Receiver<UAS_LibraryDestroyedMsg> *) this);
@ -2155,7 +2155,8 @@ NodeWindowAgent::do_search_selection (const char* value, unsigned long)
{ {
buflen += 16 ; buflen += 16 ;
char *newbuf = new char[buflen] ; char *newbuf = new char[buflen] ;
strcpy(newbuf, buffer); int len = buflen - 1;
*((char *) memcpy(newbuf, buffer, len) + len) = '\0';
int depth = dest - buffer ; int depth = dest - buffer ;
delete buffer ; delete buffer ;
buffer = newbuf ; buffer = newbuf ;
@ -2228,7 +2229,7 @@ NodeWindowAgent::search_on_selectionCB(Widget, XtPointer client_data,
void void
NodeWindowAgent::text_callback(WCallback *wcb) NodeWindowAgent::text_callback(WCallback *wcb)
{ {
XmAnyCallbackStruct *cbs = (XmAnyCallbackStruct*)wcb->CallData(); (XmAnyCallbackStruct*)wcb->CallData();
char *text = XmTextGetString(wcb->GetWidget()); char *text = XmTextGetString(wcb->GetWidget());
if (text == NULL) if (text == NULL)
return; return;
@ -2298,9 +2299,9 @@ NodeWindowAgent::search_help (Widget, XtPointer client_data,
UAS_SearchScope *scope = agent->f_scope_menu->current_scope(); UAS_SearchScope *scope = agent->f_scope_menu->current_scope();
char buffer[128]; char buffer[128];
if (scope != NULL) if (scope != NULL)
sprintf (buffer, help_text, (char *) scope->name()); snprintf (buffer, sizeof(buffer), help_text, (char *) scope->name());
else else
sprintf (buffer, help_text, default_scope); snprintf (buffer, sizeof(buffer), help_text, default_scope);
// Finally, display it in the quick help field. // Finally, display it in the quick help field.
XmTextFieldSetString(agent->f_status_text, buffer); XmTextFieldSetString(agent->f_status_text, buffer);
@ -2959,16 +2960,15 @@ NodeWindowAgent::preview (WTimeOut *)
char preview_buffer[256]; char preview_buffer[256];
UAS_String pt = f_preview_document->title(); UAS_String pt = f_preview_document->title();
strncpy (title, (char *) pt, 127); *((char *) memcpy(title, (char *) pt, 127) + 127) = '\0';
title[127] = '\0';
UAS_String bn = f_preview_document->book_name(UAS_SHORT_TITLE); UAS_String bn = f_preview_document->book_name(UAS_SHORT_TITLE);
const char *book_name = (char *) bn; const char *book_name = (char *) bn;
if (book_name != NULL && *book_name != '\0') if (book_name != NULL && *book_name != '\0')
sprintf (preview_buffer, CATGETS(Set_Messages, 8, "Link to %s: %s"), snprintf (preview_buffer, sizeof(preview_buffer),
book_name, title); CATGETS(Set_Messages, 8, "Link to %s: %s"), book_name, title);
else else
sprintf (preview_buffer, CATGETS(Set_Messages, 9, "Link to %s"), snprintf (preview_buffer, sizeof(preview_buffer),
title); CATGETS(Set_Messages, 9, "Link to %s"), title);
XmTextFieldSetString(f_status_text, preview_buffer); XmTextFieldSetString(f_status_text, preview_buffer);
f_preview_timeout = NULL; f_preview_timeout = NULL;
f_preview_document = NULL; f_preview_document = NULL;
@ -3128,7 +3128,7 @@ NodeWindowAgent::make_bookmark (Boolean edit, MarkCanvas* refmark)
unsigned int length = 0; unsigned int length = 0;
unsigned int offset = 0; unsigned int offset = 0;
int i; unsigned int i;
for (i = 0; segs[i]; i++) for (i = 0; segs[i]; i++)
{ {
_DtCvSegPts* segpts = segs[i]; _DtCvSegPts* segpts = segs[i];
@ -3431,7 +3431,7 @@ NodeWindowAgent::select_mark_in_canvas(MarkCanvas *mark_to_show, bool show_it)
} }
point_info.client_data = mark_to_show; point_info.client_data = mark_to_show;
_DtCvStatus status2 =
_DtCanvasActivatePts (f_help_dsp_area->canvas, _DtCanvasActivatePts (f_help_dsp_area->canvas,
_DtCvACTIVATE_MARK_ON, // mask _DtCvACTIVATE_MARK_ON, // mask
&point_info, // info &point_info, // info
@ -3696,7 +3696,7 @@ NodeWindowAgent::show_locator()
//const char *locator = f_node_ptr->locator(); //const char *locator = f_node_ptr->locator();
UAS_String locator_str = f_node_ptr->id(); UAS_String locator_str = f_node_ptr->id();
const char *locator = (const char *)locator_str; const char *locator = (const char *)locator_str;
sprintf (buffer, snprintf (buffer, sizeof(buffer),
CATGETS(Set_NodeWindowAgent, 4, CATGETS(Set_NodeWindowAgent, 4,
"The locator for this section is %s"), locator); "The locator for this section is %s"), locator);
XmTextFieldSetString(f_status_text, buffer); XmTextFieldSetString(f_status_text, buffer);
@ -3893,10 +3893,11 @@ NodeWindowAgent::display (UAS_Pointer<UAS_Common> &node_ptr)
f_node_view_info->comp_pixel_values( f_node_view_info->comp_pixel_values(
XtDisplay(f_help_dsp_area->dispWid), XtDisplay(f_help_dsp_area->dispWid),
f_help_dsp_area->colormap f_help_dsp_area->colormap
); );
_DtCvTopicInfo *topic = f_node_view_info->topic(); _DtCvTopicInfo *topic = f_node_view_info->topic();
SetTopic(f_node_view_info->topic()); SetTopic(topic);
initialize_controls(); initialize_controls();
@ -3914,10 +3915,11 @@ NodeWindowAgent::display (UAS_Pointer<UAS_Common> &node_ptr)
char buffer[256]; char buffer[256];
strcpy (buffer, "Dtinfo: "); *((char *) memcpy(buffer, "Dtinfo: ", 8) + 8) = '\0';
strncat (buffer, int slen = strlen(buffer);
f_node_view_info->node_ptr()->book_name (UAS_LONG_TITLE), *((char *) memcpy(buffer + slen,
127); f_node_view_info->node_ptr()->book_name (UAS_LONG_TITLE),
127) + 127) = '\0';
f_shell->Title (buffer); f_shell->Title (buffer);
f_shell->IconName (buffer); f_shell->IconName (buffer);
@ -4410,8 +4412,7 @@ NodeWindowAgent::SetTopic(_DtCvTopicPtr topic)
if (g_top_locator[0] != 0) if (g_top_locator[0] != 0)
topic->id_str = g_top_locator ; topic->id_str = g_top_locator ;
_DtCvStatus status; _DtCanvasSetTopic(f_help_dsp_area->canvas, topic, _DtCvFALSE,
status = _DtCanvasSetTopic(f_help_dsp_area->canvas, topic, _DtCvFALSE,
&ret_width, &ret_height, &ret_y); &ret_width, &ret_height, &ret_y);
#ifdef CV_HYPER_DEBUG #ifdef CV_HYPER_DEBUG
cerr << "top locator=" << topic->id_str << ' ' cerr << "top locator=" << topic->id_str << ' '
@ -4562,7 +4563,7 @@ NodeWindowAgent::create_canvas_mark(_DtCvHandle canvas,
UAS_List<UAS_String> marks_loc_list; UAS_List<UAS_String> marks_loc_list;
marks_loc_list = marks_loc.splitFields(','); marks_loc_list = marks_loc.splitFields(',');
int i; unsigned int i;
for (i = 0; i < marks_loc_list.length(); i++) for (i = 0; i < marks_loc_list.length(); i++)
{ {
UAS_String& mark_loc = *marks_loc_list[i]; UAS_String& mark_loc = *marks_loc_list[i];
@ -4713,7 +4714,8 @@ NodeWindowAgent::link_to (const char *locator)
if (target) { if (target) {
node_mgr().set_preferred_window (this); node_mgr().set_preferred_window (this);
strcpy(g_top_locator, (char*)loc); int len = MIN(strlen((char*)loc), 4096 - 1);
*((char *) memcpy(g_top_locator, (char*)loc, len) + len) = '\0';
target->retrieve() ; target->retrieve() ;
} }
@ -4793,14 +4795,14 @@ NodeWindowAgent::layout_mark_icons()
List_Iterator <MarkCanvas *> m (f_mark_list); List_Iterator <MarkCanvas *> m (f_mark_list);
MarkIcon *mark_icon = NULL; MarkIcon *mark_icon = NULL;
MarkCanvas *jump_to = NULL; //MarkCanvas *jump_to = NULL;
while (m) while (m)
{ {
if (g_view_mark() == m.item()->mark_ptr()) if (g_view_mark() == m.item()->mark_ptr())
{ {
g_view_mark() = NULL; g_view_mark() = NULL;
jump_to = m.item(); // jump_to = m.item();
} }
MarkIcon *mi = NULL; MarkIcon *mi = NULL;
@ -4820,7 +4822,7 @@ NodeWindowAgent::layout_mark_icons()
} }
if (mi == NULL) { if (mi == NULL) {
MarkIcon *mark_icon = mark_icon =
new MarkIcon (XtParent (XtParent (f_help_dsp_area->dispWid)), new MarkIcon (XtParent (XtParent (f_help_dsp_area->dispWid)),
*f_shell, m.item(), *f_shell, m.item(),
m.item()->y_position(), f_vscrollbar_offset); m.item()->y_position(), f_vscrollbar_offset);
@ -5236,8 +5238,7 @@ NodeWindowAgent::replace(UAS_Pointer<Graphic> &gr)
// inform our canvas that it needs to re-render // inform our canvas that it needs to re-render
_DtCvUnit width = 0, height = 0; _DtCvUnit width = 0, height = 0;
_DtCvStatus status; _DtCanvasResize((_DtCvHandle)f_help_dsp_area->canvas,
status = _DtCanvasResize((_DtCvHandle)f_help_dsp_area->canvas,
_DtCvTRUE, &width, &height); _DtCvTRUE, &width, &height);
// There's no C/RE APIs provided to set maxYpos correctly // There's no C/RE APIs provided to set maxYpos correctly
// after canvas reformatting contents, so dtinfo manually // after canvas reformatting contents, so dtinfo manually

View file

@ -354,7 +354,7 @@ class GraphicsHandler : public UAS_Receiver<DetachGraphic>,
{ {
public: public:
GraphicsHandler(NodeWindowAgent *agent); GraphicsHandler(NodeWindowAgent *agent);
~GraphicsHandler(); virtual ~GraphicsHandler();
void receive(DetachGraphic &, void *client_data); void receive(DetachGraphic &, void *client_data);
void receive(ReAttachGraphic &, void *client_data); void receive(ReAttachGraphic &, void *client_data);

View file

@ -91,9 +91,10 @@ using namespace std;
extern "C" { void _Xm_dump_external(XmString); } extern "C" { void _Xm_dump_external(XmString); }
#ifdef NotDefined
static XmString static XmString
XmStringCreateComponent (XmStringComponentType tag, void *data, u_int length); XmStringCreateComponent (XmStringComponentType tag, void *data, u_int length);
static void register_actions(); #endif
enum { XmSTRING_COMPONENT_POINTER = XmSTRING_COMPONENT_USER_BEGIN }; enum { XmSTRING_COMPONENT_POINTER = XmSTRING_COMPONENT_USER_BEGIN };
@ -238,11 +239,12 @@ OutlineListView::set_list (OutlineList *list, BitHandle handle)
if (f_list != NULL && f_list != list ) if (f_list != NULL && f_list != list )
list->free_data_handle (f_data_handle); list->free_data_handle (f_data_handle);
f_list = list; f_list = list;
if (list != NULL) if (list != NULL) {
if (handle != 0) if (handle != 0)
f_data_handle = handle ; f_data_handle = handle ;
else else
f_data_handle = list->get_data_handle(); f_data_handle = list->get_data_handle();
}
// Determine the base level. // Determine the base level.
f_base_level = 0; f_base_level = 0;
if (list->length() > 0) { if (list->length() > 0) {
@ -465,6 +467,7 @@ OutlineListView::generate_table (OutlineList *list, XmStringTable &table,
} }
#ifdef NotDefined
// ///////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////
// XmStringCreateComponent // XmStringCreateComponent
// ///////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////
@ -505,6 +508,7 @@ XmStringCreateComponent (XmStringComponentType tag,
#endif #endif
return (string); return (string);
} }
#endif
// ///////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////
@ -529,7 +533,7 @@ OutlineListView::y_to_outline_element (Position y)
#endif #endif
// Another Motif 1.2 bug. YToPos should return 0 for bogus position, // Another Motif 1.2 bug. YToPos should return 0 for bogus position,
// but it doesn't check the range. // but it doesn't check the range.
if (f_item_pos < 0 || f_item_pos >= ItemCount()) if (f_item_pos < 0 || (int) f_item_pos >= ItemCount())
return (NULL); return (NULL);
oe = item_at (f_item_pos); oe = item_at (f_item_pos);
@ -833,7 +837,7 @@ OutlineListView::printConvertCallback(WCallback *wcb)
char filepath[MAXPATHLEN]; char filepath[MAXPATHLEN];
OutlineElement *oe = NULL; OutlineElement *oe = NULL;
FILE * fp; FILE * fp;
int n; int n, len, slen;
Atom FILE_NAME = XInternAtom(XtDisplay(w), XmSFILE_NAME, False); Atom FILE_NAME = XInternAtom(XtDisplay(w), XmSFILE_NAME, False);
Atom TARGETS = XInternAtom(XtDisplay(w), XmSTARGETS, False); Atom TARGETS = XInternAtom(XtDisplay(w), XmSTARGETS, False);
@ -904,8 +908,12 @@ OutlineListView::printConvertCallback(WCallback *wcb)
( S_IRUSR|S_IRGRP|S_IWUSR|S_IWGRP), ( S_IRUSR|S_IRGRP|S_IWUSR|S_IWGRP),
&fp); &fp);
#else #else
strcpy(filepath, getenv("HOME")); len = MIN(strlen(getenv("HOME")), MAXPATHLEN - 1);
strcat(filepath, "/.dt/tmp/file.itp"); *((char *) memcpy(filepath, getenv("HOME"), len) + len) = '\0';
slen = len;
len = MIN(strlen("/.dt/tmp/file.itp"), MAXPATHLEN - 1);
*((char *) memcpy(filepath + slen,
"/.dt/tmp/file.itp", len) + len) = '\0';
#endif #endif
// print on on debug // print on on debug
@ -919,7 +927,7 @@ OutlineListView::printConvertCallback(WCallback *wcb)
// write out each element in the list // write out each element in the list
for (int i = 0; i < f_selected_item_count; i++) { for (unsigned int i = 0; i < f_selected_item_count; i++) {
oe = item_at(selectedPositions[i] - 1) ; oe = item_at(selectedPositions[i] - 1) ;
TOC_Element *te = (TOC_Element *)oe; TOC_Element *te = (TOC_Element *)oe;
@ -966,7 +974,6 @@ void
OutlineListView::select (WCallback *wcb) OutlineListView::select (WCallback *wcb)
{ {
XmListCallbackStruct *lcs = (XmListCallbackStruct *) wcb->CallData(); XmListCallbackStruct *lcs = (XmListCallbackStruct *) wcb->CallData();
XmStringTable items = Items();
OutlineElement *oe = NULL; OutlineElement *oe = NULL;
DEBUGF (("**** select: item count = %d, pos = %d, selected = %s\n", DEBUGF (("**** select: item count = %d, pos = %d, selected = %s\n",
@ -986,7 +993,7 @@ OutlineListView::select (WCallback *wcb)
printf ("selected # = %d\n", f_selected_item_count); printf ("selected # = %d\n", f_selected_item_count);
printf (" # = %d\n", SelectedItemCount()); printf (" # = %d\n", SelectedItemCount());
#endif #endif
for (int i = 0; i < f_selected_item_count; i++) for (unsigned int i = 0; i < f_selected_item_count; i++)
{ {
DEBUGF (("M-> extracting at %d\n", lcs->selected_item_positions[i])); DEBUGF (("M-> extracting at %d\n", lcs->selected_item_positions[i]));
oe = item_at(lcs->selected_item_positions[i] - 1) ; oe = item_at(lcs->selected_item_positions[i] - 1) ;
@ -1079,7 +1086,6 @@ void
OutlineListView::activate (WCallback *wcb) OutlineListView::activate (WCallback *wcb)
{ {
XmListCallbackStruct *lcs = (XmListCallbackStruct *) wcb->CallData(); XmListCallbackStruct *lcs = (XmListCallbackStruct *) wcb->CallData();
XmStringTable items = Items();
OutlineElement *oe; OutlineElement *oe;
int expanded = False; int expanded = False;
@ -1263,7 +1269,7 @@ void
OutlineListView::update_highlighting_recursive (OutlineList *list, OutlineListView::update_highlighting_recursive (OutlineList *list,
u_int &item_pos) u_int &item_pos)
{ {
for (int i = 0; i < list->length(); i++) for (unsigned int i = 0; i < list->length(); i++)
{ {
// Select it, do not call the select callback. // Select it, do not call the select callback.
if (OUTLINE_ELEMENT(i)->is_selected (f_data_handle)) if (OUTLINE_ELEMENT(i)->is_selected (f_data_handle))
@ -1346,12 +1352,13 @@ void
OutlineListView::track_to (OutlineElement *oe, u_int position, char icon) OutlineListView::track_to (OutlineElement *oe, u_int position, char icon)
{ {
// Remove the old tracking icon, if any set. // Remove the old tracking icon, if any set.
if (f_tracking_position > 0) if (f_tracking_position > 0) {
if (window_system().nofonts()) if (window_system().nofonts())
set_track_icon (f_tracking_element, f_tracking_position, ' '); set_track_icon (f_tracking_element, f_tracking_position, ' ');
else else
set_track_icon (f_tracking_element, f_tracking_position, set_track_icon (f_tracking_element, f_tracking_position,
OLIAS_PLACEHOLDER_ICON); OLIAS_PLACEHOLDER_ICON);
}
// Set the new tracking icon. // Set the new tracking icon.
set_track_icon (oe, position, icon); set_track_icon (oe, position, icon);
@ -1363,12 +1370,13 @@ OutlineListView::track_to (OutlineElement *oe, u_int position, char icon)
void void
OutlineListView::untrack() OutlineListView::untrack()
{ {
if (f_tracking_position > 0) if (f_tracking_position > 0) {
if (window_system().nofonts()) if (window_system().nofonts())
set_track_icon (f_tracking_element, f_tracking_position, ' '); set_track_icon (f_tracking_element, f_tracking_position, ' ');
else else
set_track_icon (f_tracking_element, f_tracking_position, set_track_icon (f_tracking_element, f_tracking_position,
OLIAS_PLACEHOLDER_ICON); OLIAS_PLACEHOLDER_ICON);
}
f_tracking_position = 0; f_tracking_position = 0;
} }
@ -1382,8 +1390,6 @@ OutlineListView::set_track_icon (OutlineElement *oe, u_int position, char icon)
{ {
xmstring (oe, 1, icon); xmstring (oe, 1, icon);
XmStringTable items = Items();
// Tell the list about the change // Tell the list about the change
XmString item = (XmString) oe->xm_string(); XmString item = (XmString) oe->xm_string();
bool selected = PosSelected (position); bool selected = PosSelected (position);

View file

@ -126,8 +126,8 @@ protected: // view variables
unsigned short f_base_level; unsigned short f_base_level;
unsigned char f_selection_policy; unsigned char f_selection_policy;
u_int f_serial_number; u_int f_serial_number;
u_int f_selected_item_count;
OutlineElement *f_current_selection; OutlineElement *f_current_selection;
u_int f_selected_item_count;
unsigned char f_tracking_possible; unsigned char f_tracking_possible;
u_int f_tracking_position; u_int f_tracking_position;
OutlineElement *f_tracking_element; OutlineElement *f_tracking_element;

View file

@ -982,7 +982,7 @@ void
PrefAgent::set_geometry (WXmTextField &field, WindowGeometry &wg) PrefAgent::set_geometry (WXmTextField &field, WindowGeometry &wg)
{ {
static char buf[16]; static char buf[16];
sprintf (buf, "%dx%d", wg.width, wg.height); snprintf (buf, sizeof(buf), "%dx%d", wg.width, wg.height);
field.Value (buf); field.Value (buf);
SET_VALUE (field, WindowGeometry, wg); SET_VALUE (field, WindowGeometry, wg);
} }
@ -996,7 +996,7 @@ void
PrefAgent::set_integer (WXmTextField &field, int i) PrefAgent::set_integer (WXmTextField &field, int i)
{ {
static char buf[16]; static char buf[16];
sprintf (buf, "%d", i); snprintf (buf, sizeof(buf), "%d", i);
field.Value (buf); field.Value (buf);
SET_VALUE (field, Integer, i); SET_VALUE (field, Integer, i);
} }
@ -1062,7 +1062,7 @@ void
PrefAgent::get_geometry (WCallback *wcb) PrefAgent::get_geometry (WCallback *wcb)
{ {
WXmTextField text_field ((Widget)wcb->ClientData()); WXmTextField text_field ((Widget)wcb->ClientData());
char *shell_name; char *shell_name = NULL;
if (text_field == f_map_geo) if (text_field == f_map_geo)
shell_name = (char*)"map"; shell_name = (char*)"map";
else if (text_field == f_browse_geo) else if (text_field == f_browse_geo)

View file

@ -182,8 +182,8 @@ Dtinfo
! Default Preference values. These are only the initial values! ! Default Preference values. These are only the initial values!
! Once changed with the Preferences dialog they are no longer used. ! Once changed with the Preferences dialog they are no longer used.
Dtinfo*BrowseGeometry: 500x630 Dtinfo*BrowseGeometry: 640x720
Dtinfo*FontScale: 0 Dtinfo*FontScale: 1
Dtinfo*BrowseLock: off Dtinfo*BrowseLock: off
Dtinfo*MapGeometry: 520x350 Dtinfo*MapGeometry: 520x350
Dtinfo*MapAutoUpdate: true Dtinfo*MapAutoUpdate: true

View file

@ -195,7 +195,7 @@ reset_ui(AppPrintData *p)
// Set up the "Number of Nodes" labels. // Set up the "Number of Nodes" labels.
static char buffer[24]; static char buffer[24];
sprintf (buffer, "%d", print_list.length()); snprintf (buffer, sizeof(buffer), "%d", print_list.length());
f_selected_field.LabelString (WXmString (buffer)); f_selected_field.LabelString (WXmString (buffer));
f_to_print_field.LabelString (WXmString (buffer)); f_to_print_field.LabelString (WXmString (buffer));
@ -244,8 +244,8 @@ customizePrintSetupBox(AppPrintData *p)
Widget print_dialog = p->f_print_dialog; Widget print_dialog = p->f_print_dialog;
RCS_DEBUG("customizePrintSetupBox called.\n"); RCS_DEBUG("customizePrintSetupBox called.\n");
Widget row, how_many_frame, how_many_title, how_many_form, selected_label, print_panel; Widget how_many_frame, how_many_form, selected_label, print_panel;
Widget to_print_label, what_frame, what_title, what_form, selected_field, to_print_field; Widget what_frame, what_form, selected_field, to_print_field;
Widget print_nodes; Widget print_nodes;
// Create the app-specific top work area // Create the app-specific top work area
@ -273,7 +273,7 @@ customizePrintSetupBox(AppPrintData *p)
label = XmStringGenerate(CATGETS(Set_AgentLabel, 205, "Number of Sections"), label = XmStringGenerate(CATGETS(Set_AgentLabel, 205, "Number of Sections"),
NULL, XmCHARSET_TEXT, NULL); NULL, XmCHARSET_TEXT, NULL);
how_many_title = XtVaCreateManagedWidget("how_many_title", XtVaCreateManagedWidget("how_many_title",
xmLabelWidgetClass, xmLabelWidgetClass,
how_many_frame, how_many_frame,
XmNchildType, XmFRAME_TITLE_CHILD, XmNchildType, XmFRAME_TITLE_CHILD,
@ -315,7 +315,7 @@ customizePrintSetupBox(AppPrintData *p)
label = XmStringGenerate(CATGETS(Set_AgentLabel, 207, "To Be Printed:"), label = XmStringGenerate(CATGETS(Set_AgentLabel, 207, "To Be Printed:"),
NULL, XmCHARSET_TEXT, NULL); NULL, XmCHARSET_TEXT, NULL);
to_print_label = XtVaCreateManagedWidget("to_print_label", XtVaCreateManagedWidget("to_print_label",
xmLabelWidgetClass, xmLabelWidgetClass,
how_many_form, how_many_form,
XmNlabelString, label, XmNlabelString, label,
@ -358,7 +358,7 @@ customizePrintSetupBox(AppPrintData *p)
label = XmStringGenerate(CATGETS(Set_AgentLabel, 209, "What to Print"), label = XmStringGenerate(CATGETS(Set_AgentLabel, 209, "What to Print"),
NULL, XmCHARSET_TEXT, NULL); NULL, XmCHARSET_TEXT, NULL);
what_title = XtVaCreateManagedWidget("what_title", XtVaCreateManagedWidget("what_title",
xmLabelWidgetClass, xmLabelWidgetClass,
what_frame, what_frame,
XmNlabelString, label, XmNlabelString, label,
@ -435,7 +435,6 @@ PdmNotifyCB(Widget pr_shell, XtPointer client_data, XtPointer call_data)
XmPrintShellCallbackStruct* pr_cbs = XmPrintShellCallbackStruct* pr_cbs =
(XmPrintShellCallbackStruct*) call_data; (XmPrintShellCallbackStruct*) call_data;
AppPrintData * p = (AppPrintData *) client_data ;
if ((pr_cbs->reason == XmCR_PDM_NONE) || if ((pr_cbs->reason == XmCR_PDM_NONE) ||
(pr_cbs->reason == XmCR_PDM_START_ERROR) || (pr_cbs->reason == XmCR_PDM_START_ERROR) ||
@ -494,7 +493,8 @@ CreatePrintShell(Widget widget, AppPrintData* p)
// set default print medium if specified on command line // set default print medium if specified on command line
if (window_system().videoShell()->paper_size != NULL) { if (window_system().videoShell()->paper_size != NULL) {
sprintf(buf, "*default-medium: %s\n", window_system().videoShell()->paper_size); snprintf(buf, sizeof(buf), "*default-medium: %s\n",
window_system().videoShell()->paper_size);
XpSetAttributes( XpSetAttributes(
p->f_print_data->print_display, p->f_print_data->print_display,
p->f_print_data->print_context, p->f_print_data->print_context,
@ -725,8 +725,6 @@ PrintCB(Widget print_dialog, XtPointer client_data, XtPointer call_data)
void void
QuickPrintCB(Widget pr_button, XtPointer client_data, XtPointer call_data) QuickPrintCB(Widget pr_button, XtPointer client_data, XtPointer call_data)
{ {
char *msg;
RCS_DEBUG("QuickPrintCB called.\n"); RCS_DEBUG("QuickPrintCB called.\n");
AppPrintData *p = (AppPrintData*)client_data; AppPrintData *p = (AppPrintData*)client_data;
@ -969,8 +967,10 @@ PrintOneUASCommon(UAS_Pointer<UAS_Common> &doc, Widget pshell, int *cur_pageP)
// set print orientation to either landscape or portrait (if set) // set print orientation to either landscape or portrait (if set)
if (f_printOrientation != NULL) { if (f_printOrientation != NULL) {
sprintf(buf, "*content-orientation: %s\n", f_printOrientation); snprintf(buf, sizeof(buf),
XpSetAttributes(XtDisplay(pshell), XpGetContext(XtDisplay(pshell)), XPPageAttr, buf, XPAttrMerge); "*content-orientation: %s\n", f_printOrientation);
XpSetAttributes(XtDisplay(pshell), XpGetContext(XtDisplay(pshell)),
XPPageAttr, buf, XPAttrMerge);
} }
for (gHelpDisplayArea->firstVisible = gHelpDisplayArea->nextNonVisible = 0; for (gHelpDisplayArea->firstVisible = gHelpDisplayArea->nextNonVisible = 0;
@ -981,7 +981,7 @@ PrintOneUASCommon(UAS_Pointer<UAS_Common> &doc, Widget pshell, int *cur_pageP)
XpStartPage(XtDisplay(pshell), XtWindow(pshell)); XpStartPage(XtDisplay(pshell), XtWindow(pshell));
sprintf(buf, "%d", *cur_pageP); snprintf(buf, sizeof(buf), "%d", *cur_pageP);
label = XmStringCreateLocalized(buf); label = XmStringCreateLocalized(buf);
n = 0; n = 0;
@ -1000,7 +1000,7 @@ PrintOneUASCommon(UAS_Pointer<UAS_Common> &doc, Widget pshell, int *cur_pageP)
// Print chidren if appropriate // Print chidren if appropriate
if (print_hierarchy) if (print_hierarchy)
{ {
int i; unsigned int i;
UAS_List<UAS_Common> kids = doc->children(); UAS_List<UAS_Common> kids = doc->children();
for (i = 0; i < kids.length(); i++) for (i = 0; i < kids.length(); i++)
@ -1028,7 +1028,6 @@ PrintCloseDisplayCB(
{ {
RCS_DEBUG("PrintCloseDisplayCB called.\n"); RCS_DEBUG("PrintCloseDisplayCB called.\n");
DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct*)call_data;
AppPrintData *p = (AppPrintData*)client_data; AppPrintData *p = (AppPrintData*)client_data;
if (p->f_print_shell) if (p->f_print_shell)
@ -1062,7 +1061,6 @@ ToggleWhatCB(
{ {
RCS_DEBUG("ToggleWhatCB called.\n"); RCS_DEBUG("ToggleWhatCB called.\n");
XmToggleButtonCallbackStruct * cbs = (XmToggleButtonCallbackStruct *) call_data;
AppPrintData * p = (AppPrintData *)client_data; AppPrintData * p = (AppPrintData *)client_data;
xList<UAS_Pointer<UAS_Common> > &print_list = *(p->f_print_list); xList<UAS_Pointer<UAS_Common> > &print_list = *(p->f_print_list);
@ -1089,7 +1087,7 @@ ToggleWhatCB(
if (active == f_print_nodes) if (active == f_print_nodes)
{ {
sprintf (buffer, "%d", print_list.length()); snprintf (buffer, sizeof(buffer), "%d", print_list.length());
print_hierarchy = False; print_hierarchy = False;
} }
else // active == f_print_hierarchy else // active == f_print_hierarchy
@ -1099,11 +1097,11 @@ ToggleWhatCB(
if (subtree_size != 0) if (subtree_size != 0)
{ {
sprintf (buffer, "%d", subtree_size); snprintf (buffer, sizeof(buffer), "%d", subtree_size);
} }
else else
{ {
strcpy (buffer, "?"); *((char *) memcpy(buffer, "?", 1) + 1) = '\0';
} }
print_hierarchy = True; print_hierarchy = True;
} }

View file

@ -176,8 +176,6 @@ ScopeMenu::fill_menu()
void void
ScopeMenu::set_scope (WCallback *wcb) ScopeMenu::set_scope (WCallback *wcb)
{ {
CALL_DATA (XmToggleButtonCallbackStruct,tbcs);
f_current_scope = f_current_scope =
(UAS_SearchScope *) WXmPushButtonGadget(wcb->GetWidget()).UserData(); (UAS_SearchScope *) WXmPushButtonGadget(wcb->GetWidget()).UserData();
} }
@ -284,7 +282,7 @@ ScopeMenu::receive (ScopeDeleted &msg, void *client_data)
XtSetArg(args[n], XmNchildren, &kids); n++; XtSetArg(args[n], XmNchildren, &kids); n++;
XtGetValues(f_pull_menu, args, n); XtGetValues(f_pull_menu, args, n);
int i; unsigned int i;
for (i = 0; i < num_kids; i++) for (i = 0; i < num_kids; i++)
{ {
if (XmIsSeparator (kids[i])) if (XmIsSeparator (kids[i]))
@ -300,7 +298,7 @@ ScopeMenu::receive (ScopeDeleted &msg, void *client_data)
// It had better be in the list! // It had better be in the list!
theKid = i; theKid = i;
Xassert (theKid != num_kids); Xassert (theKid != (int) num_kids);
ON_DEBUG (printf ("widget #%d is the button\n", theKid)); ON_DEBUG (printf ("widget #%d is the button\n", theKid));
// if it is selected, select first w/ callback called // if it is selected, select first w/ callback called
@ -322,7 +320,7 @@ ScopeMenu::receive (ScopeDeleted &msg, void *client_data)
ON_DEBUG (printf ("ScopeMenu: sep pos = %d, num_kids = %d (%d)\n", ON_DEBUG (printf ("ScopeMenu: sep pos = %d, num_kids = %d (%d)\n",
separator_pos, num_kids, num_kids -1 -2)); separator_pos, num_kids, num_kids -1 -2));
// - 1 for deleted widget // - 1 for deleted widget
if (separator_pos == (num_kids - 1)) if (separator_pos == (int) (num_kids - 1))
{ {
ON_DEBUG (puts (" destroying separator")); ON_DEBUG (puts (" destroying separator"));
XtDestroyWidget (kids[separator_pos-1]); XtDestroyWidget (kids[separator_pos-1]);
@ -339,14 +337,13 @@ ScopeMenu::receive (ScopeRenamed &msg, void *client_data)
int n; int n;
Cardinal num_kids; Cardinal num_kids;
WidgetList kids; WidgetList kids;
int separator_pos = -1;
n = 0; n = 0;
XtSetArg(args[n], XmNnumChildren, &num_kids); n++; XtSetArg(args[n], XmNnumChildren, &num_kids); n++;
XtSetArg(args[n], XmNchildren, &kids); n++; XtSetArg(args[n], XmNchildren, &kids); n++;
XtGetValues(f_pull_menu, args, n); XtGetValues(f_pull_menu, args, n);
int i; unsigned int i;
for (i = 0; i < num_kids; i++) for (i = 0; i < num_kids; i++)
{ {
if (XmIsPushButtonGadget (kids[i]) && if (XmIsPushButtonGadget (kids[i]) &&
@ -405,7 +402,7 @@ ScopeMenu::receive (UpdateMenu &msg, void *client_data)
XtGetValues(f_pull_menu, args, n); XtGetValues(f_pull_menu, args, n);
// destroy all toggle buttons in menu // destroy all toggle buttons in menu
for (int i = 0; i < num_kids; i++) for (unsigned int i = 0; i < num_kids; i++)
{ {
XtUnmanageChild (kids[i]); XtUnmanageChild (kids[i]);
XtDestroyWidget (kids[i]); XtDestroyWidget (kids[i]);

View file

@ -51,7 +51,7 @@ class ScopeMenu : public WWL,
{ {
public: public:
ScopeMenu (Widget option_menu, bool requires_current_section = FALSE); ScopeMenu (Widget option_menu, bool requires_current_section = FALSE);
~ScopeMenu(); virtual ~ScopeMenu();
UAS_SearchScope *current_scope() UAS_SearchScope *current_scope()
{ return (f_current_scope); } { return (f_current_scope); }
@ -67,8 +67,8 @@ private:
void receive (UpdateMenu &, void *client_data); void receive (UpdateMenu &, void *client_data);
private: private:
Widget f_option_menu;
Widget f_pull_menu;
UAS_SearchScope *f_current_scope; UAS_SearchScope *f_current_scope;
bool f_use_current_section ; bool f_use_current_section ;
Widget f_option_menu;
Widget f_pull_menu;
}; };

View file

@ -88,7 +88,7 @@ SearchHistoryListView::display_value(FolioObject *object)
ResultID &rid = *(ResultID*)object; ResultID &rid = *(ResultID*)object;
char buf[8]; char buf[8];
sprintf(buf, "%d", rid.ndocs()); snprintf(buf, sizeof(buf), "%d", rid.ndocs());
WXmString matchString = buf; WXmString matchString = buf;
UAS_Pointer<UAS_SearchResults> results = rid.results(); UAS_Pointer<UAS_SearchResults> results = rid.results();

View file

@ -283,7 +283,7 @@ SearchResultsAgent::display (ResultID *results)
f_results = results; f_results = results;
UAS_SearchEngine &se = search_mgr().search_engine(); // UAS_SearchEngine &se = search_mgr().search_engine();
// get window up quick // get window up quick
@ -319,10 +319,10 @@ SearchResultsAgent::display (ResultID *results)
/* -------- Display the number of hits. -------- */ /* -------- Display the number of hits. -------- */
char buffer[80]; char buffer[80];
sprintf (buffer, "%d of %d sections", snprintf (buffer, sizeof(buffer), "%d of %d sections",
f_docs_to_display, results->ndocs()); f_docs_to_display, results->ndocs());
f_hits_label->LabelString (buffer); f_hits_label->LabelString (buffer);
sprintf (buffer, "%s", snprintf (buffer, sizeof(buffer), "%s",
(char *)*(UAS_String*)(results->results()->scope_name())); (char *)*(UAS_String*)(results->results()->scope_name()));
f_scope_label->LabelString (buffer); f_scope_label->LabelString (buffer);
@ -379,8 +379,8 @@ SearchResultsAgent::fill_list(UAS_List<UAS_SearchResultsEntry>& rlist)
static XmString string_table[INITIAL_FILL_SIZE]; static XmString string_table[INITIAL_FILL_SIZE];
XmString *t = string_table; XmString *t = string_table;
int string_count = 0 ; unsigned int string_count = 0 ;
int i; unsigned int i;
for (i = 0; i < rlist.length(); i ++) { for (i = 0; i < rlist.length(); i ++) {
string_count++ ; string_count++ ;
*t++ = form_result_string (rlist[i]); *t++ = form_result_string (rlist[i]);

View file

@ -220,7 +220,9 @@ ScopeOutlineListView::select(WCallback *wcb)
} else { } else {
// first get item that was selected // first get item that was selected
#ifdef JBM
XmStringTable items = Items(); XmStringTable items = Items();
#endif
XmListCallbackStruct *lcs = (XmListCallbackStruct *)wcb->CallData(); XmListCallbackStruct *lcs = (XmListCallbackStruct *)wcb->CallData();
OutlineElement *oe ; OutlineElement *oe ;
@ -287,7 +289,7 @@ ScopeOutlineListView::find_parent(OutlineElement *parent,
if (parent->has_children() && parent->children_cached()) if (parent->has_children() && parent->children_cached())
{ {
OutlineList *olist = parent->children() ; OutlineList *olist = parent->children() ;
for (int i = 0 ; i < olist->length(); i++) for (unsigned int i = 0 ; i < olist->length(); i++)
{ {
current = (OutlineElement*)(*olist)[i] ; current = (OutlineElement*)(*olist)[i] ;
if (current == element) if (current == element)
@ -331,7 +333,7 @@ ScopeOutlineListView::lid_to_index(const UAS_String &lid)
{ {
OutlineList *ol = list(); OutlineList *ol = list();
OutlineElement *oe; OutlineElement *oe;
for (int i = 0; i < ol->length(); i++) for (unsigned int i = 0; i < ol->length(); i++)
{ {
oe = ((OutlineElement *) (*ol)[i]); oe = ((OutlineElement *) (*ol)[i]);
UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc(); UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc();
@ -347,7 +349,7 @@ ScopeOutlineListView::lid_to_name(UAS_String &lid)
{ {
OutlineList *ol = list(); OutlineList *ol = list();
OutlineElement *oe; OutlineElement *oe;
for (int i = 0; i < ol->length(); i++) for (unsigned int i = 0; i < ol->length(); i++)
{ {
oe = ((OutlineElement *) (*ol)[i]); oe = ((OutlineElement *) (*ol)[i]);
UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc(); UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc();
@ -364,7 +366,7 @@ ScopeOutlineListView::name_to_lid(UAS_String &name)
{ {
OutlineList *ol = list(); OutlineList *ol = list();
OutlineElement *oe; OutlineElement *oe;
for (int i = 0; i < ol->length(); i++) for (unsigned int i = 0; i < ol->length(); i++)
{ {
oe = ((OutlineElement *) (*ol)[i]); oe = ((OutlineElement *) (*ol)[i]);
UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc(); UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc();
@ -576,7 +578,7 @@ SearchScopeAgent::create_ui()
#else #else
UAS_List<UAS_String> rootList = UAS_Common::rootLocators (); UAS_List<UAS_String> rootList = UAS_Common::rootLocators ();
OutlineList *ol = new OutlineList(rootList.length()); OutlineList *ol = new OutlineList(rootList.length());
for (int i = 0; i < rootList.length(); i ++) { for (unsigned int i = 0; i < rootList.length(); i ++) {
UAS_Pointer<UAS_Common> d = UAS_Common::create(*(UAS_String *)rootList[i]); UAS_Pointer<UAS_Common> d = UAS_Common::create(*(UAS_String *)rootList[i]);
UAS_Pointer<UAS_Collection> cd = (UAS_Collection *) ((UAS_Common *) d); UAS_Pointer<UAS_Collection> cd = (UAS_Collection *) ((UAS_Common *) d);
ol->append (new TOC_Element (cd->root())); ol->append (new TOC_Element (cd->root()));
@ -663,7 +665,7 @@ SearchScopeAgent::scope_name_prompt()
default_name = new char[len + 1] ; default_name = new char[len + 1] ;
default_name_len = len ; default_name_len = len ;
} }
strcpy (default_name, scope_name); *((char *) memcpy(default_name, scope_name, len) + len) = '\0';
message_mgr().set_max_length(default_name_len); message_mgr().set_max_length(default_name_len);
scope_name = message_mgr().get_string( scope_name = message_mgr().get_string(
(char*)UAS_String(CATGETS(Set_SearchScopeAgent, 2, (char*)UAS_String(CATGETS(Set_SearchScopeAgent, 2,
@ -1001,7 +1003,7 @@ SearchScopeAgent::rename_scope()
// Make sure old scope name preference isn't saved by NULLing out // Make sure old scope name preference isn't saved by NULLing out
// it's value. This should really happen in a ScopeListMgr object. DJB // it's value. This should really happen in a ScopeListMgr object. DJB
char scratch[64]; char scratch[64];
sprintf (scratch, "Scope.%s", f_current_scope->name()); snprintf (scratch, sizeof(scratch), "Scope.%s", f_current_scope->name());
StringPref (scratch).value (""); StringPref (scratch).value ("");
f_current_scope->set_name (name); f_current_scope->set_name (name);
f_scope_list.save(); f_scope_list.save();
@ -1319,7 +1321,7 @@ SearchScopeAgent::bookcase_list (BitHandle handle)
// Iterate over the infolibs looking for selected entries. // Iterate over the infolibs looking for selected entries.
assert (handle != 0); assert (handle != 0);
for (infolib = 0; infolib < ol->length(); infolib++) for (infolib = 0; infolib < (int) ol->length(); infolib++)
{ {
// //
// See if the infolib is selected. // See if the infolib is selected.
@ -1329,7 +1331,7 @@ SearchScopeAgent::bookcase_list (BitHandle handle)
if (oe->is_selected (handle)) if (oe->is_selected (handle))
{ {
// get all bookcases and append them to the selected list // get all bookcases and append them to the selected list
for (bookcase = 0; bookcase < bclist->length(); bookcase++) for (bookcase = 0; bookcase < (int) bclist->length(); bookcase++)
{ {
oe = ((OutlineElement *)(*bclist)[bookcase]); oe = ((OutlineElement *)(*bclist)[bookcase]);
common = ((TOC_Element*)oe)->toc(); common = ((TOC_Element*)oe)->toc();
@ -1350,7 +1352,7 @@ SearchScopeAgent::bookcase_list (BitHandle handle)
// Get children of the infolib. // Get children of the infolib.
// If the bookcase is selected, create a BookcaseEntry and // If the bookcase is selected, create a BookcaseEntry and
// append it to the list. // append it to the list.
for (bookcase = 0; bookcase < bclist->length(); bookcase++) for (bookcase = 0; bookcase < (int) bclist->length(); bookcase++)
{ {
oe = ((OutlineElement *)(*bclist)[bookcase]); oe = ((OutlineElement *)(*bclist)[bookcase]);
if (oe->is_selected (handle)) if (oe->is_selected (handle))
@ -1378,7 +1380,7 @@ SearchScopeAgent::bookcase_list (BitHandle handle)
// //
List *books = oe->children(); List *books = oe->children();
// (1-based book, since that's how they're indexed in Fulcrum.) // (1-based book, since that's how they're indexed in Fulcrum.)
for (int book_num = 1; book_num <= books->length(); book_num++) for (int book_num = 1; book_num <= (int)books->length(); book_num++)
{ {
ON_DEBUG (printf ("Checking Book #%d: ", book_num)); ON_DEBUG (printf ("Checking Book #%d: ", book_num));
if (((OutlineElement*)(*books)[book_num-1])->is_selected (handle)) if (((OutlineElement*)(*books)[book_num-1])->is_selected (handle))
@ -1422,12 +1424,12 @@ SearchScopeAgent::bookcase_list()
OutlineList *ol = f_infolib_list->list(); OutlineList *ol = f_infolib_list->list();
OutlineElement *oe; OutlineElement *oe;
for (int i = 0; i < ol->length(); i++) for (unsigned int i = 0; i < ol->length(); i++)
{ {
oe = ((OutlineElement *) (*ol)[i]); oe = ((OutlineElement *) (*ol)[i]);
UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc(); UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc();
UAS_List<UAS_Common> kids = infolib->children(); UAS_List<UAS_Common> kids = infolib->children();
for (int j = 0; j < kids.length(); j++) for (unsigned int j = 0; j < kids.length(); j++)
{ {
if (kids[j]->type() == UAS_BOOKCASE) if (kids[j]->type() == UAS_BOOKCASE)
{ {
@ -1457,7 +1459,7 @@ SearchScopeAgent::bookcase_list(UAS_String &lid)
UAS_BookcaseEntry *bce; UAS_BookcaseEntry *bce;
UAS_List<UAS_Common> kids = infolib->children(); UAS_List<UAS_Common> kids = infolib->children();
for (int j = 0; j < kids.length(); j++) for (unsigned int j = 0; j < kids.length(); j++)
{ {
if (kids[j]->type() == UAS_BOOKCASE) if (kids[j]->type() == UAS_BOOKCASE)
{ {
@ -1585,7 +1587,7 @@ SearchScopeAgent::delete_scope()
// Make sure old scope name preference isn't saved by NULLing out // Make sure old scope name preference isn't saved by NULLing out
// it's value. This should really happen in a ScopeListMgr object. DJB // it's value. This should really happen in a ScopeListMgr object. DJB
char scratch[64]; char scratch[64];
sprintf (scratch, "Scope.%s", scope->name()); snprintf (scratch, sizeof(scratch), "Scope.%s", scope->name());
StringPref (scratch).value (""); StringPref (scratch).value ("");
delete scope; delete scope;
@ -1598,16 +1600,14 @@ void
SearchScopeAgent::add_infolib(UAS_Pointer<UAS_Common> &lib) SearchScopeAgent::add_infolib(UAS_Pointer<UAS_Common> &lib)
{ {
// get infolib list and append new infolib to the list // get infolib list and append new infolib to the list
char scratch[256];
OutlineList *ol = f_infolib_list->list(); OutlineList *ol = f_infolib_list->list();
OutlineElement *oe; OutlineElement *oe;
int infolib_num;
UAS_String temp_lid; UAS_String temp_lid;
// See if infolib is already in list--if it's there, // See if infolib is already in list--if it's there,
// don't add it again. // don't add it again.
int i; unsigned int i;
for (i = 0; i < ol->length(); i++) for (i = 0; i < ol->length(); i++)
{ {
oe = ((OutlineElement *) (*ol)[i]); oe = ((OutlineElement *) (*ol)[i]);
@ -1635,8 +1635,6 @@ SearchScopeAgent::add_infolib(UAS_Pointer<UAS_Common> &lib)
break; break;
} }
infolib_num = i; // next insertion point in list
// Create search scope for new infolib // Create search scope for new infolib
UAS_String newLib_lid(newLib->lid()); UAS_String newLib_lid(newLib->lid());
UAS_SearchScope *scope = create_infolib_scope(newLib_lid); UAS_SearchScope *scope = create_infolib_scope(newLib_lid);
@ -1671,7 +1669,6 @@ SearchScopeAgent::remove_infolib(UAS_Pointer<UAS_Common> &lib)
{ {
// get infolib list and remove infolib from the list // get infolib list and remove infolib from the list
OutlineList *ol = f_infolib_list->list(); OutlineList *ol = f_infolib_list->list();
OutlineElement *oe;
int infolib_num; int infolib_num;
// Get index of infolib in infobase list // Get index of infolib in infobase list
@ -1687,7 +1684,7 @@ SearchScopeAgent::remove_infolib(UAS_Pointer<UAS_Common> &lib)
BitHandle handle = f_infolib_list->data_handle(); BitHandle handle = f_infolib_list->data_handle();
f_infolib_list->clear(); f_infolib_list->clear();
int i; unsigned int i;
for (i = 0; i < ol->length(); i ++) for (i = 0; i < ol->length(); i ++)
((OutlineElement *) (*ol)[i])->set_expanded (handle); ((OutlineElement *) (*ol)[i])->set_expanded (handle);
@ -1710,7 +1707,7 @@ SearchScopeAgent::remove_infolib(UAS_Pointer<UAS_Common> &lib)
break; break;
} }
char scratch[128]; char scratch[128];
sprintf(scratch, "Infolib %s", (char *)kids[i]->id()); snprintf(scratch, sizeof(scratch), "Infolib %s", (char *)kids[i]->id());
#endif #endif
// remove search scope associated with infolib // remove search scope associated with infolib
@ -1725,7 +1722,7 @@ SearchScopeAgent::remove_infolib(UAS_Pointer<UAS_Common> &lib)
// it's value. This should really happen in a ScopeListMgr // it's value. This should really happen in a ScopeListMgr
// object. DJB // object. DJB
char scratch[128]; char scratch[128];
sprintf (scratch, "Scope.%s", scope->name()); snprintf (scratch, sizeof(scratch), "Scope.%s", scope->name());
StringPref (scratch).value (""); StringPref (scratch).value ("");
#endif #endif
@ -1766,7 +1763,6 @@ SearchScopeAgent::update_current_scope()
WidgetList kids; WidgetList kids;
Cardinal num_kids; Cardinal num_kids;
UAS_SearchScope* scope; UAS_SearchScope* scope;
UAS_SearchScope* current_scope=NULL;
n = 0; n = 0;
XtSetArg(args[n], XmNnumChildren, &num_kids); n++; XtSetArg(args[n], XmNnumChildren, &num_kids); n++;
@ -1775,7 +1771,7 @@ SearchScopeAgent::update_current_scope()
if(f_current_scope != NULL) if(f_current_scope != NULL)
{ {
for (int i = 1; i < num_kids; i++) for (unsigned int i = 1; i < num_kids; i++)
{ {
WXmPushButton btn (kids[i]); WXmPushButton btn (kids[i]);
scope = (UAS_SearchScope*)btn.UserData(); scope = (UAS_SearchScope*)btn.UserData();
@ -1869,7 +1865,7 @@ SearchScopeAgent::update_option_menu(UAS_String &scope_name)
// destroy all toggle buttons in menu except // destroy all toggle buttons in menu except
// the unnamed button. // the unnamed button.
for (int i = 1; i < num_kids; i++) for (unsigned int i = 1; i < num_kids; i++)
{ {
XtUnmanageChild (kids[i]); XtUnmanageChild (kids[i]);
XtDestroyWidget (kids[i]); XtDestroyWidget (kids[i]);
@ -1945,7 +1941,7 @@ SearchScopeAgent::list()
OutlineList *ol = f_infolib_list->list(); OutlineList *ol = f_infolib_list->list();
OutlineElement *oe; OutlineElement *oe;
for (int i = 0; i < ol->length(); i++) for (unsigned int i = 0; i < ol->length(); i++)
{ {
oe = ((OutlineElement *) (*ol)[i]); oe = ((OutlineElement *) (*ol)[i]);
UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc(); UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc();
@ -1971,7 +1967,7 @@ SearchScopeAgent::list(UAS_String &lid)
// get infolibs children--only save bookcases // get infolibs children--only save bookcases
UAS_List<UAS_Common> kids = infolib->children(); UAS_List<UAS_Common> kids = infolib->children();
for (int i = 0; i < kids.length(); i++) for (unsigned int i = 0; i < kids.length(); i++)
if (kids[i]->type() == UAS_BOOKCASE) if (kids[i]->type() == UAS_BOOKCASE)
rval.insert_item(kids[i]); rval.insert_item(kids[i]);
return rval; return rval;
@ -2009,7 +2005,7 @@ SearchScopeAgent::create_infolib_scope(UAS_String &lid)
// entry for each one. // entry for each one.
// //
UAS_List<UAS_Common> kids = list(lid); UAS_List<UAS_Common> kids = list(lid);
for (int i = 0; i < kids.length(); i++) for (unsigned int i = 0; i < kids.length(); i++)
{ {
bce = new UAS_BookcaseEntry(kids[i]); bce = new UAS_BookcaseEntry(kids[i]);
bcases.append(bce); bcases.append(bce);
@ -2017,7 +2013,8 @@ SearchScopeAgent::create_infolib_scope(UAS_String &lid)
#ifdef EAM #ifdef EAM
char scratch[128]; char scratch[128];
sprintf(scratch, "Infolib %s", (char *)kids[first_base_num]->id()); snprintf(scratch, sizeof(scratch), "Infolib %s",
(char *)kids[first_base_num]->id());
#endif #endif
// create search scope for infolib using the infolib name as // create search scope for infolib using the infolib name as
@ -2059,7 +2056,7 @@ SearchScopeAgent::bid_to_index(UAS_String &lid, UAS_String &bid)
OutlineElement *oe = ((OutlineElement *) (*ol)[index]); OutlineElement *oe = ((OutlineElement *) (*ol)[index]);
UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc(); UAS_Pointer<UAS_Common> infolib = ((TOC_Element *)oe)->toc();
UAS_List<UAS_Common> kids = infolib->children(); UAS_List<UAS_Common> kids = infolib->children();
for (int i = 0; i < kids.length(); i++) for (unsigned int i = 0; i < kids.length(); i++)
{ {
if (kids[i]->bid() == bid) if (kids[i]->bid() == bid)
return i; return i;
@ -2094,8 +2091,6 @@ SearchScopeAgent::get_search_scope(UAS_Pointer<UAS_Common> &infolib)
xList<UAS_SearchScope *> &scopes = f_scope_list; xList<UAS_SearchScope *> &scopes = f_scope_list;
List_Iterator<UAS_SearchScope *> iter (scopes); List_Iterator<UAS_SearchScope *> iter (scopes);
UAS_SearchScope *scope; UAS_SearchScope *scope;
int scope_idx=0;
int maxScope=0; // max scope index
iter++; // skip "Current Section" scope iter++; // skip "Current Section" scope
iter++; // skip "All Libraries" scope iter++; // skip "All Libraries" scope

View file

@ -125,17 +125,19 @@ private: // functions
private: // variables private: // variables
SearchScopeList f_scope_list;
UAS_SearchScope *f_current_scope;
WTopLevelShell f_shell; WTopLevelShell f_shell;
SearchScopeList f_scope_list;
bool f_first_time;
bool f_auto_expand;
QueryEditor *f_option_menu;
UAS_SearchScope *f_current_scope;
WXmOptionMenu f_scope_option; WXmOptionMenu f_scope_option;
WXmPushButton f_unnamed; WXmPushButton f_unnamed;
OutlineListView *f_infolib_list; OutlineListView *f_infolib_list;
OutlineListView *f_component_list; OutlineListView *f_component_list;
WXmPushButton f_new, f_save, f_rename, f_delete, f_reset; WXmPushButton f_new, f_save, f_rename, f_delete, f_reset;
bool f_first_time;
bool f_auto_expand;
QueryEditor *f_option_menu;
}; };

View file

@ -108,20 +108,23 @@ SimpleBuffer::~SimpleBuffer ()
void void
SimpleBuffer::write (char *new_data) SimpleBuffer::write (char *new_data)
{ {
int slen, len = 0;
int new_len = 0; int new_len = 0;
if (f_data) if (f_data)
new_len = strlen (f_data); len = new_len = strlen (f_data);
new_len += strlen (new_data); new_len += strlen (new_data);
// manual realloc // manual realloc
char *new_buf = new char [new_len + 1]; char *new_buf = new char [new_len + 1];
if (f_data) if (f_data)
(void) strcpy (new_buf, f_data); *((char *) memcpy(new_buf, f_data, len) + len) = '\0';
else else
*new_buf = 0; *new_buf = 0;
delete [] f_data; delete [] f_data;
f_data = new_buf; f_data = new_buf;
(void) strcat (f_data, new_data); slen = len;
len = strlen(new_data);
*((char *) memcpy(f_data + slen, new_data, len) + len) = '\0';
} }
char * char *
@ -159,7 +162,7 @@ SearchScopeList::save()
buffer.reset(); buffer.reset();
// Store the scope component mask. // Store the scope component mask.
sprintf (scratch, "%d;", scope->search_zones().zones()); snprintf (scratch, sizeof(scratch), "%d;", scope->search_zones().zones());
buffer.write (scratch, sizeof (char), strlen (scratch)); buffer.write (scratch, sizeof (char), strlen (scratch));
// get the list of bookcases for the current scope // get the list of bookcases for the current scope
@ -187,9 +190,9 @@ SearchScopeList::save()
const char *name = bce->name(); const char *name = bce->name();
const char *bid = bce->bid(); const char *bid = bce->bid();
if (bc > 0) if (bc > 0)
sprintf (scratch, "&%s(%s)", bid, name); snprintf (scratch, sizeof(scratch), "&%s(%s)", bid, name);
else else
sprintf (scratch, "%s(%s)", bid, name); snprintf (scratch, sizeof(scratch), "%s(%s)", bid, name);
buffer.write(scratch, sizeof (char), strlen(scratch)); buffer.write(scratch, sizeof (char), strlen(scratch));
if(env().debug()) if(env().debug())
@ -204,7 +207,7 @@ SearchScopeList::save()
{ {
for (int bk = 0; bk < booklist.numItems(); bk++) for (int bk = 0; bk < booklist.numItems(); bk++)
{ {
sprintf (scratch, ",%d", booklist[bk]); snprintf (scratch, sizeof(scratch), ",%d", booklist[bk]);
buffer.write(scratch, sizeof (char), strlen(scratch)); buffer.write(scratch, sizeof (char), strlen(scratch));
} }
if(env().debug()) if(env().debug())
@ -214,7 +217,7 @@ SearchScopeList::save()
buffer.write ("\0", sizeof (char), 1); buffer.write ("\0", sizeof (char), 1);
// Get the right preference object. // Get the right preference object.
sprintf (scratch, "Scope.%s", scope->name()); snprintf (scratch, sizeof(scratch), "Scope.%s", scope->name());
StringPref store (scratch); StringPref store (scratch);
// Update its value. // Update its value.
@ -278,9 +281,7 @@ SearchScopeList::save()
void void
SearchScopeList::restore() SearchScopeList::restore()
{ {
char scratch[1024]; unsigned int i;
char basename[256];
int i;
UAS_SearchScope *s; UAS_SearchScope *s;
// get the list of bookcase names // get the list of bookcase names
@ -352,13 +353,13 @@ SearchScopeList::create_named_scopes()
} }
// retrieve scopes from preference file and validate each one // retrieve scopes from preference file and validate each one
for (int sname = 0; sname < scope_names.length(); sname++) for (int sname = 0; sname < (int) scope_names.length(); sname++)
{ {
is_scope_valid = True; is_scope_valid = True;
// Get the specified scope from preferences. // Get the specified scope from preferences.
UAS_String ss = *(UAS_String*) scope_names[sname]; UAS_String ss = *(UAS_String*) scope_names[sname];
sprintf (scratch, "Scope.%s", (char*)ss); snprintf (scratch, sizeof(scratch), "Scope.%s", (char*)ss);
StringPref scope (scratch); StringPref scope (scratch);
// Grab the component mask. // Grab the component mask.
@ -389,7 +390,7 @@ SearchScopeList::create_named_scopes()
// loop once for each bookcase in search scope. create a // loop once for each bookcase in search scope. create a
// bookcase entry for each valid bookcase. if bookcase // bookcase entry for each valid bookcase. if bookcase
// is invalid, invalidate the scope. // is invalid, invalidate the scope.
for (int bname = 0; bname < bookcases.length(); bname++) for (int bname = 0; bname < (int) bookcases.length(); bname++)
{ {
UAS_String str = *(UAS_String*)bookcases[bname]; UAS_String str = *(UAS_String*)bookcases[bname];
UAS_List<UAS_String>bc_list = str.splitFields (','); UAS_List<UAS_String>bc_list = str.splitFields (',');
@ -410,14 +411,13 @@ SearchScopeList::create_named_scopes()
UAS_String sn = *(UAS_String*)scope_names[sname]; UAS_String sn = *(UAS_String*)scope_names[sname];
if(is_scope_valid) if(is_scope_valid)
{ {
UAS_SearchScope *s = f_search_scope_agent->create_scope ( f_search_scope_agent->create_scope (sn, bookcase_list, mask, False);
sn, bookcase_list, mask, False);
} }
else else
{ {
// rtp - 4/24/95 : otherwise store its name for use later; // rtp - 4/24/95 : otherwise store its name for use later;
// see SearchScopeList::save routine above // see SearchScopeList::save routine above
sprintf(scratch, "%s%s", (char*)sn, ","); snprintf(scratch, sizeof(scratch), "%s%s", (char*)sn, ",");
f_buffer->write (scratch); f_buffer->write (scratch);
} }
// reset list for next turn // reset list for next turn
@ -433,10 +433,10 @@ SearchScopeList::validate_bookcase(UAS_String &bid)
// validate bookcase id // validate bookcase id
UAS_List<UAS_Common> libs = f_search_scope_agent->list(); UAS_List<UAS_Common> libs = f_search_scope_agent->list();
for (int i = 0; i < libs.length(); i++) for (unsigned int i = 0; i < libs.length(); i++)
{ {
UAS_List<UAS_Common> kids = libs[i]->children(); UAS_List<UAS_Common> kids = libs[i]->children();
for (int j = 0; j < kids.length(); j++) for (unsigned int j = 0; j < kids.length(); j++)
{ {
if(kids[j]->bid() == bid) if(kids[j]->bid() == bid)
{ {
@ -483,7 +483,7 @@ SearchScopeList::create_bcase_entry(UAS_List<UAS_String> &bc_list)
int book_num; int book_num;
UAS_ObjList<int> booklist; UAS_ObjList<int> booklist;
for (int book = 1; book < bc_list.length(); book++) for (int book = 1; book < (int) bc_list.length(); book++)
{ {
UAS_String abook = *(UAS_String*)bc_list[book]; UAS_String abook = *(UAS_String*)bc_list[book];
if(sscanf ((char*)abook, "%d", &book_num) == 1) if(sscanf ((char*)abook, "%d", &book_num) == 1)

View file

@ -114,6 +114,7 @@ UrlAgent::document( char *locator,
Boolean new_window ) Boolean new_window )
{ {
int sts = ID_SUCCESS ; int sts = ID_SUCCESS ;
int len, bufferlen;
if( (locator == NULL) || if( (locator == NULL) ||
((locator != NULL) && ( *locator == '\0' )) ) ((locator != NULL) && ( *locator == '\0' )) )
@ -136,9 +137,9 @@ UrlAgent::document( char *locator,
// assume given a unique locator ID for the target. // assume given a unique locator ID for the target.
// construct a fully-qualified form and pass it on. // construct a fully-qualified form and pass it on.
char *buffer = bufferlen = strlen("mmdb:LOCATOR=") + strlen(locator) + 1;
new char[strlen("mmdb:LOCATOR=") + strlen(locator) + 1]; char *buffer = new char[bufferlen];
sprintf (buffer, "mmdb:LOCATOR=%s", locator); snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);
d = UAS_Common::create( buffer ) ; d = UAS_Common::create( buffer ) ;
delete [] buffer; delete [] buffer;
@ -166,7 +167,8 @@ UrlAgent::document( char *locator,
// (evil hack alert) // (evil hack alert)
g_scroll_to_locator = TRUE; g_scroll_to_locator = TRUE;
strcpy( g_top_locator, locator ) ; len = MIN(strlen(locator), 4096 - 1);
*((char *) memcpy(g_top_locator, locator, len) + len) = '\0';
d->retrieve(); d->retrieve();
} }
@ -208,7 +210,9 @@ CloseProgramCB(
XtPointer client_data, XtPointer client_data,
XtPointer /*call_data*/) XtPointer /*call_data*/)
{ {
#if 0
AppPrintData * p = (AppPrintData *) client_data ; AppPrintData * p = (AppPrintData *) client_data ;
#endif
/* we want to wait for the current job to complete before exiting */ /* we want to wait for the current job to complete before exiting */
// If a job is running, just unmap the windows and install itself // If a job is running, just unmap the windows and install itself
@ -235,6 +239,7 @@ int
UrlAgent::print_document(char *locator) UrlAgent::print_document(char *locator)
{ {
int sts = ID_SUCCESS ; int sts = ID_SUCCESS ;
int bufferlen;
// set up for printing // set up for printing
AppPrintData* p = window_system().GetAppPrintData(); AppPrintData* p = window_system().GetAppPrintData();
@ -263,9 +268,9 @@ UrlAgent::print_document(char *locator)
// assume given a unique locator ID for the target. // assume given a unique locator ID for the target.
// construct a fully-qualified form and pass it on. // construct a fully-qualified form and pass it on.
char *buffer = bufferlen = strlen("mmdb:LOCATOR=") + strlen(locator) + 1;
new char[strlen("mmdb:LOCATOR=") + strlen(locator) + 1]; char *buffer = new char[bufferlen];
sprintf (buffer, "mmdb:LOCATOR=%s", locator); snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);
d = UAS_Common::create( buffer ) ; d = UAS_Common::create( buffer ) ;
delete [] buffer; delete [] buffer;

View file

@ -12,7 +12,7 @@ class UrlAgent: public WWL {
// Constructors, Destructor // Constructors, Destructor
public: public:
UrlAgent (); UrlAgent ();
~UrlAgent (); virtual ~UrlAgent ();
// Public Member Functions // Public Member Functions
public: public:

View file

@ -60,8 +60,9 @@ class PoolString : public FolioObject
public: // functions public: // functions
PoolString (const char *string) PoolString (const char *string)
{ {
f_string = new char[strlen(string) + 1]; int len = strlen(string);
strcpy (f_string, string); f_string = new char[len + 1];
*((char *) memcpy(f_string, string, len) + len) = '\0';
} }
~PoolString () ~PoolString ()
@ -81,7 +82,7 @@ public: // variables
Atomizer::Atomizer (const char *string) Atomizer::Atomizer (const char *string)
{ {
// Try to find the string in the pool of strings // Try to find the string in the pool of strings
register int i; register unsigned int i;
for (i = 0; i < f_pool.length(); i++) for (i = 0; i < f_pool.length(); i++)
if (((PoolString *)f_pool[i])->equals (string)) if (((PoolString *)f_pool[i])->equals (string))

View file

@ -93,7 +93,7 @@ BitField::BitField(unsigned long initial_bits)
f_bits_in_use = new unsigned long [ f_num_words ] ; f_bits_in_use = new unsigned long [ f_num_words ] ;
// zero bit arrays // zero bit arrays
for (int i = 0 ; i < f_num_words; i++){ for (unsigned int i = 0 ; i < f_num_words; i++){
f_words[i] = 0 ; f_words[i] = 0 ;
} }
// reserve first (0) bit // reserve first (0) bit
@ -115,7 +115,7 @@ BitField::check_allocation (unsigned long word)
unsigned long *new_words = new unsigned long [word + 1]; unsigned long *new_words = new unsigned long [word + 1];
unsigned long *new_use = new unsigned long [word + 1]; unsigned long *new_use = new unsigned long [word + 1];
int i; unsigned int i;
for (i = 0 ; i < f_num_words ; i++) for (i = 0 ; i < f_num_words ; i++)
{ {
// copy old info // copy old info
@ -146,7 +146,7 @@ BitField::get_handle()
// find first free bit // find first free bit
// first find first free word // first find first free word
int word; unsigned int word;
for (word = 0 ; word < f_num_words ; word++ ) for (word = 0 ; word < f_num_words ; word++ )
if ( word_has_zero_bit(f_bits_in_use[word]) ) if ( word_has_zero_bit(f_bits_in_use[word]) )
break; break;

View file

@ -145,7 +145,7 @@ Buffer::write (const int integer)
// Convert bytes from native to MSB first ordering. // Convert bytes from native to MSB first ordering.
g_int = 0; g_int = 0;
for (int i = 0; i < sizeof (int); i++) for (unsigned int i = 0; i < sizeof (int); i++)
if (g_byte_pos[i] != 0) if (g_byte_pos[i] != 0)
g_intbuf[g_byte_pos[i]-1] = inbuf[i]; g_intbuf[g_byte_pos[i]-1] = inbuf[i];
@ -158,7 +158,7 @@ Buffer::read (int *integer)
*integer = 0; *integer = 0;
// Convert from MSB first ordering to native. // Convert from MSB first ordering to native.
for (int i = 0; i < sizeof (int); i++) for (unsigned int i = 0; i < sizeof (int); i++)
if (g_byte_pos[i] != 0) if (g_byte_pos[i] != 0)
((char *) integer)[i] = f_point[g_byte_pos[i]-1]; ((char *) integer)[i] = f_point[g_byte_pos[i]-1];
@ -217,7 +217,7 @@ Buffer::write (const char *bytes, u_int size, u_int length)
ON_DEBUG(printf ("Writing %d bytes to buffer @ %p\n", size * length, f_point)); ON_DEBUG(printf ("Writing %d bytes to buffer @ %p\n", size * length, f_point));
int num_bytes = size * length; int num_bytes = size * length;
check_space (num_bytes); check_space (num_bytes);
for (int i = 0; i < size * length; i++) for (unsigned int i = 0; i < size * length; i++)
ON_DEBUG(printf ("%02X ", (unsigned char) bytes[i])); ON_DEBUG(printf ("%02X ", (unsigned char) bytes[i]));
ON_DEBUG(printf ("\n")); ON_DEBUG(printf ("\n"));
memcpy (f_point, bytes, num_bytes); memcpy (f_point, bytes, num_bytes);
@ -232,7 +232,7 @@ Buffer::read (char **bytes, u_int size, u_int length)
ON_DEBUG(printf ("Reading %d bytes from buffer @ %p\n", num_bytes, f_point)); ON_DEBUG(printf ("Reading %d bytes from buffer @ %p\n", num_bytes, f_point));
assert (f_point + num_bytes <= f_end_of_data); assert (f_point + num_bytes <= f_end_of_data);
*bytes = f_point; *bytes = f_point;
for (int i = 0; i < size * length; i++) for (unsigned int i = 0; i < size * length; i++)
ON_DEBUG(printf ("%02X ", (unsigned int) (*bytes)[i])); ON_DEBUG(printf ("%02X ", (unsigned int) (*bytes)[i]));
ON_DEBUG(printf ("\n")); ON_DEBUG(printf ("\n"));
f_point += num_bytes; f_point += num_bytes;

View file

@ -57,13 +57,14 @@
extern "C" extern "C"
{ {
extern size_t strlen(const char *); extern size_t strlen(const char *);
extern char *strcpy(char *, const char *); extern void* memcpy(void *dst, const void *src, size_t len);
} }
FString::FString(const char *string) FString::FString(const char *string)
{ {
f_string = new char[ strlen (string) + 1 ] ; int len = strlen(string);
strcpy(f_string, string); f_string = new char[ len + 1 ] ;
*((char *) memcpy(f_string, string, len) + len) = '\0';
} }
FString::~FString() FString::~FString()

View file

@ -67,13 +67,13 @@ public:
f_handler (handler), f_handler (handler),
f_notify_type (notify_type), f_dependent_data (dependent_data) f_notify_type (notify_type), f_dependent_data (dependent_data)
{ if (next) next->f_pre_next = &f_next; } { if (next) next->f_pre_next = &f_next; }
Dependent **f_pre_next;
Dependent *f_next;
FolioObject *f_dependent; FolioObject *f_dependent;
FolioObject *f_folio_object; FolioObject *f_folio_object;
notify_handler_t f_handler; notify_handler_t f_handler;
u_int f_notify_type; u_int f_notify_type;
void *f_dependent_data; void *f_dependent_data;
Dependent **f_pre_next;
Dependent *f_next;
void release(); void release();
void call (FolioObject *obj, void *notify_data); void call (FolioObject *obj, void *notify_data);
}; };
@ -101,8 +101,8 @@ public:
: f_next (next), f_dependent_obj (d) : f_next (next), f_dependent_obj (d)
{ } { }
void delete_dependent(); void delete_dependent();
Dependent *f_dependent_obj;
DependOnList *f_next; DependOnList *f_next;
Dependent *f_dependent_obj;
}; };
inline void inline void

View file

@ -77,8 +77,9 @@ HashObject::HashObject(const char *key, FolioObject *object)
assert(key != NULL); assert(key != NULL);
assert(object != NULL); assert(object != NULL);
f_key = new char[strlen(key) + 1] ; int len = strlen(key);
strcpy(f_key, key); f_key = new char[len + 1] ;
*((char *) memcpy(f_key, key, len) + len) = '\0';
} }
HashObject::~HashObject() HashObject::~HashObject()

View file

@ -182,7 +182,7 @@ HashTbl::remove (const Hashable &element)
void void
HashTbl::remove_all (bool delete_elements) HashTbl::remove_all (bool delete_elements)
{ {
for (int i = 0; i < f_num_buckets; i++) for (unsigned int i = 0; i < f_num_buckets; i++)
if (f_hash_bucket[i] != NULL) if (f_hash_bucket[i] != NULL)
{ {
if (delete_elements) if (delete_elements)

View file

@ -194,7 +194,7 @@ List::insert (unsigned int location, FolioObject *element)
abort(); abort();
// Shift the array forward to make room for new insertion. // Shift the array forward to make room for new insertion.
for (int i = f_length; i > location; i--) for (unsigned int i = f_length; i > location; i--)
f_list_element[i] = f_list_element[i-1]; f_list_element[i] = f_list_element[i-1];
// Insert the new element in the list. // Insert the new element in the list.
@ -233,7 +233,7 @@ List::copy() const
// NOTE: use length() instead of f_length because it may be more general // NOTE: use length() instead of f_length because it may be more general
List *retlist = new List(length()); List *retlist = new List(length());
for (int i = 0 ; i < length(); i++) for (unsigned int i = 0 ; i < length(); i++)
retlist->append((*this)[i]); retlist->append((*this)[i]);
return retlist ; return retlist ;

View file

@ -37,8 +37,9 @@ class NodeID {
inline inline
NodeID::NodeID(const char *filename) NodeID::NodeID(const char *filename)
{ {
f_filename = new char[strlen(filename) + 1] ; int len = strlen(filename);
strcpy(f_filename, filename); f_filename = new char[len + 1] ;
*((char *) memcpy(f_filename, filename, len) + len) = '\0';
} }
inline inline

View file

@ -374,7 +374,7 @@ chop_segment(_DtCvSegment* seg, unsigned int nc)
if (widec) { if (widec) {
wchar_t* src = (wchar_t*)seg->handle.string.string + nc; wchar_t* src = (wchar_t*)seg->handle.string.string + nc;
wchar_t* dest = new wchar_t[seg_nc - nc + 1]; wchar_t* dest = new wchar_t[seg_nc - nc + 1];
for (int i = 0; i < seg_nc - nc; i++) for (unsigned int i = 0; i < seg_nc - nc; i++)
dest[i] = src[i]; dest[i] = src[i];
dest[seg_nc - nc] = '\0'; dest[seg_nc - nc] = '\0';
nseg_str = (void*)dest; nseg_str = (void*)dest;
@ -385,7 +385,7 @@ chop_segment(_DtCvSegment* seg, unsigned int nc)
else { else {
char* src = (char*)seg->handle.string.string + nc; char* src = (char*)seg->handle.string.string + nc;
char* dest = new char[seg_nc - nc + 1]; char* dest = new char[seg_nc - nc + 1];
for (int i = 0; i < seg_nc - nc; i++) for (unsigned int i = 0; i < seg_nc - nc; i++)
dest[i] = src[i]; dest[i] = src[i];
dest[seg_nc - nc] = '\0'; dest[seg_nc - nc] = '\0';
nseg_str = (void*)dest; nseg_str = (void*)dest;
@ -510,21 +510,23 @@ highlight_search_hit(_DtCvSegment* seg, unsigned int vcc, unsigned int len)
if (widec) { if (widec) {
wchar_t* src = (wchar_t*)sibling->handle.string.string; wchar_t* src = (wchar_t*)sibling->handle.string.string;
wchar_t* dst = (wchar_t*)seg->handle.string.string; wchar_t* dst = (wchar_t*)seg->handle.string.string;
int len = wcslen(dst) + wcslen(src); int slen = wcslen(dst);
int len = wcslen(src);
seg->handle.string.string = (void*) seg->handle.string.string = (void*)
realloc(seg->handle.string.string, realloc(seg->handle.string.string,
sizeof(wchar_t) * (len + 1)); sizeof(wchar_t) * (slen + len + 1));
dst = (wchar_t*)seg->handle.string.string; dst = (wchar_t*)seg->handle.string.string;
wcscat(dst, src); *((char *) memcpy(dst + slen, src, len) + len) = '\0';
} }
else { else {
char* src = (char*)sibling->handle.string.string; char* src = (char*)sibling->handle.string.string;
char* dst = (char*)seg->handle.string.string; char* dst = (char*)seg->handle.string.string;
int len = strlen(dst) + strlen(dst); int slen = strlen(dst);
int len = strlen(src);
seg->handle.string.string = (void*) seg->handle.string.string = (void*)
realloc(seg->handle.string.string, len + 1); realloc(seg->handle.string.string, slen + len + 1);
dst = (char*)seg->handle.string.string; dst = (char*)seg->handle.string.string;
strcat(dst, src); *((char *) memcpy(dst + slen, src, len) + len) = '\0';
} }
DtCvStrVcLenSync(seg); DtCvStrVcLenSync(seg);
@ -596,7 +598,7 @@ traverse_for_vcc(_DtCvSegment* seg, unsigned int vcc)
else if (seg_ptype == _DtCvTABLE) { else if (seg_ptype == _DtCvTABLE) {
_DtCvSegment** cell = seg->handle.table.cells; _DtCvSegment** cell = seg->handle.table.cells;
for (; *cell; cell++) { for (; *cell; cell++) {
if (therein = traverse_for_vcc(*cell, vcc)) if ((therein = traverse_for_vcc(*cell, vcc)))
break; break;
} }
} }
@ -709,7 +711,7 @@ NodeViewInfo::set_search_hits(UAS_Pointer<UAS_List<UAS_TextRun> >& hits)
assert( (seg->type & _DtCvPRIMARY_MASK) == _DtCvSTRING ); assert( (seg->type & _DtCvPRIMARY_MASK) == _DtCvSTRING );
if (seg = highlight_search_hit(seg, hit->offset(), hit->length())) { if ((seg = highlight_search_hit(seg, hit->offset(), hit->length()))) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "(DEBUG) highlight_search_hit succeeded, " fprintf(stderr, "(DEBUG) highlight_search_hit succeeded, "
"offset=%d\n", hit->offset()); "offset=%d\n", hit->offset());

View file

@ -54,8 +54,9 @@ OString::string (const char *s, copy_t copy)
if (s != NULL && copy == COPY) if (s != NULL && copy == COPY)
{ {
f_string = new char [strlen(s) + 1]; int len = strlen(s);
strcpy ((char *) f_string, (char *) s); f_string = new char [len + 1];
*((char *) memcpy((char *)f_string, (char *)s, len) + len) = '\0';
f_delete_string = TRUE; f_delete_string = TRUE;
} }
else else

View file

@ -66,8 +66,6 @@ OrderList::clear()
int int
OrderList::add(ListEntry *node, AddCode where, bool mvcursor) OrderList::add(ListEntry *node, AddCode where, bool mvcursor)
{ {
int status = OLIST_OK;
if (node != NULL) { if (node != NULL) {
if (f_cursor == NULL) if (f_cursor == NULL)
insertNew(node); insertNew(node);
@ -149,26 +147,26 @@ ListEntry *
OrderList::extract() OrderList::extract()
{ {
ListEntry *node; ListEntry *node;
int status = OLIST_OK; // int status = OLIST_OK;
node = f_cursor; node = f_cursor;
if ((node == f_head) && (node == f_tail)) { if ((node == f_head) && (node == f_tail)) {
f_head = NULL; f_head = NULL;
f_cursor = NULL; f_cursor = NULL;
f_tail = NULL; f_tail = NULL;
status = OLIST_LAST_REMOVD; // status = OLIST_LAST_REMOVD;
} }
else if (node == f_head) { else if (node == f_head) {
f_head = node->f_next; f_head = node->f_next;
f_cursor = node->f_next; f_cursor = node->f_next;
f_cursor->f_prev = NULL; f_cursor->f_prev = NULL;
status = OLIST_HEAD_REMOVD; // status = OLIST_HEAD_REMOVD;
} }
else if (node == f_tail) { else if (node == f_tail) {
f_tail = node->f_prev; f_tail = node->f_prev;
f_cursor = node->f_prev; f_cursor = node->f_prev;
f_cursor->f_next = NULL; f_cursor->f_next = NULL;
status = OLIST_TAIL_REMOVD; // status = OLIST_TAIL_REMOVD;
} }
else { else {
node->f_prev->f_next = node->f_next; node->f_prev->f_next = node->f_next;

View file

@ -117,7 +117,6 @@ protected: // functions
protected: // variables protected: // variables
OutlineList *f_children; // Each outline element may have a list of children OutlineList *f_children; // Each outline element may have a list of children
unsigned char f_level; // Level this element is at, zero-based
BitField f_selected ; BitField f_selected ;
BitField f_expanded ; BitField f_expanded ;
@ -130,6 +129,7 @@ protected: // variables
u_int f_string_creator; u_int f_string_creator;
unsigned char f_display_flag; // Able to be displayed on activate [rtp] unsigned char f_display_flag; // Able to be displayed on activate [rtp]
unsigned char f_level; // Level this element is at, zero-based
}; };

View file

@ -98,7 +98,7 @@ OutlineList::count_expanded (BitHandle data_handle)
void void
OutlineList::copy_selected(BitHandle src, BitHandle dest) OutlineList::copy_selected(BitHandle src, BitHandle dest)
{ {
for (int i = 0 ; i < length(); i++) for (unsigned int i = 0 ; i < length(); i++)
{ {
if (OUTLINE_ELEMENT(i)->is_selected(src)) if (OUTLINE_ELEMENT(i)->is_selected(src))
OUTLINE_ELEMENT(i)->set_selected(dest) ; OUTLINE_ELEMENT(i)->set_selected(dest) ;
@ -119,7 +119,7 @@ OutlineList::copy_selected(BitHandle src, BitHandle dest)
void void
OutlineList::copy_expanded (BitHandle src, BitHandle dest) OutlineList::copy_expanded (BitHandle src, BitHandle dest)
{ {
for (int i = 0 ; i < length(); i++) for (unsigned int i = 0 ; i < length(); i++)
{ {
if (OUTLINE_ELEMENT(i)->is_expanded (src)) if (OUTLINE_ELEMENT(i)->is_expanded (src))
OUTLINE_ELEMENT(i)->set_expanded (dest); OUTLINE_ELEMENT(i)->set_expanded (dest);
@ -140,7 +140,7 @@ OutlineList::copy_expanded (BitHandle src, BitHandle dest)
void void
OutlineList::recursive_select(BitHandle data_handle) OutlineList::recursive_select(BitHandle data_handle)
{ {
for (int i = 0 ; i < length() ; i++ ) for (unsigned int i = 0 ; i < length() ; i++ )
if (OUTLINE_ELEMENT(i)->children_cached() && if (OUTLINE_ELEMENT(i)->children_cached() &&
OUTLINE_ELEMENT(i)->has_children()) OUTLINE_ELEMENT(i)->has_children())
{ {
@ -159,7 +159,7 @@ OutlineList::recursive_select(BitHandle data_handle)
void void
OutlineList::select_all(BitHandle data_handle) OutlineList::select_all(BitHandle data_handle)
{ {
for (int i = 0 ; i < length(); i++) for (unsigned int i = 0 ; i < length(); i++)
{ {
OUTLINE_ELEMENT(i)->set_selected(data_handle); OUTLINE_ELEMENT(i)->set_selected(data_handle);
if (OUTLINE_ELEMENT(i)->children_cached() && if (OUTLINE_ELEMENT(i)->children_cached() &&
@ -177,7 +177,7 @@ OutlineList::select_all(BitHandle data_handle)
void void
OutlineList::deselect_all(BitHandle data_handle) OutlineList::deselect_all(BitHandle data_handle)
{ {
for (int i = 0 ; i < length(); i++) for (unsigned int i = 0 ; i < length(); i++)
{ {
OUTLINE_ELEMENT(i)->unset_selected(data_handle); OUTLINE_ELEMENT(i)->unset_selected(data_handle);
if (OUTLINE_ELEMENT(i)->children_cached() && if (OUTLINE_ELEMENT(i)->children_cached() &&
@ -231,7 +231,7 @@ OutlineList::selected_items (BitHandle data_handle, List *l)
if (l == NULL) if (l == NULL)
l = new List (8, 8, List::GROW_MULTIPLY); l = new List (8, 8, List::GROW_MULTIPLY);
for (int i = 0; i < length(); i++) for (unsigned int i = 0; i < length(); i++)
{ {
if (OUTLINE_ELEMENT(i)->is_selected (data_handle)) if (OUTLINE_ELEMENT(i)->is_selected (data_handle))
l->append (OUTLINE_ELEMENT(i)); l->append (OUTLINE_ELEMENT(i));

View file

@ -34,8 +34,9 @@ public: // functions
{ {
if (string != NULL) if (string != NULL)
{ {
f_string = new char [strlen(string) + 1]; int len = strlen(string);
strcpy (f_string, string); f_string = new char [len + 1];
*((char *) memcpy(f_string, string, len) + len) = '\0';
} }
else else
f_string = NULL; f_string = NULL;

View file

@ -113,8 +113,9 @@ PText::PText (PNode *parent, PNode *previous, PNode *next, char *str)
else else
f_symbol_space = f_symbol_len; f_symbol_space = f_symbol_len;
f_symbol = (char *) malloc (sizeof(char) * (f_symbol_space + 1)); int len = sizeof(char) * f_symbol_space;
strcpy (f_symbol, str); f_symbol = (char *) malloc (len + sizeof(char));
*((char *) memcpy(f_symbol, str, len) + len) = '\0';
} }

View file

@ -79,8 +79,9 @@ string_hash (const char *key)
register u_int pos, sum = 0; register u_int pos, sum = 0;
register char c; register char c;
for (pos = 0; c = *key++; pos++) for (pos = 0; (c = *key++); pos++)
sum = (sum << 5) + (sum >> (sizeof(int) * 8 - 6)) + (c ^ lookup_table[c]); sum = (sum << 5) + (sum >> (sizeof(int) * 8 - 6))
+ (c ^ lookup_table[(int)c]);
// was: // was:
// sum = c ^ lookup_table [(pos * c) % 256]; // sum = c ^ lookup_table [(pos * c) % 256];

View file

@ -80,11 +80,11 @@ PixmapGraphic::PixmapGraphic(Pixmap pixmap, Dimension width, Dimension height,
f_width (width), f_width (width),
f_height (height), f_height (height),
f_flag (flag), f_flag (flag),
f_agent(0),
f_colormap(0), f_colormap(0),
f_num_colors(0), f_num_colors(0),
f_colors(NULL), f_colors(NULL),
f_tiff_context(NULL), f_tiff_context(NULL)
f_agent(0)
{ {
} }

View file

@ -28,9 +28,9 @@ SUBDIRS=Widgets $(CLASSLIBS) Messages cgm
XCOMM redefine TopLevelProject to build DtInfo with standard CDE config dir XCOMM redefine TopLevelProject to build DtInfo with standard CDE config dir
#undef TopLevelProject #undef TopLevelProject
#define TopLevelProject DtInfo #define TopLevelProject DtInfo
IMAKE_DEFINES = -DTopLevelProject=TopLevelProject \ IMAKE_DEF_DTINFO = -DTopLevelProject=TopLevelProject \
-DProjectTmplFile='<DtInfo.tmpl>' \ -DProjectTmplFile='<DtInfo.tmpl>' \
-DProjectRulesFile='<DtInfo.rules>' -DProjectRulesFile='<DtInfo.rules>'
DependSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS))
@ -42,8 +42,10 @@ SYS_LIBRARIES=-lm -liconv /usr/lib/libpthreads.a -blibpath:/usr/dt/lib:/X11/lib:
SYS_LIBRARIES=-lm -lfs SYS_LIBRARIES=-lm -lfs
#elif defined(HPArchitecture) #elif defined(HPArchitecture)
SYS_LIBRARIES=$(DYNAMIC) -lm SYS_LIBRARIES=$(DYNAMIC) -lm
#elif defined(LinuxArchitecture) || defined(FreeBSDArchitecture) || defined(OpenBSDArchitecture) #elif defined(LinuxArchitecture) || defined(FreeBSDArchitecture)
SYS_LIBRARIES=-lm -L$(XPROJECTROOT)/lib SYS_LIBRARIES=-lm -L$(XPROJECTROOT)/lib
#elif defined(OpenBSDArchitecture)
SYS_LIBRARIES=-lm -L$(XPROJECTROOT)/lib -L$(MPROJECTROOT)/lib
#else #else
SYS_LIBRARIES=-lm SYS_LIBRARIES=-lm
#endif #endif
@ -311,7 +313,7 @@ all:: Prelude.h dfiles messages Dtinfo
includes:: Prelude.h dfiles messages includes:: Prelude.h dfiles messages
#if defined(HPArchitecture) ||defined (AIXArchitecture) || defined(UXPArchitecture) || (defined(SunArchitecture) && CplusplusCompilerMajorVersion < 4) || defined(AlphaArchitecture) || defined(USLArchitecture) || defined(FreeBSDArchitecture) #if defined(HPArchitecture) ||defined (AIXArchitecture) || defined(UXPArchitecture) || (defined(SunArchitecture) && CplusplusCompilerMajorVersion < 4) || defined(AlphaArchitecture) || defined(USLArchitecture) || defined(FreeBSDArchitecture) || defined(OpenBSDArchitecture)
# ifndef Dont_Use_Templates_Repository # ifndef Dont_Use_Templates_Repository
# define Dont_Use_Templates_Repository # define Dont_Use_Templates_Repository
UAS_INCLUDES=-I./UAS/Base UAS_INCLUDES=-I./UAS/Base
@ -336,7 +338,7 @@ SpecialCPlusPlusObjectRule(Templates.o,,-ptf $(SUBDIR_TEMPL_INCLUDES))
SpecialCPlusPlusExpandRule(Templates..c,,-ptf -DMakeOperatorNewPublic) SpecialCPlusPlusExpandRule(Templates..c,,-ptf -DMakeOperatorNewPublic)
#elif defined(DoLicenseManagement) #elif defined(DoLicenseManagement)
SpecialCPlusPlusObjectRule(Templates.o,,-ptf $(LICENSE_L_INCLUDES)) SpecialCPlusPlusObjectRule(Templates.o,,-ptf $(LICENSE_L_INCLUDES))
#elif defined(LinuxArchitecture) || defined(FreeBSDArchitecture) #elif defined(LinuxArchitecture) || defined(FreeBSDArchitecture) || defined(OpenBSDArchitecture)
SpecialCPlusPlusObjectRule(Templates.o,,$(SUBDIR_TEMPL_INCLUDES)) SpecialCPlusPlusObjectRule(Templates.o,,$(SUBDIR_TEMPL_INCLUDES))
SpecialCPlusPlusExpandRule(Templates..c,,-DMakeOperatorNewPublic) SpecialCPlusPlusExpandRule(Templates..c,,-DMakeOperatorNewPublic)
#else #else

View file

@ -44,6 +44,8 @@ CatMgr* CatMgr::f_msg_catalog_mgr = NULL;
CatMgr::CatMgr() : f_msg(NULL), f_default(NULL) CatMgr::CatMgr() : f_msg(NULL), f_default(NULL)
{ {
int len;
#ifdef DEBUG #ifdef DEBUG
char* nlspath = getenv("NLSPATH"); char* nlspath = getenv("NLSPATH");
if (nlspath) if (nlspath)
@ -61,8 +63,9 @@ CatMgr::CatMgr() : f_msg(NULL), f_default(NULL)
#endif #endif
char* msg = ::catgets(f_catd, Set_CatMgr, DEFAULT_MSG, char* msg = ::catgets(f_catd, Set_CatMgr, DEFAULT_MSG,
"default message not found."); "default message not found.");
f_default = new char[strlen(msg) + 1]; len = strlen(msg);
strcpy(f_default, msg); f_default = new char[len + 1];
*((char *) memcpy(f_default, msg, len) + len) = '\0';
} }
else { else {
#ifdef DEBUG #ifdef DEBUG
@ -71,8 +74,9 @@ CatMgr::CatMgr() : f_msg(NULL), f_default(NULL)
#else #else
static char* cat_not_found = (char*)""; static char* cat_not_found = (char*)"";
#endif #endif
f_default = new char[strlen(cat_not_found) + 1]; len = strlen(cat_not_found);
strcpy(f_default, cat_not_found); f_default = new char[len + 1];
*((char *) memcpy(f_default, cat_not_found, len) + len) = '\0';
} }
#ifdef DEBUG #ifdef DEBUG
cerr << "(DEBUG) default msg=" << f_default << '\n' << flush; cerr << "(DEBUG) default msg=" << f_default << '\n' << flush;
@ -91,15 +95,17 @@ CatMgr::~CatMgr()
if (is_open(f_catd)) { if (is_open(f_catd)) {
int status = catclose(f_catd); int status = catclose(f_catd);
#ifdef DEBUG
if (status < 0) { if (status < 0) {
#ifdef DEBUG
cerr << "(ERROR) catclose failed." << '\n' << flush; cerr << "(ERROR) catclose failed." << '\n' << flush;
abort(); abort();
#endif
} }
else { else {
#ifdef DEBUG
cerr << "(DEBUG) catclose succeeded" << '\n' << flush; cerr << "(DEBUG) catclose succeeded" << '\n' << flush;
}
#endif #endif
}
} }
#ifdef DEBUG #ifdef DEBUG
else { else {
@ -111,6 +117,8 @@ CatMgr::~CatMgr()
char* char*
CatMgr::catgets(int set_num, int msg_num, const char* def) CatMgr::catgets(int set_num, int msg_num, const char* def)
{ {
int len;
if (f_msg) if (f_msg)
delete[] f_msg; delete[] f_msg;
@ -126,6 +134,7 @@ CatMgr::catgets(int set_num, int msg_num, const char* def)
for (; *msg == ' ' || *msg == '\t'; msg++); for (; *msg == ' ' || *msg == '\t'; msg++);
#endif #endif
int msglen = strlen(msg); int msglen = strlen(msg);
len = msglen;
f_msg = new char[msglen + 1]; f_msg = new char[msglen + 1];
#if defined(UXPDS) && defined(GENCAT_BUG) #if defined(UXPDS) && defined(GENCAT_BUG)
#ifdef DEBUG #ifdef DEBUG
@ -144,16 +153,18 @@ CatMgr::catgets(int set_num, int msg_num, const char* def)
msglen--; msglen--;
} }
#endif #endif
strcpy(f_msg, msg); *((char *) memcpy(f_msg, msg, len) + len) = '\0';
} }
else { else {
if (def) { if (def) {
f_msg = new char[strlen(def) + 1]; len = strlen(def);
strcpy(f_msg, def); f_msg = new char[len + 1];
*((char *) memcpy(f_msg, def, len) + len) = '\0';
} }
else { else {
f_msg =new char[strlen(f_default) + 1]; len = strlen(f_default);
strcpy(f_msg, f_default); f_msg =new char[len + 1];
*((char *) memcpy(f_msg, f_default, len) + len) = '\0';
} }
} }

View file

@ -75,6 +75,8 @@ using namespace std;
#include "Managers/CatMgr.hh" #include "Managers/CatMgr.hh"
#include "Prelude.h" #include "Prelude.h"
#include "utility/funcs.h"
#undef debug
LONG_LIVED_CC(EnvMgr, env); LONG_LIVED_CC(EnvMgr, env);
@ -87,8 +89,8 @@ bool g_debug;
#define SLSEP ',' #define SLSEP ','
EnvMgr::EnvMgr() : f_argv(NULL), EnvMgr::EnvMgr() : f_argc(0),
f_argc(0), f_argv(NULL),
f_lang(NULL), f_lang(NULL),
f_secondary(False), f_secondary(False),
f_verbose(False), f_verbose(False),
@ -116,7 +118,7 @@ EnvMgr::EnvMgr() : f_argv(NULL),
#ifdef LCX_DEBUG #ifdef LCX_DEBUG
fprintf(stderr, "(DEBUG) standard locale=\"%s\"\n", std_locale); fprintf(stderr, "(DEBUG) standard locale=\"%s\"\n", std_locale);
#endif #endif
f_lang = XtNewString(std_locale); f_lang = XtsNewString(std_locale);
free(std_locale); free(std_locale);
} }
} }
@ -127,18 +129,18 @@ EnvMgr::EnvMgr() : f_argv(NULL),
// If OpToStd conversion failed, use non-std name // If OpToStd conversion failed, use non-std name
if (f_lang == NULL) if (f_lang == NULL)
f_lang = XtNewString(lang); f_lang = XtsNewString(lang);
// tell mmdb info_lib to load info_base only if it matches to f_lang // tell mmdb info_lib to load info_base only if it matches to f_lang
static char mmdb_lang[_POSIX_PATH_MAX]; static char mmdb_lang[_POSIX_PATH_MAX];
sprintf(mmdb_lang, "MMDB_LANG=%s", f_lang); snprintf(mmdb_lang, _POSIX_PATH_MAX, "MMDB_LANG=%s", f_lang);
putenv (mmdb_lang); putenv (mmdb_lang);
f_home = XtNewString( getenv("HOME") ); f_home = XtsNewString( getenv("HOME") );
char dirname[256]; char dirname[256];
sprintf (dirname, "%s/.dt/dtinfo/%s", f_home, f_lang); snprintf (dirname, sizeof(dirname), "%s/.dt/dtinfo/%s", f_home, f_lang);
f_user_path = XtNewString(dirname); f_user_path = XtsNewString(dirname);
// if $HOME/.dt/dtinfo/$LANG does not exist, create it, // if $HOME/.dt/dtinfo/$LANG does not exist, create it,
@ -146,7 +148,7 @@ EnvMgr::EnvMgr() : f_argv(NULL),
if(!check_user_path()) if(!check_user_path())
{ {
create_user_path(); create_user_path();
help_agent().display_help ((char*)"doc_list_help"); // help_agent().display_help ((char*)"doc_list_help");
} }
UAS_Collection::request( UAS_Collection::request(
@ -218,14 +220,15 @@ EnvMgr::init(int argc_i, char** argv_i)
{ {
// link up indirect paths to mmdb code... ;-) // link up indirect paths to mmdb code... ;-)
static char buffer[256]; static char buffer[256];
sprintf (buffer, "MMDB_PATH=%s", (char *)f_infolibsStr ); snprintf (buffer, sizeof(buffer), "MMDB_PATH=%s", (char *)f_infolibsStr );
putenv (buffer); putenv (buffer);
char *where = getenv ("DTINFO_MARKSPECPATH"); char *where = getenv ("DTINFO_MARKSPECPATH");
if (where == NULL) if (where == NULL)
{ {
static char markref[256]; static char markref[256];
sprintf (markref, "DTINFO_MARKSPECPATH=%s", "/usr/dt/infolib/etc" ); snprintf (markref, sizeof(markref), "DTINFO_MARKSPECPATH=%s",
"/usr/dt/infolib/etc" );
putenv (markref); putenv (markref);
} }
} }
@ -868,21 +871,21 @@ EnvMgr::arglist()
f_argv = (char **)XtMalloc( p_argc*sizeof(char *) ) ; f_argv = (char **)XtMalloc( p_argc*sizeof(char *) ) ;
int ia = 0 ; int ia = 0 ;
f_argv[ia++] = XtNewString( "dtinfo" ) ; f_argv[ia++] = XtsNewString( "dtinfo" ) ;
if( secondary() ) if( secondary() )
{ {
f_argv[ia++] = XtNewString( "-secondary" ) ; f_argv[ia++] = XtsNewString( "-secondary" ) ;
} }
f_argv[ia++] = XtNewString( "-l" ) ; f_argv[ia++] = XtsNewString( "-l" ) ;
tmp = (char *)(infolibsArg()) ; tmp = (char *)(infolibsArg()) ;
f_argv[ia++] = XtNewString( tmp ) ; f_argv[ia++] = XtsNewString( tmp ) ;
// always insert the -sect key and its arg, even if the arg // always insert the -sect key and its arg, even if the arg
// is zero length. This saves us from any re-malloc and copy. // is zero length. This saves us from any re-malloc and copy.
f_argv[ia++] = XtNewString( "-sect" ) ; f_argv[ia++] = XtsNewString( "-sect" ) ;
tmp = (char *)(sectionsArg()) ; // can be empty here tmp = (char *)(sectionsArg()) ; // can be empty here
f_argv[ia++] = XtNewString( tmp ) ; f_argv[ia++] = XtsNewString( tmp ) ;
f_argc = p_argc ; f_argc = p_argc ;
} }
@ -897,14 +900,14 @@ EnvMgr::arglist()
{ {
XtFree( f_argv[++i] ) ; XtFree( f_argv[++i] ) ;
tmp = (char *)(infolibsArg()) ; tmp = (char *)(infolibsArg()) ;
f_argv[i] = XtNewString( tmp ) ; f_argv[i] = XtsNewString( tmp ) ;
il = i ; il = i ;
} }
else if( strcmp(f_argv[i], "-sect") == 0 ) else if( strcmp(f_argv[i], "-sect") == 0 )
{ {
XtFree( f_argv[++i] ) ; XtFree( f_argv[++i] ) ;
tmp = (char *)(sectionsArg()) ; tmp = (char *)(sectionsArg()) ;
f_argv[i] = XtNewString( tmp ) ; f_argv[i] = XtsNewString( tmp ) ;
is = i ; is = i ;
} }
} }
@ -931,7 +934,8 @@ EnvMgr::mkdirs(char *pathname)
{ {
char buffer[256]; char buffer[256];
char *c; char *c;
strcpy(buffer, pathname); int len = MIN(strlen(pathname), 256 - 1);
*((char *) memcpy(buffer, pathname, len) + len) = '\0';
if(mkdir(buffer, 0777) == -1) if(mkdir(buffer, 0777) == -1)
{ {

View file

@ -305,7 +305,7 @@ GraphicsMgr::get_graphic (const UAS_String &imdata,
printf( printf(
"Insufficient color cells for graphic. Retry with degraded colors.\n" ); "Insufficient color cells for graphic. Retry with degraded colors.\n" );
#endif #endif
_DtGrLoadStatus status = status =
_DtGrLoad(&gr_stream, // image _DtGrLoad(&gr_stream, // image
&image_type, &image_type,
screen, screen,
@ -412,7 +412,7 @@ GraphicsMgr::detach (UAS_Pointer<UAS_Common> &node_ptr,
// ViewportAgent will actually remove it from display // ViewportAgent will actually remove it from display
gr->set_detached(TRUE); gr->set_detached(TRUE);
PixmapGraphic *pgraphic = gr->pixmap_graphic(); //PixmapGraphic *pgraphic = gr->pixmap_graphic();
GraphicAgent *ga = new GraphicAgent(node_ptr, gr); GraphicAgent *ga = new GraphicAgent(node_ptr, gr);
//gr->set_agent(ga); //gr->set_agent(ga);

View file

@ -182,9 +182,9 @@ class Graphic: public UAS_Base {
GraphicAgent *get_agent() { return fagent; } GraphicAgent *get_agent() { return fagent; }
private: private:
unsigned int fDetached;
PixmapGraphic * fPixmap; PixmapGraphic * fPixmap;
PixmapGraphic * fDetachedPixmap; PixmapGraphic * fDetachedPixmap;
unsigned int fDetached;
UAS_Pointer<UAS_EmbeddedObject> fObj; UAS_Pointer<UAS_EmbeddedObject> fObj;
GraphicAgent *fagent; GraphicAgent *fagent;

View file

@ -173,7 +173,7 @@ LibraryMgr::display (UAS_Pointer<UAS_Common> &toc)
// First, check to see if the object to display is already // First, check to see if the object to display is already
// in our list. // in our list.
// //
int i; unsigned int i;
for (i = 0; i < fObjList.length(); i ++) for (i = 0; i < fObjList.length(); i ++)
{ {
if (fObjList[i] == toc) if (fObjList[i] == toc)
@ -309,7 +309,7 @@ LibraryMgr::undisplay (OutlineElement *root) {
UAS_Pointer<UAS_Common> rootDoc = ((TOC_Element *) root)->toc(); UAS_Pointer<UAS_Common> rootDoc = ((TOC_Element *) root)->toc();
if (rootDoc->type() != UAS_LIBRARY) if (rootDoc->type() != UAS_LIBRARY)
throw (CASTEXCEPT Exception()); throw (CASTEXCEPT Exception());
int i; unsigned int i;
for (i = 0; i < fObjList.length(); i ++) { for (i = 0; i < fObjList.length(); i ++) {
if (fObjList[i] == rootDoc) { if (fObjList[i] == rootDoc) {
break; break;
@ -328,7 +328,7 @@ LibraryMgr::remove (UAS_Pointer<UAS_Common> lib) {
for (; l; l++) { for (; l; l++) {
l.item()->library_removed (lib); l.item()->library_removed (lib);
} }
for (int i = 0; i < fObjList.length(); i ++) { for (unsigned int i = 0; i < fObjList.length(); i ++) {
if (fObjList[i] == lib) { if (fObjList[i] == lib) {
fObjList.remove_item(i); fObjList.remove_item(i);
break; break;
@ -416,7 +416,7 @@ LibraryMgr::library()
void void
LibraryMgr::init(UAS_List<UAS_String> &infolibpaths) LibraryMgr::init(UAS_List<UAS_String> &infolibpaths)
{ {
int i; unsigned int i;
UAS_Common::initialize(infolibpaths); UAS_Common::initialize(infolibpaths);
@ -450,7 +450,7 @@ LibraryMgr::init(UAS_List<UAS_String> &infolibpaths)
bool bool
LibraryMgr::lib_exist(UAS_String& lid) LibraryMgr::lib_exist(UAS_String& lid)
{ {
for (int i = 0; i < fObjList.length(); i ++) { for (unsigned int i = 0; i < fObjList.length(); i ++) {
if (fObjList[i]->lid() == lid) if (fObjList[i]->lid() == lid)
return True; return True;
} }

View file

@ -132,10 +132,10 @@ MarkMgr::MarkMgr()
{ {
// the marks directory needs to be in sync with mmdb (user_base.cc) // the marks directory needs to be in sync with mmdb (user_base.cc)
buffer = new char[MAXPATHLEN]; buffer = new char[MAXPATHLEN];
sprintf (buffer, "%s/marks/default", env().user_path()); snprintf (buffer, MAXPATHLEN, "%s/marks/default", env().user_path());
#if EAM #if EAM
sprintf (buffer, "%s/.dt/dtinfo/%s/marks/default", snprintf (buffer, MAXPATHLEN, "%s/.dt/dtinfo/%s/marks/default",
env().home(), env().lang()); env().home(), env().lang());
#endif #endif
filename = buffer; filename = buffer;
@ -249,7 +249,9 @@ MarkMgr::create_mark (UAS_Pointer<UAS_Common> &doc_ptr, const Anchor &anchor,
char* trimmed_name; char* trimmed_name;
int size = strlen(name) + 1; int size = strlen(name) + 1;
int n = mbstowcs(new_name, name, size); int n = mbstowcs(new_name, name, size);
assert( n >= 0 ); if( n >= 0 ) {
assert( n >= 0 );
}
while (*start != (wchar_t)'\0' && iswspace(*start)) while (*start != (wchar_t)'\0' && iswspace(*start))
start++; start++;
if (*start != (wchar_t)'\0') { if (*start != (wchar_t)'\0') {

View file

@ -210,7 +210,8 @@ MessageMgr::cancel_cb()
void void
MessageMgr::show_it(Widget dialog) MessageMgr::show_it(Widget dialog)
{ {
Widget parent, shell; Widget parent = NULL;
Widget shell = NULL;
XtManageChild(dialog); XtManageChild(dialog);
@ -548,7 +549,7 @@ MessageMgr::assert_failed (char *statement, char *file,
{ {
char buffer[512]; char buffer[512];
sprintf (buffer, snprintf (buffer, sizeof(buffer),
"An internal error has occured.\n\ "An internal error has occured.\n\
The current operation cannot be completed.\n\ The current operation cannot be completed.\n\
Please file a bug report with this information:\n\ Please file a bug report with this information:\n\

View file

@ -316,13 +316,13 @@ NodeMgr::set_font_scale(int value)
NodeViewInfo * NodeViewInfo *
NodeMgr::load(UAS_Pointer<UAS_Common> &node_ptr) NodeMgr::load(UAS_Pointer<UAS_Common> &node_ptr)
{ {
static int first = 0;
extern int styleparse(); extern int styleparse();
extern void stylerestart(FILE *); extern void stylerestart(FILE *);
extern NodeViewInfo *gNodeViewInfo; extern NodeViewInfo *gNodeViewInfo;
#ifdef FILE_STYLE_SHEET #ifdef FILE_STYLE_SHEET
static int first = 0;
StyleSheet ss ; StyleSheet ss ;
{ {
extern istream *g_stylein; extern istream *g_stylein;

View file

@ -201,8 +201,6 @@ PrintMgr::set_font_scale(int value)
NodeViewInfo * NodeViewInfo *
PrintMgr::load(UAS_Pointer<UAS_Common> &node_ptr) PrintMgr::load(UAS_Pointer<UAS_Common> &node_ptr)
{ {
static int first = 0;
extern int styleparse(); extern int styleparse();
extern void stylerestart(FILE *); extern void stylerestart(FILE *);
extern NodeViewInfo *gNodeViewInfo; extern NodeViewInfo *gNodeViewInfo;

View file

@ -142,7 +142,7 @@ SearchMgr::init()
{ {
UAS_List<UAS_String> rootLocs = UAS_Common::rootLocators (); UAS_List<UAS_String> rootLocs = UAS_Common::rootLocators ();
int i; unsigned int i;
for (i = 0; i < rootLocs.length(); i ++) { for (i = 0; i < rootLocs.length(); i ++) {
UAS_Pointer<UAS_Common> theDoc = UAS_Pointer<UAS_Common> theDoc =
UAS_Common::create(*(UAS_String*)rootLocs[i]); UAS_Common::create(*(UAS_String*)rootLocs[i]);
@ -308,8 +308,6 @@ SearchMgr::parse_and_search (char *query, UAS_SearchScope *scope) {
void void
SearchMgr::display_message (SearchMessageType msg, int) SearchMgr::display_message (SearchMessageType msg, int)
{ {
char *msg_str;
switch( msg ){ switch( msg ){
case NO_HITS: case NO_HITS:
message_mgr().info_dialog ( message_mgr().info_dialog (
@ -336,7 +334,7 @@ SearchMgr::current_hits()
void void
SearchMgr::add_root(UAS_Pointer<UAS_Common>& root) SearchMgr::add_root(UAS_Pointer<UAS_Common>& root)
{ {
int i; unsigned int i;
for (i = 0; i < f_roots.length(); i++) { for (i = 0; i < f_roots.length(); i++) {
if (f_roots[i] == root) if (f_roots[i] == root)
break; break;
@ -352,7 +350,7 @@ SearchMgr::add_root(UAS_Pointer<UAS_Common>& root)
void void
SearchMgr::remove_root(UAS_Pointer<UAS_Common>& root) SearchMgr::remove_root(UAS_Pointer<UAS_Common>& root)
{ {
int i; unsigned int i;
for (i = 0; i < f_roots.length(); i++) { for (i = 0; i < f_roots.length(); i++) {
if (f_roots[i] == root) if (f_roots[i] == root)
break; break;

View file

@ -69,8 +69,8 @@ private:
List *ibase_list(); List *ibase_list();
protected: // variables protected: // variables
QueryEditor *f_query_editor;
UAS_Pointer<UAS_SearchEngine> f_search_engine ; UAS_Pointer<UAS_SearchEngine> f_search_engine ;
QueryEditor *f_query_editor;
HistoryList f_search_history_list; HistoryList f_search_history_list;
ListView *f_search_history_list_view; ListView *f_search_history_list_view;
UAS_String f_search_section; UAS_String f_search_section;

View file

@ -245,7 +245,7 @@ ServiceMgr::process_olias_event (Window client,
return; return;
unsigned char event_type = *stream++; unsigned char event_type = *stream++;
char *infobase; int len, bufferlen;
char *locator; // NOTE: make fixed width and add "mmdb:" to char *locator; // NOTE: make fixed width and add "mmdb:" to
// front ? Should eventually go into calling // front ? Should eventually go into calling
// program to determine doc type. // program to determine doc type.
@ -258,7 +258,6 @@ ServiceMgr::process_olias_event (Window client,
// Skip over the defunct infobase name. // Skip over the defunct infobase name.
// NOTE: It should be removed from the olias api. DJB // NOTE: It should be removed from the olias api. DJB
infobase = (char *) stream;
while (*stream != '\0') while (*stream != '\0')
stream++; stream++;
stream++; stream++;
@ -273,14 +272,16 @@ ServiceMgr::process_olias_event (Window client,
} }
else else
{ {
char *buffer = new char[strlen("mmdb:LOCATOR=") + strlen(locator) + 1]; bufferlen = strlen("mmdb:LOCATOR=") + strlen(locator) + 1;
sprintf (buffer, "mmdb:LOCATOR=%s", locator); char *buffer = new char[bufferlen];
snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);
d = UAS_Common::create (buffer); d = UAS_Common::create (buffer);
if (d != (const int)NULL) if (d != (const int)NULL)
{ {
// (evil hack alert) // (evil hack alert)
g_scroll_to_locator = TRUE; g_scroll_to_locator = TRUE;
strcpy (g_top_locator, locator); len = MIN(strlen(locator), 4096 - 1);
*((char *) memcpy(g_top_locator, locator, len) + len) = '\0';
} }
delete [] buffer; delete [] buffer;
} }
@ -398,6 +399,7 @@ olias_send_event (Widget, OliasEvent *event)
{ {
char *buffer = NULL; char *buffer = NULL;
char *locator; char *locator;
int len, bufferlen;
UAS_Pointer<UAS_Common> d; UAS_Pointer<UAS_Common> d;
switch (event->type) switch (event->type)
@ -416,8 +418,9 @@ olias_send_event (Widget, OliasEvent *event)
} }
else else
{ {
buffer = new char[strlen("mmdb:LOCATOR=") + strlen(locator) + 1]; bufferlen = strlen("mmdb:LOCATOR=") + strlen(locator) + 1;
sprintf (buffer, "mmdb:LOCATOR=%s", locator); buffer = new char[bufferlen];
snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);
d = UAS_Common::create (buffer); d = UAS_Common::create (buffer);
delete [] buffer; delete [] buffer;
if (d != (const int)NULL) if (d != (const int)NULL)
@ -425,11 +428,12 @@ olias_send_event (Widget, OliasEvent *event)
// (evil hack alert) // (evil hack alert)
if (locator == NULL) if (locator == NULL)
return (OLIAS_TIMEOUT); return (OLIAS_TIMEOUT);
ON_DEBUG (printf (">>> g_top_locator = %p\n", g_top_locator)); ON_DEBUG(printf(">>> g_top_locator = %p\n", g_top_locator));
if (g_top_locator == NULL) if (g_top_locator == NULL)
return (OLIAS_TIMEOUT); return (OLIAS_TIMEOUT);
g_scroll_to_locator = TRUE; g_scroll_to_locator = TRUE;
strcpy (g_top_locator, locator); len = MIN(strlen(locator), 4096 - 1);
*((char *) memcpy(g_top_locator, locator, len) +len) = '\0';
} }
} }
} }
@ -459,4 +463,6 @@ olias_send_event (Widget, OliasEvent *event)
default: default:
return (OLIAS_TIMEOUT); return (OLIAS_TIMEOUT);
} }
return (OLIAS_LOCATOR_NOT_FOUND);
} }

View file

@ -52,6 +52,7 @@
#define L_Managers #define L_Managers
#include "Prelude.h" #include "Prelude.h"
#include "utility/funcs.h"
LONG_LIVED_CC( SessionMgr, session ); LONG_LIVED_CC( SessionMgr, session );
@ -65,9 +66,9 @@ SaveSession_cb( Widget w,
} }
SessionMgr::SessionMgr() : prior_session(NULL), SessionMgr::SessionMgr() : sid(NULL),
session_path(NULL), session_path(NULL),
sid(NULL) prior_session(NULL)
{ {
// get session id & the place to save special startup info (future) // get session id & the place to save special startup info (future)
DtSessionSavePath( window_system().toplevel(), &session_path, &sid ); DtSessionSavePath( window_system().toplevel(), &session_path, &sid );
@ -94,7 +95,7 @@ SessionMgr::~SessionMgr()
void void
SessionMgr::file( char *savefile ) SessionMgr::file( char *savefile )
{ {
prior_session = XtNewString( savefile ); prior_session = XtsNewString( savefile );
} }
@ -137,19 +138,19 @@ SessionMgr::setWmCommand()
// insert a -session arg and its value into the arg list // insert a -session arg and its value into the arg list
wm_command = (char **) XtMalloc((in_cnt+2) * sizeof(char*)); wm_command = (char **) XtMalloc((in_cnt+2) * sizeof(char*));
wm_command[0] = XtNewString( main_argv[0] ); wm_command[0] = XtsNewString( main_argv[0] );
wm_command[1] = XtNewString( "-session" ); wm_command[1] = XtsNewString( "-session" );
if( sid ) wm_command[2] = XtNewString( sid ); if( sid ) wm_command[2] = XtsNewString( sid );
else if( session_path ) wm_command[2] = XtNewString( session_path ); else if( session_path ) wm_command[2] = XtsNewString( session_path );
else wm_command[2] = XtNewString( "dtinfo_session" ); else wm_command[2] = XtsNewString( "dtinfo_session" );
#ifdef DEBUG #ifdef DEBUG
printf( "session id = %s input arg count = %d\n", wm_command[2], in_cnt ); printf( "session id = %s input arg count = %d\n", wm_command[2], in_cnt );
#endif #endif
for (i = 1, j = 3; i < in_cnt; i++) { for (i = 1, j = 3; i < in_cnt; i++) {
wm_command[j] = XtNewString(main_argv[i]); wm_command[j] = XtsNewString(main_argv[i]);
j++; j++;
} }
// actually register the command line with the window system // actually register the command line with the window system

View file

@ -129,7 +129,7 @@ void
StyleSheetMgr::initOnlineStyleSheet (UAS_Pointer<UAS_Common> &doc) { StyleSheetMgr::initOnlineStyleSheet (UAS_Pointer<UAS_Common> &doc) {
UAS_List<UAS_StyleSheet> ssList = doc->style_sheet_list (); UAS_List<UAS_StyleSheet> ssList = doc->style_sheet_list ();
UAS_Pointer<UAS_StyleSheet> onlineSS; UAS_Pointer<UAS_StyleSheet> onlineSS;
for (int i = 0; i < ssList.length(); i ++) { for (unsigned int i = 0; i < ssList.length(); i ++) {
if (ssList[i]->style_sheet_type() == SS_ONLINE) { if (ssList[i]->style_sheet_type() == SS_ONLINE) {
onlineSS = ssList[i]; onlineSS = ssList[i];
break; break;
@ -187,7 +187,7 @@ void
StyleSheetMgr::initPrintStyleSheet (UAS_Pointer<UAS_Common> &doc) { StyleSheetMgr::initPrintStyleSheet (UAS_Pointer<UAS_Common> &doc) {
UAS_List<UAS_StyleSheet> ssList = doc->style_sheet_list (); UAS_List<UAS_StyleSheet> ssList = doc->style_sheet_list ();
UAS_Pointer<UAS_StyleSheet> printSS; UAS_Pointer<UAS_StyleSheet> printSS;
for (int i = 0; i < ssList.length(); i ++) { for (unsigned int i = 0; i < ssList.length(); i ++) {
if (ssList[i]->style_sheet_type() == SS_HARDCOPY) { if (ssList[i]->style_sheet_type() == SS_HARDCOPY) {
printSS = ssList[i]; printSS = ssList[i];
break; break;

View file

@ -65,6 +65,7 @@
#include "Registration.hh" #include "Registration.hh"
#include "utility/mmdb_exception.h" #include "utility/mmdb_exception.h"
#include "utility/funcs.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -135,15 +136,17 @@ LogToolTalkMessage (
char * errfmt; char * errfmt;
char * statmsg; char * statmsg;
char * errmsg; char * errmsg;
int errmsglen;
if (! tt_is_err(status)) return XtNewString("");; if (! tt_is_err(status)) return XtsNewString("");;
errfmt = CATGETS(Set_TtIpcMgr, msg_num, dflt_txt); errfmt = CATGETS(Set_TtIpcMgr, msg_num, dflt_txt);
statmsg = tt_status_message(status); statmsg = tt_status_message(status);
errmsg = XtMalloc(strlen(errfmt) + strlen(statmsg) + 2); errmsglen = strlen(errfmt) + strlen(statmsg) + 2;
errmsg = XtMalloc(errmsglen);
if (! strlen(errfmt)) if (! strlen(errfmt))
errfmt = (char*)"%s"; errfmt = (char*)"%s";
sprintf(errmsg, errfmt, statmsg); snprintf(errmsg, errmsglen, errfmt, statmsg);
DtMsgLogMessage ("Dtinfo", msg_type, errfmt, errmsg); DtMsgLogMessage ("Dtinfo", msg_type, errfmt, errmsg);
return errmsg; return errmsg;
@ -301,7 +304,7 @@ TtIpcMgr::ipc_init_wp1( XtPointer theIpcObj )
// actually join the "default" session for all previously // actually join the "default" session for all previously
// registered patterns to take effect there-in // registered patterns to take effect there-in
Tt_pattern *sess_patterns = // Tt_pattern *sess_patterns =
ttdt_session_join( NULL, NULL, ttdt_session_join( NULL, NULL,
window_system().toplevel(), theIpcObj, True ) ; window_system().toplevel(), theIpcObj, True ) ;
// invoke msg handler explicitly in case a message already queued // invoke msg handler explicitly in case a message already queued
@ -320,7 +323,7 @@ TtIpcMgr::ipc_init_wp1( XtPointer theIpcObj )
TtIpcMgr::~TtIpcMgr() TtIpcMgr::~TtIpcMgr()
{ {
char *dfile; // char *dfile;
// send a Dtinfo_Quit message to whomever may be observing // send a Dtinfo_Quit message to whomever may be observing
notify_quit() ; notify_quit() ;
@ -401,12 +404,11 @@ TtIpcMgr::do_locator( char *locator,
int int
TtIpcMgr::do_print(Tt_message msg) TtIpcMgr::do_print(Tt_message msg)
{ {
int sts = ID_SUCCESS ;
UAS_Pointer<UAS_Common> d = NULL ; UAS_Pointer<UAS_Common> d = NULL ;
char *filepath = tt_message_file(msg); char *filepath = tt_message_file(msg);
FILE *fp; FILE *fp;
char locator[512]; char locator[512];
int bufferlen;
fprintf(stderr, "TtIpcMgr::do_print: filepath = %s.\n", filepath); fprintf(stderr, "TtIpcMgr::do_print: filepath = %s.\n", filepath);
@ -434,9 +436,9 @@ TtIpcMgr::do_print(Tt_message msg)
// assume given a unique locator ID for the target. // assume given a unique locator ID for the target.
// construct a fully-qualified form and pass it on. // construct a fully-qualified form and pass it on.
char *buffer = bufferlen = strlen("mmdb:LOCATOR=") + strlen(locator) + 1;
new char[strlen("mmdb:LOCATOR=") + strlen(locator) + 1]; char *buffer = new char[bufferlen];
sprintf (buffer, "mmdb:LOCATOR=%s", locator); snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);
d = UAS_Common::create (buffer); d = UAS_Common::create (buffer);
delete [] buffer; delete [] buffer;
} }

View file

@ -91,7 +91,7 @@ MarkBase_mmdb::open (const char *filename, bool read_only)
char buffer[256]; char buffer[256];
struct stat file_info; struct stat file_info;
sprintf (buffer, "%s/mmdb.names", filename); snprintf (buffer, sizeof(buffer), "%s/names.mmdb", filename);
int status = stat (buffer, &file_info); int status = stat (buffer, &file_info);
if (status == -1) if (status == -1)

View file

@ -240,15 +240,14 @@ Mark_mmdb::restore()
end_try; end_try;
// NOTE: Need better guard against corrupt mark data!! // NOTE: Need better guard against corrupt mark data!!
if (f_user_mark->mark_value()->size() == 0) if (sz == 0)
{ {
ON_DEBUG (puts ("*** ZERO LENGTH MARK ***")); ON_DEBUG (puts ("*** ZERO LENGTH MARK ***"));
throw (CASTEXCEPT Exception()); throw (CASTEXCEPT Exception());
} }
// Suck the data out of the mmdb mark object. // Suck the data out of the mmdb mark object.
g_buffer.reset(); g_buffer.reset();
g_buffer.write (f_user_mark->mark_value()->get(), sizeof (char), g_buffer.write (str, sizeof (char), sz);
f_user_mark->mark_value()->size());
// Read the fields out of the buffer. // Read the fields out of the buffer.
int mark_version; int mark_version;

View file

@ -72,8 +72,8 @@ private: // functions
private: private:
UAS_Pointer<UAS_Common> f_doc_ptr; UAS_Pointer<UAS_Common> f_doc_ptr;
Anchor f_anchor; Anchor f_anchor;
MarkBase_mmdb &f_mark_base;
char *f_name; char *f_name;
char *f_notes; char *f_notes;
mark_smart_ptr *f_user_mark; mark_smart_ptr *f_user_mark;
MarkBase_mmdb &f_mark_base;
}; };

View file

@ -87,87 +87,87 @@ struct s_entry
static static
struct s_entry symbols[] = struct s_entry symbols[] =
{ {
GRAPHIC_attr, "GRAPHIC", { GRAPHIC_attr, "GRAPHIC" },
INLGRAPHIC, "INLGRAPHIC", { INLGRAPHIC, "INLGRAPHIC" },
ISMAP, "ISMAP", { ISMAP, "ISMAP" },
OLID, "OL-ID", { OLID, "OL-ID" },
OLIDREF, "OL-IDREF", { OLIDREF, "OL-IDREF" },
REMOTE, "REMOTE", { REMOTE, "REMOTE" },
TABLE, "TABLE", { TABLE, "TABLE" },
TERMS, "TERMS", { TERMS, "TERMS" },
ALIGN, "ALIGN", { ALIGN, "ALIGN" },
BOTTOM, "BOTTOM", { BOTTOM, "BOTTOM" },
LINEBREAK, "LINEBREAK", { LINEBREAK, "LINEBREAK" },
CHARSETS, "CHARSET", { CHARSETS, "CHARSET" },
SET, "SET", { SET, "SET" },
BGCOLOR, "BGCOLOR", { BGCOLOR, "BGCOLOR" },
FGCOLOR, "FGCOLOR", { FGCOLOR, "FGCOLOR" },
FONT, "FONT", { FONT, "FONT" },
FONTCATALOG, "FONTCATALOG", { FONTCATALOG, "FONTCATALOG" },
FONTFAMILY, "FONTFAMILY", { FONTFAMILY, "FONTFAMILY" },
HIGHLIGHT, "HIGHLIGHT", { HIGHLIGHT, "HIGHLIGHT" },
IGNORE, "IGNORE", { IGNORE, "IGNORE" },
LEFT, "LEFT", { LEFT, "LEFT" },
MARGIN, "MARGIN", { MARGIN, "MARGIN" },
SUFFIX, "SUFFIX", { SUFFIX, "SUFFIX" },
PREFIX, "PREFIX", { PREFIX, "PREFIX" },
PREVIEW, "PREVIEW", { PREVIEW, "PREVIEW" },
RIGHT, "RIGHT", { RIGHT, "RIGHT" },
TABSTOPS, "TABSTOP", { TABSTOPS, "TABSTOP" },
CONTENT, "CONTENT", { CONTENT, "CONTENT" },
TOP, "TOP", { TOP, "TOP" },
OVERLINE, "OVERLINE", { OVERLINE, "OVERLINE" },
STRIKETHROUGH,"STRIKETHROUGH", { STRIKETHROUGH,"STRIKETHROUGH" },
UNDERLINE, "UNDERLINE", { UNDERLINE, "UNDERLINE" },
WRAP, "WRAP", { WRAP, "WRAP" },
XLFD, "XLFD", { XLFD, "XLFD" },
GRAPHIC_feature,"GRAPHIC", { GRAPHIC_feature,"GRAPHIC" },
FAMILY, "FAMILY", { FAMILY, "FAMILY" },
WEIGHT, "WEIGHT", { WEIGHT, "WEIGHT" },
SLANT, "SLANT", { SLANT, "SLANT" },
SIZE, "SIZE", { SIZE, "SIZE" },
CHARSET, "CHARSET", { CHARSET, "CHARSET" },
REVERSEVIDEO, "REVERSE-VIDEO", { REVERSEVIDEO, "REVERSE-VIDEO" },
AT, "AT", { AT, "AT" },
EVERY, "EVERY", { EVERY, "EVERY" },
POSITION, "POSITION", { POSITION, "POSITION" },
HORIZ, "HORIZ", { HORIZ, "HORIZ" },
VERT, "VERT", { VERT, "VERT" },
LAYOUT, "LAYOUT", { LAYOUT, "LAYOUT" },
ASPACE, "ASPACE", { ASPACE, "ASPACE" },
BSPACE, "BSPACE", { BSPACE, "BSPACE" },
LEADING, "LEADING", { LEADING, "LEADING" },
FINDENT, "FINDENT", { FINDENT, "FINDENT" },
LINDENT, "LINDENT", { LINDENT, "LINDENT" },
RINDENT, "RINDENT", { RINDENT, "RINDENT" },
FLOW, "FLOW", { FLOW, "FLOW" },
JUSTIFY, "JUSTIFY", { JUSTIFY, "JUSTIFY" },
VJUSTIFY, "VJUSTIFY", { VJUSTIFY, "VJUSTIFY" },
BORDER, "BORDER", { BORDER, "BORDER" },
THICKNESS, "THICKNESS", { THICKNESS, "THICKNESS" },
ROW, "ROW", { ROW, "ROW" },
COLS, "COLS", { COLS, "COLS" },
COLFORMAT, "COLFORMAT", { COLFORMAT, "COLFORMAT" },
CHARALIGN, "CHARALIGN", { CHARALIGN, "CHARALIGN" },
SPANCOLS, "SPANCOLS", { SPANCOLS, "SPANCOLS" },
MOREROWS, "MOREROWS", { MOREROWS, "MOREROWS" },
CELL, "CELL", { CELL, "CELL" },
WIDTH, "WIDTH", { WIDTH, "WIDTH" },
FALLBACK, "FALLBACK", { FALLBACK, "FALLBACK" },
FOUNDRY, "FOUNDRY", { FOUNDRY, "FOUNDRY" },
NAME, "NAME", { NAME, "NAME" },
DISPLAY, "DISPLAY", { DISPLAY, "DISPLAY" },
COLREF, "COLREF", { COLREF, "COLREF" },
SUBSUPER, "POSITION", { SUBSUPER, "POSITION" },
COLSEP, "COLSEP", { COLSEP, "COLSEP" },
ROWSEP, "ROWSEP", { ROWSEP, "ROWSEP" },
TGROUP, "TGROUP", { TGROUP, "TGROUP" },
FRAME, "FRAME", { FRAME, "FRAME" },
MEDIA, "MEDIUM", { MEDIA, "MEDIUM" },
PAGEBREAK, "PAGEBREAK", { PAGEBREAK, "PAGEBREAK" },
FOOTERS, "FOOTERS", { FOOTERS, "FOOTERS" },
HEADERS, "HEADERS", { HEADERS, "HEADERS" },
ORIENTATION, "ORIENTATION" { ORIENTATION, "ORIENTATION" }
}; };
// supported features // supported features
@ -231,11 +231,11 @@ print_justify (unsigned value)
CanvasRenderer::CanvasRenderer(int font_scale) CanvasRenderer::CanvasRenderer(int font_scale)
: Renderer(), : Renderer(),
fBogusSymbol(gElemSymTab->intern("%BOGUS")), f_current_tgroup (0),
f_font_scale(font_scale),
f_font (0), f_font (0),
f_link_idx (-1), f_link_idx (-1),
f_current_tgroup (0), f_font_scale(font_scale),
fBogusSymbol(gElemSymTab->intern("%BOGUS")),
f_level(0) f_level(0)
{ {
// make symbols // make symbols
@ -993,10 +993,10 @@ CanvasRenderer::handle_olias_attributes(ElementFeatures &features,
if (grattr) if (grattr)
{ {
#ifdef GRAPHIC_DEBUG
const Feature *graphic_display_type = const Feature *graphic_display_type =
complete.deep_lookup("GRAPHIC", "ALIGN", 0); complete.deep_lookup("GRAPHIC", "ALIGN", 0);
#ifdef GRAPHIC_DEBUG
cerr << "GRAPHIC" << endl; cerr << "GRAPHIC" << endl;
cerr << "Graphic( " << element.gi() << "): (" ; cerr << "Graphic( " << element.gi() << "): (" ;
@ -1225,7 +1225,8 @@ CanvasRenderer::handle_olias_attributes(ElementFeatures &features,
else else
{ {
char buf[100] ; char buf[100] ;
sprintf(buf, "Graphic \"%s\" unavailable", graphic); snprintf(buf, sizeof(buf),
"Graphic \"%s\" unavailable", graphic);
#ifdef TML_NO_THIS_ASSIGNMENT #ifdef TML_NO_THIS_ASSIGNMENT
new_gnode = new (the_model) gnode(the_model); new_gnode = new (the_model) gnode(the_model);
#else #else
@ -1377,7 +1378,7 @@ new_segment(unsigned long type)
unsigned size = sizeof(segment->handle); unsigned size = sizeof(segment->handle);
//cerr << "Handle size = " << size << endl; //cerr << "Handle size = " << size << endl;
char *p = (char *)&(segment->handle) ; char *p = (char *)&(segment->handle) ;
for (int i = 0; i < size; i++, p++) for (unsigned int i = 0; i < size; i++, p++)
*p = 0; *p = 0;
} }
@ -1493,7 +1494,7 @@ CanvasRenderer::insert_string (_DtCvSegment *container,
// find the newlines, and make a string segment up to that point, // find the newlines, and make a string segment up to that point,
// then advance our start pointer beyond that point // then advance our start pointer beyond that point
for (; newline = strchr(start, '\n'); start = newline + 1) { for (; (newline = strchr(start, '\n')); start = newline + 1) {
seg = really_insert_string(container, font, start, (newline - start), count_vcc); seg = really_insert_string(container, font, start, (newline - start), count_vcc);
_DtCvSegment *lbseg = insert_break(container, _DtCvNEW_LINE); _DtCvSegment *lbseg = insert_break(container, _DtCvNEW_LINE);
@ -1541,7 +1542,7 @@ CanvasRenderer::really_insert_string (_DtCvSegment *container,
f_current_displayable = strseg ; f_current_displayable = strseg ;
int ret_indx ; long ret_indx ;
// calculate dthelp font index // calculate dthelp font index
{ {
// WARNING: this routine keeps the ptr to the xlfd_spec // WARNING: this routine keeps the ptr to the xlfd_spec
@ -1582,7 +1583,7 @@ CanvasRenderer::really_insert_string (_DtCvSegment *container,
#endif #endif
unsigned char* strp; unsigned char* strp;
while (strp = (unsigned char*)strchr(string, '\015')) { while ((strp = (unsigned char*)strchr(string, '\015'))) {
#ifdef CR_JP_DEBUG #ifdef CR_JP_DEBUG
cerr << "<CR> found..."; cerr << "<CR> found...";
#endif #endif
@ -1800,12 +1801,12 @@ CanvasRenderer::setup_container(_DtCvSegment *container, ElementFeatures &featur
PartialElementFeatures::PartialElementFeatures(CanvasRenderer* renderer) PartialElementFeatures::PartialElementFeatures(CanvasRenderer* renderer)
: f_text (0), : f_text (0),
f_font(0), f_font(0),
f_subsuper(baseline),
f_linebreak(0), f_linebreak(0),
f_pagebreak(PAGEBREAK_NONE), f_pagebreak(PAGEBREAK_NONE),
f_graphic (0),
f_subsuper(baseline),
f_ignore(0),
f_layout(renderer), f_layout(renderer),
f_graphic (0),
f_ignore(0),
f_orientation("portrait") f_orientation("portrait")
{ {
@ -1814,13 +1815,13 @@ PartialElementFeatures::PartialElementFeatures(CanvasRenderer* renderer)
PartialElementFeatures::PartialElementFeatures (PartialElementFeatures &features) PartialElementFeatures::PartialElementFeatures (PartialElementFeatures &features)
: f_text (features.f_text), : f_text (features.f_text),
f_font (features.f_font), f_font (features.f_font),
f_subsuper (features.f_subsuper),
f_highlight (features.f_highlight), f_highlight (features.f_highlight),
f_linebreak (features.f_linebreak), f_linebreak (features.f_linebreak),
f_pagebreak (features.f_pagebreak), f_pagebreak (features.f_pagebreak),
f_position (features.f_position), f_position (features.f_position),
f_layout (features.f_layout), f_layout (features.f_layout),
f_graphic (features.f_graphic), f_graphic (features.f_graphic),
f_subsuper (features.f_subsuper),
f_ignore (features.f_ignore), f_ignore (features.f_ignore),
f_orientation (features.f_orientation) f_orientation (features.f_orientation)
{ {
@ -1834,17 +1835,17 @@ PartialElementFeatures::~PartialElementFeatures()
ElementFeatures::ElementFeatures(CanvasRenderer* renderer) ElementFeatures::ElementFeatures(CanvasRenderer* renderer)
: PartialElementFeatures(renderer), : PartialElementFeatures(renderer),
f_row (NULL), f_row (NULL),
f_border (_DtCvBORDER_NONE),
f_graphic (0), f_graphic (0),
f_locator (0), f_border (_DtCvBORDER_NONE),
f_link_idx (-1), f_border_width(-1), // invalid border width
f_table (NULL), f_table (NULL),
f_tgroup (NULL), f_tgroup (NULL),
f_colformat (NULL), f_colformat (NULL),
f_border_width(-1), // invalid border width
f_xref(NULL),
f_prefix(renderer), f_prefix(renderer),
f_suffix(renderer) f_suffix(renderer),
f_locator (0),
f_xref(NULL),
f_link_idx (-1)
{} {}
ElementFeatures::~ElementFeatures() ElementFeatures::~ElementFeatures()
@ -1911,8 +1912,8 @@ Layout::Layout(CanvasRenderer* renderer)
f_aspace (0), f_bspace (0), f_leading (-1), f_aspace (0), f_bspace (0), f_leading (-1),
f_findent (0), f_rindent(0), f_lindent (0), f_findent (0), f_rindent(0), f_lindent (0),
f_flow (_DtCvOPTION_BAD), f_flow (_DtCvOPTION_BAD),
f_wrap (_DtCvOPTION_BAD), f_justify (_DtCvOPTION_BAD),
f_justify (_DtCvOPTION_BAD) f_wrap (_DtCvOPTION_BAD)
{ {
} }
@ -1922,11 +1923,11 @@ Layout::Layout (Layout &layout)
f_bspace (layout.f_bspace), f_bspace (layout.f_bspace),
f_leading (layout.f_leading), f_leading (layout.f_leading),
f_findent (layout.f_findent), f_findent (layout.f_findent),
f_lindent (layout.f_lindent),
f_rindent (layout.f_rindent), f_rindent (layout.f_rindent),
f_lindent (layout.f_lindent),
f_flow (layout.f_flow), f_flow (layout.f_flow),
f_wrap (layout.f_wrap), f_justify (layout.f_justify),
f_justify (layout.f_justify) f_wrap (layout.f_wrap)
{ {
} }
@ -2076,14 +2077,17 @@ TGDefn::add (ColDefn *cd)
} }
} }
#if 0
static void static void
add_id(char **cell_ids, unsigned row, unsigned number, _DtCvSegment *segment) add_id(char **cell_ids, unsigned row, unsigned number, _DtCvSegment *segment)
{ {
char *id = segment->handle.container.id; char *id = segment->handle.container.id;
char idstr[64]; char idstr[64];
int cell_idslen;
if (id == NULL) if (id == NULL)
{ {
sprintf(idstr,"id%d", number); snprintf(idstr, sizeof(idstr), "id%d", number);
id = idstr ; id = idstr ;
segment->handle.container.id = strdup (id); segment->handle.container.id = strdup (id);
@ -2095,17 +2099,19 @@ add_id(char **cell_ids, unsigned row, unsigned number, _DtCvSegment *segment)
else else
{ {
char *orig = cell_ids[row] ; char *orig = cell_ids[row] ;
cell_ids[row] = new char [ strlen (orig) + 1 + strlen (id) + 1 ] ; cell_idslen = strlen (orig) + 1 + strlen (id) + 1 ;
sprintf(cell_ids[row], "%s %s", orig, id); cell_ids[row] = new char [ cell_idslen ] ;
snprintf(cell_ids[row], cell_idslen, "%s %s", orig, id);
} }
} }
#endif
ColFormat::ColFormat() ColFormat::ColFormat()
: f_char_align ('.'), : f_char_align ('.'),
f_name(NULL),
f_justify (_DtCvOPTION_BAD), f_justify (_DtCvOPTION_BAD),
f_width (1), f_width (1),
f_name(NULL),
f_colsep(CRSEP_NOT_SPECIFIED), f_colsep(CRSEP_NOT_SPECIFIED),
f_rowsep(CRSEP_NOT_SPECIFIED) f_rowsep(CRSEP_NOT_SPECIFIED)
{} {}
@ -2142,7 +2148,7 @@ _DtCvSegment *ensure_id(_DtCvSegment *segment)
if (segment->handle.container.id == NULL) if (segment->handle.container.id == NULL)
{ {
char buffer[16] ; char buffer[16] ;
sprintf(buffer, "id%d", id_count++); snprintf(buffer, sizeof(buffer), "id%d", id_count++);
segment->handle.container.id = strdup (buffer); segment->handle.container.id = strdup (buffer);
} }
return segment ; return segment ;
@ -2188,7 +2194,7 @@ TGDefn::find_format(const char *name, int* index)
void void
TGDefn::build() TGDefn::build()
{ {
unsigned i ; unsigned i, len, slen, lent, leng;
unsigned num_cells = 0; // # of virtual cells unsigned num_cells = 0; // # of virtual cells
unsigned num_rows = 0; // # of physical rows unsigned num_rows = 0; // # of physical rows
unsigned num_columns = 0; // # of physical columns unsigned num_columns = 0; // # of physical columns
@ -2290,7 +2296,7 @@ TGDefn::build()
for (i = 0 ; i < num_rows ; i++) for (i = 0 ; i < num_rows ; i++)
{ {
grid[i] = new _DtCvSegment *[num_columns] ; grid[i] = new _DtCvSegment *[num_columns] ;
for (int c = 0 ; c < num_columns; c++) for (unsigned int c = 0 ; c < num_columns; c++)
grid[i][c] = NULL ; grid[i][c] = NULL ;
} }
@ -2342,9 +2348,9 @@ TGDefn::build()
int spancols = 1; int spancols = 1;
ColFormat* msformat; // most significant format ColFormat* msformat; // most significant format
ColFormat* lsformat; // least significant format ColFormat* lsformat; // least significant format
if (msformat = find_format(colcell->colstart(), &start_index)) { if ((msformat = find_format(colcell->colstart(), &start_index))) {
int end_index; int end_index;
if (lsformat = find_format(colcell->colend(), &end_index)) { if ((lsformat = find_format(colcell->colend(), &end_index))) {
if (start_index > end_index) { if (start_index > end_index) {
int anonym = start_index; int anonym = start_index;
start_index = end_index; start_index = end_index;
@ -2370,7 +2376,7 @@ TGDefn::build()
setup_cell(segment, colcell, row_cursor.key(), msformat, lsformat); setup_cell(segment, colcell, row_cursor.key(), msformat, lsformat);
for (int i = 0 ; i < spancols; i++) { for (int i = 0 ; i < spancols; i++) {
for (int j = 0; j < colcell->spanrows(); j++) { for (unsigned int j = 0; j < colcell->spanrows(); j++) {
// if there's entrenchment from above rows, skip it. // if there's entrenchment from above rows, skip it.
if (grid[current_row + j][start_index + i]) if (grid[current_row + j][start_index + i])
continue; continue;
@ -2383,7 +2389,6 @@ TGDefn::build()
columns.removeAt(kept); columns.removeAt(kept);
} }
unsigned current_column = 0 ;
count = columns.entries(); count = columns.entries();
for (vc = 0, kept = 0; vc < count; vc++) // iterate for virtual cells for (vc = 0, kept = 0; vc < count; vc++) // iterate for virtual cells
{ {
@ -2401,7 +2406,7 @@ TGDefn::build()
} }
end_try; end_try;
int i, start_index; unsigned int i, start_index;
for (i = 0; i < num_columns; i++) { for (i = 0; i < num_columns; i++) {
if (grid[current_row][i] == NULL) { if (grid[current_row][i] == NULL) {
start_index = i; start_index = i;
@ -2434,7 +2439,7 @@ TGDefn::build()
columns.removeAt(kept); columns.removeAt(kept);
} }
for (int c = 0; c < num_columns; c++) for (unsigned int c = 0; c < num_columns; c++)
{ {
if (grid[current_row][c] == NULL) if (grid[current_row][c] == NULL)
{ {
@ -2458,7 +2463,7 @@ TGDefn::build()
#ifdef TABLE_DEBUG #ifdef TABLE_DEBUG
fprintf(stderr, "(DEBUG) blank spot found in the table.\n"); fprintf(stderr, "(DEBUG) blank spot found in the table.\n");
#endif #endif
int col; unsigned int col;
if (c == 0) if (c == 0)
{ {
@ -2471,7 +2476,7 @@ TGDefn::build()
{ {
_DtCvSegment* filler = grid[r][col]; _DtCvSegment* filler = grid[r][col];
for (int i = c; i < col; i++) for (unsigned int i = c; i < col; i++)
grid[r][i] = filler; grid[r][i] = filler;
} }
} }
@ -2501,7 +2506,7 @@ TGDefn::build()
for (r = 0 ; r < num_rows ; r++) for (r = 0 ; r < num_rows ; r++)
{ {
for (int c = 0 ; c < num_columns ; c++) for (unsigned int c = 0 ; c < num_columns ; c++)
{ {
if (c == 0) if (c == 0)
{ {
@ -2512,11 +2517,13 @@ TGDefn::build()
{ {
// subsequent items, append space separated id // subsequent items, append space separated id
unsigned len = strlen (table->cell_ids[r]) + strlen (grid[r][c]->handle.container.id); lent = strlen (table->cell_ids[r]);
char *new_ids = new char [len + 2] ; leng = strlen (grid[r][c]->handle.container.id);
strcpy(new_ids, table->cell_ids[r]) ; char *new_ids = new char [lent + leng + 2] ;
strcat(new_ids, " "); *((char *) memcpy(new_ids, table->cell_ids[r], lent) +lent) ='\0';
strcat(new_ids, grid[r][c]->handle.container.id); *((char *) memcpy(new_ids + lent, " ", 1) + 1) = '\0';
*((char *) memcpy(new_ids + lent + 1,
grid[r][c]->handle.container.id, leng) + leng) = '\0';
delete table->cell_ids[r] ; delete table->cell_ids[r] ;
table->cell_ids[r] = new_ids ; table->cell_ids[r] = new_ids ;
} }
@ -2534,7 +2541,7 @@ TGDefn::build()
justify_chars[0] = 0 ; justify_chars[0] = 0 ;
for (int i = 0 ; i < num_columns ; i++) for (unsigned int i = 0 ; i < num_columns ; i++)
{ {
justify[i] = _DtCvOPTION_BAD; justify[i] = _DtCvOPTION_BAD;
col_widths[i] = NULL; col_widths[i] = NULL;
@ -2547,7 +2554,7 @@ TGDefn::build()
justify[i] = format->justify(); justify[i] = format->justify();
sprintf(buffer, "%d", format->width()); snprintf(buffer, sizeof(buffer), "%d", format->width());
col_widths[i] = strdup(buffer); col_widths[i] = strdup(buffer);
if (format->justify() == _DtCvJUSTIFY_CHAR) if (format->justify() == _DtCvJUSTIFY_CHAR)
@ -2555,7 +2562,9 @@ TGDefn::build()
char buf[2] ; char buf[2] ;
buf[0] = format->char_align() ; buf[0] = format->char_align() ;
buf[1] = 0 ; buf[1] = 0 ;
strcat(justify_chars, buf); slen = strlen(buf);
len = MIN(strlen(buf), num_columns - slen);
*((char *) memcpy(justify_chars + slen, buf, len) + len) = '\0';
} }
} }
table->col_justify = justify ; table->col_justify = justify ;

View file

@ -347,7 +347,7 @@ class PartialElementFeatures
public: public:
PartialElementFeatures(CanvasRenderer *); PartialElementFeatures(CanvasRenderer *);
PartialElementFeatures (PartialElementFeatures &); PartialElementFeatures (PartialElementFeatures &);
~PartialElementFeatures(); virtual ~PartialElementFeatures();
virtual int requires_container(int affix); virtual int requires_container(int affix);
virtual int ignore_linebreak(int affix); virtual int ignore_linebreak(int affix);

View file

@ -137,7 +137,6 @@ CanvasRenderer::get_pattern(const char *fallback, const char *weight, const char
const char *family_str = "*"; const char *family_str = "*";
const char *weight_str = weight; const char *weight_str = weight;
const char *slant_str = slant; const char *slant_str = slant;
const char *setwidth_name_str = "*";
const char *style_str = "*"; const char *style_str = "*";
int point_size = size; int point_size = size;
const char *spacing_str = "*"; const char *spacing_str = "*";
@ -378,8 +377,9 @@ pattern_done:
char pattern[256]; char pattern[256];
// -dt-application-medium-r-normal-sans-8-80-75-75-p-46-iso8859-1 // -dt-application-medium-r-normal-sans-8-80-75-75-p-46-iso8859-1
sprintf ( snprintf (
pattern, pattern,
sizeof(pattern),
"-%s-%s-%s-%s-normal-%s-*-%d-*-*-%s-*-%s", "-%s-%s-%s-%s-normal-%s-*-%d-*-*-%s-*-%s",
foundry_str ? foundry_str : "*", foundry_str ? foundry_str : "*",
family_str ? family_str : "*", family_str ? family_str : "*",
@ -417,8 +417,9 @@ pattern_done:
printf("point size = %d.\n", point_size); printf("point size = %d.\n", point_size);
#endif #endif
sprintf ( snprintf (
pattern, pattern,
sizeof(pattern),
"-%s-%s-%s-%s-normal-%s-*-%d-*-*-%s-*-%s", "-%s-%s-%s-%s-normal-%s-*-%d-*-*-%s-*-%s",
foundry_str ? foundry_str : "*", foundry_str ? foundry_str : "*",
family_str ? family_str : "*", family_str ? family_str : "*",
@ -462,11 +463,12 @@ pattern_done:
char* char*
CanvasRenderer::_dofont(const FeatureSet &fs, Symbol** symbols) CanvasRenderer::_dofont(const FeatureSet &fs, Symbol** symbols)
{ {
int len, slen;
const char *fallback = NULL; const char *fallback = NULL;
const Feature *fallbackF = fs.lookup(symbols[FALLBACK]); const Feature *fallbackF = fs.lookup(symbols[FALLBACK]);
if (fallbackF) { if (fallbackF) {
if (fallback = *fallbackF->value()) { if ((fallback = *fallbackF->value())) {
if (strcasecmp(fallback, "sans") == 0) if (strcasecmp(fallback, "sans") == 0)
fallback = f_sans ; fallback = f_sans ;
else if (strcasecmp(fallback, "serif") == 0) else if (strcasecmp(fallback, "serif") == 0)
@ -492,14 +494,17 @@ CanvasRenderer::_dofont(const FeatureSet &fs, Symbol** symbols)
const Feature *slantF = fs.lookup(symbols[SLANT]); const Feature *slantF = fs.lookup(symbols[SLANT]);
const Feature *sizeF = fs.lookup(symbols[SIZE]); const Feature *sizeF = fs.lookup(symbols[SIZE]);
const char *name = NULL, *foundry = NULL, *charset = NULL; const char *name = NULL, *charset = NULL;
#ifdef JBM_FONT_DEBUG
const char *foundry = NULL;
#endif
// need to add something for spacing here // need to add something for spacing here
//const Feature *spacingF = fs.lookup(symbols[SPACING]); //const Feature *spacingF = fs.lookup(symbols[SPACING]);
const char* font; const char* font;
char* xlfd = NULL; char* xlfd = NULL;
int i; unsigned int i;
for (i = 0; i < fs.entries(); i++) { for (i = 0; i < fs.entries(); i++) {
Feature* entry; Feature* entry;
@ -525,10 +530,12 @@ CanvasRenderer::_dofont(const FeatureSet &fs, Symbol** symbols)
continue; continue;
} }
#ifdef JBM_FONT_DEBUG
const Feature* foundryF = familyFS->lookup(symbols[FOUNDRY]); const Feature* foundryF = familyFS->lookup(symbols[FOUNDRY]);
if (foundryF) { if (foundryF) {
foundry = *foundryF->value(); foundry = *foundryF->value();
} }
#endif
const Feature* charsetF = familyFS->lookup(symbols[CHARSET]); const Feature* charsetF = familyFS->lookup(symbols[CHARSET]);
if (charsetF) if (charsetF)
charset = *charsetF->value(); charset = *charsetF->value();
@ -566,9 +573,11 @@ CanvasRenderer::_dofont(const FeatureSet &fs, Symbol** symbols)
// if xlfd already defined, create a font list // if xlfd already defined, create a font list
if (xlfd) { if (xlfd) {
xlfd = (char*)realloc(xlfd, strlen(xlfd) + strlen(font) + 3); slen = strlen(xlfd);
strcat(xlfd, ","); len = strlen(font);
strcat(xlfd, font); xlfd = (char*)realloc(xlfd, slen + len + 3);
*((char *) memcpy(xlfd + slen, ",", 1) + 1) = '\0';
*((char *) memcpy(xlfd + slen + 1, ",", len) + len) = '\0';
} }
// otherwise, just dup the font streing // otherwise, just dup the font streing
else { else {
@ -587,7 +596,8 @@ CanvasRenderer::_dofont(const FeatureSet &fs, Symbol** symbols)
// list so append a colon to the end of the font list string // list so append a colon to the end of the font list string
if (strchr(xlfd, ',')) { if (strchr(xlfd, ',')) {
strcat(xlfd, ":"); slen = strlen(xlfd);
*((char *) memcpy(xlfd + slen, ":", 1) + 1) = '\0';
} }
} }
@ -629,10 +639,9 @@ CanvasRenderer::_dofont(const FeatureSet &fs, Symbol** symbols)
// p points to comma or end of string // p points to comma or end of string
if (*p == ',') if (*p == ',')
{ {
int len = p - family ; len = p - family ;
fallback = new char[len + 1] ; fallback = new char[len + 1] ;
strncpy(fallback, family, len); *((char *) memcpy(fallback, family, len) + len) = '\0';
fallback[len] = 0 ;
do p++; while (isspace(*p)); do p++; while (isspace(*p));
family = p ; family = p ;

View file

@ -160,13 +160,16 @@ FontCache::getxlfd(const char *family, int bold,
// get cache of font family // get cache of font family
static char pattern[256]; static char pattern[256];
if (charset && *charset) { if (charset && *charset) {
sprintf(pattern, "-*-%s-*-*-*-*-*-*-*-*-*-*-%s", family, charset); snprintf(pattern, sizeof(pattern),
"-*-%s-*-*-*-*-*-*-*-*-*-*-%s", family, charset);
} }
else if (family && *family) { else if (family && *family) {
sprintf(pattern, "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*", family); snprintf(pattern, sizeof(pattern),
"-*-%s-*-*-*-*-*-*-*-*-*-*-*-*", family);
} }
else { else {
strcpy(pattern, fallback); int len = MIN(strlen(fallback), 256 - 1);
*((char *) memcpy(pattern, fallback, len) + len) = '\0';
} }
CC_String _l_pattern(pattern); CC_String _l_pattern(pattern);
@ -177,8 +180,8 @@ FontCache::getxlfd(const char *family, int bold,
#if DO_SCALEABLE_FONTS #if DO_SCALEABLE_FONTS
// first check for scalable // first check for scalable
char scaled_pattern[256]; char scaled_pattern[256];
sprintf(scaled_pattern, "-*-%s-%s-%s-*-*-0-0-*-*-*-*-*-*", snprintf(scaled_pattern, sizeof(scaled_pattern),
family, weight, slant); "-*-%s-%s-%s-*-*-0-0-*-*-*-*-*-*", family, weight, slant);
newfont = XLoadQueryFont(display, pattern); newfont = XLoadQueryFont(display, pattern);
#endif #endif
@ -218,8 +221,8 @@ FontCache::getxlfd(const char *family, int bold,
#ifdef DO_SCALEABLE_FONTS #ifdef DO_SCALEABLE_FONTS
if (fontlist->scaleable()) if (fontlist->scaleable())
{ {
sprintf(pattern, "-*-%s-%s-%s-*-*-%d-*-*-*-*-*-*-*", snprintf(pattern, sizeof(pattern),
family, weight, slant, size); "-*-%s-%s-%s-*-*-%d-*-*-*-*-*-*-*", family, weight, slant, size);
return pattern ; return pattern ;
} }
@ -243,7 +246,7 @@ FontCache::getxlfd(const char *family, int bold,
(scan = strchr(scan+1, '-'))){ (scan = strchr(scan+1, '-'))){
if(bold == (strncmp(scan + 1, "medium", 6) == 0)) if(bold == (strncmp(scan + 1, "medium", 6) == 0))
score += 500; //HEURISTIC score += 500; //HEURISTIC
if(scan = strchr(scan+1, '-')){ if((scan = strchr(scan+1, '-'))){
if(italic == (strncmp(scan+1, "r", 1) == 0)) if(italic == (strncmp(scan+1, "r", 1) == 0))
score += 500; //HEURISTIC score += 500; //HEURISTIC
if((scan = strchr(scan+1, '-')) && if((scan = strchr(scan+1, '-')) &&
@ -286,8 +289,8 @@ FontCache::getxlfd(const char *family, int bold,
FontList::FontList(int count, const char **names) FontList::FontList(int count, const char **names)
: f_count(count), : f_names(names),
f_names(names) f_count(count)
{ {
} }
FontList::~FontList() FontList::~FontList()

View file

@ -33,7 +33,7 @@ dfiles:
#ifdef UXPArchitecture #ifdef UXPArchitecture
SpecialCPlusPlusObjectRule(ORTemplates.o,, +Tall_tmpls -DEXPAND_TEMPLATES) SpecialCPlusPlusObjectRule(ORTemplates.o,, +Tall_tmpls -DEXPAND_TEMPLATES)
SpecialCPlusPlusExpandRule(ORTemplates..c,ORTemplates.C,+Tall_tmpls -DEXPAND_TEMPLATES) SpecialCPlusPlusExpandRule(ORTemplates..c,ORTemplates.C,+Tall_tmpls -DEXPAND_TEMPLATES)
#elif defined(LinuxArchitecture) || defined(FreeBSDArchitecture) #elif defined(LinuxArchitecture) || defined(FreeBSDArchitecture) || defined(OpenBSDArchitecture)
SpecialCPlusPlusObjectRule(ORTemplates.o,,-DEXPAND_TEMPLATES) SpecialCPlusPlusObjectRule(ORTemplates.o,,-DEXPAND_TEMPLATES)
SpecialCPlusPlusExpandRule(ORTemplates..c,ORTemplates.C,-DEXPAND_TEMPLATES) SpecialCPlusPlusExpandRule(ORTemplates..c,ORTemplates.C,-DEXPAND_TEMPLATES)
#endif #endif

View file

@ -225,8 +225,8 @@ class Shell_Info {
public: public:
Shell_Info (Widget w) Shell_Info (Widget w)
: f_shell (w), : f_shell (w),
f_restore (False), f_size_hints (NULL),
f_size_hints (NULL) f_restore (False)
{ } { }
public: public:
@ -244,12 +244,12 @@ public:
// ///////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////
WindowSystem::WindowSystem (int &argc, char *argv[]) WindowSystem::WindowSystem (int &argc, char *argv[])
: f_shell_list (20), : f_printing(False),
f_default_pixmap (0), f_default_pixmap (0),
f_defpix_width (0), f_defpix_width (0),
f_defpix_height (0), f_defpix_height (0),
f_printing(False),
f_detached_pixmap(0), f_detached_pixmap(0),
f_shell_list (20),
f_cursor_stack_pos(-1), f_cursor_stack_pos(-1),
f_dtinfo_font(NULL), f_dtinfo_font(NULL),
f_dtinfo_space_font(NULL) f_dtinfo_space_font(NULL)
@ -275,7 +275,7 @@ WindowSystem::WindowSystem (int &argc, char *argv[])
} }
/* Reference the scale widget so Veritas Replay Xt lib can link. */ /* Reference the scale widget so Veritas Replay Xt lib can link. */
WidgetClass xxx = xmScaleWidgetClass; /* WidgetClass xxx = xmScaleWidgetClass; */
int count; int count;
char **names = XListFonts(window_system().display(), char **names = XListFonts(window_system().display(),
@ -540,9 +540,6 @@ xevent_error_aborter(Display *display, XErrorEvent* error_event)
void void
WindowSystem::init() WindowSystem::init()
{ {
Arg args[8];
int i = 0;
XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL); XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL);
_DtEnvControl(DT_ENV_SET); _DtEnvControl(DT_ENV_SET);
@ -872,7 +869,7 @@ WindowSystem::set_cursor (Cursor cursor, Widget exception)
{ {
Widget shell; Widget shell;
// ON_DEBUG (printf ("Cursor change <%d>\n", f_cursor_stack_pos)); // ON_DEBUG (printf ("Cursor change <%d>\n", f_cursor_stack_pos));
for (int i = 0; i < f_shell_list.length(); i++) for (unsigned int i = 0; i < f_shell_list.length(); i++)
{ {
shell = ((Shell_Info *) f_shell_list[i])->f_shell; shell = ((Shell_Info *) f_shell_list[i])->f_shell;
if (shell != exception && XtWindow (shell) != 0) if (shell != exception && XtWindow (shell) != 0)
@ -904,14 +901,14 @@ WindowSystem::reset_cursor (WCallback *wcb)
Widget shell; Widget shell;
Widget exception = wcb ? wcb->GetWidget() : NULL; Widget exception = wcb ? wcb->GetWidget() : NULL;
f_cursor_stack_pos--; f_cursor_stack_pos--;
Cursor cursor; Cursor cursor = 0;
if (f_cursor_stack_pos >= 0) if (f_cursor_stack_pos >= 0)
cursor = f_cursor_stack[f_cursor_stack_pos].cursor; cursor = f_cursor_stack[f_cursor_stack_pos].cursor;
for (int i = 0; i < f_shell_list.length(); i++) for (unsigned int i = 0; i < f_shell_list.length(); i++)
{ {
shell = ((Shell_Info *) f_shell_list[i])->f_shell; shell = ((Shell_Info *) f_shell_list[i])->f_shell;
if (shell != exception && XtWindow (shell) != 0) if (shell != exception && XtWindow (shell) != 0) {
// Reset the previous cursor if there's one on the stack, revert // Reset the previous cursor if there's one on the stack, revert
// to default cursor if the stack is empty. // to default cursor if the stack is empty.
// printf ("Resetting cursor on %s\n", XtName(shell)); // printf ("Resetting cursor on %s\n", XtName(shell));
@ -920,6 +917,7 @@ WindowSystem::reset_cursor (WCallback *wcb)
XDefineCursor (f_display, XtWindow (shell), cursor); XDefineCursor (f_display, XtWindow (shell), cursor);
else else
XUndefineCursor (f_display, XtWindow (shell)); XUndefineCursor (f_display, XtWindow (shell));
}
} }
XFlush (f_display); XFlush (f_display);
} }
@ -957,10 +955,11 @@ WindowSystem::create_cursor (const char *filename)
Cursor cursor; Cursor cursor;
Pixmap cursor_bits, cursor_mask; Pixmap cursor_bits, cursor_mask;
Screen *screen = DefaultScreenOfDisplay (f_display); Screen *screen = DefaultScreenOfDisplay (f_display);
static XColor white = { 0, ~0, ~0, ~0, DoRed | DoGreen | DoBlue }; unsigned short c = ~0;
static XColor white = { 0, c, c, c, DoRed | DoGreen | DoBlue };
static XColor black = { 0, 0, 0, 0, DoRed | DoGreen | DoBlue }; static XColor black = { 0, 0, 0, 0, DoRed | DoGreen | DoBlue };
int hot_x, hot_y; int hot_x, hot_y;
int depth; int depth, len;
Boolean success; Boolean success;
// Get the cursor pixmap. // Get the cursor pixmap.
@ -978,12 +977,15 @@ WindowSystem::create_cursor (const char *filename)
&hot_x, &hot_y, // &hot_x, &hot_y, //
0, 0); // width, height 0, 0); // width, height
assert (success); if(!success) {
assert (success);
}
// Get the cursor mask pixmap. // Get the cursor mask pixmap.
char *mask_filename = new char [strlen(filename) + 2]; len = strlen(filename);
strcpy (mask_filename, filename); char *mask_filename = new char [len + 2];
strcat (mask_filename, "m"); *((char *) memcpy(mask_filename, filename, len) + len) = '\0';
*((char *) memcpy(mask_filename + len, "m", 1) + 1) = '\0';
cursor_mask = XmGetPixmapByDepth (screen, mask_filename, 1, 0, 1); cursor_mask = XmGetPixmapByDepth (screen, mask_filename, 1, 0, 1);
if (cursor_mask == XmUNSPECIFIED_PIXMAP) if (cursor_mask == XmUNSPECIFIED_PIXMAP)
{ {
@ -1098,11 +1100,10 @@ WindowSystem::default_pixmap (Dimension *width, Dimension *height)
temp_width = default_width; temp_width = default_width;
temp_height = default_height; temp_height = default_height;
#else #else
int status ;
XpmAttributes xpm_attr ; XpmAttributes xpm_attr ;
xpm_attr.valuemask = 0 ; xpm_attr.valuemask = 0 ;
status = XmeXpmCreatePixmapFromData(f_display, XmeXpmCreatePixmapFromData(f_display,
XtWindow((Widget)toplevel()), XtWindow((Widget)toplevel()),
(char**)graphic_unavailable_data, (char**)graphic_unavailable_data,
&temp_pixmap, &temp_pixmap,
@ -1197,7 +1198,8 @@ WindowSystem::read_pixmap(const char *pname,
xpm_attributes.valuemask = 0; xpm_attributes.valuemask = 0;
strcpy(fname, pname); int len = MIN(strlen(pname), 255 - 1);
*((char *) memcpy(fname, pname, len) + len) = '\0';
#ifdef UseDlOpen #ifdef UseDlOpen
status = xpm_lib().ReadFileToPixmap (f_display, XtWindow ((Widget)toplevel()), status = xpm_lib().ReadFileToPixmap (f_display, XtWindow ((Widget)toplevel()),
@ -1349,7 +1351,8 @@ WindowSystem::get_message (const char *message_name)
XtGetApplicationResources (toplevel(), &string, resource, 1, NULL, 0); XtGetApplicationResources (toplevel(), &string, resource, 1, NULL, 0);
if (string == default_message) if (string == default_message)
sprintf (string, "%s (Message description not found)", message_name); snprintf (string, sizeof(default_message),
"%s (Message description not found)", message_name);
return (string); return (string);
} }
@ -1499,7 +1502,7 @@ WindowSystem::show_all_windows()
Shell_Info *si; Shell_Info *si;
Boolean waiting_for_wm; Boolean waiting_for_wm;
for (int i = 0; i < f_shell_list.length(); i++) for (unsigned int i = 0; i < f_shell_list.length(); i++)
{ {
si = (Shell_Info *) f_shell_list[i]; si = (Shell_Info *) f_shell_list[i];
if (si->f_restore) if (si->f_restore)

View file

@ -80,13 +80,14 @@
#define _VROOT_H_ #define _VROOT_H_
#if !defined(lint) && !defined(SABER) #if !defined(lint) && !defined(SABER)
static char vroot_rcsid[] = "$XConsortium: vroot.h /main/3 1996/06/11 16:30:45 cde-hal $"; static const char vroot_rcsid[] = "$XConsortium: vroot.h /main/3 1996/06/11 16:30:45 cde-hal $";
#endif #endif
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#if 0
static Window static Window
VirtualRootWindowOfScreen(Screen *screen) VirtualRootWindowOfScreen(Screen *screen)
{ {
@ -97,7 +98,7 @@ VirtualRootWindowOfScreen(Screen *screen)
{ {
Display *dpy = DisplayOfScreen(screen); Display *dpy = DisplayOfScreen(screen);
Atom __SWM_VROOT = None; Atom __SWM_VROOT = None;
int i; unsigned int i;
Window rootReturn, parentReturn, *children; Window rootReturn, parentReturn, *children;
unsigned int numChildren; unsigned int numChildren;
@ -139,6 +140,7 @@ VirtualRootWindowOfScreen(Screen *screen)
return (root); return (root);
} }
#endif
/* Need original macros to figure out if there is a virtual root. */ /* Need original macros to figure out if there is a virtual root. */

View file

@ -71,9 +71,9 @@ void
BooleanPref::save() BooleanPref::save()
{ {
if (f_value == 0) if (f_value == 0)
strcpy (g_buffer, "false"); *((char *) memcpy(g_buffer, "false", 6) + 6) = '\0';
else else
strcpy (g_buffer, "true"); *((char *) memcpy(g_buffer, "true", 5) + 5) = '\0';
set_value (g_buffer); set_value (g_buffer);
} }

View file

@ -63,7 +63,7 @@
void void
IntegerPref::save() IntegerPref::save()
{ {
sprintf (g_buffer, "%d", f_value); snprintf (g_buffer, sizeof(g_buffer), "%d", f_value);
set_value (g_buffer); set_value (g_buffer);
} }

View file

@ -111,7 +111,8 @@ PreferenceRecord::form_filename()
static char filename[256]; static char filename[256];
if (filename[0] == '\0') if (filename[0] == '\0')
{ {
sprintf (filename, "%s/preferences", env().user_path()); snprintf (filename, sizeof(filename),
"%s/preferences", env().user_path());
#if EAM #if EAM
const char *home = env().home(); const char *home = env().home();
if (home == NULL) if (home == NULL)
@ -120,8 +121,8 @@ PreferenceRecord::form_filename()
if (lang == NULL) if (lang == NULL)
throw (CASTEXCEPT Exception()); throw (CASTEXCEPT Exception());
sprintf (filename, "%s/.dt/dtinfo/%s/preferences", snprintf (filename, sizeof(filename),
home, lang); "%s/.dt/dtinfo/%s/preferences", home, lang);
#endif #endif
} }
@ -134,8 +135,8 @@ revert_from_backup (const char *filename)
{ {
int ret; int ret;
// Failed, so look for the backup file. // Failed, so look for the backup file.
char backup[256], original[256]; char backup[256];
sprintf (backup, "%s.bak", filename); snprintf (backup, sizeof(backup), "%s.bak", filename);
struct stat file_info; struct stat file_info;
if (stat (backup, &file_info) != -1 && if (stat (backup, &file_info) != -1 &&
@ -143,6 +144,7 @@ revert_from_backup (const char *filename)
{ {
unlink (filename); unlink (filename);
ret = link (backup, filename); ret = link (backup, filename);
if(ret == 0) throw (CASTEXCEPT Exception());
} }
} }
@ -155,11 +157,13 @@ read_version (FILE *stream)
// Make sure the file is valid. // Make sure the file is valid.
char V = '-'; char V = '-';
ret1 = fread (&V, 1, 1, stream); ret1 = fread (&V, 1, 1, stream);
if(ret1 == 0) throw (CASTEXCEPT Exception());
if (V != 'V') if (V != 'V')
return (0); return (0);
// Nab the version from the file. // Nab the version from the file.
int version = 0; int version = 0;
ret2 = fscanf (stream, "%d", &version); ret2 = fscanf (stream, "%d", &version);
if(ret2 == 0) throw (CASTEXCEPT Exception());
return (version); return (version);
} }
@ -172,6 +176,7 @@ read_update_count (FILE *stream)
int update_count; int update_count;
ret = fgets (buffer, 256, stream); ret = fgets (buffer, 256, stream);
if(ret == NULL) throw (CASTEXCEPT Exception());
p = buffer; p = buffer;
while (*p != ',' && *p != '\0') while (*p != ',' && *p != '\0')
p++; p++;
@ -290,7 +295,7 @@ PreferenceRecord::write_prefs()
backup[0] = '\0'; backup[0] = '\0';
if (status == 0) if (status == 0)
{ {
sprintf (backup, "%s.bak", filename); snprintf (backup, sizeof(backup), "%s.bak", filename);
unlink (backup); unlink (backup);
if (rename (filename, backup) == -1) if (rename (filename, backup) == -1)
throw (CASTEXCEPT Exception()); throw (CASTEXCEPT Exception());
@ -298,7 +303,7 @@ PreferenceRecord::write_prefs()
else // Make sure the parent directory exists. else // Make sure the parent directory exists.
{ {
char dirname[256]; char dirname[256];
sprintf (dirname, "%s", env().user_path()); snprintf (dirname, sizeof(dirname), "%s", env().user_path());
status = stat (dirname, &file_info); status = stat (dirname, &file_info);
if (status == -1) if (status == -1)
{ {

View file

@ -63,7 +63,7 @@
void void
WindowGeometryPref::save() WindowGeometryPref::save()
{ {
sprintf (g_buffer, "%dx%d+%d+%d", snprintf (g_buffer, sizeof(g_buffer), "%dx%d+%d+%d",
f_value.width, f_value.height, f_value.ulx, f_value.uly); f_value.width, f_value.height, f_value.ulx, f_value.uly);
set_value (g_buffer); set_value (g_buffer);
} }

View file

@ -102,9 +102,9 @@ QueryEditor *QueryEditor::f_query_editor;
// ///////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////
QueryEditor::QueryEditor(UAS_SearchEngine& search_engine) QueryEditor::QueryEditor(UAS_SearchEngine& search_engine)
: f_shell (NULL), : f_query (NULL),
f_query (NULL),
f_query_view (NULL), f_query_view (NULL),
f_shell (NULL),
f_null_terms (0) f_null_terms (0)
{ {
f_query_editor = this; f_query_editor = this;

View file

@ -99,11 +99,13 @@ static const char *infix_formats[] =
"%s weight %%s", "%s scope %s", "not %s", "%s*", "\"%s\"" }; "%s weight %%s", "%s scope %s", "not %s", "%s*", "\"%s\"" };
#endif #endif
#if 0
static const char *infix_pformats[] = static const char *infix_pformats[] =
{ "", "(%s or %s%)", "(%s xor %s%)", "(%s and %s)", { "", "(%s or %s%)", "(%s xor %s%)", "(%s and %s)",
"(%s near %s%%s)", "(%s before %s%%s)", // %%s is loc to insert proximity "(%s near %s%%s)", "(%s before %s%%s)", // %%s is loc to insert proximity
" within %s", // proximity string to insert " within %s", // proximity string to insert
"%%s weight %s", "%s scope %s", "not %s", "%s*", "\"%s\"" }; "%%s weight %s", "%s scope %s", "not %s", "%s*", "\"%s\"" };
#endif
// Order of these correspond to query_type_t enum in QueryGroup.hh // Order of these correspond to query_type_t enum in QueryGroup.hh
static const char **formats[] = { fulcrum_formats, infix_formats }; static const char **formats[] = { fulcrum_formats, infix_formats };
@ -387,15 +389,17 @@ QueryGroup::format (query_type_t query_type, QueryTerm *term)
static char *buf[2]; static char *buf[2];
// 48 is enough space to handle phrase, not, weight, and completion. // 48 is enough space to handle phrase, not, weight, and completion.
int n = 48 + strlen (term->term_string()); int n = 48 + strlen (term->term_string());
int buflen = n;
buf[0] = (char *) malloc (n); buf[0] = (char *) malloc (n);
buf[1] = (char *) malloc (n); buf[1] = (char *) malloc (n);
n = 0; n = 0;
s = strcpy (buf[n++], s); int len = strlen(s);
*((char *) memcpy(buf[n++], s, len) + len) = '\0';
if (term->prefix() & QueryTerm::PFX_COMPLETE_BITS){ if (term->prefix() & QueryTerm::PFX_COMPLETE_BITS){
char * p = buf [n++ % 2]; char * p = buf [n++ % 2];
sprintf (p, formats[query_type][OPT_COMPLETE], s); snprintf (p, buflen, formats[query_type][OPT_COMPLETE], s);
s = p; s = p;
} }
// If there's any interal spaces, we need to use the phase operator. // If there's any interal spaces, we need to use the phase operator.
@ -404,13 +408,13 @@ QueryGroup::format (query_type_t query_type, QueryTerm *term)
for (; *cp > 0x20; cp++); // looking for control chars for (; *cp > 0x20; cp++); // looking for control chars
if (*cp != '\0') { if (*cp != '\0') {
char *p = buf [n++ % 2]; char *p = buf [n++ % 2];
sprintf (p, infix_formats[OPT_PHRASE], s); snprintf (p, buflen, infix_formats[OPT_PHRASE], s);
s = p; /// alternating s = p; /// alternating
} }
if (term->prefix() & QueryTerm::PFX_NOT_BITS) if (term->prefix() & QueryTerm::PFX_NOT_BITS)
{ {
char *p = buf [n++ % 2]; char *p = buf [n++ % 2];
sprintf (p, formats[query_type][OPT_NOT], s); snprintf (p, buflen, formats[query_type][OPT_NOT], s);
s = p; s = p;
} }
#else #else
@ -423,13 +427,13 @@ QueryGroup::format (query_type_t query_type, QueryTerm *term)
if (TRUE || *t != '\0') if (TRUE || *t != '\0')
{ {
char *p = buf [n++ % 2]; char *p = buf [n++ % 2];
sprintf (p, formats[query_type][OPT_PHRASE], s); snprintf (p, buflen, formats[query_type][OPT_PHRASE], s);
s = p; s = p;
} }
if (term->prefix() & QueryTerm::PFX_NOT_BITS) if (term->prefix() & QueryTerm::PFX_NOT_BITS)
{ {
char *p = buf [n++ % 2]; char *p = buf [n++ % 2];
sprintf (p, formats[query_type][OPT_NOT], s); snprintf (p, buflen, formats[query_type][OPT_NOT], s);
s = p; s = p;
} }
#endif #endif
@ -442,10 +446,10 @@ QueryGroup::format (query_type_t query_type, QueryTerm *term)
{ {
// First plug in the weight format string, then add the weight to it. // First plug in the weight format string, then add the weight to it.
char *p = buf [n++ % 2]; char *p = buf [n++ % 2];
sprintf (p, formats[query_type][OPT_WEIGHT], s); snprintf (p, buflen, formats[query_type][OPT_WEIGHT], s);
s = p; s = p;
p = buf [n++ % 2]; p = buf [n++ % 2];
sprintf (p, s, term->weight()); snprintf (p, buflen, s, term->weight());
s = p; s = p;
} }
@ -457,7 +461,7 @@ QueryGroup::format (query_type_t query_type, QueryTerm *term)
{ {
char *p = buf [n % 2]; char *p = buf [n % 2];
sprintf (p, s, term->term_string()); snprintf (p, buflen, s, term->term_string());
s = p; s = p;
} }
// Rember the point, since it will change after the write. // Rember the point, since it will change after the write.
@ -499,16 +503,17 @@ QueryGroup::reduce (query_type_t query_type,
if (opt == C_XOR) opsize *= 2; if (opt == C_XOR) opsize *= 2;
int fmt_length = strlen (formats[query_type][opt]) + int fmt_length = strlen (formats[query_type][opt]) +
strlen (formats[query_type][OPT_PROXIMITY]); strlen (formats[query_type][OPT_PROXIMITY]);
char *buf = (char*) malloc (fmt_length + opsize + 1); int buflen = fmt_length + opsize + 1;
char *buf = (char*) malloc (buflen);
sprintf (buf, formats[query_type][opt], op1, op2, op1, op2); snprintf (buf, buflen, formats[query_type][opt], op1, op2, op1, op2);
// Take care of proximity if necessary. // Take care of proximity if necessary.
if (opt == C_NEAR || opt == C_BEFORE) if (opt == C_NEAR || opt == C_BEFORE)
{ {
char *b2 = (char *) malloc (fmt_length + opsize + 1); char *b2 = (char *) malloc (buflen);
sprintf (b2, buf, formats[query_type][OPT_PROXIMITY]); snprintf (b2, buflen, buf, formats[query_type][OPT_PROXIMITY]);
sprintf (buf, b2, proximity); snprintf (buf, buflen, b2, proximity);
free (b2); free (b2);
} }

View file

@ -172,7 +172,7 @@ QueryTerm::cleanup_term_string()
wclen = mbstowcs(wcbuf, f_term_string, length + 1); wclen = mbstowcs(wcbuf, f_term_string, length + 1);
assert( *(wcbuf + wclen) == (TML_CHAR_TYPE)'\0' ); assert( *(wcbuf + wclen) == (TML_CHAR_TYPE)'\0' );
#else #else
strcpy((char *) wcbuf, f_term_string); *((char *) memcpy((char *) wcbuf, f_term_string, length) + length) = '\0';
wclen = length ; wclen = length ;
#endif #endif
@ -200,7 +200,8 @@ QueryTerm::cleanup_term_string()
#ifdef UseWideChars #ifdef UseWideChars
wcstombs(f_term_string, first, length + 1); wcstombs(f_term_string, first, length + 1);
#else #else
strcpy(f_term_string, (const char *) first); *((char *) memcpy(f_term_string,
(const char *) first, length) + length) = '\0';
#endif #endif
} }
delete[] wcbuf; delete[] wcbuf;

View file

@ -87,17 +87,17 @@ private:
QueryGroup *f_parent; QueryGroup *f_parent;
QueryTerm *f_previous; QueryTerm *f_previous;
QueryTerm *f_next; QueryTerm *f_next;
u_char f_type;
union { union {
QueryGroup *f_group_term; QueryGroup *f_group_term;
char *f_term_string; char *f_term_string;
}; };
u_char f_prefix; u_char f_prefix;
u_char f_connective; u_char f_connective;
char *f_proximity;
char *f_weight; char *f_weight;
char *f_proximity;
char *f_scope; char *f_scope;
bool f_term_string_fixed; bool f_term_string_fixed;
u_char f_type;
// may need some way to verify the scope... // may need some way to verify the scope...
static unsigned int f_caps; static unsigned int f_caps;

View file

@ -327,8 +327,7 @@ QueryTermView::create_ui()
void void
QueryTermView::select_toggle (WCallback *wcb) QueryTermView::select_toggle (WCallback *wcb)
{ {
XmToggleButtonCallbackStruct *tbcs = (XmToggleButtonCallbackStruct *) wcb->CallData();
(XmToggleButtonCallbackStruct *) wcb->CallData();
// notify someone about selection state... // notify someone about selection state...
invert_colors(); invert_colors();
@ -716,7 +715,7 @@ QueryTermView::weight_changed()
cursor_pos = w = 0; cursor_pos = w = 0;
else else
cursor_pos = f_weight_field.GetInsertionPosition(); cursor_pos = f_weight_field.GetInsertionPosition();
sprintf(weight_string, "%d", w); snprintf(weight_string, sizeof(weight_string), "%d", w);
f_weight_field.SetString(weight_string); f_weight_field.SetString(weight_string);
f_weight_field.SetInsertionPosition(cursor_pos); f_weight_field.SetInsertionPosition(cursor_pos);
} }

View file

@ -97,10 +97,13 @@ private:
private: private:
#ifdef UseQSearch #ifdef UseQSearch
QueryTerm *f_query_term; QueryTerm *f_query_term;
WXmForm f_form;
WXmForm f_pws_form;
WXmTextField f_weight_field;
WXmLabelGadget f_weight_label;
QueryGroupView *f_parent; QueryGroupView *f_parent;
QueryTermView *f_previous; QueryTermView *f_previous;
QueryTermView *f_next; QueryTermView *f_next;
WXmForm f_form;
WXmOptionMenu f_prefix; WXmOptionMenu f_prefix;
union { union {
WXmTextField *f_term_field; WXmTextField *f_term_field;
@ -109,15 +112,15 @@ private:
}; };
WXmArrowButton f_pw_button; WXmArrowButton f_pw_button;
WXmOptionMenu f_connective; WXmOptionMenu f_connective;
WXmForm f_pws_form;
WXmLabelGadget f_weight_label;
WXmTextField f_weight_field;
#else #else
QueryTerm *f_query_term; QueryTerm *f_query_term;
WXmForm f_form;
WXmForm f_pws_form;
WXmLabelGadget f_proximity_label;
WXmTextField f_proximity_field;
QueryGroupView *f_parent; QueryGroupView *f_parent;
QueryTermView *f_previous; QueryTermView *f_previous;
QueryTermView *f_next; QueryTermView *f_next;
WXmForm f_form;
WXmToggleButton f_select_toggle; // What is this for? - 6/28/94 kamiya WXmToggleButton f_select_toggle; // What is this for? - 6/28/94 kamiya
WXmOptionMenu f_prefix; WXmOptionMenu f_prefix;
union { union {
@ -127,9 +130,6 @@ private:
}; };
WXmArrowButton f_pw_button; WXmArrowButton f_pw_button;
WXmOptionMenu f_connective; WXmOptionMenu f_connective;
WXmForm f_pws_form;
WXmLabelGadget f_proximity_label;
WXmTextField f_proximity_field;
WXmTextField f_weight_field; WXmTextField f_weight_field;
WXmTextField f_scope_field; WXmTextField f_scope_field;
#endif #endif

View file

@ -29,7 +29,7 @@ UAS_List<UAS_Common>
bookcaseList () { bookcaseList () {
UAS_List<UAS_Common> rval; UAS_List<UAS_Common> rval;
UAS_List<UAS_String> rootLocs = UAS_Common::rootLocators (); UAS_List<UAS_String> rootLocs = UAS_Common::rootLocators ();
int i; unsigned int i;
for (i = 0; i < rootLocs.length(); i ++) { for (i = 0; i < rootLocs.length(); i ++) {
UAS_Pointer<UAS_Common> curDoc (UAS_Common::create UAS_Pointer<UAS_Common> curDoc (UAS_Common::create
(*(UAS_String*)rootLocs[i])); (*(UAS_String*)rootLocs[i]));
@ -42,7 +42,7 @@ bookcaseList () {
if (curDoc->type() == UAS_LIBRARY) { if (curDoc->type() == UAS_LIBRARY) {
UAS_List<UAS_Common> kids = curDoc->children(); UAS_List<UAS_Common> kids = curDoc->children();
for (int j = 0; j < kids.length(); j ++) { for (unsigned int j = 0; j < kids.length(); j ++) {
if (kids[j]->type() == UAS_BOOKCASE) { if (kids[j]->type() == UAS_BOOKCASE) {
rval.insert_item(kids[j]); rval.insert_item(kids[j]);
} }

View file

@ -54,7 +54,10 @@ UAS_BookcaseEntry::UAS_BookcaseEntry(UAS_Pointer<UAS_Common> &bookcase,
f_name(0), f_name(0),
f_base_num(-1) f_base_num(-1)
{ {
const char *bc_path = bookcase->id(); int len;
f_bookcase_name = bookcase->id();
const char *bc_path = f_bookcase_name;
if (! bc_path) { if (! bc_path) {
f_name = f_path = NULL; f_name = f_path = NULL;
} }
@ -62,11 +65,13 @@ UAS_BookcaseEntry::UAS_BookcaseEntry(UAS_Pointer<UAS_Common> &bookcase,
const char *bc_name = UASbasename(bc_path); const char *bc_name = UASbasename(bc_path);
f_name = new char[strlen(bc_name)+1]; len = strlen(bc_name);
strcpy(f_name, bc_name); f_name = new char[len + 1];
*((char *) memcpy(f_name, bc_name, len) + len) = '\0';
f_path = new char[strlen(bc_path)+1]; len = strlen(bc_path);
strcpy (f_path, bc_path); f_path = new char[len + 1];
*((char *) memcpy(f_path, bc_path, len) + len) = '\0';
} }
f_infolib_id = bookcase->lid(); f_infolib_id = bookcase->lid();

View file

@ -47,6 +47,7 @@ class UAS_BookcaseEntry : public UAS_Base
UAS_String f_infolib_id; // infolib id where bookcase resides UAS_String f_infolib_id; // infolib id where bookcase resides
UAS_String f_bookcase_id; // bookcase id UAS_String f_bookcase_id; // bookcase id
UAS_String f_bookcase_name;// infolib name where bookcase resides
}; };
#endif #endif

View file

@ -23,6 +23,7 @@
// $XConsortium: UAS_Buffer.cc /main/3 1996/06/11 16:36:44 cde-hal $ // $XConsortium: UAS_Buffer.cc /main/3 1996/06/11 16:36:44 cde-hal $
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include "UAS_Buffer.hh" #include "UAS_Buffer.hh"
// If necessary in the future, we can rework UAS_Buffer class to provide // If necessary in the future, we can rework UAS_Buffer class to provide
@ -118,7 +119,7 @@ UAS_Buffer::write (const ssize_t integer)
// Convert bytes from native to MSB first ordering. // Convert bytes from native to MSB first ordering.
g_int = 0; g_int = 0;
for (int i = 0; i < sizeof (int); i++) for (unsigned int i = 0; i < sizeof (int); i++)
if (g_byte_pos[i] != 0) if (g_byte_pos[i] != 0)
g_intbuf[g_byte_pos[i]-1] = inbuf[i]; g_intbuf[g_byte_pos[i]-1] = inbuf[i];
@ -131,7 +132,7 @@ UAS_Buffer::read (int *integer)
*integer = 0; *integer = 0;
// Convert from MSB first ordering to native. // Convert from MSB first ordering to native.
for (int i = 0; i < sizeof (int); i++) for (unsigned int i = 0; i < sizeof (int); i++)
if (g_byte_pos[i] != 0) if (g_byte_pos[i] != 0)
((char *) integer)[i] = f_point[g_byte_pos[i]-1]; ((char *) integer)[i] = f_point[g_byte_pos[i]-1];
@ -183,7 +184,7 @@ UAS_Buffer::write (const char *bytes, unsigned int size, unsigned int length)
{ {
int num_bytes = size * length; int num_bytes = size * length;
check_space (num_bytes); check_space (num_bytes);
for (int i = 0; i < size * length; i++) for (unsigned int i = 0; i < size * length; i++)
memcpy (f_point, bytes, num_bytes); memcpy (f_point, bytes, num_bytes);
f_point += num_bytes; f_point += num_bytes;
f_end_of_data = f_point; f_end_of_data = f_point;
@ -194,7 +195,7 @@ UAS_Buffer::read (char **bytes, unsigned int size, unsigned int length)
{ {
int num_bytes = size * length; int num_bytes = size * length;
*bytes = f_point; *bytes = f_point;
for (int i = 0; i < size * length; i++) for (unsigned int i = 0; i < size * length; i++)
f_point += num_bytes; f_point += num_bytes;
} }

View file

@ -245,7 +245,7 @@ UAS_Common::subtree_size()
int tree_size = 1; int tree_size = 1;
for (int i = 0; i < num_kids; i++) { for (unsigned int i = 0; i < num_kids; i++) {
if (! (kids[i] == (const int)NULL)) if (! (kids[i] == (const int)NULL))
tree_size += kids[i]->subtree_size(); tree_size += kids[i]->subtree_size();
} }

Some files were not shown because too many files have changed in this diff Show more