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
#undef TopLevelProject
#define TopLevelProject DtInfo
IMAKE_DEFINES = -DTopLevelProject=TopLevelProject \
-DProjectTmplFile='<DtInfo.tmpl>' \
-DProjectRulesFile='<DtInfo.rules>'
IMAKE_DEF_DTINFO = -DTopLevelProject=TopLevelProject \
-DProjectTmplFile='<DtInfo.tmpl>' \
-DProjectRulesFile='<DtInfo.rules>'
MakeSubdirs($(SUBDIRS))

View file

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

View file

@ -207,6 +207,7 @@ AddLibraryAgent::pick_dir () {
if( !f_file_sel )
{
Arg args[20];
unsigned int len, slen;
int n;
XmString title_str = XmStringCreateLocalized(
@ -217,20 +218,23 @@ AddLibraryAgent::pick_dir () {
XmString infolibs_str = XmStringCreateLocalized( (char*)"Infolibs" );
// 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
// LANG-type subdirectories, so the normalized CDE language
// string can be used for lookup. For now, must assume the
// user environment LANG is OK ...
char *tmpstr;
if( tmpstr = getenv("LANG") )
sprintf( buf, "/usr/dt/infolib/%s/", tmpstr );
if( (tmpstr = getenv("LANG")) )
snprintf( buf, buflen, "/usr/dt/infolib/%s/", tmpstr );
else
sprintf( buf, "/usr/dt/infolib/%s/", env().lang() );
snprintf( buf, buflen, "/usr/dt/infolib/%s/", env().lang() );
//
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 );
delete [] buf;

View file

@ -32,7 +32,7 @@ class AddLibraryAgent: public WWL {
WXmForm f_form;
WXmPushButton f_ok;
WXmPushButton f_clr;
Widget f_file_sel;
bool f_done;
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 -------- */
for (int i = 0; i < mi.length(); i++) {
for (unsigned int i = 0; i < mi.length(); i++) {
UAS_Pointer<MarkUnitInfo> mui_t = mi[i];
MarkUnitInfo& mui = *mui_t;
char buf[64];
if (i > 0)
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;
}

View file

@ -78,8 +78,8 @@ BookTab::BookTab (const WComposite &parent)
BookTab::BookTab (NodeWindowAgent *nwa,
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)
{
widget = XyzCreateTabButton (parent, "tab", NULL, 0);

View file

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

View file

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

View file

@ -408,7 +408,6 @@ HelpAgent::get_locator_id(const Widget w)
res.default_type = XtRString;
res.default_addr = (void*)NULL_LOCATORID;
char *wname = XtName(w); // Just for gdb
String string;
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.nitems = *length;
char** string_list;
int count;
int count, len, slen;
XmbTextPropertyToTextList(XtDisplay(w), &prop, &string_list, &count);
char *mbs = strdup("");
for (int i=0; i<count; i++) {
mbs = (char*)realloc(mbs, strlen(mbs) + strlen(string_list[i]) + 1);
mbs = strcat(mbs, string_list[i]);
slen = strlen(mbs);
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);
#if 0
@ -493,7 +495,7 @@ IcccmAgent::convert_handler(Widget w, Atom selection, Atom target,
target_list[1] = XA_STRING;
target_list[2] = XA_TEXT(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];
XtFree((char*)xmu_targets);
xmu_targets = NULL;

View file

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

View file

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

View file

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

View file

@ -103,6 +103,10 @@ private: // variables
Widget f_shell;
OutlineListView *f_doc_tree_view;
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_copy;
Widget f_detach;
@ -115,10 +119,6 @@ private: // variables
Widget f_remove;
Widget f_remove2;
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;
Widget f_status_text;
ScopeMenu *f_scope_menu;

View file

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

View file

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

View file

@ -92,6 +92,7 @@ class MapButton : public WWL
public:
MapButton (WComposite &parent, const UAS_Pointer<UAS_Common> &doc_ptr,
MapButton *ancestor);
virtual ~MapButton() {}
void activate();
void expand();
@ -193,7 +194,7 @@ MapButton::expand()
// Create a button for each child.
UAS_List<UAS_Common> kids (f_doc_ptr->children());
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);
ON_DEBUG (puts ("managing kids"));
MapButton::ManageKids();

View file

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

View file

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

View file

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

View file

@ -283,7 +283,7 @@ MarkListView::view()
{
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);
int i = 1;
@ -311,7 +311,7 @@ void
MarkListView::remove()
{
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);
int i = 1;
@ -335,7 +335,7 @@ void
MarkListView::edit()
{
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);
int i = 1;

View file

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

View file

@ -143,9 +143,9 @@ MessageAgent::position_dialog (WCallback *)
int win_x, win_y;
unsigned int mask;
#ifdef BOGUS
static int sizesSet = 0;
#ifdef BOGUS
if (!sizesSet) {
WXmDialogShell theShell (XtParent (*f_dialog));
theShell.MinHeight (theShell.Height());
@ -600,7 +600,7 @@ MessageAgent::get_integer (const char *message, const char* title,
mtfstring = CATGETS(Set_AgentLabel, 162, "Cancel");
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->Manage();
@ -734,7 +734,8 @@ MessageAgent::get_string (const char *msg, const char* title,
g_active = FALSE;
f_text->Unmanage();
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));

View file

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

View file

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

View file

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

View file

@ -354,7 +354,7 @@ class GraphicsHandler : public UAS_Receiver<DetachGraphic>,
{
public:
GraphicsHandler(NodeWindowAgent *agent);
~GraphicsHandler();
virtual ~GraphicsHandler();
void receive(DetachGraphic &, 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); }
#ifdef NotDefined
static XmString
XmStringCreateComponent (XmStringComponentType tag, void *data, u_int length);
static void register_actions();
#endif
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 )
list->free_data_handle (f_data_handle);
f_list = list;
if (list != NULL)
if (list != NULL) {
if (handle != 0)
f_data_handle = handle ;
else
f_data_handle = list->get_data_handle();
}
// Determine the base level.
f_base_level = 0;
if (list->length() > 0) {
@ -465,6 +467,7 @@ OutlineListView::generate_table (OutlineList *list, XmStringTable &table,
}
#ifdef NotDefined
// /////////////////////////////////////////////////////////////////
// XmStringCreateComponent
// /////////////////////////////////////////////////////////////////
@ -505,6 +508,7 @@ XmStringCreateComponent (XmStringComponentType tag,
#endif
return (string);
}
#endif
// /////////////////////////////////////////////////////////////////
@ -529,7 +533,7 @@ OutlineListView::y_to_outline_element (Position y)
#endif
// Another Motif 1.2 bug. YToPos should return 0 for bogus position,
// but it doesn't check the range.
if (f_item_pos < 0 || f_item_pos >= ItemCount())
if (f_item_pos < 0 || (int) f_item_pos >= ItemCount())
return (NULL);
oe = item_at (f_item_pos);
@ -833,7 +837,7 @@ OutlineListView::printConvertCallback(WCallback *wcb)
char filepath[MAXPATHLEN];
OutlineElement *oe = NULL;
FILE * fp;
int n;
int n, len, slen;
Atom FILE_NAME = XInternAtom(XtDisplay(w), XmSFILE_NAME, False);
Atom TARGETS = XInternAtom(XtDisplay(w), XmSTARGETS, False);
@ -904,8 +908,12 @@ OutlineListView::printConvertCallback(WCallback *wcb)
( S_IRUSR|S_IRGRP|S_IWUSR|S_IWGRP),
&fp);
#else
strcpy(filepath, getenv("HOME"));
strcat(filepath, "/.dt/tmp/file.itp");
len = MIN(strlen(getenv("HOME")), MAXPATHLEN - 1);
*((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
// print on on debug
@ -919,7 +927,7 @@ OutlineListView::printConvertCallback(WCallback *wcb)
// 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) ;
TOC_Element *te = (TOC_Element *)oe;
@ -966,7 +974,6 @@ void
OutlineListView::select (WCallback *wcb)
{
XmListCallbackStruct *lcs = (XmListCallbackStruct *) wcb->CallData();
XmStringTable items = Items();
OutlineElement *oe = NULL;
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 (" # = %d\n", SelectedItemCount());
#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]));
oe = item_at(lcs->selected_item_positions[i] - 1) ;
@ -1079,7 +1086,6 @@ void
OutlineListView::activate (WCallback *wcb)
{
XmListCallbackStruct *lcs = (XmListCallbackStruct *) wcb->CallData();
XmStringTable items = Items();
OutlineElement *oe;
int expanded = False;
@ -1263,7 +1269,7 @@ void
OutlineListView::update_highlighting_recursive (OutlineList *list,
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.
if (OUTLINE_ELEMENT(i)->is_selected (f_data_handle))
@ -1346,12 +1352,13 @@ void
OutlineListView::track_to (OutlineElement *oe, u_int position, char icon)
{
// Remove the old tracking icon, if any set.
if (f_tracking_position > 0)
if (f_tracking_position > 0) {
if (window_system().nofonts())
set_track_icon (f_tracking_element, f_tracking_position, ' ');
else
set_track_icon (f_tracking_element, f_tracking_position,
OLIAS_PLACEHOLDER_ICON);
}
// Set the new tracking icon.
set_track_icon (oe, position, icon);
@ -1363,12 +1370,13 @@ OutlineListView::track_to (OutlineElement *oe, u_int position, char icon)
void
OutlineListView::untrack()
{
if (f_tracking_position > 0)
if (f_tracking_position > 0) {
if (window_system().nofonts())
set_track_icon (f_tracking_element, f_tracking_position, ' ');
else
set_track_icon (f_tracking_element, f_tracking_position,
OLIAS_PLACEHOLDER_ICON);
}
f_tracking_position = 0;
}
@ -1382,8 +1390,6 @@ OutlineListView::set_track_icon (OutlineElement *oe, u_int position, char icon)
{
xmstring (oe, 1, icon);
XmStringTable items = Items();
// Tell the list about the change
XmString item = (XmString) oe->xm_string();
bool selected = PosSelected (position);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -51,7 +51,7 @@ class ScopeMenu : public WWL,
{
public:
ScopeMenu (Widget option_menu, bool requires_current_section = FALSE);
~ScopeMenu();
virtual ~ScopeMenu();
UAS_SearchScope *current_scope()
{ return (f_current_scope); }
@ -67,8 +67,8 @@ private:
void receive (UpdateMenu &, void *client_data);
private:
Widget f_option_menu;
Widget f_pull_menu;
UAS_SearchScope *f_current_scope;
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;
char buf[8];
sprintf(buf, "%d", rid.ndocs());
snprintf(buf, sizeof(buf), "%d", rid.ndocs());
WXmString matchString = buf;
UAS_Pointer<UAS_SearchResults> results = rid.results();

View file

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

View file

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

View file

@ -125,17 +125,19 @@ private: // functions
private: // variables
SearchScopeList f_scope_list;
UAS_SearchScope *f_current_scope;
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;
WXmPushButton f_unnamed;
OutlineListView *f_infolib_list;
OutlineListView *f_component_list;
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
SimpleBuffer::write (char *new_data)
{
int slen, len = 0;
int new_len = 0;
if (f_data)
new_len = strlen (f_data);
len = new_len = strlen (f_data);
new_len += strlen (new_data);
// manual realloc
char *new_buf = new char [new_len + 1];
if (f_data)
(void) strcpy (new_buf, f_data);
*((char *) memcpy(new_buf, f_data, len) + len) = '\0';
else
*new_buf = 0;
delete [] f_data;
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 *
@ -159,7 +162,7 @@ SearchScopeList::save()
buffer.reset();
// 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));
// get the list of bookcases for the current scope
@ -187,9 +190,9 @@ SearchScopeList::save()
const char *name = bce->name();
const char *bid = bce->bid();
if (bc > 0)
sprintf (scratch, "&%s(%s)", bid, name);
snprintf (scratch, sizeof(scratch), "&%s(%s)", bid, name);
else
sprintf (scratch, "%s(%s)", bid, name);
snprintf (scratch, sizeof(scratch), "%s(%s)", bid, name);
buffer.write(scratch, sizeof (char), strlen(scratch));
if(env().debug())
@ -204,7 +207,7 @@ SearchScopeList::save()
{
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));
}
if(env().debug())
@ -214,7 +217,7 @@ SearchScopeList::save()
buffer.write ("\0", sizeof (char), 1);
// Get the right preference object.
sprintf (scratch, "Scope.%s", scope->name());
snprintf (scratch, sizeof(scratch), "Scope.%s", scope->name());
StringPref store (scratch);
// Update its value.
@ -278,9 +281,7 @@ SearchScopeList::save()
void
SearchScopeList::restore()
{
char scratch[1024];
char basename[256];
int i;
unsigned int i;
UAS_SearchScope *s;
// get the list of bookcase names
@ -352,13 +353,13 @@ SearchScopeList::create_named_scopes()
}
// 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;
// Get the specified scope from preferences.
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);
// Grab the component mask.
@ -389,7 +390,7 @@ SearchScopeList::create_named_scopes()
// loop once for each bookcase in search scope. create a
// bookcase entry for each valid bookcase. if bookcase
// 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_List<UAS_String>bc_list = str.splitFields (',');
@ -410,14 +411,13 @@ SearchScopeList::create_named_scopes()
UAS_String sn = *(UAS_String*)scope_names[sname];
if(is_scope_valid)
{
UAS_SearchScope *s = f_search_scope_agent->create_scope (
sn, bookcase_list, mask, False);
f_search_scope_agent->create_scope (sn, bookcase_list, mask, False);
}
else
{
// rtp - 4/24/95 : otherwise store its name for use later;
// see SearchScopeList::save routine above
sprintf(scratch, "%s%s", (char*)sn, ",");
snprintf(scratch, sizeof(scratch), "%s%s", (char*)sn, ",");
f_buffer->write (scratch);
}
// reset list for next turn
@ -433,10 +433,10 @@ SearchScopeList::validate_bookcase(UAS_String &bid)
// validate bookcase id
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();
for (int j = 0; j < kids.length(); j++)
for (unsigned int j = 0; j < kids.length(); j++)
{
if(kids[j]->bid() == bid)
{
@ -483,7 +483,7 @@ SearchScopeList::create_bcase_entry(UAS_List<UAS_String> &bc_list)
int book_num;
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];
if(sscanf ((char*)abook, "%d", &book_num) == 1)

View file

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

View file

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

View file

@ -60,8 +60,9 @@ class PoolString : public FolioObject
public: // functions
PoolString (const char *string)
{
f_string = new char[strlen(string) + 1];
strcpy (f_string, string);
int len = strlen(string);
f_string = new char[len + 1];
*((char *) memcpy(f_string, string, len) + len) = '\0';
}
~PoolString ()
@ -81,7 +82,7 @@ public: // variables
Atomizer::Atomizer (const char *string)
{
// 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++)
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 ] ;
// 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 ;
}
// 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_use = new unsigned long [word + 1];
int i;
unsigned int i;
for (i = 0 ; i < f_num_words ; i++)
{
// copy old info
@ -146,7 +146,7 @@ BitField::get_handle()
// find first free bit
// first find first free word
int word;
unsigned int word;
for (word = 0 ; word < f_num_words ; word++ )
if ( word_has_zero_bit(f_bits_in_use[word]) )
break;

View file

@ -145,7 +145,7 @@ Buffer::write (const int integer)
// Convert bytes from native to MSB first ordering.
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)
g_intbuf[g_byte_pos[i]-1] = inbuf[i];
@ -158,7 +158,7 @@ Buffer::read (int *integer)
*integer = 0;
// 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)
((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));
int num_bytes = size * length;
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 ("\n"));
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));
assert (f_point + num_bytes <= f_end_of_data);
*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 ("\n"));
f_point += num_bytes;

View file

@ -57,13 +57,14 @@
extern "C"
{
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)
{
f_string = new char[ strlen (string) + 1 ] ;
strcpy(f_string, string);
int len = strlen(string);
f_string = new char[ len + 1 ] ;
*((char *) memcpy(f_string, string, len) + len) = '\0';
}
FString::~FString()

View file

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

View file

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

View file

@ -182,7 +182,7 @@ HashTbl::remove (const Hashable &element)
void
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 (delete_elements)

View file

@ -194,7 +194,7 @@ List::insert (unsigned int location, FolioObject *element)
abort();
// 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];
// 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
List *retlist = new List(length());
for (int i = 0 ; i < length(); i++)
for (unsigned int i = 0 ; i < length(); i++)
retlist->append((*this)[i]);
return retlist ;

View file

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

View file

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

View file

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

View file

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

View file

@ -117,7 +117,6 @@ protected: // functions
protected: // variables
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_expanded ;
@ -130,6 +129,7 @@ protected: // variables
u_int f_string_creator;
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
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))
OUTLINE_ELEMENT(i)->set_selected(dest) ;
@ -119,7 +119,7 @@ OutlineList::copy_selected(BitHandle src, BitHandle dest)
void
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))
OUTLINE_ELEMENT(i)->set_expanded (dest);
@ -140,7 +140,7 @@ OutlineList::copy_expanded (BitHandle src, BitHandle dest)
void
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() &&
OUTLINE_ELEMENT(i)->has_children())
{
@ -159,7 +159,7 @@ OutlineList::recursive_select(BitHandle data_handle)
void
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);
if (OUTLINE_ELEMENT(i)->children_cached() &&
@ -177,7 +177,7 @@ OutlineList::select_all(BitHandle data_handle)
void
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);
if (OUTLINE_ELEMENT(i)->children_cached() &&
@ -231,7 +231,7 @@ OutlineList::selected_items (BitHandle data_handle, List *l)
if (l == NULL)
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))
l->append (OUTLINE_ELEMENT(i));

View file

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

View file

@ -113,8 +113,9 @@ PText::PText (PNode *parent, PNode *previous, PNode *next, char *str)
else
f_symbol_space = f_symbol_len;
f_symbol = (char *) malloc (sizeof(char) * (f_symbol_space + 1));
strcpy (f_symbol, str);
int len = sizeof(char) * f_symbol_space;
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 char c;
for (pos = 0; c = *key++; pos++)
sum = (sum << 5) + (sum >> (sizeof(int) * 8 - 6)) + (c ^ lookup_table[c]);
for (pos = 0; (c = *key++); pos++)
sum = (sum << 5) + (sum >> (sizeof(int) * 8 - 6))
+ (c ^ lookup_table[(int)c]);
// was:
// 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_height (height),
f_flag (flag),
f_agent(0),
f_colormap(0),
f_num_colors(0),
f_colors(NULL),
f_tiff_context(NULL),
f_agent(0)
f_tiff_context(NULL)
{
}

View file

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

View file

@ -44,6 +44,8 @@ CatMgr* CatMgr::f_msg_catalog_mgr = NULL;
CatMgr::CatMgr() : f_msg(NULL), f_default(NULL)
{
int len;
#ifdef DEBUG
char* nlspath = getenv("NLSPATH");
if (nlspath)
@ -61,8 +63,9 @@ CatMgr::CatMgr() : f_msg(NULL), f_default(NULL)
#endif
char* msg = ::catgets(f_catd, Set_CatMgr, DEFAULT_MSG,
"default message not found.");
f_default = new char[strlen(msg) + 1];
strcpy(f_default, msg);
len = strlen(msg);
f_default = new char[len + 1];
*((char *) memcpy(f_default, msg, len) + len) = '\0';
}
else {
#ifdef DEBUG
@ -71,8 +74,9 @@ CatMgr::CatMgr() : f_msg(NULL), f_default(NULL)
#else
static char* cat_not_found = (char*)"";
#endif
f_default = new char[strlen(cat_not_found) + 1];
strcpy(f_default, cat_not_found);
len = strlen(cat_not_found);
f_default = new char[len + 1];
*((char *) memcpy(f_default, cat_not_found, len) + len) = '\0';
}
#ifdef DEBUG
cerr << "(DEBUG) default msg=" << f_default << '\n' << flush;
@ -91,15 +95,17 @@ CatMgr::~CatMgr()
if (is_open(f_catd)) {
int status = catclose(f_catd);
#ifdef DEBUG
if (status < 0) {
#ifdef DEBUG
cerr << "(ERROR) catclose failed." << '\n' << flush;
abort();
#endif
}
else {
#ifdef DEBUG
cerr << "(DEBUG) catclose succeeded" << '\n' << flush;
}
#endif
}
}
#ifdef DEBUG
else {
@ -111,6 +117,8 @@ CatMgr::~CatMgr()
char*
CatMgr::catgets(int set_num, int msg_num, const char* def)
{
int len;
if (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++);
#endif
int msglen = strlen(msg);
len = msglen;
f_msg = new char[msglen + 1];
#if defined(UXPDS) && defined(GENCAT_BUG)
#ifdef DEBUG
@ -144,16 +153,18 @@ CatMgr::catgets(int set_num, int msg_num, const char* def)
msglen--;
}
#endif
strcpy(f_msg, msg);
*((char *) memcpy(f_msg, msg, len) + len) = '\0';
}
else {
if (def) {
f_msg = new char[strlen(def) + 1];
strcpy(f_msg, def);
len = strlen(def);
f_msg = new char[len + 1];
*((char *) memcpy(f_msg, def, len) + len) = '\0';
}
else {
f_msg =new char[strlen(f_default) + 1];
strcpy(f_msg, f_default);
len = strlen(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 "Prelude.h"
#include "utility/funcs.h"
#undef debug
LONG_LIVED_CC(EnvMgr, env);
@ -87,8 +89,8 @@ bool g_debug;
#define SLSEP ','
EnvMgr::EnvMgr() : f_argv(NULL),
f_argc(0),
EnvMgr::EnvMgr() : f_argc(0),
f_argv(NULL),
f_lang(NULL),
f_secondary(False),
f_verbose(False),
@ -116,7 +118,7 @@ EnvMgr::EnvMgr() : f_argv(NULL),
#ifdef LCX_DEBUG
fprintf(stderr, "(DEBUG) standard locale=\"%s\"\n", std_locale);
#endif
f_lang = XtNewString(std_locale);
f_lang = XtsNewString(std_locale);
free(std_locale);
}
}
@ -127,18 +129,18 @@ EnvMgr::EnvMgr() : f_argv(NULL),
// If OpToStd conversion failed, use non-std name
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
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);
f_home = XtNewString( getenv("HOME") );
f_home = XtsNewString( getenv("HOME") );
char dirname[256];
sprintf (dirname, "%s/.dt/dtinfo/%s", f_home, f_lang);
f_user_path = XtNewString(dirname);
snprintf (dirname, sizeof(dirname), "%s/.dt/dtinfo/%s", f_home, f_lang);
f_user_path = XtsNewString(dirname);
// if $HOME/.dt/dtinfo/$LANG does not exist, create it,
@ -146,7 +148,7 @@ EnvMgr::EnvMgr() : f_argv(NULL),
if(!check_user_path())
{
create_user_path();
help_agent().display_help ((char*)"doc_list_help");
// help_agent().display_help ((char*)"doc_list_help");
}
UAS_Collection::request(
@ -218,14 +220,15 @@ EnvMgr::init(int argc_i, char** argv_i)
{
// link up indirect paths to mmdb code... ;-)
static char buffer[256];
sprintf (buffer, "MMDB_PATH=%s", (char *)f_infolibsStr );
snprintf (buffer, sizeof(buffer), "MMDB_PATH=%s", (char *)f_infolibsStr );
putenv (buffer);
char *where = getenv ("DTINFO_MARKSPECPATH");
if (where == NULL)
{
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);
}
}
@ -868,21 +871,21 @@ EnvMgr::arglist()
f_argv = (char **)XtMalloc( p_argc*sizeof(char *) ) ;
int ia = 0 ;
f_argv[ia++] = XtNewString( "dtinfo" ) ;
f_argv[ia++] = XtsNewString( "dtinfo" ) ;
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()) ;
f_argv[ia++] = XtNewString( tmp ) ;
f_argv[ia++] = XtsNewString( tmp ) ;
// always insert the -sect key and its arg, even if the arg
// 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
f_argv[ia++] = XtNewString( tmp ) ;
f_argv[ia++] = XtsNewString( tmp ) ;
f_argc = p_argc ;
}
@ -897,14 +900,14 @@ EnvMgr::arglist()
{
XtFree( f_argv[++i] ) ;
tmp = (char *)(infolibsArg()) ;
f_argv[i] = XtNewString( tmp ) ;
f_argv[i] = XtsNewString( tmp ) ;
il = i ;
}
else if( strcmp(f_argv[i], "-sect") == 0 )
{
XtFree( f_argv[++i] ) ;
tmp = (char *)(sectionsArg()) ;
f_argv[i] = XtNewString( tmp ) ;
f_argv[i] = XtsNewString( tmp ) ;
is = i ;
}
}
@ -931,7 +934,8 @@ EnvMgr::mkdirs(char *pathname)
{
char buffer[256];
char *c;
strcpy(buffer, pathname);
int len = MIN(strlen(pathname), 256 - 1);
*((char *) memcpy(buffer, pathname, len) + len) = '\0';
if(mkdir(buffer, 0777) == -1)
{

View file

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

View file

@ -182,9 +182,9 @@ class Graphic: public UAS_Base {
GraphicAgent *get_agent() { return fagent; }
private:
unsigned int fDetached;
PixmapGraphic * fPixmap;
PixmapGraphic * fDetachedPixmap;
unsigned int fDetached;
UAS_Pointer<UAS_EmbeddedObject> fObj;
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
// in our list.
//
int i;
unsigned int i;
for (i = 0; i < fObjList.length(); i ++)
{
if (fObjList[i] == toc)
@ -309,7 +309,7 @@ LibraryMgr::undisplay (OutlineElement *root) {
UAS_Pointer<UAS_Common> rootDoc = ((TOC_Element *) root)->toc();
if (rootDoc->type() != UAS_LIBRARY)
throw (CASTEXCEPT Exception());
int i;
unsigned int i;
for (i = 0; i < fObjList.length(); i ++) {
if (fObjList[i] == rootDoc) {
break;
@ -328,7 +328,7 @@ LibraryMgr::remove (UAS_Pointer<UAS_Common> lib) {
for (; l; l++) {
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) {
fObjList.remove_item(i);
break;
@ -416,7 +416,7 @@ LibraryMgr::library()
void
LibraryMgr::init(UAS_List<UAS_String> &infolibpaths)
{
int i;
unsigned int i;
UAS_Common::initialize(infolibpaths);
@ -450,7 +450,7 @@ LibraryMgr::init(UAS_List<UAS_String> &infolibpaths)
bool
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)
return True;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -129,7 +129,7 @@ void
StyleSheetMgr::initOnlineStyleSheet (UAS_Pointer<UAS_Common> &doc) {
UAS_List<UAS_StyleSheet> ssList = doc->style_sheet_list ();
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) {
onlineSS = ssList[i];
break;
@ -187,7 +187,7 @@ void
StyleSheetMgr::initPrintStyleSheet (UAS_Pointer<UAS_Common> &doc) {
UAS_List<UAS_StyleSheet> ssList = doc->style_sheet_list ();
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) {
printSS = ssList[i];
break;

View file

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

View file

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

View file

@ -240,15 +240,14 @@ Mark_mmdb::restore()
end_try;
// 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 ***"));
throw (CASTEXCEPT Exception());
}
// Suck the data out of the mmdb mark object.
g_buffer.reset();
g_buffer.write (f_user_mark->mark_value()->get(), sizeof (char),
f_user_mark->mark_value()->size());
g_buffer.write (str, sizeof (char), sz);
// Read the fields out of the buffer.
int mark_version;

View file

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

View file

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

View file

@ -347,7 +347,7 @@ class PartialElementFeatures
public:
PartialElementFeatures(CanvasRenderer *);
PartialElementFeatures (PartialElementFeatures &);
~PartialElementFeatures();
virtual ~PartialElementFeatures();
virtual int requires_container(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 *weight_str = weight;
const char *slant_str = slant;
const char *setwidth_name_str = "*";
const char *style_str = "*";
int point_size = size;
const char *spacing_str = "*";
@ -378,8 +377,9 @@ pattern_done:
char pattern[256];
// -dt-application-medium-r-normal-sans-8-80-75-75-p-46-iso8859-1
sprintf (
snprintf (
pattern,
sizeof(pattern),
"-%s-%s-%s-%s-normal-%s-*-%d-*-*-%s-*-%s",
foundry_str ? foundry_str : "*",
family_str ? family_str : "*",
@ -417,8 +417,9 @@ pattern_done:
printf("point size = %d.\n", point_size);
#endif
sprintf (
snprintf (
pattern,
sizeof(pattern),
"-%s-%s-%s-%s-normal-%s-*-%d-*-*-%s-*-%s",
foundry_str ? foundry_str : "*",
family_str ? family_str : "*",
@ -462,11 +463,12 @@ pattern_done:
char*
CanvasRenderer::_dofont(const FeatureSet &fs, Symbol** symbols)
{
int len, slen;
const char *fallback = NULL;
const Feature *fallbackF = fs.lookup(symbols[FALLBACK]);
if (fallbackF) {
if (fallback = *fallbackF->value()) {
if ((fallback = *fallbackF->value())) {
if (strcasecmp(fallback, "sans") == 0)
fallback = f_sans ;
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 *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
//const Feature *spacingF = fs.lookup(symbols[SPACING]);
const char* font;
char* xlfd = NULL;
int i;
unsigned int i;
for (i = 0; i < fs.entries(); i++) {
Feature* entry;
@ -525,10 +530,12 @@ CanvasRenderer::_dofont(const FeatureSet &fs, Symbol** symbols)
continue;
}
#ifdef JBM_FONT_DEBUG
const Feature* foundryF = familyFS->lookup(symbols[FOUNDRY]);
if (foundryF) {
foundry = *foundryF->value();
}
#endif
const Feature* charsetF = familyFS->lookup(symbols[CHARSET]);
if (charsetF)
charset = *charsetF->value();
@ -566,9 +573,11 @@ CanvasRenderer::_dofont(const FeatureSet &fs, Symbol** symbols)
// if xlfd already defined, create a font list
if (xlfd) {
xlfd = (char*)realloc(xlfd, strlen(xlfd) + strlen(font) + 3);
strcat(xlfd, ",");
strcat(xlfd, font);
slen = strlen(xlfd);
len = strlen(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
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
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
if (*p == ',')
{
int len = p - family ;
len = p - family ;
fallback = new char[len + 1] ;
strncpy(fallback, family, len);
fallback[len] = 0 ;
*((char *) memcpy(fallback, family, len) + len) = '\0';
do p++; while (isspace(*p));
family = p ;

View file

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

View file

@ -33,7 +33,7 @@ dfiles:
#ifdef UXPArchitecture
SpecialCPlusPlusObjectRule(ORTemplates.o,, +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)
SpecialCPlusPlusExpandRule(ORTemplates..c,ORTemplates.C,-DEXPAND_TEMPLATES)
#endif

View file

@ -225,8 +225,8 @@ class Shell_Info {
public:
Shell_Info (Widget w)
: f_shell (w),
f_restore (False),
f_size_hints (NULL)
f_size_hints (NULL),
f_restore (False)
{ }
public:
@ -244,12 +244,12 @@ public:
// /////////////////////////////////////////////////////////////////
WindowSystem::WindowSystem (int &argc, char *argv[])
: f_shell_list (20),
: f_printing(False),
f_default_pixmap (0),
f_defpix_width (0),
f_defpix_height (0),
f_printing(False),
f_detached_pixmap(0),
f_shell_list (20),
f_cursor_stack_pos(-1),
f_dtinfo_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. */
WidgetClass xxx = xmScaleWidgetClass;
/* WidgetClass xxx = xmScaleWidgetClass; */
int count;
char **names = XListFonts(window_system().display(),
@ -540,9 +540,6 @@ xevent_error_aborter(Display *display, XErrorEvent* error_event)
void
WindowSystem::init()
{
Arg args[8];
int i = 0;
XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL);
_DtEnvControl(DT_ENV_SET);
@ -872,7 +869,7 @@ WindowSystem::set_cursor (Cursor cursor, Widget exception)
{
Widget shell;
// 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;
if (shell != exception && XtWindow (shell) != 0)
@ -904,14 +901,14 @@ WindowSystem::reset_cursor (WCallback *wcb)
Widget shell;
Widget exception = wcb ? wcb->GetWidget() : NULL;
f_cursor_stack_pos--;
Cursor cursor;
Cursor cursor = 0;
if (f_cursor_stack_pos >= 0)
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;
if (shell != exception && XtWindow (shell) != 0)
if (shell != exception && XtWindow (shell) != 0) {
// Reset the previous cursor if there's one on the stack, revert
// to default cursor if the stack is empty.
// printf ("Resetting cursor on %s\n", XtName(shell));
@ -920,6 +917,7 @@ WindowSystem::reset_cursor (WCallback *wcb)
XDefineCursor (f_display, XtWindow (shell), cursor);
else
XUndefineCursor (f_display, XtWindow (shell));
}
}
XFlush (f_display);
}
@ -957,10 +955,11 @@ WindowSystem::create_cursor (const char *filename)
Cursor cursor;
Pixmap cursor_bits, cursor_mask;
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 };
int hot_x, hot_y;
int depth;
int depth, len;
Boolean success;
// Get the cursor pixmap.
@ -978,12 +977,15 @@ WindowSystem::create_cursor (const char *filename)
&hot_x, &hot_y, //
0, 0); // width, height
assert (success);
if(!success) {
assert (success);
}
// Get the cursor mask pixmap.
char *mask_filename = new char [strlen(filename) + 2];
strcpy (mask_filename, filename);
strcat (mask_filename, "m");
len = strlen(filename);
char *mask_filename = new char [len + 2];
*((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);
if (cursor_mask == XmUNSPECIFIED_PIXMAP)
{
@ -1098,11 +1100,10 @@ WindowSystem::default_pixmap (Dimension *width, Dimension *height)
temp_width = default_width;
temp_height = default_height;
#else
int status ;
XpmAttributes xpm_attr ;
xpm_attr.valuemask = 0 ;
status = XmeXpmCreatePixmapFromData(f_display,
XmeXpmCreatePixmapFromData(f_display,
XtWindow((Widget)toplevel()),
(char**)graphic_unavailable_data,
&temp_pixmap,
@ -1197,7 +1198,8 @@ WindowSystem::read_pixmap(const char *pname,
xpm_attributes.valuemask = 0;
strcpy(fname, pname);
int len = MIN(strlen(pname), 255 - 1);
*((char *) memcpy(fname, pname, len) + len) = '\0';
#ifdef UseDlOpen
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);
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);
}
@ -1499,7 +1502,7 @@ WindowSystem::show_all_windows()
Shell_Info *si;
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];
if (si->f_restore)

View file

@ -80,13 +80,14 @@
#define _VROOT_H_
#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
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#if 0
static Window
VirtualRootWindowOfScreen(Screen *screen)
{
@ -97,7 +98,7 @@ VirtualRootWindowOfScreen(Screen *screen)
{
Display *dpy = DisplayOfScreen(screen);
Atom __SWM_VROOT = None;
int i;
unsigned int i;
Window rootReturn, parentReturn, *children;
unsigned int numChildren;
@ -139,6 +140,7 @@ VirtualRootWindowOfScreen(Screen *screen)
return (root);
}
#endif
/* Need original macros to figure out if there is a virtual root. */

View file

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

View file

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

View file

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

View file

@ -63,7 +63,7 @@
void
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);
set_value (g_buffer);
}

View file

@ -102,9 +102,9 @@ QueryEditor *QueryEditor::f_query_editor;
// /////////////////////////////////////////////////////////////////
QueryEditor::QueryEditor(UAS_SearchEngine& search_engine)
: f_shell (NULL),
f_query (NULL),
: f_query (NULL),
f_query_view (NULL),
f_shell (NULL),
f_null_terms (0)
{
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\"" };
#endif
#if 0
static const char *infix_pformats[] =
{ "", "(%s or %s%)", "(%s xor %s%)", "(%s and %s)",
"(%s near %s%%s)", "(%s before %s%%s)", // %%s is loc to insert proximity
" within %s", // proximity string to insert
"%%s weight %s", "%s scope %s", "not %s", "%s*", "\"%s\"" };
#endif
// Order of these correspond to query_type_t enum in QueryGroup.hh
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];
// 48 is enough space to handle phrase, not, weight, and completion.
int n = 48 + strlen (term->term_string());
int buflen = n;
buf[0] = (char *) malloc (n);
buf[1] = (char *) malloc (n);
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){
char * p = buf [n++ % 2];
sprintf (p, formats[query_type][OPT_COMPLETE], s);
snprintf (p, buflen, formats[query_type][OPT_COMPLETE], s);
s = p;
}
// 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
if (*cp != '\0') {
char *p = buf [n++ % 2];
sprintf (p, infix_formats[OPT_PHRASE], s);
snprintf (p, buflen, infix_formats[OPT_PHRASE], s);
s = p; /// alternating
}
if (term->prefix() & QueryTerm::PFX_NOT_BITS)
{
char *p = buf [n++ % 2];
sprintf (p, formats[query_type][OPT_NOT], s);
snprintf (p, buflen, formats[query_type][OPT_NOT], s);
s = p;
}
#else
@ -423,13 +427,13 @@ QueryGroup::format (query_type_t query_type, QueryTerm *term)
if (TRUE || *t != '\0')
{
char *p = buf [n++ % 2];
sprintf (p, formats[query_type][OPT_PHRASE], s);
snprintf (p, buflen, formats[query_type][OPT_PHRASE], s);
s = p;
}
if (term->prefix() & QueryTerm::PFX_NOT_BITS)
{
char *p = buf [n++ % 2];
sprintf (p, formats[query_type][OPT_NOT], s);
snprintf (p, buflen, formats[query_type][OPT_NOT], s);
s = p;
}
#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.
char *p = buf [n++ % 2];
sprintf (p, formats[query_type][OPT_WEIGHT], s);
snprintf (p, buflen, formats[query_type][OPT_WEIGHT], s);
s = p;
p = buf [n++ % 2];
sprintf (p, s, term->weight());
snprintf (p, buflen, s, term->weight());
s = p;
}
@ -457,7 +461,7 @@ QueryGroup::format (query_type_t query_type, QueryTerm *term)
{
char *p = buf [n % 2];
sprintf (p, s, term->term_string());
snprintf (p, buflen, s, term->term_string());
s = p;
}
// 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;
int fmt_length = strlen (formats[query_type][opt]) +
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.
if (opt == C_NEAR || opt == C_BEFORE)
{
char *b2 = (char *) malloc (fmt_length + opsize + 1);
sprintf (b2, buf, formats[query_type][OPT_PROXIMITY]);
sprintf (buf, b2, proximity);
char *b2 = (char *) malloc (buflen);
snprintf (b2, buflen, buf, formats[query_type][OPT_PROXIMITY]);
snprintf (buf, buflen, b2, proximity);
free (b2);
}

View file

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

View file

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

View file

@ -327,8 +327,7 @@ QueryTermView::create_ui()
void
QueryTermView::select_toggle (WCallback *wcb)
{
XmToggleButtonCallbackStruct *tbcs =
(XmToggleButtonCallbackStruct *) wcb->CallData();
(XmToggleButtonCallbackStruct *) wcb->CallData();
// notify someone about selection state...
invert_colors();
@ -716,7 +715,7 @@ QueryTermView::weight_changed()
cursor_pos = w = 0;
else
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.SetInsertionPosition(cursor_pos);
}

View file

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

View file

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

View file

@ -54,7 +54,10 @@ UAS_BookcaseEntry::UAS_BookcaseEntry(UAS_Pointer<UAS_Common> &bookcase,
f_name(0),
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) {
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);
f_name = new char[strlen(bc_name)+1];
strcpy(f_name, bc_name);
len = strlen(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];
strcpy (f_path, bc_path);
len = strlen(bc_path);
f_path = new char[len + 1];
*((char *) memcpy(f_path, bc_path, len) + len) = '\0';
}
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_bookcase_id; // bookcase id
UAS_String f_bookcase_name;// infolib name where bookcase resides
};
#endif

View file

@ -23,6 +23,7 @@
// $XConsortium: UAS_Buffer.cc /main/3 1996/06/11 16:36:44 cde-hal $
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include "UAS_Buffer.hh"
// 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.
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)
g_intbuf[g_byte_pos[i]-1] = inbuf[i];
@ -131,7 +132,7 @@ UAS_Buffer::read (int *integer)
*integer = 0;
// 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)
((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;
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);
f_point += num_bytes;
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;
*bytes = f_point;
for (int i = 0; i < size * length; i++)
for (unsigned int i = 0; i < size * length; i++)
f_point += num_bytes;
}

View file

@ -245,7 +245,7 @@ UAS_Common::subtree_size()
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))
tree_size += kids[i]->subtree_size();
}

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