Mercurial > hg > dmlib
changeset 1364:0d61895e1763
Cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 22 Sep 2017 23:00:32 +0300 |
parents | 3af0057f377d |
children | 60d7240e1a63 |
files | tools/lib64gfx.c |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/lib64gfx.c Fri Sep 22 16:40:43 2017 +0300 +++ b/tools/lib64gfx.c Fri Sep 22 23:00:32 2017 +0300 @@ -908,7 +908,7 @@ { const DMC64EncDecOp *op = &fmt->encdecOps[i]; Uint8 *dst = 2 + buf + op->offs; - size_t size; + size_t size, chksize; // Check operation validity if ((res = dmC64SanityCheckEncDecOp(i, op)) != DMERR_OK) @@ -925,9 +925,10 @@ } // Do we need to reallocate some more space? - if (2 + op->offs + size > allocated) + chksize = op->offs + size + 2; + if (chksize > allocated) { - size_t diff = allocated - (op->offs + size + 2), + size_t diff = allocated - chksize, grow = (diff / (BUF_SIZE_GROW - 1)) * BUF_SIZE_GROW; allocated += grow; @@ -941,8 +942,8 @@ } } - if (fmt->size == 0 && op->offs + size + 2 > *plen) - *plen = op->offs + size + 2; + if (fmt->size == 0 && chksize > *plen) + *plen = chksize; // Perform operation switch (op->type)