307 |
|
rmx_load_header(RMATRIX *rm, FILE *fp) |
308 |
|
{ |
309 |
|
if (!rm | !fp) |
310 |
< |
return(-1); |
310 |
> |
return(0); |
311 |
|
if (rm->info) { /* clear state */ |
312 |
|
free(rm->info); |
313 |
|
rm->info = NULL; |
327 |
|
rm->ncomp = 3; |
328 |
|
setcolor(rm->cexp, 1.f, 1.f, 1.f); |
329 |
|
memcpy(rm->wlpart, WLPART, sizeof(rm->wlpart)); |
330 |
+ |
rm->swapin = 0; |
331 |
|
} |
332 |
|
SET_FILE_BINARY(fp); |
333 |
|
rm->dtype = DTascii; /* assumed w/o FORMAT */ |
334 |
|
if (getheader(fp, get_dminfo, rm) < 0) { |
335 |
|
fputs("Unrecognized matrix format\n", stderr); |
336 |
< |
return(-1); |
336 |
> |
return(0); |
337 |
|
} |
338 |
|
/* resolution string? */ |
339 |
|
if ((rm->nrows <= 0) | (rm->ncols <= 0)) { |
340 |
|
if (!fscnresolu(&rm->ncols, &rm->nrows, fp)) |
341 |
< |
return(-1); |
341 |
> |
return(0); |
342 |
|
if ((rm->dtype == DTrgbe) | (rm->dtype == DTxyze) && |
343 |
|
rm->ncomp != 3) |
344 |
< |
return(-1); |
344 |
> |
return(0); |
345 |
|
} |
346 |
< |
return(rm->dtype); |
346 |
> |
return(1); |
347 |
|
} |
348 |
|
|
349 |
|
/* Allocate & load post-header data from stream given type set in rm->dtype */ |
409 |
|
flockfile(fp); |
410 |
|
#endif |
411 |
|
/* load header info */ |
412 |
< |
if (rmx_load_header(dnew = rmx_new(0,0,3), fp) < 0) { |
412 |
> |
if (!rmx_load_header(dnew = rmx_new(0,0,3), fp)) { |
413 |
|
fprintf(stderr, "Bad header in: %s\n", inspec); |
414 |
|
if (inspec[0] == '!') pclose(fp); |
415 |
|
else fclose(fp); |