17 |
|
#define MINELEN 8 /* minimum scanline length for encoding */ |
18 |
|
#define MINRUN 4 /* minimum run length */ |
19 |
|
|
20 |
+ |
#ifndef frexp |
21 |
+ |
extern double frexp(); |
22 |
+ |
#endif |
23 |
|
|
24 |
+ |
|
25 |
|
char * |
26 |
|
tempbuffer(len) /* get a temporary buffer */ |
27 |
|
unsigned len; |
43 |
|
|
44 |
|
fwritecolrs(scanline, len, fp) /* write out a colr scanline */ |
45 |
|
register COLR *scanline; |
46 |
< |
int len; |
46 |
> |
unsigned len; |
47 |
|
register FILE *fp; |
48 |
|
{ |
49 |
|
register int i, j, beg, cnt; |
50 |
|
int c2; |
51 |
|
|
52 |
< |
if (len < MINELEN) /* too small to encode */ |
52 |
> |
if (len < MINELEN | len > 0x7fff) /* OOBs, write out flat */ |
53 |
|
return(fwrite((char *)scanline,sizeof(COLR),len,fp) - len); |
54 |
< |
if (len > 32767) /* too big! */ |
51 |
< |
return(-1); |
52 |
< |
putc(2, fp); /* put magic header */ |
54 |
> |
/* put magic header */ |
55 |
|
putc(2, fp); |
56 |
+ |
putc(2, fp); |
57 |
|
putc(len>>8, fp); |
58 |
|
putc(len&255, fp); |
59 |
|
/* put components seperately */ |
101 |
|
register int i, j; |
102 |
|
int code; |
103 |
|
/* determine scanline type */ |
104 |
< |
if (len < MINELEN) |
104 |
> |
if (len < MINELEN | len > 0x7fff) |
105 |
|
return(oldreadcolrs(scanline, len, fp)); |
106 |
|
if ((i = getc(fp)) == EOF) |
107 |
|
return(-1); |
229 |
|
register COLR clr; |
230 |
|
double r, g, b; |
231 |
|
{ |
229 |
– |
double frexp(); |
232 |
|
double d; |
233 |
|
int e; |
234 |
|
|