17 |
|
|
18 |
|
#include "color.h" |
19 |
|
|
20 |
+ |
#ifdef getc_unlocked /* avoid horrendous overhead of flockfile */ |
21 |
+ |
#define getc getc_unlocked |
22 |
+ |
#define putc putc_unlocked |
23 |
+ |
#endif |
24 |
+ |
|
25 |
|
#define MINELEN 8 /* minimum scanline length for encoding */ |
26 |
|
#define MAXELEN 0x7fff /* maximum scanline length for encoding */ |
27 |
|
#define MINRUN 4 /* minimum run length */ |
36 |
|
|
37 |
|
if (len > tempbuflen) { |
38 |
|
if (tempbuflen > 0) |
39 |
< |
tempbuf = (char *)realloc(tempbuf, len); |
39 |
> |
tempbuf = (char *)realloc((void *)tempbuf, len); |
40 |
|
else |
41 |
|
tempbuf = (char *)malloc(len); |
42 |
|
tempbuflen = tempbuf==NULL ? 0 : len; |
54 |
|
register int i, j, beg, cnt = 1; |
55 |
|
int c2; |
56 |
|
|
57 |
< |
if (len < MINELEN | len > MAXELEN) /* OOBs, write out flat */ |
57 |
> |
if ((len < MINELEN) | (len > MAXELEN)) /* OOBs, write out flat */ |
58 |
|
return(fwrite((char *)scanline,sizeof(COLR),len,fp) - len); |
59 |
|
/* put magic header */ |
60 |
|
putc(2, fp); |
144 |
|
register int i, j; |
145 |
|
int code, val; |
146 |
|
/* determine scanline type */ |
147 |
< |
if (len < MINELEN | len > MAXELEN) |
147 |
> |
if ((len < MINELEN) | (len > MAXELEN)) |
148 |
|
return(oldreadcolrs(scanline, len, fp)); |
149 |
|
if ((i = getc(fp)) == EOF) |
150 |
|
return(-1); |