libansilove

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

commit 2b52d536f1776644870c085827555188da762b4d
parent bda7fd7d9640d69a6889818bd9ce978010a2ce60
Author: Frederic Cambus <fred@statdns.com>
Date:   Sat, 30 Jun 2018 00:06:31 +0200

Change return value of the loaders to int, for error handling

Diffstat:
Minclude/ansilove.h | 14+++++++-------
Msrc/loaders/ansi.c | 4+++-
Msrc/loaders/artworx.c | 4+++-
Msrc/loaders/binary.c | 4+++-
Msrc/loaders/icedraw.c | 4+++-
Msrc/loaders/pcboard.c | 4+++-
Msrc/loaders/tundra.c | 4+++-
Msrc/loaders/xbin.c | 4+++-
8 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/include/ansilove.h b/include/ansilove.h @@ -33,12 +33,12 @@ struct output { uint32_t retinaScaleFactor; }; -void ansi(struct input *, struct output *); -void artworx(struct input *, struct output *); -void binary(struct input *, struct output *); -void icedraw(struct input *, struct output *); -void pcboard(struct input *, struct output *); -void tundra(struct input *, struct output *); -void xbin(struct input *, struct output *); +int ansi(struct input *, struct output *); +int artworx(struct input *, struct output *); +int binary(struct input *, struct output *); +int icedraw(struct input *, struct output *); +int pcboard(struct input *, struct output *); +int tundra(struct input *, struct output *); +int xbin(struct input *, struct output *); #endif diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -25,7 +25,7 @@ struct ansiChar { bool underline; }; -void ansi(struct input *inputFile, struct output *outputFile) +int ansi(struct input *inputFile, struct output *outputFile) { // ladies and gentlemen, it's type declaration time struct fontStruct fontData; @@ -491,4 +491,6 @@ void ansi(struct input *inputFile, struct output *outputFile) // free memory free(ansi_buffer); + + return 0; } diff --git a/src/loaders/artworx.c b/src/loaders/artworx.c @@ -11,7 +11,7 @@ #include "../ansilove.h" -void artworx(struct input *inputFile, struct output *outputFile) +int artworx(struct input *inputFile, struct output *outputFile) { // libgd image pointers gdImagePtr canvas; @@ -69,4 +69,6 @@ void artworx(struct input *inputFile, struct output *outputFile) // create output file output(canvas, outputFile->fileName, outputFile->retina, outputFile->retinaScaleFactor); + + return 0; } diff --git a/src/loaders/binary.c b/src/loaders/binary.c @@ -11,7 +11,7 @@ #include "../ansilove.h" -void binary(struct input *inputFile, struct output *outputFile) +int binary(struct input *inputFile, struct output *outputFile) { // binary files must have an even size if (inputFile->size % 2) { @@ -79,4 +79,6 @@ void binary(struct input *inputFile, struct output *outputFile) // create output image output(canvas, outputFile->fileName, outputFile->retina, outputFile->retinaScaleFactor); + + return 0; } diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -11,7 +11,7 @@ #include "../ansilove.h" -void icedraw(struct input *inputFile, struct output *outputFile) +int icedraw(struct input *inputFile, struct output *outputFile) { // extract relevant part of the IDF header, 16-bit endian unsigned short int32_t x2 = (inputFile->data[9] << 8) + inputFile->data[8]; @@ -127,4 +127,6 @@ void icedraw(struct input *inputFile, struct output *outputFile) // free memory free(idf_buffer); + + return 0; } diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c @@ -20,7 +20,7 @@ struct pcbChar { int32_t current_character; }; -void pcboard(struct input *inputFile, struct output *outputFile) +int pcboard(struct input *inputFile, struct output *outputFile) { // some type declarations struct fontStruct fontData; @@ -181,4 +181,6 @@ void pcboard(struct input *inputFile, struct output *outputFile) // free memory free(pcboard_buffer); + + return 0; } diff --git a/src/loaders/tundra.c b/src/loaders/tundra.c @@ -11,7 +11,7 @@ #include "../ansilove.h" -void tundra(struct input *inputFile, struct output *outputFile) +int tundra(struct input *inputFile, struct output *outputFile) { // some type declarations struct fontStruct fontData; @@ -174,5 +174,7 @@ void tundra(struct input *inputFile, struct output *outputFile) // create output image output(canvas, outputFile->fileName, outputFile->retina, outputFile->retinaScaleFactor); + + return 0; } diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c @@ -11,7 +11,7 @@ #include "../ansilove.h" -void xbin(struct input *inputFile, struct output *outputFile) +int xbin(struct input *inputFile, struct output *outputFile) { const unsigned char *font_data; unsigned char *font_data_xbin = NULL; @@ -180,4 +180,6 @@ void xbin(struct input *inputFile, struct output *outputFile) // nuke garbage free(font_data_xbin); + + return 0; }