# HG changeset patch # User Matti Hamalainen # Date 1578613546 -7200 # Node ID 0b1928ed902fb95a5fbbb5fd35c8fe277396865d # Parent 698ee976fb235420ce5687c0ff96a26c6d3f63f7 Merge dmC64ImageGetNumBlocks() into dmC64SetupImageData(). diff -r 698ee976fb23 -r 0b1928ed902f tools/lib64gfx.c --- a/tools/lib64gfx.c Fri Jan 10 01:37:41 2020 +0200 +++ b/tools/lib64gfx.c Fri Jan 10 01:45:46 2020 +0200 @@ -96,23 +96,6 @@ } -int dmC64ImageGetNumBlocks(const DMC64ImageFormat *fmt) -{ - int nblocks = 0; - for (int i = 0; i < D64_MAX_ENCDEC_OPS; i++) - { - const DMC64EncDecOp *op = fmtGetEncDecOp(fmt, i); - if (op->type == DO_LAST) - break; - - if (op->bank > nblocks) - nblocks = op->bank; - } - - return nblocks + 1; -} - - int dmC64MemBlockAlloc(DMC64MemBlock *blk, const size_t size) { if ((blk->data = dmMalloc0(size)) == NULL) @@ -167,8 +150,19 @@ static void dmC64SetupImageData(DMC64Image *img, const DMC64ImageFormat *fmt) { + int nblocks = 0; + for (int i = 0; i < D64_MAX_ENCDEC_OPS; i++) + { + const DMC64EncDecOp *op = fmtGetEncDecOp(fmt, i); + if (op->type == DO_LAST) + break; + + if (op->bank > nblocks) + nblocks = op->bank; + } + img->fmt = fmt->format; - img->nblocks = dmC64ImageGetNumBlocks(fmt); + img->nblocks = nblocks + 1; dmMemset(img->extraInfo, 0, sizeof(img->extraInfo)); img->extraInfo[D64_EI_MODE] = fmt->format->mode; diff -r 698ee976fb23 -r 0b1928ed902f tools/lib64gfx.h --- a/tools/lib64gfx.h Fri Jan 10 01:37:41 2020 +0200 +++ b/tools/lib64gfx.h Fri Jan 10 01:45:46 2020 +0200 @@ -415,8 +415,6 @@ const int width, const int height, const BOOL multicolor, const int *colors); -int dmC64ImageGetNumBlocks(const DMC64ImageFormat *fmt); - const char *dmC64GetOpSubjectName(const int subject); const DMC64MemBlock * dmC64GetOpMemBlock(const DMC64Image *img, const int subject, const int bank); int dmC64SanityCheckEncDecOp(const int i, const DMC64EncDecOp *op, const DMC64Image *img);