libansilove

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

commit 48c55c5c1e7823c69a2ed20eee52754700699083
parent 77517f05d1a908f3c0c2f8ad1fccf7f093d0940c
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon,  8 Oct 2018 22:33:06 +0200

Since column is now uint32_t, remove always false check and add check for integer underflow

Diffstat:
Msrc/loaders/ansi.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -214,10 +214,10 @@ int ansilove_ansi(struct ansilove_ctx *ctx, struct ansilove_options *options) uint32_t seq_column = strtonum(seqGrab, 0, UINT32_MAX, &errstr); free(seqGrab); - column -= seq_column ? seq_column : 1; - - if (column < 0) - column = 0; + if (seq_column && (column - seq_column) >= 0) + column -= seq_column; + else if (column > 0) + column--; loop += ansi_sequence_loop+2; break;