214 |
|
cm_load(const char *inspec, int nrows, int ncols, int dtype) |
215 |
|
{ |
216 |
|
const int ROWINC = 2048; |
217 |
< |
int rowsOK = (dtype == DTascii) | (nrows > 0); |
217 |
> |
int dimsOK = (dtype == DTascii) | (nrows > 0) && ncols; |
218 |
|
int swap = 0; |
219 |
|
FILE *fp; |
220 |
|
COLOR scale; |
241 |
|
#endif |
242 |
|
if (dtype != DTascii) |
243 |
|
SET_FILE_BINARY(fp); /* doesn't really work */ |
244 |
< |
if (!dtype | !rowsOK | !ncols) { /* expecting header? */ |
244 |
> |
if (!dtype | !dimsOK) { /* expecting header? */ |
245 |
|
char *err = cm_getheader(&dtype, &nrows, &ncols, &swap, scale, fp); |
246 |
|
if (err) |
247 |
|
error(USER, err); |
248 |
< |
rowsOK = (nrows > 0); |
248 |
> |
dimsOK = ncols > 0 && ( nrows > 0 || |
249 |
> |
(dtype != DTrgbe) & (dtype != DTxyze) ); |
250 |
|
} |
251 |
< |
if (!rowsOK | !ncols && !fscnresolu(&ncols, &nrows, fp)) |
251 |
> |
if (!dimsOK && !fscnresolu(&ncols, &nrows, fp)) |
252 |
|
error(USER, "unspecified matrix size"); |
253 |
|
switch (dtype) { |
254 |
|
case DTascii: |