fixed compile errors and a segfault on exit

This commit is contained in:
Amy G. Bowersox 2019-12-06 23:34:34 -07:00
parent 7b1c8dd5bb
commit 82ca8371e6
4 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,6 @@
OBJS=main.o sysinput.o fbinit.o fbprimitive.o log.o gpio.o msg_queue.o time_func.o config.o splash.o
LIBS=-lbcm2835 -lpthread
CFLAGS=-g
upiwin: $(OBJS)
gcc -o upiwin $(OBJS) $(LIBS)

View File

@ -46,8 +46,9 @@ static void run_exit_funcs(void)
{
p = exitfuncs;
exitfuncs = p->next;
for (i = p->num_funcs - 1; i >= 0; i++)
(*(p->funcs[i]))();
for (i = p->num_funcs - 1; i >= 0; i--)
if (p->funcs[i])
(*(p->funcs[i]))();
free(p);
}
}

View File

@ -73,10 +73,10 @@ void Fb_line(INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color, BOOL xor)
void Fb_rectangle(INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color, BOOL xor)
{
FB_line(x1, y1, x2, y1, color, xor);
FB_line(x2, y1 + 1, x2, y2 - 1, color, xor);
FB_line(x1, y2, x2, y2, color, xor);
FB_line(x1, y1 + 1, x1, y2 - 1, color, xor);
Fb_line(x1, y1, x2, y1, color, xor);
Fb_line(x2, y1 + 1, x2, y2 - 1, color, xor);
Fb_line(x1, y2, x2, y2, color, xor);
Fb_line(x1, y1 + 1, x1, y2 - 1, color, xor);
}
void Fb_filled_rectangle(INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color, BOOL xor)

View File

@ -14,10 +14,10 @@ static void do_draw(void)
{
Fb_filled_rectangle(10, 10, 50, 50, FBPRIMCLR_RED, FALSE);
Fb_filled_rectangle(60, 10, 100, 50, FBPRIMCLR_GREEN, FALSE);
Fb_filled_rectangle(110, 10, 160, 50, FBPRIMCLR_BLUE, FALSE);
Fb_filled_rectangle(110, 10, 150, 50, FBPRIMCLR_BLUE, FALSE);
Fb_filled_rectangle(10, 60, 50, 100, FBPRIMCLR_CYAN, FALSE);
Fb_filled_rectangle(60, 60, 100, 100, FBPRIMCLR_MAGENTA, FALSE);
Fb_filled_rectangle(110, 60, 160, 100, FBPRIMCLR_YELLOW, FALSE);
Fb_filled_rectangle(110, 60, 150, 100, FBPRIMCLR_YELLOW, FALSE);
}
int main(int argc, char *argv[])