From 3ecedd11dd869d38588c149c1bf6f3fd48070ce0 Mon Sep 17 00:00:00 2001 From: Colin Dean Date: Sun, 8 Apr 2018 11:49:07 -0400 Subject: [PATCH 1/3] Silences a few build warnings --- font.h | 2 +- optar.c | 2 +- unoptar.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/font.h b/font.h index 49e0b7a..77a7ae1 100644 --- a/font.h +++ b/font.h @@ -269,7 +269,7 @@ static char header_data_cmap[256][3] = { {255,255,255}, {255,255,255} }; -static char header_data[] = { +static char header_data[36000] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, diff --git a/optar.c b/optar.c index b7739ad..c6c9d13 100644 --- a/optar.c +++ b/optar.c @@ -16,7 +16,7 @@ #define HEIGHT (2*BORDER+DATA_HEIGHT+TEXT_HEIGHT) #define TEXT_HEIGHT 24 -static unsigned char ary[WIDTH*HEIGHT]; +static unsigned char ary[WIDTH * HEIGHT]; static unsigned char *file_label=(unsigned char *)""; /* The filename written in the file_label */ static char *output_filename; /* The output filename */ diff --git a/unoptar.c b/unoptar.c index 5cd6e76..afcead7 100644 --- a/unoptar.c +++ b/unoptar.c @@ -316,7 +316,7 @@ static double angle(double x, double y) { double deg; - if (abs(x)>abs(y)){ + if (fabs(x)>fabs(y)){ /* Horizontal */ deg=180/M_PI*asin(y); if (x<0) deg=180-deg; From a3f7e4765f80f6c2f2b5ad28568dac946cbfaaac Mon Sep 17 00:00:00 2001 From: Colin Dean Date: Sun, 8 Apr 2018 12:01:21 -0400 Subject: [PATCH 2/3] Adds some compiler-specific configuration Mostly to silence warnings. I hate buzzers going off! --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dc32b61..cd6b04c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,14 @@ CC?=gcc LDFLAGS=-lm -CFLAGS=-O3 -Wall -Wuninitialized -fomit-frame-pointer -funroll-loops \ - -fstrength-reduce -DNODEBUG `libpng-config --I_opts` +ifeq ($(CC), gcc) + SPECIFIC_CFLAGS=-fstrength-reduce +else + SPECIFIC_CFLAGS= +endif +CFLAGS=-O3 -Wall -Wuninitialized \ + -fomit-frame-pointer -funroll-loops \ + $(SPECIFIC_CFLAGS) \ + -DNODEBUG `libpng-config --I_opts` all: optar unoptar From 9c8379c25466bf142459a26b0f34521bdde2af12 Mon Sep 17 00:00:00 2001 From: Colin Dean Date: Sun, 8 Apr 2018 12:03:44 -0400 Subject: [PATCH 3/3] Explicitly declares variable types for ints GCC 7 discourages implicit typing --- optar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/optar.c b/optar.c index c6c9d13..1f2cba1 100644 --- a/optar.c +++ b/optar.c @@ -109,7 +109,7 @@ void border(void) memset(ptr,0,BORDER*WIDTH); } -void cross(x,y) +void cross(int x, int y) { unsigned char *ptr=ary+y*WIDTH+x; unsigned c; @@ -132,7 +132,7 @@ void crosses(void) } /* x is in the range 0 to DATA_WIDTH-1 */ -void text_block (destx, srcx, width) +void text_block (int destx, int srcx, int width) { int x, y; unsigned char *srcptr;