minor tweaks
This commit is contained in:
parent
03cfbf8217
commit
746e8d12f6
@ -102,6 +102,9 @@ fclose(fp);
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------- */
|
/* ---------------------------------------------------------------- */
|
||||||
|
/*
|
||||||
|
* load a dump in a pre-allocated FloatImg
|
||||||
|
*/
|
||||||
int fimg_load_from_dump(char *fname, FloatImg *where)
|
int fimg_load_from_dump(char *fname, FloatImg *where)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -113,13 +116,14 @@ fprintf(stderr, ">>> %-25s ( '%s' %p )\n", __func__, fname, head);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (NULL==(fp = fopen(fname, "r"))) {
|
if (NULL==(fp = fopen(fname, "r"))) {
|
||||||
perror(fname); exit(1);
|
perror(fname);
|
||||||
|
return -15;
|
||||||
}
|
}
|
||||||
foo = fread(&filehead, sizeof(FimgFileHead), 1, fp);
|
foo = fread(&filehead, sizeof(FimgFileHead), 1, fp);
|
||||||
if (1 != foo) {
|
if (1 != foo) {
|
||||||
fprintf(stderr, "%s: short read on '%s'\n", __func__, fname);
|
fprintf(stderr, "%s: short read on '%s'\n", __func__, fname);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check compatibility */
|
/* check compatibility */
|
||||||
@ -135,7 +139,7 @@ if ( (filehead.w != where->width) ||
|
|||||||
nbre = filehead.w*filehead.h*filehead.t; /* ugly quirk */
|
nbre = filehead.w*filehead.h*filehead.t; /* ugly quirk */
|
||||||
foo = fread(where->R, sizeof(float), nbre, fp);
|
foo = fread(where->R, sizeof(float), nbre, fp);
|
||||||
if (nbre != foo) {
|
if (nbre != foo) {
|
||||||
fprintf(stderr, "%s: err read '%s' : %d\n", __func__, fname, errno);
|
fprintf(stderr, "%s: err read '%s' : %d\n", __func__, fname, foo);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -18;
|
return -18;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user