aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <sokolyuk@gmail.com>2023-07-26 17:31:31 +0200
committerDimitri Sokolyuk <sokolyuk@gmail.com>2023-07-26 17:31:31 +0200
commit22476d9b204ecde6e441f4eff9e4b56fb4502d50 (patch)
tree5f4644eace884f086b4d7e776ad353541f42f295
parentf52da5122ce23c514ab691283191a2670e8cd252 (diff)
Fix warnings
-rw-r--r--BarDisplay.c40
-rw-r--r--Graph.c14
-rw-r--r--GraphDisplay.c8
-rw-r--r--GraphDisplayP.h2
-rw-r--r--demomonitor.c6
5 files changed, 36 insertions, 34 deletions
diff --git a/BarDisplay.c b/BarDisplay.c
index f22b373..ffa5c7a 100644
--- a/BarDisplay.c
+++ b/BarDisplay.c
@@ -19,10 +19,10 @@ static XtResource resources[] = {
};
#undef Offset
-static void Initialize();
-static void Redisplay();
-static void ComputeSize();
-static Boolean SetValues();
+static void Initialize(Widget, Widget, ArgList, Cardinal *);
+static void Redisplay(Widget, XEvent *, Region);
+static void ComputeSize(Widget);
+static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *);
BarDisplayClassRec barDisplayClassRec = {
.object_class = {
@@ -118,45 +118,47 @@ ComputeLabelDimensions(BarDisplayObject bd,
}
static void
-ComputeSize(GraphWidget w)
+ComputeSize(Widget w)
{
- BarDisplayObject bd = (BarDisplayObject) w->composite.children[0];
+ GraphWidget gw = (GraphWidget) w;
+ BarDisplayObject bd = (BarDisplayObject) gw->composite.children[0];
Dimension label_width, total_width, label_height;
ComputeLabelDimensions(bd, &label_width, &total_width, &label_height);
- if (w->core.width == 0) {
- w->core.width = 4 * bd->barDisplay.space + total_width +
+ if (gw->core.width == 0) {
+ gw->core.width = 4 * bd->barDisplay.space + total_width +
bd->barDisplay.default_graph_width;
}
- if (w->core.height == 0) {
- w->core.height = w->graph.num_entries * (bd->barDisplay.space +
+ if (gw->core.height == 0) {
+ gw->core.height = gw->graph.num_entries * (bd->barDisplay.space +
label_height) + bd->barDisplay.space;
}
}
static void
-Redisplay(GraphWidget w,
+Redisplay(Widget w,
XEvent *event,
Region region)
{
- BarDisplayObject bd = (BarDisplayObject) w->composite.children[0];
+ GraphWidget gw = (GraphWidget) w;
+ BarDisplayObject bd = (BarDisplayObject) gw->composite.children[0];
Dimension label_width, total_width, label_height;
Boolean displayBars;
int i;
int x, y, bar_width;
char buf[100];
- int *values = w->graph.values;
- String *labels = w->graph.labels;
+ int *values = gw->graph.values;
+ String *labels = gw->graph.labels;
ComputeLabelDimensions(bd, &label_width, &total_width, &label_height);
- bar_width = w->core.width - total_width - 4 * bd->barDisplay.space;
+ bar_width = gw->core.width - total_width - 4 * bd->barDisplay.space;
displayBars = (bar_width > (int)bd->barDisplay.space);
y = bd->barDisplay.space;
- for (i = 0; i < w->graph.num_entries; i++) {
+ for (i = 0; i < gw->graph.num_entries; i++) {
if (labels != NULL) {
XDrawString(XtDisplay(w), XtWindow(w),
bd->graphDisplay.gc,
@@ -170,14 +172,14 @@ Redisplay(GraphWidget w,
if (displayBars) {
XFillRectangle(XtDisplay(w), XtWindow(w),
bd->graphDisplay.gc, x, y,
- bar_width * values[i] / w->graph.max_value,
+ bar_width * values[i] / gw->graph.max_value,
bd->graphDisplay.font->max_bounds.ascent);
- x += bar_width * values[i] / w->graph.max_value +
+ x += bar_width * values[i] / gw->graph.max_value +
bd->barDisplay.space;
}
snprintf(buf, sizeof(buf), bd->barDisplay.format,
- (float) values[i] / w->graph.scale);
+ (float) values[i] / gw->graph.scale);
XDrawString(XtDisplay(w), XtWindow(w), bd->graphDisplay.gc,
x, y + bd->graphDisplay.font->max_bounds.ascent,
buf, strlen(buf));
diff --git a/Graph.c b/Graph.c
index 6057c5f..5432bfe 100644
--- a/Graph.c
+++ b/Graph.c
@@ -21,12 +21,12 @@ static XtResource resources[] = {
#undef Offset
static void ClassInitialize();
-static void Initialize();
-static void Redisplay();
-static void Destroy();
-static void Realize();
-static void InsertChild();
-static Boolean SetValues();
+static void Initialize(Widget, Widget, ArgList, Cardinal *);
+static void Redisplay(Widget, XEvent *, Region);
+static void Destroy(Widget);
+static void Realize(Widget, XtValueMask *, XSetWindowAttributes *);
+static void InsertChild(Widget);
+static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *);
static CompositeClassExtensionRec compositeExtension = {
.next_extension = NULL,
@@ -256,7 +256,7 @@ InsertChild(Widget w)
childClass = (GraphDisplayObjectClass)XtClass(w);
if (childClass->graphDisplay_class.compute_size != NULL)
- (*childClass->graphDisplay_class.compute_size)(parent);
+ (*childClass->graphDisplay_class.compute_size)((Widget)parent);
}
static void
diff --git a/GraphDisplay.c b/GraphDisplay.c
index 7b7ed5c..f67592f 100644
--- a/GraphDisplay.c
+++ b/GraphDisplay.c
@@ -13,10 +13,10 @@ static XtResource resources[] = {
};
#undef Offset
-static void ClassPartInitialize();
-static void Initialize();
-static void Destroy();
-static Boolean SetValues();
+static void ClassPartInitialize(WidgetClass);
+static void Initialize(Widget, Widget, ArgList, Cardinal *);
+static void Destroy(Widget);
+static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *);
GraphDisplayClassRec graphDisplayClassRec = {
.object_class = {
diff --git a/GraphDisplayP.h b/GraphDisplayP.h
index 4b43b75..a2ca364 100644
--- a/GraphDisplayP.h
+++ b/GraphDisplayP.h
@@ -16,7 +16,7 @@ typedef struct _GraphDisplayRec {
GraphDisplayPart graphDisplay;
} GraphDisplayRec;
-typedef void (*ComputeSizeProc)();
+typedef void (*ComputeSizeProc)(Widget);
typedef struct {
ComputeSizeProc compute_size;
diff --git a/demomonitor.c b/demomonitor.c
index 6f61c7e..fc9b6e9 100644
--- a/demomonitor.c
+++ b/demomonitor.c
@@ -11,8 +11,8 @@ XtAppContext app;
Widget graph;
int *fields;
-void Timer();
-void CreateGraphWidget();
+void Timer(XtPointer, XtIntervalId *);
+void CreateGraphWidget(Widget);
void GetGraphData();
void quit();
@@ -32,7 +32,7 @@ XtResource resources[] = {
Offset(num_fields), XtRImmediate, (XtPointer) 3 },
{ "command", "Command", XtRString, sizeof(String),
Offset(command), XtRString,
- "vmstat 1 2 | awk '{if (NR == 4) print $(NF-2), $(NF-1), $(NF)}'" },
+ "vmstat 1 2 | awk '{if (NR == 4) print $(NF-2), $(NF-1), $(NF)}'" },
};
#undef Offset