diff --git a/funcs/classif.c b/funcs/classif.c index eb6dc37..9e4fd60 100644 --- a/funcs/classif.c +++ b/funcs/classif.c @@ -21,9 +21,19 @@ float range, dist, rgb[3], dr, dg, db; int x, y, on, off; #if DEBUG_LEVEL -fprintf(stderr, ">>> %s ( %p %p %f %d )\n", __func__, psrc, pdst, fval, notused); +fprintf(stderr, ">>> %s ( %p %p %f %d )\n", __func__, + psrc, pdst, fval, notused); #endif +if (FIMG_TYPE_RGB != psrc->type) { + fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type); + return -7; + } +if (fimg_images_not_compatible(psrc, pdst)) { + fprintf(stderr, "%s: bad dst type %d\n", __func__, pdst->type); + return -8; + } + /* calculer les amplitudes RGB de l'image source */ fimg_get_minmax_rgb(psrc, minmax); delta[0] = minmax[1] - minmax[0]; diff --git a/funcs/contour2x2.c b/funcs/contour2x2.c index 804a95c..0c3add9 100644 --- a/funcs/contour2x2.c +++ b/funcs/contour2x2.c @@ -32,6 +32,16 @@ int tbl[] = /* deep magic inside */ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, reverse); #endif +if (FIMG_TYPE_RGB != psrc->type) { + fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type); + return -7; + } +if (fimg_images_not_compatible(psrc, pdst)) { + fprintf(stderr, "%s: bad dst type %d\n", __func__, pdst->type); + return -8; + } + + if (reverse) { v1 = 0.0; v2 = 1.0; } diff --git a/funcs/qsortrgb.c b/funcs/qsortrgb.c index 6a1a96a..dd801f8 100644 --- a/funcs/qsortrgb.c +++ b/funcs/qsortrgb.c @@ -27,6 +27,15 @@ int foo, szimg; fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused); #endif +if (FIMG_TYPE_RGB != psrc->type) { + fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type); + return -7; + } +if (fimg_images_not_compatible(psrc, pdst)) { + fprintf(stderr, "%s: bad dst type %d\n", __func__, pdst->type); + return -8; + } + foo = fimg_copy_data(psrc, pdst); szimg = pdst->width * pdst->height; @@ -44,7 +53,7 @@ typedef struct { float r, g, b; } pix; -static compare_b(const void *p1, const void *p2) +static int compare_b(const void *p1, const void *p2) { pix *s1, *s2; s1 = (pix *)p1; @@ -62,6 +71,15 @@ float rgb[3]; fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused); #endif +if (FIMG_TYPE_RGB != psrc->type) { + fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type); + return -7; + } +if (fimg_images_not_compatible(psrc, pdst)) { + fprintf(stderr, "%s: bad dst type %d\n", __func__, pdst->type); + return -8; + } + szimg = pdst->width * pdst->height; fprintf(stderr, "%s : %d pixels\n", __func__, szimg);