projects
/
monky
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Another off-by-one found by valgrind.
[monky]
/
src
/
specials.c
diff --git
a/src/specials.c
b/src/specials.c
index
9a30b66
..
3fa6e0b
100644
(file)
--- a/
src/specials.c
+++ b/
src/specials.c
@@
-10,7
+10,7
@@
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
- * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
+ * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
* (see AUTHORS)
* All rights reserved.
*
@@
-324,7
+324,6
@@
static void graph_append(struct special_t *graph, double f, char showaslog)
f = graph->graph_scale;
}
f = graph->graph_scale;
}
- graph->graph[0] = f; /* add new data */
/* shift all the data by 1 */
for (i = graph->graph_width - 1; i > 0; i--) {
graph->graph[i] = graph->graph[i - 1];
/* shift all the data by 1 */
for (i = graph->graph_width - 1; i > 0; i--) {
graph->graph[i] = graph->graph[i - 1];
@@
-333,9
+332,10
@@
static void graph_append(struct special_t *graph, double f, char showaslog)
graph->graph_scale = graph->graph[i - 1];
}
}
graph->graph_scale = graph->graph[i - 1];
}
}
- if (graph->scaled && graph->graph[graph->graph_width] > graph->graph_scale) {
+ graph->graph[0] = f; /* add new data */
+ if (graph->scaled && graph->graph[0] > graph->graph_scale) {
/* check if we need to update the scale */
/* check if we need to update the scale */
- graph->graph_scale = graph->graph[graph->graph_width];
+ graph->graph_scale = graph->graph[0];
}
}
}
}
@@
-491,17
+491,11
@@
static void new_bar_in_x11(struct text_object *obj, char *buf, int usage)
struct special_t *s = 0;
struct bar *b = obj->special_data;
struct special_t *s = 0;
struct bar *b = obj->special_data;
- if ((output_methods & TO_X) == 0)
- return;
-
- if (!b)
- return;
-
s = new_special(buf, BAR);
s->arg = usage;
s = new_special(buf, BAR);
s->arg = usage;
- s->width = b->width;
- s->height = b->height;
+ s->width = b ? b->width : default_bar_width;
+ s->height = b ? b->height : default_bar_height;
}
#endif /* X11 */
}
#endif /* X11 */