diff --git a/Makefile b/Makefile index fa7f7d9..a35d8e4 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CC = gcc BIN = /usr/bin INCLUDES = -I. -CFLAGS = -O3 -g -Wall -Wextra $(INCLUDES) +CFLAGS = -O3 -g -Wall -Wextra -Wno-missing-field-initializers $(INCLUDES) OBJS = main.o image.o dsp.o filter.o reg.o pngio.o median.o color.o aptdec: $(OBJS) diff --git a/pngio.c b/pngio.c index 0eb5c3e..086afac 100644 --- a/pngio.c +++ b/pngio.c @@ -277,8 +277,8 @@ int applyUserPalette(float **prow, int nrow, char *filename, rgb_t **crow){ for(int y = 0; y < nrow; y++){ for(int x = 0; x < CH_WIDTH; x++){ int cha = prow[y][x + CHA_OFFSET]; - int cbb = prow[y][x + CHB_OFFSET]; - crow[y][x + CHA_OFFSET] = pal_row[cbb][cha]; + int chb = prow[y][x + CHB_OFFSET]; + crow[y][x + CHA_OFFSET] = pal_row[chb][cha]; } } @@ -293,7 +293,6 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c sprintf(outName, "%s/%s", opts->path, opts->filename); } - #pragma GCC diagnostic ignored "-Wunused-result" png_text meta[] = { {PNG_TEXT_COMPRESSION_NONE, "Software", VERSION}, {PNG_TEXT_COMPRESSION_NONE, "Channel", desc, sizeof(desc)}, @@ -340,8 +339,8 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c } if(opts->map != NULL && opts->map[0] != '\0'){ - greyscale = 0; - } + greyscale = 0; + } FILE *pngfile; @@ -384,15 +383,15 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c png_write_info(png_ptr, info_ptr); // Move prow into crow, crow ~ color rows, if required - rgb_t *crow[img->nrow]; - if(!greyscale){ - prow2crow(img->prow, img->nrow, palette, crow); - } - + rgb_t *crow[MAX_HEIGHT]; + if(!greyscale){ + prow2crow(img->prow, img->nrow, palette, crow); + } + // Apply a user provided color palette if(CONTAINS(opts->type, Palleted)){ applyUserPalette(img->prow, img->nrow, opts->palette, crow); - } + } // Precipitation overlay if(CONTAINS(opts->effects, Precipitation_Overlay)){ @@ -417,7 +416,6 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c printf("Writing %s", outName); - // Float power macro (for gamma adjustment) #define POWF(a, b) (b == 1.0 ? a : exp(b * log(a))) float a = POWF(255, opts->gamma)/255;