forked from tTh/FloatImg
chasse au bug
This commit is contained in:
parent
ed227d6563
commit
2ff17fc54b
@ -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; x<fimg->width; x++) {
|
||||
// fprintf(stderr, " %6d %f\n", x, val);
|
||||
}
|
||||
|
||||
|
||||
k = (fimg->height / 4) + 90;
|
||||
for (x=0; x<fimg->width; x++) {
|
||||
val = ((x%8)<4) ? dval : 0.0;
|
||||
@ -78,6 +86,8 @@ for (x=0; x<fimg->width; x++) {
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "ALIVE %s\n", __func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
@ -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");
|
||||
// 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);
|
||||
|
Loading…
Reference in New Issue
Block a user