-/*
+/*
*------------------------------------------------------------------
* Copyright (c) 2005-2016 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
gtk_widget_show(s_nonebutton);
gtk_signal_connect (GTK_OBJECT(s_allbutton), "clicked",
- GTK_SIGNAL_FUNC(button_click_callback),
+ GTK_SIGNAL_FUNC(button_click_callback),
(gpointer) ALL_BUTTON);
gtk_signal_connect (GTK_OBJECT(s_nonebutton), "clicked",
- GTK_SIGNAL_FUNC(button_click_callback),
+ GTK_SIGNAL_FUNC(button_click_callback),
(gpointer) NONE_BUTTON);
- gtk_box_pack_start(GTK_BOX(s_pointselbuttons), s_allbutton, FALSE,
+ gtk_box_pack_start(GTK_BOX(s_pointselbuttons), s_allbutton, FALSE,
FALSE, 0);
- gtk_box_pack_start(GTK_BOX(s_pointselbuttons), s_nonebutton, FALSE,
+ gtk_box_pack_start(GTK_BOX(s_pointselbuttons), s_nonebutton, FALSE,
FALSE, 0);
-
+
gtk_widget_show(s_pointselbuttons);
- gtk_widget_ref(s_pointselbuttons);
+ gtk_widget_ref(s_pointselbuttons);
- gtk_box_pack_start(GTK_BOX(s_pointselbox), s_pointselbuttons, FALSE,
+ gtk_box_pack_start(GTK_BOX(s_pointselbox), s_pointselbuttons, FALSE,
FALSE, 0);
- gtk_box_pack_end (GTK_BOX(g_mainhbox), s_pointselbox,
+ gtk_box_pack_end (GTK_BOX(g_mainhbox), s_pointselbox,
FALSE, FALSE, 0);
- s_ps_vsadj = gtk_adjustment_new(0.0 /* initial value */,
+ s_ps_vsadj = gtk_adjustment_new(0.0 /* initial value */,
0.0 /* minimum value */,
2000.0 /* maximum value */,
- 0.1 /* step increment */,
- 10.0/* page increment */,
+ 0.1 /* step increment */,
+ 10.0/* page increment */,
10.0/* page size */);
-
+
s_ps_vscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT(s_ps_vsadj));
gtk_signal_connect (GTK_OBJECT (s_ps_vsadj), "value-changed",
- GTK_SIGNAL_FUNC (scroll_callback),
+ GTK_SIGNAL_FUNC (scroll_callback),
(gpointer)s_ps_vscroll);
gtk_box_pack_end(GTK_BOX(g_mainhbox), s_ps_vscroll, FALSE, FALSE, 0);
}
gtk_widget_hide(s_pointselbox);
gtk_widget_hide(s_pointselbuttons);
gtk_widget_hide(s_ps_vscroll);
- gtk_container_remove(GTK_CONTAINER(s_pointselbox),
+ gtk_container_remove(GTK_CONTAINER(s_pointselbox),
s_pointselbuttons);
-
+
for (i = 0; i < g_neventdefs; i++) {
if (s_event_buttons[i]) {
- gtk_container_remove(GTK_CONTAINER(s_pointselbox),
+ gtk_container_remove(GTK_CONTAINER(s_pointselbox),
s_event_buttons[i]);
s_event_buttons[i] = 0;
}
for (i = 0; i < g_neventdefs; i++) {
ep = &g_eventdefs[i];
- sprintf(tmpbuf, "[%lu] %s", ep->event,
+ snprintf(tmpbuf, sizeof(tmpbuf), "[%lu] %s", ep->event,
ep->name ? ep->name : "(none)");
/* Hack to reduce width of point selectors */
if (strlen(tmpbuf) > 50) {
wp = gtk_check_button_new_with_label (tmpbuf);
s_event_buttons[i] = wp;
gtk_signal_connect (GTK_OBJECT(wp), "toggled",
- GTK_SIGNAL_FUNC(point_select_callback),
+ GTK_SIGNAL_FUNC(point_select_callback),
(gpointer) (unsigned long long) i);
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON(wp), TRUE);
s_min_shown_pointsel = 1;
up_button();
- gtk_box_pack_start(GTK_BOX(s_pointselbox), s_pointselbuttons, FALSE,
+ gtk_box_pack_start(GTK_BOX(s_pointselbox), s_pointselbuttons, FALSE,
FALSE, 0);
gtk_widget_show(s_pointselbuttons);
gtk_widget_show(s_pointselbox);
g_error("Too many event definitions, increase NEVENTS!");
/*NOTREACHED*/
}
-
+
/* Simple dup check, probably not needed very often */
for (i = 0; i < g_neventdefs; i++) {
if (g_eventdefs[i].event == event) {
* add_event_from_cpel_file
****************************************************************************/
-void add_event_from_cpel_file(ulong event, char *event_format,
+void add_event_from_cpel_file(ulong event, char *event_format,
char *datum_format)
{
event_def_t *ep;
/*
* Duplicate the strings for backward compatibility. Otherwise,
* the g_free above will barf because the name/format strings are
- * actually in mmap'ed memory
+ * actually in mmap'ed memory
*/
ep->name = sxerox(event_format);
ep->format = sxerox(datum_format);
* add_event_from_clib_file
****************************************************************************/
-void add_event_from_clib_file(unsigned int event, char *name,
+void add_event_from_clib_file(unsigned int event, char *name,
unsigned int vec_index)
{
event_def_t *ep;
/* skip ws after #define */
while (*cp && isspace ((int)*cp))
cp++;
-
+
if (*cp == 0)
continue;
/* skip ws after symbolic name */
while (*cp && isspace ((int)*cp))
cp++;
-
+
if (*cp == 0)
continue;
while (*cp && *cp != '(')
cp++;
-
+
if (*cp == 0)
continue;
- cp++;
+ cp++;
while (*cp && isspace ((int)*cp))
cp++;
-
- }
+
+ }
/* eat event code. */
while (*cp && isdigit ((int)*cp))
/* skip ws after event code */
while (*cp && isspace ((int)*cp))
cp++;
-
+
if (*cp != '/')
continue;
continue;
*cp++ = 0;
-
+
/* skip ws after name: */
while (*cp && isspace ((int)*cp))
cp++;
-
+
if (*cp == 0 || *cp == '/')
{
format = " ";
}
format = cp;
-
+
/* accumulate format string */
while (*cp && !isspace ((int)*cp))
cp++;
/* skip ws after EV_COMPxxx_START */
while (*cp && isspace ((int)*cp))
cp++;
-
+
if (*cp == 0)
continue;
-
+
basenum = atol (cp);
-
+
/* skip #define */
while (*cp && (*cp != '/'))
cp++;
while (*cp && !isspace ((int)*cp))
cp++;
-
+
*cp = 0;
s_hfp = fopen (name, "rt");
s_elog_hfp = fopen (filename, "rt");
if (s_elog_hfp == NULL) {
- sprintf (tmpbuf, "Couldn't open %s\n", filename);
+ snprintf (tmpbuf, sizeof(tmpbuf), "Couldn't open %s\n", filename);
infobox ("Open Failed", tmpbuf);
return(FALSE);
}
s_hfp = fopen (filename, "rt");
if (s_hfp == NULL) {
- sprintf (tmpbuf, "Couldn't open %s\n", filename);
+ snprintf (tmpbuf, sizeof(tmpbuf), "Couldn't open %s\n", filename);
infobox ("Read Event Definition Failure", tmpbuf);
return(FALSE);
}
/* Happens if the user feeds us the wrong file, for example */
if (g_neventdefs == 0) {
- sprintf (tmpbuf, "No event definitions found in %s\n", filename);
+ snprintf (tmpbuf, sizeof(tmpbuf),
+ "No event definitions found in %s\n", filename);
infobox ("No Event Definitions?", tmpbuf);
return(FALSE);
}
index = (bottom + top) / 2;
edp = (g_eventdefs + index);
-
+
if (edp->event == code)
return(edp);
edp->selected = TRUE;
edp->event = code;
edp->format = "0x%x";
- sprintf (dummy_string, "E%lu", code);
+ snprintf (dummy_string, sizeof(dummy_string), "E%lu", code);
edp->name = &dummy_string[0];
return(edp);
}
if (edp->event < code)
top = index + 1;
- else
+ else
bottom = index - 1;
}
}
void pointsel_next_snapshot(void)
{
int i;
-
+
for (i = 0; i < g_neventdefs; i++) {
gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON(s_event_buttons[i]),
+ GTK_TOGGLE_BUTTON(s_event_buttons[i]),
g_eventdefs[i].selected);
}
}
void pointsel_about (char *tmpbuf)
{
- sprintf (tmpbuf+strlen(tmpbuf), "%d event definitions\n",
+ snprintf (tmpbuf+strlen(tmpbuf), 128, "%d event definitions\n",
g_neventdefs);
}