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))
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))
if( !f_file_sel )
{
Arg args[20];
+ unsigned int len, slen;
int n;
XmString title_str = XmStringCreateLocalized(
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;
WXmForm f_form;
WXmPushButton f_ok;
WXmPushButton f_clr;
- Widget f_file_sel;
bool f_done;
bool f_cancelled;
+ Widget f_file_sel;
};
/* -------- 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;
}
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);
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,
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();
}
{
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);
(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))
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)
else
scale_factor =
(100 * porthole.Height()) / f_graphic->pixmap_graphic()->height();
+#endif
wscale = (100 * porthole.Width()) / gr_width;
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 ;
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);
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
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;
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;
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.
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
#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);
*CATGETS(Set_AgentLabel, 258, ""),
NULL);
- sep = XtCreateManagedWidget("sep", xmSeparatorGadgetClass,
+ XtCreateManagedWidget("sep", xmSeparatorGadgetClass,
helpM, 0, 0);
on_tasks = XtCreateManagedWidget("on_tasks", xmPushButtonGadgetClass,
helpM, 0, 0);
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);
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);
void
LibraryAgent::text_callback(WCallback *wcb)
{
+#if 0
XmAnyCallbackStruct *cbs = (XmAnyCallbackStruct*)wcb->CallData();
+#endif
char *text = XmTextGetString(wcb->GetWidget());
if (*text != '\0')
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);
LibraryAgent::add_library(char* newLib, Widget parent)
{
int sts = ID_SUCCESS ;
+ int bufferlen;
if( (newLib == NULL) ||
((newLib != NULL) && ( *newLib == '\0' )) )
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;
}
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;
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;
{
// 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)
{
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());
}
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());
}
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;
}
}
// 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];
// 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.
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);
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) {
//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);
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))
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();
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;
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;
(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);
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)
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;
public:
MapButton (WComposite &parent, const UAS_Pointer<UAS_Common> &doc_ptr,
MapButton *ancestor);
+ virtual ~MapButton() {}
void activate();
void 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();
public:
MarkCanvas (UAS_Pointer<Mark>, Agent *agent,
unsigned int offset, unsigned int ypos);
- ~MarkCanvas();
+ virtual ~MarkCanvas();
STATIC_SENDER_HH (MarkSelectionChanged);
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 ;
WTimeOut *g_timeout;
-static void register_actions();
-
// /////////////////////////////////////////////////////////////////
// class constructor
public:
MarkIcon (Widget parent, Widget chooser_parent,
MarkCanvas *, int ypos, int scrollbar_offset);
- ~MarkIcon();
+ virtual ~MarkIcon();
void append (MarkCanvas *);
void insert (MarkCanvas *);
{
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;
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;
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;
public:
MarkListView();
- ~MarkListView();
+ virtual ~MarkListView();
void display();
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());
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();
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));
NodeHistoryAgent()
: f_shell (NULL), f_selected_item (0)
{ }
- ~NodeHistoryAgent();
+ virtual ~NodeHistoryAgent();
void display();
private: // functions
#include "Registration.hh"
// for DtCanvas Help stuff
+#include <DtI/Access.h>
#include <DtI/XUICreateI.h>
#include <DtI/SetListI.h>
#include <DtI/CallbacksI.h>
// 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++;
// ui
if ((f_help_dsp_area == NULL) || (gHelpDisplayArea == 0)) {
- DtHelpDispAreaStruct *displayArea = create_ui(f_print_shell);
+ create_ui(f_print_shell);
first_time = TRUE;
}
// 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++;
#include "Registration.hh"
// for DtCanvas Help stuff
+#include <DtI/Access.h>
#include <DtI/XUICreateI.h>
#include <DtI/SetListI.h>
#include <DtI/CallbacksI.h>
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;
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));
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
// /////////////////////////////////////////////////////////////////
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);
{
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 ;
void
NodeWindowAgent::text_callback(WCallback *wcb)
{
- XmAnyCallbackStruct *cbs = (XmAnyCallbackStruct*)wcb->CallData();
+ (XmAnyCallbackStruct*)wcb->CallData();
char *text = XmTextGetString(wcb->GetWidget());
if (text == NULL)
return;
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);
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;
unsigned int length = 0;
unsigned int offset = 0;
- int i;
+ unsigned int i;
for (i = 0; segs[i]; i++)
{
_DtCvSegPts* segpts = segs[i];
}
point_info.client_data = mark_to_show;
- _DtCvStatus status2 =
+
_DtCanvasActivatePts (f_help_dsp_area->canvas,
_DtCvACTIVATE_MARK_ON, // mask
&point_info, // info
//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);
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();
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);
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 << ' '
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];
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() ;
}
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;
}
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);
// 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
{
public:
GraphicsHandler(NodeWindowAgent *agent);
- ~GraphicsHandler();
+ virtual ~GraphicsHandler();
void receive(DetachGraphic &, void *client_data);
void receive(ReAttachGraphic &, void *client_data);
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 };
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) {
}
+#ifdef NotDefined
// /////////////////////////////////////////////////////////////////
// XmStringCreateComponent
// /////////////////////////////////////////////////////////////////
#endif
return (string);
}
+#endif
// /////////////////////////////////////////////////////////////////
#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);
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);
( 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
// 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;
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",
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) ;
OutlineListView::activate (WCallback *wcb)
{
XmListCallbackStruct *lcs = (XmListCallbackStruct *) wcb->CallData();
- XmStringTable items = Items();
OutlineElement *oe;
int expanded = False;
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))
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);
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;
}
{
xmstring (oe, 1, icon);
- XmStringTable items = Items();
-
// Tell the list about the change
XmString item = (XmString) oe->xm_string();
bool selected = PosSelected (position);
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;
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);
}
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);
}
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)
! 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
// 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));
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
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,
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,
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,
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) ||
// 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,
void
QuickPrintCB(Widget pr_button, XtPointer client_data, XtPointer call_data)
{
- char *msg;
-
RCS_DEBUG("QuickPrintCB called.\n");
AppPrintData *p = (AppPrintData*)client_data;
// 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;
XpStartPage(XtDisplay(pshell), XtWindow(pshell));
- sprintf(buf, "%d", *cur_pageP);
+ snprintf(buf, sizeof(buf), "%d", *cur_pageP);
label = XmStringCreateLocalized(buf);
n = 0;
// 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++)
{
RCS_DEBUG("PrintCloseDisplayCB called.\n");
- DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct*)call_data;
AppPrintData *p = (AppPrintData*)client_data;
if (p->f_print_shell)
{
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);
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
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;
}
void
ScopeMenu::set_scope (WCallback *wcb)
{
- CALL_DATA (XmToggleButtonCallbackStruct,tbcs);
-
f_current_scope =
(UAS_SearchScope *) WXmPushButtonGadget(wcb->GetWidget()).UserData();
}
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]))
// 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
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]);
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]) &&
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]);
{
public:
ScopeMenu (Widget option_menu, bool requires_current_section = FALSE);
- ~ScopeMenu();
+ virtual ~ScopeMenu();
UAS_SearchScope *current_scope()
{ return (f_current_scope); }
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;
};
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();
f_results = results;
- UAS_SearchEngine &se = search_mgr().search_engine();
+ // UAS_SearchEngine &se = search_mgr().search_engine();
// get window up quick
/* -------- 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);
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]);
} else {
// first get item that was selected
+#ifdef JBM
XmStringTable items = Items();
+#endif
XmListCallbackStruct *lcs = (XmListCallbackStruct *)wcb->CallData();
OutlineElement *oe ;
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)
{
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();
{
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();
{
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();
#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()));
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,
// 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();
// 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.
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();
// 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))
//
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))
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)
{
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)
{
// 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;
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]);
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);
{
// 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
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);
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
// 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
WidgetList kids;
Cardinal num_kids;
UAS_SearchScope* scope;
- UAS_SearchScope* current_scope=NULL;
n = 0;
XtSetArg(args[n], XmNnumChildren, &num_kids); n++;
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();
// 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]);
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();
// 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;
// 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);
#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
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;
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
private: // variables
+ WTopLevelShell f_shell;
SearchScopeList f_scope_list;
+
+ bool f_first_time;
+ bool f_auto_expand;
+ QueryEditor *f_option_menu;
+
UAS_SearchScope *f_current_scope;
- WTopLevelShell f_shell;
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;
};
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 *
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
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())
{
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())
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.
void
SearchScopeList::restore()
{
- char scratch[1024];
- char basename[256];
- int i;
+ unsigned int i;
UAS_SearchScope *s;
// get the list of bookcase names
}
// 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.
// 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 (',');
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
// 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)
{
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)
Boolean new_window )
{
int sts = ID_SUCCESS ;
+ int len, bufferlen;
if( (locator == NULL) ||
((locator != NULL) && ( *locator == '\0' )) )
// 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;
// (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();
}
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
UrlAgent::print_document(char *locator)
{
int sts = ID_SUCCESS ;
+ int bufferlen;
// set up for printing
AppPrintData* p = window_system().GetAppPrintData();
// 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;
// Constructors, Destructor
public:
UrlAgent ();
- ~UrlAgent ();
+ virtual ~UrlAgent ();
// Public Member Functions
public:
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 ()
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))
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
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
// 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;
// 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];
*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];
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);
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;
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()
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);
};
: f_next (next), f_dependent_obj (d)
{ }
void delete_dependent();
- Dependent *f_dependent_obj;
DependOnList *f_next;
+ Dependent *f_dependent_obj;
};
inline void
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()
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)
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.
// 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 ;
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
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;
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;
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);
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;
}
}
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());
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
int
OrderList::add(ListEntry *node, AddCode where, bool mvcursor)
{
- int status = OLIST_OK;
-
if (node != NULL) {
if (f_cursor == NULL)
insertNew(node);
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;
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 ;
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
};
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) ;
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);
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())
{
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() &&
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() &&
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));
{
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;
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';
}
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];
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)
{
}
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))
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
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
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
CatMgr::CatMgr() : f_msg(NULL), f_default(NULL)
{
+ int len;
+
#ifdef DEBUG
char* nlspath = getenv("NLSPATH");
if (nlspath)
#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
#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;
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 {
char*
CatMgr::catgets(int set_num, int msg_num, const char* def)
{
+ int len;
+
if (f_msg)
delete[] f_msg;
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
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';
}
}
#include "Managers/CatMgr.hh"
#include "Prelude.h"
+#include "utility/funcs.h"
+#undef debug
LONG_LIVED_CC(EnvMgr, env);
#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),
#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);
}
}
// 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,
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(
{
// 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);
}
}
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 ;
}
{
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 ;
}
}
{
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)
{
printf(
"Insufficient color cells for graphic. Retry with degraded colors.\n" );
#endif
- _DtGrLoadStatus status =
+ status =
_DtGrLoad(&gr_stream, // image
&image_type,
screen,
// 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);
GraphicAgent *get_agent() { return fagent; }
private:
- unsigned int fDetached;
PixmapGraphic * fPixmap;
PixmapGraphic * fDetachedPixmap;
+ unsigned int fDetached;
UAS_Pointer<UAS_EmbeddedObject> fObj;
GraphicAgent *fagent;
// 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)
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;
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;
void
LibraryMgr::init(UAS_List<UAS_String> &infolibpaths)
{
- int i;
+ unsigned int i;
UAS_Common::initialize(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;
}
{
// 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;
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') {
void
MessageMgr::show_it(Widget dialog)
{
- Widget parent, shell;
+ Widget parent = NULL;
+ Widget shell = NULL;
XtManageChild(dialog);
{
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\
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;
NodeViewInfo *
PrintMgr::load(UAS_Pointer<UAS_Common> &node_ptr)
{
- static int first = 0;
-
extern int styleparse();
extern void stylerestart(FILE *);
extern NodeViewInfo *gNodeViewInfo;
{
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]);
void
SearchMgr::display_message (SearchMessageType msg, int)
{
- char *msg_str;
-
switch( msg ){
case NO_HITS:
message_mgr().info_dialog (
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;
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;
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;
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.
// Skip over the defunct infobase name.
// NOTE: It should be removed from the olias api. DJB
- infobase = (char *) stream;
while (*stream != '\0')
stream++;
stream++;
}
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;
}
{
char *buffer = NULL;
char *locator;
+ int len, bufferlen;
UAS_Pointer<UAS_Common> d;
switch (event->type)
}
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)
// (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';
}
}
}
default:
return (OLIAS_TIMEOUT);
}
+
+ return (OLIAS_LOCATOR_NOT_FOUND);
}
#define L_Managers
#include "Prelude.h"
+#include "utility/funcs.h"
LONG_LIVED_CC( SessionMgr, session );
}
-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 );
void
SessionMgr::file( char *savefile )
{
- prior_session = XtNewString( savefile );
+ prior_session = XtsNewString( savefile );
}
// 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
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;
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;
#include "Registration.hh"
#include "utility/mmdb_exception.h"
+#include "utility/funcs.h"
#include <string.h>
#include <stdio.h>
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;
// 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
TtIpcMgr::~TtIpcMgr()
{
- char *dfile;
+ // char *dfile;
// send a Dtinfo_Quit message to whomever may be observing
notify_quit() ;
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);
{
// 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;
}
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)
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;
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;
};
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
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
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() << "): (" ;
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
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;
}
// 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);
f_current_displayable = strseg ;
- int ret_indx ;
+ long ret_indx ;
// calculate dthelp font index
{
// WARNING: this routine keeps the ptr to the xlfd_spec
#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
PartialElementFeatures::PartialElementFeatures(CanvasRenderer* renderer)
: f_text (0),
f_font(0),
+ f_subsuper(baseline),
f_linebreak(0),
f_pagebreak(PAGEBREAK_NONE),
+ f_layout(renderer),
f_graphic (0),
- f_subsuper(baseline),
f_ignore(0),
- f_layout(renderer),
f_orientation("portrait")
{
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)
{
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()
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)
{
}
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)
{
}
}
}
+#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);
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)
{}
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 ;
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
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 ;
}
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;
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;
columns.removeAt(kept);
}
- unsigned current_column = 0 ;
count = columns.entries();
for (vc = 0, kept = 0; vc < count; vc++) // iterate for virtual cells
{
}
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;
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)
{
#ifdef TABLE_DEBUG
fprintf(stderr, "(DEBUG) blank spot found in the table.\n");
#endif
- int col;
+ unsigned int col;
if (c == 0)
{
{
_DtCvSegment* filler = grid[r][col];
- for (int i = c; i < col; i++)
+ for (unsigned int i = c; i < col; i++)
grid[r][i] = filler;
}
}
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)
{
{
// 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 ;
}
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;
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)
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 ;
public:
PartialElementFeatures(CanvasRenderer *);
PartialElementFeatures (PartialElementFeatures &);
- ~PartialElementFeatures();
+ virtual ~PartialElementFeatures();
virtual int requires_container(int affix);
virtual int ignore_linebreak(int affix);
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 = "*";
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 : "*",
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 : "*",
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)
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;
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();
// 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 {
// 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';
}
}
// 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 ;
// 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);
#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
#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 ;
}
(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, '-')) &&
FontList::FontList(int count, const char **names)
-: f_count(count),
- f_names(names)
+: f_names(names),
+ f_count(count)
{
}
FontList::~FontList()
#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
public:
Shell_Info (Widget w)
: f_shell (w),
- f_restore (False),
- f_size_hints (NULL)
+ f_size_hints (NULL),
+ f_restore (False)
{ }
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)
}
/* 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(),
void
WindowSystem::init()
{
- Arg args[8];
- int i = 0;
-
XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL);
_DtEnvControl(DT_ENV_SET);
{
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)
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));
XDefineCursor (f_display, XtWindow (shell), cursor);
else
XUndefineCursor (f_display, XtWindow (shell));
+ }
}
XFlush (f_display);
}
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.
&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)
{
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,
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()),
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);
}
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)
#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)
{
{
Display *dpy = DisplayOfScreen(screen);
Atom __SWM_VROOT = None;
- int i;
+ unsigned int i;
Window rootReturn, parentReturn, *children;
unsigned int numChildren;
return (root);
}
+#endif
/* Need original macros to figure out if there is a virtual root. */
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);
}
void
IntegerPref::save()
{
- sprintf (g_buffer, "%d", f_value);
+ snprintf (g_buffer, sizeof(g_buffer), "%d", f_value);
set_value (g_buffer);
}
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)
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
}
{
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 &&
{
unlink (filename);
ret = link (backup, filename);
+ if(ret == 0) throw (CASTEXCEPT Exception());
}
}
// 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);
}
int update_count;
ret = fgets (buffer, 256, stream);
+ if(ret == NULL) throw (CASTEXCEPT Exception());
p = buffer;
while (*p != ',' && *p != '\0')
p++;
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());
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)
{
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);
}
// /////////////////////////////////////////////////////////////////
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;
"%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 };
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.
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
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
{
// 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;
}
{
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.
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);
}
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
#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;
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;
void
QueryTermView::select_toggle (WCallback *wcb)
{
- XmToggleButtonCallbackStruct *tbcs =
- (XmToggleButtonCallbackStruct *) wcb->CallData();
+ (XmToggleButtonCallbackStruct *) wcb->CallData();
// notify someone about selection state...
invert_colors();
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);
}
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;
};
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 {
};
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
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]));
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]);
}
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;
}
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();
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
// $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
// 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];
*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];
{
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;
{
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;
}
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();
}
UAS_Factory *theFactory = UAS_Factory::lookup(access);
if (theFactory == 0) {
char buf[BUFSIZ];
- (void) sprintf (buf, CATGETS(Set_UAS_Base, 2,
+ (void) snprintf (buf, sizeof(buf), CATGETS(Set_UAS_Base, 2,
"Don't know how to create %s: objects"),
(char*)access);
UAS_PtrList<FactoryEntry>&theList = *gFactoryList;
for (int i = 0; i < theList.numItems(); i ++) {
UAS_List<UAS_String> cur = theList[i]->factory()->rootLocators();
- for (int j = 0; j < cur.length(); j ++) {
+ for (unsigned int j = 0; j < cur.length(); j ++) {
rval.insert_item (cur[j]);
}
}
template <class T>
UAS_Pointer<T> &
UAS_List<T>::item(unsigned int index) {
- if (index >= fNumItems) {
+ if (index >= (unsigned int)fNumItems) {
abort ();
}
return fItems[index];
template <class T>
int
UAS_List<T>::set_item (const UAS_Pointer<T>& theItem, unsigned int index) {
- if (index >= fNumItems)
+ if (index >= (unsigned int)fNumItems)
return 0;
fItems[index] = theItem;
return 1;
template <class T>
int
UAS_List<T>::remove_item (unsigned int index) {
- if (index >= fNumItems)
+ if (index >= (unsigned int)fNumItems)
return 0;
for (int i = index + 1; i < fNumItems; i ++)
fItems[i - 1] = fItems[i];
template <class T>
int
UAS_List<T>::remove_item (const UAS_Pointer<T>& theItem) {
- for (unsigned int i = 0; i < fNumItems; i ++) {
+ for (unsigned int i = 0; i < (unsigned int)fNumItems; i ++) {
if (fItems[i] == theItem) {
return remove_item (i);
}
}
char *tmpstr = new char [len + 1] ;
- strcpy(tmpstr, fBuffer);
+ len = strlen(fBuffer);
+ *((char *) memcpy(tmpstr, fBuffer, len) + len) = '\0';
if (insert_completion)
{
tmpstr[fIndx - 1] = 0 ; // get rid of the *
- strcat(tmpstr, "\\C-w");
+ *((char *) memcpy(tmpstr + len - 1, "\\C-w", 4) + 4) = '\0';
}
f_stack.push(tmpstr);
while (*f_input_ptr == ' ') // skip whitespace
f_input_ptr++ ;
- while (c = *f_input_ptr){
+ while ((c = *f_input_ptr)){
f_input_ptr++ ;
if ((c < '0') || (c > '9')){
c = *f_input_ptr ;
}
- while (c = *f_input_ptr) {
+ while ((c = *f_input_ptr)) {
f_input_ptr++ ;
if (c == '\\')
private: // variables
- const char* f_input_ptr; // olias query language string
-
OQL_Token fSymbol;
+ const char* f_input_ptr; // olias query language string
+
char fBuffer[1024];
unsigned int fIndx;
int num_docs() const { return f_ndocs; }
protected:
- int f_ndocs;
UAS_Pointer<UAS_String> f_query;
UAS_Pointer<UAS_String> f_scope_name;
UAS_List<UAS_SearchResultsEntry> f_results;
+ int f_ndocs;
};
#endif
f_read_only (ro),
f_infolib(NULL)
{
- f_name = new char[strlen(name) + 1 ];
- strcpy(f_name, name);
+ int len = strlen(name);
+ f_name = new char[len + 1];
+ *((char *) memcpy(f_name, name, len) + len) = '\0';
f_bcases = bcases;
delete f_name ;
u_int len = strlen(newname);
f_name = new char[len + 1] ;
- strcpy(f_name,newname);
+ *((char *) memcpy(f_name, newname, len) + len) = '\0';
return name();
}
UAS_SearchScope::set_name (const char *name)
{
delete f_name;
- f_name = new char[strlen(name) + 1 ];
- strcpy(f_name, name);
+ int len = strlen(name);
+ f_name = new char[len + 1];
+ *((char *) memcpy(f_name, name, len) + len) = '\0';
static ScopeRenamed rename_msg;
rename_msg.f_search_scope = this;
send_message (rename_msg, 0);
if (!cp) {
return s1.length() == 0;
}
- if (strlen (cp) != s1.length())
+ if (strlen (cp) != (size_t)s1.length())
return 0;
return !memcmp (cp, (char *) s1, s1.length());
}
}
int status;
- if (status = DtSearchGetKeytypes((char*)*f_dbname,
+ if ((status = DtSearchGetKeytypes((char*)*f_dbname,
&f_ktcount,
- &f_keytypes)) {
+ &f_keytypes))) {
#ifdef DEBUG
fprintf(stderr, "(ERROR) DtSearchGetKeytypes failed\n");
abort();
#endif
}
- int i;
#ifdef DEBUG
+ int i;
printf("(DEBUG) ktcount = %d\n", f_ktcount);
for (i = 0; i < f_ktcount; i++) {
printf(" kt[%d]=%c,%s\n", i, f_keytypes[i].ktchar, f_keytypes[i].name);
return;
}
- int i;
+ unsigned int i;
for (i = 0; i < bcases().length(); i++) {
DtSR_BookcaseSearchEntry* bce = bcases()[i];
bce->_search_zones(search_zones);
UAS_String str = CATGETS(Set_DtSR_Parser, 1,
"The ``%s'' Search feature is not supported.");
UAS_String opstr = CATGETS(Set_DtSR_Parser, 3, "weight");
- sprintf(msg, (char*)str, (char*)opstr);
+ snprintf(msg, sizeof(msg), (char*)str, (char*)opstr);
UAS_String uas_msg = msg;
throw(UAS_Search_Feature_Unavailable(uas_msg));
#endif
UAS_String str = CATGETS(Set_DtSR_Parser, 1,
"The ``%s'' Search feature is not supported.");
UAS_String opstr = CATGETS(Set_DtSR_Parser, 2, "quoted phrase");
- sprintf(msg, (char*)str, (char*)opstr);
+ snprintf(msg, sizeof(msg), (char*)str, (char*)opstr);
UAS_String uas_msg = msg;
throw(UAS_Search_Feature_Unavailable(uas_msg));
UAS_String str = CATGETS(Set_DtSR_Parser, 1,
"The ``%s'' Search feature is not supported.");
UAS_String opstr = CATGETS(Set_DtSR_Parser, 4, "proximity");
- sprintf(msg, (char*)str, (char*)opstr);
+ snprintf(msg, sizeof(msg), (char*)str, (char*)opstr);
UAS_String uas_msg = msg;
throw(UAS_Search_Feature_Unavailable(uas_msg));
#endif
UAS_String str = CATGETS(Set_DtSR_Parser, 1,
"The ``%s'' Search feature is not supported.");
UAS_String opstr = CATGETS(Set_DtSR_Parser, 5, "xor");
- sprintf(msg, (char*)str, (char*)opstr);
+ snprintf(msg, sizeof(msg), (char*)str, (char*)opstr);
UAS_String uas_msg = msg;
throw(UAS_Search_Feature_Unavailable(uas_msg));
#endif
DtSR_SearchEngine::DtSR_SearchEngine()
: f_dbnames(NULL), f_dbcount(0), f_valid_bc_map(0)
{
- char* ocf_path = mktemp((char*)".DtSR_XXXXXX");
+ string ocf_tmpl = "/tmp/.DtSR_XXXXXX";
+ int len = ocf_tmpl.size();
+ char* ocf_path = new char [len + 1];
+ *((char *) memcpy(ocf_path, ocf_tmpl.c_str(), len) + len) = '\0';
+ ocf_path = mktemp(ocf_path);
f_config_path = ocf_path;
if (ocf_path)
if (bcases->numItems() == 0 || *(char*)f_config_path == '\0')
return;
- if (bcases->numItems() == DtSR_BookcaseSearchEntry::bcases().length()) {
+ if (bcases->numItems() ==
+ (int) DtSR_BookcaseSearchEntry::bcases().length()) {
// if sets of bookcases are same, you do not have to (re)init
}
#endif
DtSrResult *item = (DtSrResult *)malloc(sizeof(DtSrResult));
*item = *iter; // copy as it is
- item->abstractp = (char*)malloc(strlen(iter->abstractp) + 1);
- strcpy(item->abstractp, iter->abstractp);
+ int len = strlen(iter->abstractp);
+ item->abstractp = (char*)malloc(len + 1);
+ *((char *) memcpy(item->abstractp,
+ iter->abstractp, len) + len) = '\0';
item->link = NULL;
if (rval == NULL)
rval = tail = item;
bookid_dict[bookid] = True;
}
- for (i = 0; i < res->length(); i++) {
+ for (i = 0; i < (int) res->length(); i++) {
// all these temporary variables are needed to get this
// code to compile on novell
res->set_item(NULL, i);
}
- for (i = 0; i < res->length(); i++) {
+ for (i = 0; i < (int) res->length(); i++) {
if (res->item(i) == (int)NULL)
res->remove_item(i--);
}
UAS_List<UAS_SearchResultsEntry>& list =
*(UAS_List<UAS_SearchResultsEntry>*)res;
- for (int i = 0; i < list.length(); i++) {
+ for (unsigned int i = 0; i < list.length(); i++) {
UAS_Pointer<UAS_SearchResultsEntry> crude_ptr = list[i];
UAS_SearchResultsEntry &cptr2 = *crude_ptr;
*(UAS_List<UAS_SearchResultsEntry>*)res;
unsigned int list_length = Ref_list.length();
- for (int i = 0; i < list_length; i++) {
- for (int j = i+1; j < list_length; j++) {
+ for (unsigned int i = 0; i < list_length; i++) {
+ for (unsigned int j = i+1; j < list_length; j++) {
#ifdef USL
// this line does nothing, but if you remove it
DtSR_SearchResults::create_results(int index, int nres)
{
// garbage input
- if (nres == 0 || index >= f_results.length())
+ if (nres == 0 || index >= (int) f_results.length())
return NULL;
int n;
}
f_ndocs = res->f_ndocs;
- for (i = 0; i < res->f_stems_list.length(); i++) {
+ for (i = 0; i < (int) res->f_stems_list.length(); i++) {
f_stems_list.insert_item(res->f_stems_list[i]);
}
res = NULL;
}
// merge stems list
- for (i = 0; i < res->f_stems_list.length(); i++) {
+ for (i = 0; i < (int) res->f_stems_list.length(); i++) {
f_stems_list.insert_item(res->f_stems_list[i]);
}
if (dbn < 0 || dbn >= db_count)
return NULL;
- int i;
+ unsigned int i;
for (i = 0; i < f_stems_list.length(); i++) {
if (f_stems_list[i]->dbn() == dbn)
break;
if (uas_zone > UAS_SearchZones::uas_all) // range error
return Beyond_Range;
- if (f_zone & 0x01<<uas_zone == 0)
+ if (f_zone & (0x01<<uas_zone == 0))
return set_proximity(uas_zone, proximity);
return f_proximity[uas_zone] = (f_proximity[uas_zone] + proximity) / 2;
unsigned int
DtSR_SearchResultsEntry::relevance()
{
- if (f_relevance != Inv_Relevance)
+ if ((int)f_relevance != Inv_Relevance)
return f_relevance;
int prox;
char** pat_tbl = new char*[n_of_pats + 1];
char** pat_tbl_end = pat_tbl + n_of_pats;
- int npat;
+ int npat, len;
for (npat = 0; *patterns && n_of_pats > 0; npat++, n_of_pats--) {
char* del = (char *)strchr(patterns, '\n');
if (del != NULL) { // more pattern specified
- pat_tbl[npat] = new char[del - patterns + 1];
- strncpy(pat_tbl[npat], patterns, del - patterns);
- pat_tbl[npat][del - patterns] = '\0';
+ len = del - patterns;
+ pat_tbl[npat] = new char[len + 1];
+ *((char *) memcpy(pat_tbl[npat], patterns, len) + len) = '\0';
patterns = del + 1;
}
else {
- pat_tbl[npat] = new char[strlen(patterns) + 1];
- strcpy(pat_tbl[npat], patterns);
+ int len = strlen(patterns);
+ pat_tbl[npat] = new char[len + 1];
+ *((char *) memcpy(pat_tbl[npat], patterns, len) + len) = '\0';
patterns += strlen(patterns);
assert( *patterns == '\0' );
}
// remove null and too long patterns
int i;
for (i = 0 ; pat_tbl[i]; i++) {
- if (*(pat_tbl[i]) == '\0' || text_len < strlen(pat_tbl[i])) {
+ if (*(pat_tbl[i]) == '\0' || text_len < (int) strlen(pat_tbl[i])) {
delete[] pat_tbl[i];
pat_tbl[i] = NULL;
npat--;
size += 256;
patterns = (char*) realloc(patterns, size);
}
- sprintf(patterns, "%s%s\n", patterns, argv[i]);
+ snprintf(patterns, size, "%s%s\n", patterns, argv[i]);
}
ostringstream text;
template<class K, class V>
-Dict<K,V>::Dict(const K& k, const V& v) : def_key(k), def_val(v), head(NULL)
+Dict<K,V>::Dict(const K& k, const V& v) : head(NULL), def_key(k), def_val(v)
{
init();
}
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))
if (!olias_db().validInfoLibPath(infoLibPath)) {
UAS_ErrorMsg badPath;
char buf[BUFSIZ];
- (void) sprintf (buf, CATGETS(Set_UAS_MMDB, 2,
+ (void) snprintf (buf, sizeof(buf), CATGETS(Set_UAS_MMDB, 2,
"Invalid Infolib path: %s"),
(char *) infoLibPath);
badPath.fErrorMsg = buf;
} mcatch_any() {
#if 0
char buf[BUFSIZ];
- (void) sprintf (buf, CATGETS(Set_UAS_MMDB, 3,
+ (void) snprintf (buf, sizeof(buf), CATGETS(Set_UAS_MMDB, 3,
"Ignoring invalid Infolib path: %s"),
(char *) infoLibPath);
UAS_ErrorMsg theError;
returnMMDB = 0;
returnInfoBase = 0;
for (int i = 0; i < fMMDBList.numItems(); i ++) {
- if (returnInfoBase = fMMDBList[i]->infolib()->
- getInfobaseByComponent(loc, info_lib::LOC)) {
+ if ((returnInfoBase = fMMDBList[i]->infolib()->
+ getInfobaseByComponent(loc, info_lib::LOC))) {
returnMMDB = fMMDBList[i];
return;
}
//for (int i = 0; i < fields.length(); i ++) {
//(void) getMMDB (*(UAS_String*)fields[i]);
//}
- for (int i = 0; i < libs.length(); i ++) {
+ for (unsigned int i = 0; i < libs.length(); i ++) {
// If this call doesn't create a new MMDB, it sends
// an error message to the application.
(void) getMMDB (*(UAS_String*)libs[i]);
MMDB_Factory::genInfolibName () {
static int counter = 0;
char buf[BUFSIZ];
- (void) sprintf (buf, CATGETS(Set_UAS_MMDB, 4, "DtMmdb Library %d"), ++counter);
+ (void) snprintf (buf, sizeof(buf),
+ CATGETS(Set_UAS_MMDB, 4, "DtMmdb Library %d"), ++counter);
return UAS_String (buf);
}
UAS_String access, rest;
in.split (':', access, rest);
UAS_List<UAS_String> pairs = rest.splitFields ('&');
- for (int i = 0; i < pairs.length(); i ++) {
+ for (unsigned int i = 0; i < pairs.length(); i ++) {
UAS_String key, value;
pairs[i]->split ('=', key, value);
installPair (key, value);
if (f_name == "")
{
UAS_List<UAS_Common> kids = children();
- int i;
+ unsigned int i;
for (i = 0; i < kids.length(); i++)
{
if (kids[i]->type() == UAS_BOOKCASE)
if (i < kids.length())
{
char scratch[128];
- sprintf(scratch, CATGETS(Set_UAS_MMDB, 6, "File a Bug"),
- (char *)kids[i]->id());
+ snprintf(scratch, sizeof(scratch),
+ CATGETS(Set_UAS_MMDB, 6, "File a Bug"), (char *)kids[i]->id());
f_name = UAS_String(scratch);
}
}
UAS_List<UAS_Common> bookcases = bookcaseList();
UAS_PtrList<const char> cList;
- int i;
+ unsigned int i;
#ifdef DEBUG
for (i = 0; i < bookcases.length(); i++)
fprintf(stderr, "(DEBUG) bookcases %d=%s\n",
info_base *ib,
const oid_t &ssid,
StyleSheetType sstype):
- MMDB_Common (theMMDB, ib),
UAS_StyleSheet (sstype),
- fSSID (ssid),
- fStyleSheet (ib, ssid) {
+ MMDB_Common (theMMDB, ib),
+ fStyleSheet (ib, ssid),
+ fSSID (ssid) {
}
MMDB_StyleSheet::~MMDB_StyleSheet () {
if (home == NULL)
throw (Exception());
- sprintf (filename, "%s/.olias/preferences", home);
+ snprintf (filename, sizeof(filename), "%s/.olias/preferences", home);
}
return (filename);
{
// Failed, so look for the backup file.
char backup[256], original[256];
- sprintf (backup, "%s.bak", filename);
+ snprintf (backup, sizeof(backup), "%s.bak", filename);
struct stat file_info;
if (stat (backup, &file_info) != -1 &&
if (!ilib)
print_usage_and_exit(argv[0], NULL);
else {
- tbuf = new char[128];
- sprintf(tbuf, "DTINFO_INFOLIB_PATH=%s", ilib);
+ int buflen = 128;
+ tbuf = new char[buflen];
+ snprintf(tbuf, buflen, "DTINFO_INFOLIB_PATH=%s", ilib);
putenv(tbuf);
}
}
for (int i = 0; i < fields.length(); i ++) {
ilib_path = (char *)*(fields[i]);
- sprintf(names_buf, "%s/names.mmdb", ilib_path);
+ snprintf(names_buf, sizeof(names_buf), "%s/names.mmdb", ilib_path);
if (stat(names_buf, &stat_buf) == -1) {
cout << "\n\nWarning: library does not appear to be valid;\n";
cout << " couldn't stat file: " << names_buf << ";\n";
if (base_name[0] != '#') {
new_len = strlen(ilib_path) + 1 + strlen(base_name) + 1;
new_buf = new char[new_len];
- sprintf(new_buf, "%s/%s", ilib_path, base_name);
+ snprintf(new_buf, new_len, "%s/%s", ilib_path, base_name);
basepathList.append(new_buf);
}
}
}
assert( strlen(name) > 0 );
// Get the specified preference.
- sprintf (scratch, "Scope.%s", name);
+ snprintf (scratch, sizeof(scratch), "Scope.%s", name);
StringPref scope (scratch);
ON_DEBUG (printf ("RESTORING scope: %s\n", name));
ON_DEBUG (printf (" value = %s\n", scope.value()));
if (level >= 2) {
char buf[1024];
UAS_String loc = doc->id();
- (void) sprintf (buf, "mmdb:LOCATOR=%s", (char *) loc);
+ (void) snprintf (buf, sizeof(buf), "mmdb:LOCATOR=%s", (char *) loc);
UAS_Pointer<UAS_Common> theDoc = UAS_Common::create(buf);
cerr << (char *) theLoc << ", " << (char *) theDoc->title() << endl;
} else {
#include <X11/Xaw/XawInit.h> /* for XawInitializeWidgetSet */
#include <X11/Xaw/PannerP.h> /* us */
#include <X11/Xmu/Misc.h> /* for Min */
+#include <X11/Xmu/StdCmap.h> /* for XmuDistinguishableColors() */
+#include <X11/Xmu/Drawing.h> /* for XmuCreateStippledPixmap */
#include <Xm/Xm.h> /* for Motif */
#include <ctype.h> /* for isascii() etc. */
-#include <math.h> /* for atof() */
+#include <stdlib.h> /* for atof() */
#if defined(ISC) && defined(SYSV) && defined(SYSV386) && __STDC__
extern double atof(char *);
#endif
+extern void _XmDrawShadow (Display *display, Drawable d, GC top_GC,
+ GC bottom_GC, int size, int x, int y,
+ int width, int height);
+
static char defaultTranslations[] =
"<Btn1Down>: start() \n\
<Btn1Motion>: move() \n\
static void ReDisplay();
static XtGeometryResult QueryGeometry();
-static char *defaultTranslations[] = {""};
-
/*
+static char *defaultTranslations[] = {""};
static XtActionsRec actions[] =
{
};
/* Only allow width changes to the width of the restraint. */
if (request->request_mode & CWWidth)
- if (request->width == restraint->core.width)
- yes = True;
- else
- almost = True;
+ {
+ if (request->width == restraint->core.width)
+ yes = True;
+ else
+ almost = True;
+ }
/* Allow any height changes */
if (request->request_mode & CWHeight)
if (c->simple_class.change_sensitive == NULL) {
char buf[BUFSIZ];
- sprintf(buf,
+ snprintf(buf, sizeof(buf),
"%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.",
c->core_class.class_name);
XtWarning(buf);
Mask *valueMask;
XSetWindowAttributes *attributes;
{
- Pixmap border_pixmap;
+ Pixmap border_pixmap = 0;
if (!XtIsSensitive(w)) {
/* change border to gray; have to remember the old one,
#include "TabButtonP.h"
#include <stdio.h>
#include <stdlib.h>
+#include <Xm/Xm.h>
+#include <Xm/IconButtonP.h>
/* **************************************************************
* constant and type declarations
/* If the event was a button event, make sure it occured within
the tab. (The user could have released outside the tab.) */
if (event->type != ButtonRelease ||
- event->xbutton.x >= (int) -bw &&
- event->xbutton.y >= (int) -bw &&
- event->xbutton.x < (int) (tabw->core.width + bw) &&
- event->xbutton.y < (int) (tabw->core.height + bw))
+ (event->xbutton.x >= (int) -bw &&
+ event->xbutton.y >= (int) -bw &&
+ event->xbutton.x < (int) (tabw->core.width + bw) &&
+ event->xbutton.y < (int) (tabw->core.height + bw)))
{
/* Bail out if this is a multiple click and we're ignoring them. */
if (tabw->tab.click_count > 1 &&
SetValues (Widget cw, Widget rw, Widget nw, ArgList args, Cardinal *num_args)
{
XyzTabButtonWidget current = (XyzTabButtonWidget) cw;
- XyzTabButtonWidget request = (XyzTabButtonWidget) rw;
Boolean redisplay = False;
if (tabw->tab.arm_pixmap != current->tab.arm_pixmap &&
static void
get_label_rect (Widget w, rect_t *rect)
{
- int dx, adjust;
+ int dx;
short fill = 0;
/* Make some room between shadows and label area if the colors are
}
#endif
+_XFUNCPROTOBEGIN
+
+extern void _XmCalcLabelDimensions(Widget wid);
+
+extern Boolean _XmFontListSearch (XmFontList fontlist, XmStringCharSet charset,
+ short *indx, XFontStruct **font_struct);
+
+extern Boolean _XmDifferentBackground (Widget w, Widget parent);
+
+_XFUNCPROTOEND
+
#endif /* _TabButton_h */
/* DO NOT ADD ANY LINES AFTER THIS #endif */
protected:
void insert_op (WCallback *wcb);
- long &f_position;
PRoot *&f_root;
- insert_op_func_t f_insert;
+ long &f_position;
is_sensitive_func_t f_is_sensitive;
+ insert_op_func_t f_insert;
bool f_sensitive;
};
#include <X11/Intrinsic.h> /* Xt toolkit */
#include "GraphicsP.h"
-extern open_cgm_file(_DtGrStream *stream); /* in cgmio.c */
-extern open_cgm_buffer(_DtGrStream *stream); /* in cgmio.c */
+extern int open_cgm_file(_DtGrStream *stream); /* in cgmio.c */
+extern int open_cgm_buffer(_DtGrStream *stream); /* in cgmio.c */
/* in cgmcmds.c */
-extern xl_setup(Screen*, Display*, Window, int, Colormap, Visual*, GC,
+extern int xl_setup(Screen*, Display*, Window, int, Colormap, Visual*, GC,
Dimension*, Dimension*, Pixel**, int*, Pixmap*, unsigned short);
/* the external entry point */
int byte_no; /* its byte position in file */
int p_len; /* its parameter length */
};
+#if 0
/* now put in the strings we will use for diagnostics and listings */
/* use B_ATTRSIZE since it is the largest Class (of 8) */
static char *cgm_name[8][B_ATTRSIZE] = {
"Application Data"
}
};
+#endif
+
extern unsigned char *get_b_cmd(struct cmd_info_s*,
_DtGrStream *stream); /* in cgmio.c */
-extern do_b_cmd(struct cmd_info_s*, unsigned char*,cgm_s_type*);
+extern int do_b_cmd(struct cmd_info_s*, unsigned char*,cgm_s_type*);
/* in cgmcmds.c */
-extern cgm_defs(cgm_s_type*),
- cgm_assign(cgm_s_type*, cgm_s_type*); /* in cgmcommon.c */
+extern int cgm_defs(cgm_s_type*); /* in cgmcommon.c */
+extern int cgm_assign(cgm_s_type*, cgm_s_type*); /* in cgmcommon.c */
/* structure for the description of partial text pieces */
struct partialTextStruct {
char *text;
static int visualClass, visualID, colormap_size, bits_per_rgb;
static unsigned long redMask, greenMask, blueMask;
static unsigned int visualDepth;
+#ifdef DEBUG_VISUAL
/* in case we need this for error messages */
static char *visualNames[6] = {"StaticGrey", "GrayScale", "StaticColor",
"PseudoColor", "TrueColor", "DirectColor"};
+#endif
static Dimension *ret_width;
static Dimension *ret_height;
static XColor my_colrs[MAXCOLRS];
/* all of these routines take the address of a pointer and step the pointer */
/* forward before they return */
/* the general Binary format string */
-static b_str(unsigned char **in_ptr, char **out_ptr)
+static int b_str(unsigned char **in_ptr, char **out_ptr)
{
int p_len, data_left, i;
unsigned char *my_ptr;
}
/* XLib specific functions */
/* the setup routine */
-xl_setup(Screen *screen, Display *inDisplay, Window inWin, int inDepth,
- Colormap inCmap, Visual *inVis, GC inGC, Dimension *in_width,
- Dimension *in_height, Pixel **in_colrs, int *in_number,
- Pixmap *inPixmap, unsigned short sf)
+int xl_setup(Screen *screen, Display *inDisplay, Window inWin, int inDepth,
+ Colormap inCmap, Visual *inVis, GC inGC, Dimension *in_width,
+ Dimension *in_height, Pixel **in_colrs, int *in_number,
+ Pixmap *inPixmap, unsigned short sf)
{
XVisualInfo myTemp, *myInfo;
int tmp;
Pixel bestPixel = 0;
float dColrs[3];
float fDiv;
- unsigned short r, g, b;
int i, bestI;
unsigned int bestDif, tempDif;
/* normalize colours for X routines */
/* now the functions that do the work */
/* Delimiters */
/* Begin Metafile */
-static bmf(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int bmf(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
/* nothing for now */
return 1;
}
/* End Metafile */
-static emf(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int emf(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
/* nothing for now */
return 1;
}
/* Begin Picture */
-static bpic(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int bpic(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
/* nothing for now */
return 1;
}
/* Begin Picture Body */
-static bpicbody(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int bpicbody(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
XPoint myClipRect[4];
GC clearGC;
/* look at VDC extent and figure out Pixmap size and scaling */
float x0, x1, y0, y1, w, h, maxWH;
- int i;
+
if (cgm_s->vdctype) { /* real VDC's */
x0 = cgm_s->vdcextent[0].r;
y0 = cgm_s->vdcextent[1].r;
return(1);
}
/* End Picture */
-static epic(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int epic(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
/* need to fill out the pixels array */
int i;
}
/* Metafile Descriptors */
/* Metafile Version */
-static mfversion(dat_ptr, cmd_ptr, cgm_s)
+static int mfversion(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Metafile Descriptor */
-static mfdescrip(dat_ptr, cmd_ptr, cgm_s)
+static int mfdescrip(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* VDC type */
-static vdctype(dat_ptr, cmd_ptr, cgm_s)
+static int vdctype(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Integer Precision */
-static intprec(dat_ptr, cmd_ptr, cgm_s)
+static int intprec(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Real Precision */
-static realprec(dat_ptr, cmd_ptr, cgm_s)
+static int realprec(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Index Precision */
-static indexprec(dat_ptr, cmd_ptr, cgm_s)
+static int indexprec(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Colour Precision */
-static colprec(dat_ptr, cmd_ptr, cgm_s)
+static int colprec(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Colour Index Precision */
-static cindprec(dat_ptr, cmd_ptr, cgm_s)
+static int cindprec(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Maximum Colour Index */
-static maxcind(dat_ptr, cmd_ptr, cgm_s)
+static int maxcind(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Colour Value Extent */
-static cvextent(dat_ptr, cmd_ptr, cgm_s)
+static int cvextent(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Metafile Element List */
-static mfellist(dat_ptr, cmd_ptr, cgm_s)
+static int mfellist(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Metafile Defaults Replacement, a complex element */
-static mfdefrep(dat_ptr, cmd_ptr, cgm_s)
+static int mfdefrep(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
{
struct cmd_info_s new_cmd; /* for the new commands */
- int i, ret = 1, new_len, b_to_move, data_left;
+ int i, new_len, b_to_move, data_left;
unsigned char *out_ptr, *end_ptr, *new_ptr, *start_ptr;
/* in this element, many other elements can be encoded in its */
return 1;
}
/* Font List, store the data, but ignored for now */
-static fontlist(dat_ptr, cmd_ptr, cgm_s)
+static int fontlist(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Character Set List, stored but ignored */
-static charlist(dat_ptr, cmd_ptr, cgm_s)
+static int charlist(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Character Announcer */
-static charannounce(dat_ptr, cmd_ptr, cgm_s)
+static int charannounce(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
}
/* Picture Descriptors */
/* Scaling Mode */
-static scalmode(dat_ptr, cmd_ptr, cgm_s)
+static int scalmode(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Colour Selection Mode */
-static colselmode(dat_ptr, cmd_ptr, cgm_s)
+static int colselmode(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Line Width Specification Mode */
-static lwidspecmode(dat_ptr, cmd_ptr, cgm_s)
+static int lwidspecmode(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Marker Size Specification Mode */
-static marksizspecmode(dat_ptr, cmd_ptr, cgm_s)
+static int marksizspecmode(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Edge Width Specification Mode */
-static edwidspecmode(dat_ptr, cmd_ptr, cgm_s)
+static int edwidspecmode(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* VDC Extent */
-static vdcextent(dat_ptr, cmd_ptr, cgm_s)
+static int vdcextent(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Background Colour */
-static backcolr(dat_ptr, cmd_ptr, cgm_s)
+static int backcolr(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
}
/* Control Elements */
/* VDC Integer Precision */
-static vdcintprec(dat_ptr, cmd_ptr, cgm_s)
+static int vdcintprec(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* VDC Real Precision */
-static vdcrprec(dat_ptr, cmd_ptr, cgm_s)
+static int vdcrprec(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Auxiliary Colour */
-static auxcolr(dat_ptr, cmd_ptr, cgm_s)
+static int auxcolr(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Transparency */
-static transp(dat_ptr, cmd_ptr, cgm_s)
+static int transp(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return noPts;
}
/* Clipping Rectangle */
-static cliprect(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int cliprect(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
int noPts;
XPoint *myPtr = NULL, myClipRect[4];
return 1;
}
/* Clipping Indicator */
-static clipindic(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int clipindic(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
- Region r;
cgm_s->clipindic = b_gsint(&dat_ptr, 16);
if (cgm_s->clipindic) {
XSetRegion(display, lineGC, clipRegion);
return noSegments;
}
/* Polyline */
-static polyline(dat_ptr, cmd_ptr, cgm_s)
+static int polyline(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return(1);
}
/* Disjoint Polyline, on/off segments */
-static dispoly(dat_ptr, cmd_ptr, cgm_s)
- unsigned char *dat_ptr;
- struct cmd_info_s *cmd_ptr;
- cgm_s_type *cgm_s;
+static int dispoly(dat_ptr, cmd_ptr, cgm_s)
+unsigned char *dat_ptr;
+struct cmd_info_s *cmd_ptr;
+cgm_s_type *cgm_s;
{
int noSegments;
XSegment *myPtr = NULL;
return(1);
}
/* Polymarker */
-static polymarker(dat_ptr, cmd_ptr, cgm_s)
+static int polymarker(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
textX = textY = textW = textH = 0;
}
/* Regular Text */
-static text(dat_ptr, cmd_ptr, cgm_s)
+static int text(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
{
int final_flag;
- unsigned char *out_ptr;
partialText *newPtr, *myPtr;
/* clean up in case we didn't get a final flag (e.g., old NCAR) */
if (textPtr) doText(cgm_s);
return 1;
}
/* Restricted Text */
-static restext(dat_ptr, cmd_ptr, cgm_s)
+static int restext(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Appended Text */
-static apptext(dat_ptr, cmd_ptr, cgm_s)
+static int apptext(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
{
- int i, ret, final_flag;
partialText *newPtr, *myPtr;
- if (!textPtr) return; /* can't append if there's nothing started ! */
+ if (!textPtr) return 0; /* can't append if there's nothing started ! */
- /* first the final/not final flag */
- final_flag = b_gsint(&dat_ptr, 16);
/* make some memory */
newPtr = (partialText *) malloc(sizeof(partialText));
newPtr->text = NULL;
return 1;
}
/* Polygon */
-static polygon(dat_ptr, cmd_ptr, cgm_s)
+static int polygon(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Polyset */
-static polyset(dat_ptr, cmd_ptr, cgm_s)
+static int polyset(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
{
- int i, j, noPts, *vPtr, lastFill;
+ int i, noPts, *vPtr, lastFill;
XPoint *myPtr;
/* get the number of pts */
else out = (*ptr >> (8 - temp)) & 1; break;}
/* get a packed list */
static void getListPixels(unsigned char *datPtr, cgm_s_type *cgm_s,
- int nx, int ny, int prec, Pixel *retPtr)
+ int nx, int ny, int prec, Pixel *retPtr)
{
unsigned char *startPtr;
- int rowSize, i, j, k, maxCol, done, iCol, iColrs[3];
+ int rowSize, i, j, k, done, iColrs[3];
+ int iCol = 0;
/* may be in direct colour mode or indexed colour mode */
switch (cgm_s->colselmode) {
case D_C_M: /* direct colour */
}
/* get a run-length encoded list */
static void getRLPixels(unsigned char *dat_ptr, cgm_s_type *cgm_s,
- int nx, int ny, int prec, Pixel *retPtr)
+ int nx, int ny, int prec, Pixel *retPtr)
{
static unsigned char bitMask[8] = {255, 127, 63, 31, 15, 7, 3, 1};
unsigned char *rowPtr;
Pixel myPixel;
- int i, j, k, done, iCol, iColrs[3], bitOffset,count;
+ int i, j, k, done, iColrs[3], bitOffset,count;
+ int iCol = 0;
Pixel tP;
for (i=0; i<ny; ++i) { /* loop through the rows */
static Pixel *getPixels(unsigned char *dat_ptr, cgm_s_type *cgm_s,
int nx, int ny, int localPrec, int repMode)
{
- int ix, iy;
Pixel *retPtr;
retPtr = (Pixel *) malloc(nx * ny * sizeof(Pixel));
if (!retPtr) return NULL;
return retPtr;
}
/* actually get the cellarray command */
-static cellarray(dat_ptr, cmd_ptr, cgm_s)
+static int cellarray(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
{
- int i, j, x[3], y[3], nx, ny, local_prec, rep_mode, xSize, ySize;
+ int i, x[3], y[3], nx, ny, local_prec, rep_mode, xSize, ySize;
int Qx, Qy, Rx, Ry, det, xMin, xMax, yMin, yMax, newX, newY, ix, iy,
oldX, oldY;
double ddet, axx, axy, ayx, ayy;
return 1;
}
/* Rectangle */
-static rectangle(dat_ptr, cmd_ptr, cgm_s)
+static int rectangle(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Circle */
-static circle(dat_ptr, cmd_ptr, cgm_s)
+static int circle(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
{
int i, r, xc, yc;
double theta[3], dtheta;
- float m1, m2, x[5], y[5];
+ float m1 = 0;
+ float m2, x[5], y[5];
/* for convenience */
for (i=0; i<3; ++i) {
x[i] = inX[i];
return r;
}
/* Circular Arc, set by 3 points */
-static circ3(dat_ptr, cmd_ptr, cgm_s)
+static int circ3(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Circular Arc, set by 3 points, close */
-static circ3close(dat_ptr, cmd_ptr, cgm_s)
+static int circ3close(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return dtheta;
}
/* Circular Arc, set by center */
-static circcentre(dat_ptr, cmd_ptr, cgm_s)
+static int circcentre(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Circular Arc, set by center, close */
-static circcclose(dat_ptr, cmd_ptr, cgm_s)
+static int circcclose(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
int i, xc, yc, r, close_type, x0, y0, x1, y1;
double theta0, dtheta;
float dxy[4];
- double t0, t1;
/* get the center */
xc = getX(&dat_ptr, cgm_s);
yc = getY(&dat_ptr, cgm_s);
return nSteps;
}
/* Ellipse */
-static ellipse(dat_ptr, cmd_ptr, cgm_s)
+static int ellipse(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
{
- int xc, yc, cdx0, cdy0, cdx1, cdy1, x0, y0, w, h, noPts, i;
+ int xc, yc, cdx0, cdy0, cdx1, cdy1, noPts, i;
XPoint *myPtr = NULL;
static float dxy[4] = {1, 0, 1, 0}; /* make a full ellipse */
/* get the Ellipse centre */
return 1;
}
/* Elliptical arc */
-static elarc(dat_ptr, cmd_ptr, cgm_s)
+static int elarc(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Elliptical arc, close */
-static elarcclose(dat_ptr, cmd_ptr, cgm_s)
+static int elarcclose(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Line Type */
-static ltype(dat_ptr, cmd_ptr, cgm_s)
+static int ltype(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return setLineType(cgm_s->ltype, lineGC);
}
/* Line Width */
-static lwidth(dat_ptr, cmd_ptr, cgm_s)
+static int lwidth(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Line Colour */
-static lcolr(dat_ptr, cmd_ptr, cgm_s)
+static int lcolr(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Marker Type */
-static mtype(dat_ptr, cmd_ptr, cgm_s)
+static int mtype(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Marker Size */
-static msize(dat_ptr, cmd_ptr, cgm_s)
+static int msize(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Marker Colour */
-static mcolr(dat_ptr, cmd_ptr, cgm_s)
+static int mcolr(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Text Font Index, ignored at the moment */
-static tfindex(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int tfindex(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
/* get the text font index */
cgm_s->tfindex = b_gsint(&dat_ptr, cgm_s->indexprec);
return 1;
}
/* Text Precision, ignored at the moment; stroke everything */
-static tprec(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int tprec(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
/* get the text font index */
cgm_s->tprec = b_gsint(&dat_ptr, 16);
return 1;
}
/* Character Expansion Factor */
-static cexpfac(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int cexpfac(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
cgm_s->cexpfac = b_real(&dat_ptr, &(cgm_s->realprec));
return 1;
}
/* Character Space */
-static cspace(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int cspace(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
cgm_s->cspace = b_real(&dat_ptr, &(cgm_s->realprec));
return 1;
}
/* Text Colour */
-static tcolr(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int tcolr(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
int i, index;
return 1;
}
/* Character Height */
-static cheight(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int cheight(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
/* just 1 VDC to grab */
cgm_s->cheight.i = getVDC(&dat_ptr, cgm_s);
return 1;
}
/* Character Orientation */
-static corient(unsigned char *dat_ptr,struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int corient(unsigned char *dat_ptr,struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
int i;
return 1;
}
/* Text Path */
-static tpath(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int tpath(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
cgm_s->tpath = b_gsint(&dat_ptr, 16);
return 1;
}
/* Text Alignment */
-static talign(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
- cgm_s_type *cgm_s)
+static int talign(unsigned char *dat_ptr, struct cmd_info_s *cmd_ptr,
+ cgm_s_type *cgm_s)
{
int i;
return 1;
}
/* Character Set Index */
-static csetindex(dat_ptr, cmd_ptr, cgm_s)
+static int csetindex(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Alternate Character Set Index */
-static altcsetindex(dat_ptr, cmd_ptr, cgm_s)
+static int altcsetindex(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Interior Style */
-static intstyle(dat_ptr, cmd_ptr, cgm_s)
+static int intstyle(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Fill Colour */
-static fillcolr(dat_ptr, cmd_ptr, cgm_s)
+static int fillcolr(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Hatch Index */
-static hatchindex(dat_ptr, cmd_ptr, cgm_s)
+static int hatchindex(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Pattern Index */
-static patindex(dat_ptr, cmd_ptr, cgm_s)
+static int patindex(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Edge Type */
-static etype(dat_ptr, cmd_ptr, cgm_s)
+static int etype(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return setLineType(cgm_s->etype, edgeGC);
}
/* Edge Width */
-static ewidth(dat_ptr, cmd_ptr, cgm_s)
+static int ewidth(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Edge Colour */
-static ecolr(dat_ptr, cmd_ptr, cgm_s)
+static int ecolr(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Edge Visibility */
-static evis(dat_ptr, cmd_ptr, cgm_s)
+static int evis(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* Colour Table */
-static coltab(dat_ptr, cmd_ptr, cgm_s)
+static int coltab(dat_ptr, cmd_ptr, cgm_s)
unsigned char *dat_ptr;
struct cmd_info_s *cmd_ptr;
cgm_s_type *cgm_s;
return 1;
}
/* this is the external entry point */
-do_b_cmd(struct cmd_info_s *cmd_ptr, unsigned char *dat_ptr,
- cgm_s_type *cgm_s)
+int do_b_cmd(struct cmd_info_s *cmd_ptr, unsigned char *dat_ptr,
+ cgm_s_type *cgm_s)
{
/* for convenience define and argument list macro */
#define ARG_LIST dat_ptr,cmd_ptr, cgm_s
/* this is the module of common routines for the CGM interpreter */
#include "cgm.h" /* our defs */
/* this routine sets a cgm state variable to its defaults */
-cgm_defs(cgm_s_type *cgm_s)
+int cgm_defs(cgm_s_type *cgm_s)
{
int i;
return(1);
}
/* this routine sets one cgm state equal to another */
-cgm_assign(cgm_s_type *cgm_1, cgm_s_type *cgm_2)
+int cgm_assign(cgm_s_type *cgm_1, cgm_s_type *cgm_2)
{
int i;
static int io_debug = 0, recs_got, bytes_read;
/* function to get an input record, return no of bytes read */
-static get_cgm_rec(unsigned char *start_ptr,
- int buffer_size,
- _DtGrStream *cgmptr)
+static int get_cgm_rec(unsigned char *start_ptr,
+ int buffer_size,
+ _DtGrStream *cgmptr)
{
int bytes_got;
}
/* function to open the CGM file */
/* stream is a file stream */
-open_cgm_file(_DtGrStream *stream)
+int open_cgm_file(_DtGrStream *stream)
{
int bytes_got;
fprintf(stderr, "Attempting to open file, %s\n", stream->source.file.filename);
/* function to prepare the CGM buffer */
/* stream is a buffer stream */
-open_cgm_buffer(_DtGrStream *stream)
+int open_cgm_buffer(_DtGrStream *stream)
{
int bytes_got;
}
/* function to get a number of binary format bytes */
-static get_b_bytes(unsigned char *out_ptr,
- int bytes_wanted, _DtGrStream *stream)
+static int get_b_bytes(unsigned char *out_ptr,
+ int bytes_wanted, _DtGrStream *stream)
{
int bytes_got, i;
if (!begin_ptr) {
partialText *inText)
{
XPoint myPts[128]; /* should be plenty */
- int offset, noPts, w1, w2, x, y, w = 0, h = 0;
+ int offset, noPts, w1, w2, x, y, w = 0;
unsigned char *hPtr;
char *inS;
float charSize, cMod = 1;
inS = myText->text;
charSize = cMod * myText->cheight / 24.0; /* chars are in a 24 pt box */
while (*inS) { /* step thru the string */
- if ((*inS < 0) || ((offset = h_array[*inS]) < 0))
+ if ((*inS < 0) || ((offset = h_array[(int)*inS]) < 0))
{ /* illegal character */
++inS; /* step over */
continue;
int *ret_num_colors,
_DtGrContext *context)
{
- int thisPage;
unsigned char *dat_ptr;
/* declare two CGM state variables, one active, one for defaults */
static cgm_s_type cgm_act, cgm_def, *cgm_s_ptr;
cgm_def.tPixel = BlackPixelOfScreen(screen);
/* now go thru the input file */
- thisPage = 0;
do {
/* get next command */
dat_ptr = get_b_cmd(&cmd_info, stream);
XtPointer *value, unsigned long *length, int *format)
{
unsigned char *stream;
+ int len;
*length = 1 + strlen (event->infobase) + strlen (event->locator) + 2;
/* Xt will free this memory. */
/* Encode event in packed byte format. */
*stream++ = (unsigned char) event->type;
- strcpy (stream, event->infobase);
- stream += strlen (event->infobase) + 1;
- strcpy (stream, event->locator);
+ len = strlen (event->infobase);
+ *((char *) memcpy(stream, event->infobase, len) + len) = '\0';
+ stream += len + 1;
+ len = strlen (event->locator);
+ *((char *) memcpy(stream, event->locator, len) + len) = '\0';
}
/* -------- Create a unique selection property for this client. -------- */
- sprintf (buf, OLIAS_CLIENT_ATOM_FMT, XtWindow (toplevel));
+ snprintf (buf, sizeof(buf), OLIAS_CLIENT_ATOM_FMT, XtWindow (toplevel));
_olias_client_atom = XInternAtom (XtDisplay (toplevel), buf, False);
/* -------- Set up communication handling routines. -------- */
static void
parse_args (int argc, char *argv[])
{
- int i;
+ int i. len;
if (argc == 1)
print_usage_and_exit (argv[0], NULL);
print_usage_and_exit(argv[0], argv[i]);
}
else
- strcpy (loc_buf, argv[i]);
+ len = MIN(strlen(argv[i]), BUFSIZE -1);
+ *((char *) memcpy (loc_buf, argv[i], len) + len) = '\0';
}
// set up to display the documents
- for (int i = 0; i < docs.length(); i++)
+ for (unsigned int i = 0; i < docs.length(); i++)
{
(*(docs[i])).split( '-', start_doc, end_doc ) ;
doc_locator = start_doc.length() ? start_doc : end_doc ;
// allocate memory for a normal c string to pass
// through to the work proc
- document = new char[doc_locator.length()];
+ int len = doc_locator.length();
+ document = new char[len + 1];
temp = (char *)doc_locator;
- strcpy(document, temp);
+ *((char *) memcpy(document, temp, len) + len) = '\0';
XtAppAddWorkProc( window_system().app_context(),
DisplayNode_wp, document) ;
char *document;
char *temp;
- for (int i = 0; i < docs.length(); i++)
+ for (unsigned int i = 0; i < docs.length(); i++)
{
(*(docs[i])).split( '-', start_doc, end_doc ) ;
doc_locator = start_doc.length() ? start_doc : end_doc ;
// only print cares about a range of locators;
- document = new char[doc_locator.length()];
+ int len = doc_locator.length();
+ document = new char[len + 1];
temp = (char *)doc_locator;
- strcpy(document, temp);
+ *((char *) memcpy(document, temp, len) + len) = '\0';
// ... needs expansion of range here if present ...
XtAppAddWorkProc( window_system().app_context(),
mcatch (Exception &, e)
{
char buffer[256];
- sprintf (buffer,
+ snprintf (buffer, sizeof(buffer),
"Internal Error: Exception got away.\nFile: %s, Line: %d",
#ifdef C_API
e.file(), e.line());
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))
Add (name, value);
va_list argv;
va_start (argv, value);
- while (str = va_arg(argv, String))
+ while ((str = va_arg(argv, String)))
Add (str, va_arg (argv, XtArgVal));
va_end (argv);
}
Boolean found = False;
// Loop til a matching name is found or we get to the end of the array
- for (int i=0; !found && i<num_args; i++) {
+ for (unsigned int i = 0; !found && i < num_args; i++) {
a = &(*this)[i];
if ( strcmp(a->name, name) == 0 ) {
found = True;
while (XmStringGetNextSegment(context, &text, &tag, &dir, &sep)) {
if (text) {
- int textlen = strlen(text) + (sep? 1 : 0);
+ len = strlen(text);
+ int textlen = len + (sep? 1 : 0);
{ // buffer size adjustment
int bufsize_required = bufsize;
while (buflen + textlen > bufsize_required)
bufsize = bufsize_required;
}
}
- strcat(buf, text);
+ slen = strlen(buf);
+ *((char *) memcpy(buf + slen, text, len) + len) = '\0';
if (sep)
- strcat(buf, "\n");
+ *((char *) memcpy(buf + slen + 1, "\n", 1) + 1) = '\0';
buflen += textlen;
XtFree(text);