63 |
|
|
64 |
|
int |
65 |
|
putbinary( /* fwrite() replacement for small objects */ |
66 |
< |
char *s, |
66 |
> |
const void *p, |
67 |
|
int elsiz, |
68 |
|
int nel, |
69 |
|
FILE *fp) |
70 |
|
{ |
71 |
< |
int nbytes = elsiz*nel; |
71 |
> |
const char *s = (const char *)p; |
72 |
> |
int nbytes = elsiz*nel; |
73 |
|
|
74 |
< |
if (nbytes > 512) |
75 |
< |
return(fwrite(s, elsiz, nel, fp)); |
74 |
> |
if (nbytes > 256) |
75 |
> |
return(fwrite(p, elsiz, nel, fp)); |
76 |
|
|
77 |
|
while (nbytes-- > 0) |
78 |
< |
putc(*s++, fp); |
78 |
> |
if (putc(*s++, fp) == EOF) |
79 |
> |
return((elsiz*nel - nbytes)/elsiz); |
80 |
|
|
81 |
|
return(nel); |
82 |
|
} |
144 |
|
|
145 |
|
int |
146 |
|
getbinary( /* fread() replacement for small objects */ |
147 |
< |
char *s, |
147 |
> |
void *p, |
148 |
|
int elsiz, |
149 |
|
int nel, |
150 |
|
FILE *fp) |
151 |
|
{ |
152 |
+ |
char *s = (char *)p; |
153 |
|
int nbytes = elsiz*nel; |
154 |
|
int c; |
155 |
|
|
156 |
< |
if (nbytes > 512) |
157 |
< |
return(fread(s, elsiz, nel, fp)); |
156 |
> |
if (nbytes > 256) |
157 |
> |
return(fread(p, elsiz, nel, fp)); |
158 |
|
|
159 |
|
while (nbytes-- > 0) { |
160 |
|
if ((c = getc(fp)) == EOF) |