31 |
|
|
32 |
|
if (len > tempbuflen) { |
33 |
|
if (tempbuflen > 0) |
34 |
< |
tempbuf = (char *)realloc(tempbuf, len); |
34 |
> |
tempbuf = (char *)realloc((void *)tempbuf, len); |
35 |
|
else |
36 |
|
tempbuf = (char *)malloc(len); |
37 |
|
tempbuflen = tempbuf==NULL ? 0 : len; |
49 |
|
register int i, j, beg, cnt = 1; |
50 |
|
int c2; |
51 |
|
|
52 |
< |
if (len < MINELEN | len > MAXELEN) /* OOBs, write out flat */ |
52 |
> |
if ((len < MINELEN) | (len > MAXELEN)) /* OOBs, write out flat */ |
53 |
|
return(fwrite((char *)scanline,sizeof(COLR),len,fp) - len); |
54 |
|
/* put magic header */ |
55 |
|
putc(2, fp); |
139 |
|
register int i, j; |
140 |
|
int code, val; |
141 |
|
/* determine scanline type */ |
142 |
< |
if (len < MINELEN | len > MAXELEN) |
142 |
> |
if ((len < MINELEN) | (len > MAXELEN)) |
143 |
|
return(oldreadcolrs(scanline, len, fp)); |
144 |
|
if ((i = getc(fp)) == EOF) |
145 |
|
return(-1); |
253 |
|
|
254 |
|
d = frexp(d, &e) * 255.9999 / d; |
255 |
|
|
256 |
< |
clr[RED] = r * d; |
257 |
< |
clr[GRN] = g * d; |
258 |
< |
clr[BLU] = b * d; |
256 |
> |
if (r > 0.0) |
257 |
> |
clr[RED] = r * d; |
258 |
> |
else |
259 |
> |
clr[RED] = 0; |
260 |
> |
if (g > 0.0) |
261 |
> |
clr[GRN] = g * d; |
262 |
> |
else |
263 |
> |
clr[GRN] = 0; |
264 |
> |
if (b > 0.0) |
265 |
> |
clr[BLU] = b * d; |
266 |
> |
else |
267 |
> |
clr[BLU] = 0; |
268 |
> |
|
269 |
|
clr[EXP] = e + COLXS; |
270 |
|
} |
271 |
|
|