# HG changeset patch # User Matti Hamalainen # Date 1526266402 -10800 # Node ID 3cc7b2aadda33f672a7ac79c1cb4ef14e2078629 # Parent 22f29c25b349a86a5f4851068058e7d1d7557760 Add inline helper function fmtGetEncDecOp() and use it. diff -r 22f29c25b349 -r 3cc7b2aadda3 tools/gfxconv.c --- 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 diff -r 22f29c25b349 -r 3cc7b2aadda3 tools/lib64gfx.c --- 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; diff -r 22f29c25b349 -r 3cc7b2aadda3 tools/lib64gfx.h --- 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