15 |
|
#include "color.h" |
16 |
|
|
17 |
|
#define MINELEN 8 /* minimum scanline length for encoding */ |
18 |
+ |
#define MAXELEN 0x7ffe /* maximum scanline length for encoding */ |
19 |
|
#define MINRUN 4 /* minimum run length */ |
20 |
|
|
21 |
+ |
#ifndef frexp |
22 |
+ |
extern double frexp(); |
23 |
+ |
#endif |
24 |
|
|
25 |
+ |
|
26 |
|
char * |
27 |
|
tempbuffer(len) /* get a temporary buffer */ |
28 |
|
unsigned len; |
29 |
|
{ |
30 |
|
extern char *malloc(), *realloc(); |
31 |
|
static char *tempbuf = NULL; |
32 |
< |
static int tempbuflen = 0; |
32 |
> |
static unsigned tempbuflen = 0; |
33 |
|
|
34 |
|
if (len > tempbuflen) { |
35 |
|
if (tempbuflen > 0) |
50 |
|
register int i, j, beg, cnt; |
51 |
|
int c2; |
52 |
|
|
53 |
< |
if (len < MINELEN | len > 0x7fff) /* OOBs, write out flat */ |
53 |
> |
if (len < MINELEN | len > MAXELEN) /* OOBs, write out flat */ |
54 |
|
return(fwrite((char *)scanline,sizeof(COLR),len,fp) - len); |
55 |
|
/* put magic header */ |
56 |
|
putc(2, fp); |
102 |
|
register int i, j; |
103 |
|
int code; |
104 |
|
/* determine scanline type */ |
105 |
< |
if (len < MINELEN | len > 0x7fff) |
105 |
> |
if (len < MINELEN | len > MAXELEN) |
106 |
|
return(oldreadcolrs(scanline, len, fp)); |
107 |
|
if ((i = getc(fp)) == EOF) |
108 |
|
return(-1); |
230 |
|
register COLR clr; |
231 |
|
double r, g, b; |
232 |
|
{ |
228 |
– |
double frexp(); |
233 |
|
double d; |
234 |
|
int e; |
235 |
|
|