15 |
|
#include "paths.h" |
16 |
|
#include "resolu.h" |
17 |
|
|
18 |
– |
const char stdin_name[] = "<stdin>"; |
19 |
– |
|
20 |
– |
const char *cm_fmt_id[] = { |
21 |
– |
"unknown", COLRFMT, CIEFMT, SPECFMT, |
22 |
– |
"float", "ascii", "double" |
23 |
– |
}; |
24 |
– |
|
25 |
– |
const int cm_elem_size[] = { |
26 |
– |
0, 4, 4, 0, 3*sizeof(float), 0, 3*sizeof(double) |
27 |
– |
}; |
28 |
– |
|
18 |
|
/* Allocate a color coefficient matrix */ |
19 |
|
CMATRIX * |
20 |
|
cm_alloc(int nrows, int ncols) |
85 |
|
char fmt[MAXFMTLEN]; |
86 |
|
int i; |
87 |
|
|
88 |
< |
if (!strncmp(s, "NCOMP=", 6) && atoi(s+6) != 3) { |
88 |
> |
if (isncomp(s) && ncompval(s) != 3) { |
89 |
|
ip->err = "unexpected # components (must be 3)"; |
90 |
|
return(-1); |
91 |
|
} |
484 |
|
|
485 |
|
if (!cm) |
486 |
|
return(0); |
487 |
+ |
#ifdef getc_unlocked |
488 |
+ |
flockfile(fp); |
489 |
+ |
#endif |
490 |
|
mp = cm->cmem; |
491 |
|
switch (dtype) { |
492 |
|
case DTascii: |
538 |
|
fputs("Unsupported data type in cm_write()!\n", stderr); |
539 |
|
return(0); |
540 |
|
} |
541 |
+ |
#ifdef getc_unlocked |
542 |
+ |
funlockfile(fp); |
543 |
+ |
#endif |
544 |
|
return(fflush(fp) == 0); |
545 |
|
} |