changeset 2398:0b1928ed902f

Merge dmC64ImageGetNumBlocks() into dmC64SetupImageData().
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 10 Jan 2020 01:45:46 +0200
parents 698ee976fb23
children 5d391c31ebc9
files tools/lib64gfx.c tools/lib64gfx.h
diffstat 2 files changed, 12 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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);