| 173 |
|
#endif |
| 174 |
|
dinfo.nrows = dinfo.ncols = dinfo.ncomp = 0; |
| 175 |
|
dinfo.dtype = DTascii; |
| 176 |
< |
if (getheader(fp, &get_dminfo, &dinfo) < 0) { |
| 176 |
> |
if (getheader(fp, get_dminfo, &dinfo) < 0) { |
| 177 |
|
fclose(fp); |
| 178 |
|
return(NULL); |
| 179 |
|
} |
| 180 |
< |
if ((dinfo.dtype == DTrgbe) | (dinfo.dtype == DTxyze)) { |
| 180 |
> |
if ((dinfo.nrows <= 0) | (dinfo.ncols <= 0)) { |
| 181 |
|
if (!fscnresolu(&dinfo.ncols, &dinfo.nrows, fp)) { |
| 182 |
|
fclose(fp); |
| 183 |
|
return(NULL); |
| 184 |
|
} |
| 185 |
< |
dinfo.ncomp = 3; |
| 185 |
> |
if (dinfo.ncomp <= 0) |
| 186 |
> |
dinfo.ncomp = 3; |
| 187 |
> |
else if ((dinfo.dtype == DTrgbe) | (dinfo.dtype == DTxyze) && |
| 188 |
> |
dinfo.ncomp != 3) { |
| 189 |
> |
fclose(fp); |
| 190 |
> |
return(NULL); |
| 191 |
> |
} |
| 192 |
|
} |
| 193 |
|
dnew = rmx_alloc(dinfo.nrows, dinfo.ncols, dinfo.ncomp); |
| 194 |
|
if (dnew == NULL) { |