changeset 1591:3cc7b2aadda3

Add inline helper function fmtGetEncDecOp() and use it.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 14 May 2018 05:53:22 +0300
parents 22f29c25b349
children 91d1bb571fca
files tools/gfxconv.c tools/lib64gfx.c tools/lib64gfx.h
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tools/gfxconv.c	Mon May 14 05:38:58 2018 +0300
+++ b/tools/gfxconv.c	Mon May 14 05:53:22 2018 +0300
@@ -1024,7 +1024,7 @@
 
         for (int i = 0; i < D64_MAX_ENCDEC_OPS; i++)
         {
-            const DMC64EncDecOp *op = &dstFmt->encdecOps[i];
+            const DMC64EncDecOp *op = fmtGetEncDecOp(dstFmt, i);
             size_t size;
 
             // Check for last operator
--- a/tools/lib64gfx.c	Mon May 14 05:38:58 2018 +0300
+++ b/tools/lib64gfx.c	Mon May 14 05:53:22 2018 +0300
@@ -88,7 +88,7 @@
     int nbanks = 0;
     for (int i = 0; i < D64_MAX_ENCDEC_OPS; i++)
     {
-        const DMC64EncDecOp *op = &fmt->encdecOps[i];
+        const DMC64EncDecOp *op = fmtGetEncDecOp(fmt, i);
         if (op->type == DT_LAST)
             break;
 
@@ -610,7 +610,7 @@
     // Perform decoding
     for (int i = 0; i < D64_MAX_ENCDEC_OPS; i++)
     {
-        const DMC64EncDecOp *op = &fmt->encdecOps[i];
+        const DMC64EncDecOp *op = fmtGetEncDecOp(fmt, i);
         const Uint8 *src;
         DMC64MemBlock *blk;
         char *blkname;
@@ -771,7 +771,7 @@
     // Perform encoding
     for (int i = 0; i < D64_MAX_ENCDEC_OPS; i++)
     {
-        const DMC64EncDecOp *op = &fmt->encdecOps[i];
+        const DMC64EncDecOp *op = fmtGetEncDecOp(fmt, i);
         size_t size, chksize;
         const DMC64MemBlock *blk;
         char *blkname;
--- a/tools/lib64gfx.h	Mon May 14 05:38:58 2018 +0300
+++ b/tools/lib64gfx.h	Mon May 14 05:53:22 2018 +0300
@@ -316,6 +316,12 @@
 }
 
 
+static inline const DMC64EncDecOp * fmtGetEncDecOp(const DMC64ImageFormat *fmt, const int index)
+{
+    return &fmt->encdecOps[index];
+}
+
+
 #ifdef __cplusplus
 }
 #endif