# HG changeset patch # User Matti Hamalainen # Date 1530004808 -10800 # Node ID 74405ff6bc4af8a5bab8bbb098ba4e30c358b6da # Parent 636d3c8bcd35379a2815d8015d281a1384cf8fcc Cleanups. diff -r 636d3c8bcd35 -r 74405ff6bc4a tools/libgfx.c --- a/tools/libgfx.c Tue Jun 26 05:03:55 2018 +0300 +++ b/tools/libgfx.c Tue Jun 26 12:20:08 2018 +0300 @@ -1975,9 +1975,10 @@ { if (mode == DMODE_LIT) { - if (offs - *l_offs > *r_count || flush) + size_t l_count = offs - *l_offs; + if (l_count > *r_count || flush) { - size_t count = (offs - *l_offs) - *r_count; + size_t count = l_count - *r_count; Sint8 tmp = count - 1; if (!dmf_write_byte(fp, tmp) || @@ -2086,10 +2087,9 @@ } } - // Write mask data + // Write mask data, if any if (iff->bmhd.masking == IFF_MASK_HAS_MASK) { - // Encode bitplane dmMemset(buf, 0, bufLen); for (int xc = 0; xc < img->width; xc++)