libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

commit 741e4985cdd450ee41b148c004e3ead48913b356
parent 31f9e2fbd08ce4a315d930004ade5a99c9a0d153
Author: Frederic Cambus <fred@statdns.com>
Date:   Thu, 14 Jun 2018 23:00:59 +0200

Remove useless braces

Diffstat:
Msrc/drawchar.c | 2--
Msrc/loaders/ansi.c | 33+++------------------------------
Msrc/loaders/binary.c | 2--
Msrc/loaders/pcboard.c | 8--------
Msrc/loaders/tundra.c | 4----
Msrc/loaders/xbin.c | 3+--
6 files changed, 4 insertions(+), 48 deletions(-)

diff --git a/src/drawchar.c b/src/drawchar.c @@ -28,9 +28,7 @@ void drawchar(gdImagePtr im, const unsigned char *font_data, int32_t bits, gdImageSetPixel(im, column * bits + x, row*height + y, foreground); if (bits == 9 && x == 7 && character > 191 && character < 224) - { gdImageSetPixel(im, column * bits + 8, row * height + y, foreground); - } } } } diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -54,9 +54,8 @@ void ansi(struct input *inputFile, struct output *outputFile) } // check if current file has a .diz extension - if (!strcmp(inputFile->fext, ".diz")) { + if (!strcmp(inputFile->fext, ".diz")) isDizFile = true; - } // libgd image pointers gdImagePtr canvas; @@ -119,15 +118,11 @@ void ansi(struct input *inputFile, struct output *outputFile) // tab if (current_character == 9) - { column += 8; - } // sub if (current_character == 26) - { break; - } // ANSi sequence if (current_character == 27 && next_character == 91) @@ -209,9 +204,7 @@ void ansi(struct input *inputFile, struct output *outputFile) column += seq_column ? seq_column : 1; if (column > 80) - { column = 80; - } loop += ansi_sequence_loop+2; break; @@ -230,9 +223,7 @@ void ansi(struct input *inputFile, struct output *outputFile) column -= seq_column ? seq_column : 1; if (column < 0) - { column = 0; - } loop += ansi_sequence_loop+2; break; @@ -321,21 +312,16 @@ void ansi(struct input *inputFile, struct output *outputFile) } if (seqValue == 3) - { italics = true; - } if (seqValue == 4) - { underline = true; - } if (seqValue == 5) { if (!workbench) - { background += 8; - } + blink = true; } @@ -344,9 +330,7 @@ void ansi(struct input *inputFile, struct output *outputFile) foreground = seqValue - 30; if (bold) - { foreground += 8; - } } if (seqValue > 39 && seqValue < 48) @@ -354,9 +338,7 @@ void ansi(struct input *inputFile, struct output *outputFile) background = seqValue - 40; if (blink && outputFile->icecolors) - { background += 8; - } } } @@ -390,14 +372,10 @@ void ansi(struct input *inputFile, struct output *outputFile) { // record number of columns and lines used if (column > columnMax) - { columnMax = column; - } if (row > rowMax) - { rowMax = row; - } // write current character in ansiChar structure if (!fontData.isAmigaFont || (current_character != 12 && current_character != 13)) @@ -427,13 +405,10 @@ void ansi(struct input *inputFile, struct output *outputFile) rowMax++; if (ced) - { columns = 78; - } - if (isDizFile) { + if (isDizFile) columns = fmin(columnMax, 80); - } // create that damn thingy canvas = gdImageCreate(columns * outputFile->bits, (rowMax)*fontData.height); @@ -502,9 +477,7 @@ void ansi(struct input *inputFile, struct output *outputFile) // transparent flag used? if (transparent) - { gdImageColorTransparent(canvas, 0); - } // create output image output(canvas, outputFile->fileName, outputFile->retina, outputFile->retinaScaleFactor); diff --git a/src/loaders/binary.c b/src/loaders/binary.c @@ -68,9 +68,7 @@ void binary(struct input *inputFile, struct output *outputFile) foreground = (attribute & 15); if (background > 8 && !outputFile->icecolors) - { background -= 8; - } drawchar(canvas, fontData.font_data, outputFile->bits, fontData.height, column, row, colors[background], colors[foreground], character); diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c @@ -74,15 +74,11 @@ void pcboard(struct input *inputFile, struct output *outputFile) // Tab if (current_character == 9) - { column += 8; - } // Sub if (current_character == 26) - { break; - } // PCB sequence if (current_character == 64 && next_character == 88) @@ -123,14 +119,10 @@ void pcboard(struct input *inputFile, struct output *outputFile) { // record number of columns and lines used if (column > columnMax) - { columnMax = column; - } if (row > rowMax) - { rowMax = row; - } // reallocate structure array memory temp = realloc(pcboard_buffer, (structIndex + 1) * sizeof (struct pcbChar)); diff --git a/src/loaders/tundra.c b/src/loaders/tundra.c @@ -30,9 +30,7 @@ void tundra(struct input *inputFile, struct output *outputFile) // need to add check for "TUNDRA24" string in the header if (tundra_version != 24) - { fputs("\nInput file is not a TUNDRA file.\n\n", stderr); exit(4); - } // read tundra file a first time to find the image size uint32_t character, background = 0, foreground = 0; @@ -83,9 +81,7 @@ void tundra(struct input *inputFile, struct output *outputFile) } if (character != 1 && character != 2 && character != 4 && character != 6) - { column++; - } loop++; } diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c @@ -16,9 +16,8 @@ void xbin(struct input *inputFile, struct output *outputFile) const unsigned char *font_data; unsigned char *font_data_xbin = NULL; - if (strncmp((char *)inputFile->data, "XBIN\x1a", 5) != 0) { + if (strncmp((char *)inputFile->data, "XBIN\x1a", 5) != 0) fputs("\nNot an XBin.\n\n", stderr); exit(4); - } int32_t xbin_width = (inputFile->data[6] << 8) + inputFile->data[5]; int32_t xbin_height = (inputFile->data[8] << 8) + inputFile->data[7];