From 2ff17fc54bd3c28776468088d9e783d90978e139 Mon Sep 17 00:00:00 2001 From: tTh Date: Thu, 29 Jun 2023 14:29:14 +0200 Subject: [PATCH] chasse au bug --- funcs/misc-plots.c | 10 ++++++++++ lib/fimg-file.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/funcs/misc-plots.c b/funcs/misc-plots.c index e30cf4b..8aa2b18 100644 --- a/funcs/misc-plots.c +++ b/funcs/misc-plots.c @@ -10,6 +10,11 @@ #include "../floatimg.h" /* --------------------------------------------------------------------- */ +/* + ********************************************* + * SEGFAULT SI IMAGE TROP PETITE * + ********************************************* +*/ int fimg_test_pattern(FloatImg *fimg, int type, double dval) { @@ -26,6 +31,8 @@ if (fimg->type != FIMG_TYPE_RGB) { return -6; } +fprintf(stderr, "ENTERING %s\n", __func__); + if (type) { fprintf(stderr, "%s : %d %f\n", __func__, type, dval); } @@ -60,6 +67,7 @@ for (x=0; xwidth; x++) { // fprintf(stderr, " %6d %f\n", x, val); } + k = (fimg->height / 4) + 90; for (x=0; xwidth; x++) { val = ((x%8)<4) ? dval : 0.0; @@ -78,6 +86,8 @@ for (x=0; xwidth; x++) { } } +fprintf(stderr, "ALIVE %s\n", __func__); + return 0; } /* --------------------------------------------------------------------- */ diff --git a/lib/fimg-file.c b/lib/fimg-file.c index 0811b53..cd025e6 100644 --- a/lib/fimg-file.c +++ b/lib/fimg-file.c @@ -178,11 +178,17 @@ if (FIMG_TYPE_RGB != fimg->type) { return -8; } +// fprintf(stderr, "'%s' try to open '%s'\n", __func__, fname); fp = fopen(fname, "w"); -if (NULL==fp) { +// fprintf(stderr, " fp at %p\n", fp); + +if (NULL == fp) { perror(fname); return -1; } +else { + // fprintf(stderr, "file '%s' opened\n", fname); + } memset(&filehead, 0, sizeof(filehead)); memcpy(filehead.magic, "FIMG", 4); @@ -195,6 +201,9 @@ if (1 != foo) { fclose(fp); return -2; } +// fprintf(stderr, "'%s' write header --> %d\n", __func__, foo); + + nbre = fimg->width * fimg->height; /* pixels per frame */ foo = fwrite(fimg->R, sizeof(float), nbre, fp);