kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16-epplets.git/commit/?id=4f25ca8cd2265b1bbcf0ae71fb6102de01648cb8

commit 4f25ca8cd2265b1bbcf0ae71fb6102de01648cb8
Author: Kim Woelders <k...@woelders.dk>
Date:   Fri Aug 27 18:43:37 2021 +0200

    E-Wireless: Fix bad memory access
    
    And a couple of cleanups.
---
 epplets/E-Wireless.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/epplets/E-Wireless.c b/epplets/E-Wireless.c
index d90efe7..2020834 100644
--- a/epplets/E-Wireless.c
+++ b/epplets/E-Wireless.c
@@ -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;
 }

-- 


Reply via email to