From 6ac0caa54a207c35d31f4a76d1d81fd6c7e3f511 Mon Sep 17 00:00:00 2001 From: Tonton Th Date: Wed, 22 Jan 2020 09:33:35 +0100 Subject: [PATCH] killing some bad magic numbers --- lib/operators.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/operators.c b/lib/operators.c index 12cdc3a5..1c2b3133 100644 --- a/lib/operators.c +++ b/lib/operators.c @@ -27,7 +27,9 @@ int idx, nbpixels; fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d); #endif -if (3 != a->type || 3 != b->type || 3 != d->type) { +if (FIMG_TYPE_RGB != a->type || + FIMG_TYPE_RGB != b->type || + FIMG_TYPE_RGB != d->type) { fprintf(stderr, "%s : got a bad type fimg\n", __func__); return -8; } @@ -54,7 +56,7 @@ int idx, nbpixels; fprintf(stderr, ">>> %s ( %p %p )\n", __func__, a, b); #endif -if (3 != a->type || 3 != b->type) { +if (FIMG_TYPE_RGB != a->type || FIMG_TYPE_RGB != b->type) { fprintf(stderr, "%s : got a bad type fimg\n", __func__); return -8; } @@ -81,7 +83,9 @@ int idx, nbpixels; fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d); #endif -if (3 != a->type || 3 != b->type || 3 != d->type) { +if (FIMG_TYPE_RGB != a->type || + FIMG_TYPE_RGB != b->type || + FIMG_TYPE_RGB != d->type) { fprintf(stderr, "%s : got a bad type fimg\n", __func__); return -8; } @@ -111,7 +115,7 @@ int idx, nbpixels; fprintf(stderr, ">>> %s ( %p %p )\n", __func__, a, b); #endif -if (3 != a->type || 3 != b->type) { +if (FIMG_TYPE_RGB != a->type || FIMG_TYPE_RGB != b->type) { fprintf(stderr, "%s : got a bad type fimg\n", __func__); return -8; } @@ -124,6 +128,7 @@ for (idx=0; idxB[idx] *= a->B[idx]; } +return 0; } /* ---------------------------------------------------------------- */ /* @@ -137,7 +142,8 @@ int idx, nbpixels; fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d); #endif -if (3 != a->type || 3 != b->type || 3 != d->type) { +if (FIMG_TYPE_RGB != a->type || FIMG_TYPE_RGB != b->type || + FIMG_TYPE_RGB != d->type) { fprintf(stderr, "%s : got a bad type fimg\n", __func__); return -8; } @@ -161,7 +167,8 @@ int idx, nbiter; fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d); #endif -if (3 != a->type || 3 != b->type || 3 != d->type) { +if (FIMG_TYPE_RGB != a->type || FIMG_TYPE_RGB != b->type || + FIMG_TYPE_RGB != d->type) { fprintf(stderr, "%s : got a bad type fimg\n", __func__); return -8; } @@ -186,7 +193,8 @@ int idx, nbiter; fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d); #endif -if (3 != a->type || 3 != b->type || 3 != d->type) { +if (FIMG_TYPE_RGB != a->type || FIMG_TYPE_RGB != b->type || + FIMG_TYPE_RGB != d->type) { fprintf(stderr, "%s : got a bad type fimg\n", __func__); return -8; }