19 |
|
|
20 |
|
#include "targa.h" |
21 |
|
|
22 |
+ |
#ifndef BSD |
23 |
+ |
#define bcopy(s,d,n) (void)memcpy(d,s,n) |
24 |
+ |
extern char *memcpy(); |
25 |
+ |
#endif |
26 |
|
/* descriptor for a picture file or frame buffer */ |
27 |
|
typedef struct { |
28 |
|
char *name; /* file name */ |
231 |
|
|
232 |
|
if (ip != NULL) |
233 |
|
if (nidbytes) |
234 |
< |
fread(ip, nidbytes, 1, fp); |
234 |
> |
fread((char *)ip, nidbytes, 1, fp); |
235 |
|
else |
236 |
|
*ip = '\0'; |
237 |
|
else if (nidbytes) |
324 |
|
register int i, j; |
325 |
|
|
326 |
|
/* get color table */ |
327 |
< |
if ((hp->CMapBits==24 ? fread(map.c3, sizeof(map.c3), 1, stdin) : |
328 |
< |
fread(map.c4, sizeof(map.c4), 1, stdin)) != 1) |
327 |
> |
if ((hp->CMapBits==24 ? fread((char *)map.c3,sizeof(map.c3),1,stdin) : |
328 |
> |
fread((char *)map.c4,sizeof(map.c4),1,stdin)) != 1) |
329 |
|
quiterr("error reading color table"); |
330 |
|
/* convert table */ |
331 |
|
for (i = hp->mapOrig; i < hp->mapOrig+hp->mapLength; i++) |
395 |
|
int y; |
396 |
|
pixel *l; |
397 |
|
{ |
398 |
< |
bcopy(l, &tarData[(ymax-1-y)*xmax], xmax*sizeof(pixel)); |
398 |
> |
bcopy((char *)l, (char *)&tarData[(ymax-1-y)*xmax], xmax*sizeof(pixel)); |
399 |
|
} |
400 |
|
|
401 |
|
|
405 |
|
FILE *fp; |
406 |
|
{ |
407 |
|
if (h->dataType == IM_CMAP) { /* uncompressed */ |
408 |
< |
if (fwrite(d, h->x*sizeof(pixel), h->y, fp) != h->y) |
408 |
> |
if (fwrite((char *)d,h->x*sizeof(pixel),h->y,fp) != h->y) |
409 |
|
quiterr("error writing targa file"); |
410 |
|
return; |
411 |
|
} |
422 |
|
register pixel *dp; |
423 |
|
|
424 |
|
if (h->dataType == IM_CMAP) { /* uncompressed */ |
425 |
< |
if (fread(data, h->x*sizeof(pixel), h->y, fp) != h->y) |
425 |
> |
if (fread((char *)data,h->x*sizeof(pixel),h->y,fp) != h->y) |
426 |
|
goto readerr; |
427 |
|
return; |
428 |
|
} |