libansilove

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

commit 15849ba2022ea96b81f86f7a56c610d1fd2c3c05
parent c1b0ca7e32ca88d58964044beade824381bdcf42
Author: Frederic Cambus <fred@statdns.com>
Date:   Wed, 24 Oct 2018 19:06:47 +0200

Add error checking for the output function

Diffstat:
MTODO | 1-
Msrc/loaders/ansi.c | 3++-
Msrc/loaders/artworx.c | 4+---
Msrc/loaders/binary.c | 4+---
Msrc/loaders/icedraw.c | 3++-
Msrc/loaders/pcboard.c | 3++-
Msrc/loaders/tundra.c | 5+----
Msrc/loaders/xbin.c | 3++-
8 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/TODO b/TODO @@ -11,5 +11,4 @@ - Fuzz with AFL, especially for non ANSI formats - Allow enabling DOS aspect ratio + retina at the same time - Split fonts to have one include file per font -- Add error checking for the output function - Check for the TUNDRA24 string in TND files header diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -500,7 +500,8 @@ int ansilove_ansi(struct ansilove_ctx *ctx, struct ansilove_options *options) gdImageColorTransparent(canvas, 0); // create output image - output(ctx, options, canvas); + if (output(ctx, options, canvas) != 0) + return -1; // free memory free(ansi_buffer); diff --git a/src/loaders/artworx.c b/src/loaders/artworx.c @@ -79,7 +79,5 @@ int ansilove_artworx(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output file - output(ctx, options, canvas); - - return 0; + return output(ctx, options, canvas); } diff --git a/src/loaders/binary.c b/src/loaders/binary.c @@ -85,7 +85,5 @@ int ansilove_binary(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output image - output(ctx, options, canvas); - - return 0; + return output(ctx, options, canvas); } diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -129,7 +129,8 @@ int ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output file - output(ctx, options, canvas); + if (output(ctx, options, canvas) != 0) + return -1; // free memory free(idf_buffer); diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c @@ -179,7 +179,8 @@ int ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output image - output(ctx, options, canvas); + if (output(ctx, options, canvas) != 0) + return -1; // free memory free(pcboard_buffer); diff --git a/src/loaders/tundra.c b/src/loaders/tundra.c @@ -190,8 +190,5 @@ int ansilove_tundra(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output image - output(ctx, options, canvas); - - return 0; + return output(ctx, options, canvas); } - diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c @@ -175,7 +175,8 @@ int ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output file - output(ctx, options, canvas); + if (output(ctx, options, canvas) != 0) + return -1; // nuke garbage free(font_data_xbin);