E-Wireless: Fix bad memory access

And a couple of cleanups.
This commit is contained in:
Kim Woelders 2021-08-27 18:43:37 +02:00
parent beae0b229a
commit 4f25ca8cd2
1 changed files with 5 additions and 3 deletions

View File

@ -19,7 +19,7 @@ static int *cpu_hist = NULL;
static int hist_pos = 0;
static int color = 0;
static unsigned char colors[7][3][3] = {
static const unsigned char colors[7][3][3] = {
{{0x00, 0x23, 0x00}, {0x00, 0x50, 0x00}, {0x00, 0xff, 0x00}}, //green
{{0x00, 0x00, 0x23}, {0x00, 0x00, 0x50}, {0x00, 0x00, 0xff}}, //blue
{{0x23, 0x00, 0x00}, {0x50, 0x00, 0x00}, {0xff, 0x00, 0x00}}, //red
@ -31,7 +31,7 @@ static unsigned char colors[7][3][3] = {
static void
draw_line(unsigned char *rgb, int x1, int y1, int x2, int y2,
unsigned char *clr)
const unsigned char *clr)
{
unsigned char *rptr;
int i, steep = 0, sx, sy, dx, dy, e;
@ -115,6 +115,8 @@ draw_graph(void)
j = ((hist_pos + 1) % WIDTH);
y = HEIGHT - ((HEIGHT * cpu_hist[j]) / 100);
if (y >= HEIGHT)
y = HEIGHT - 1;
for (i = 0; i < WIDTH - 1; i++)
{
j++;
@ -272,5 +274,5 @@ main(int argc, char *argv[])
Epplet_show();
Epplet_Loop();
return (0);
return 0;
}