| 1 |
– |
/* Copyright 1990 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* x11raster.c - routines to handle images for X windows. |
| 6 |
|
* |
| 14 |
|
#include "color.h" |
| 15 |
|
#include "x11raster.h" |
| 16 |
|
|
| 20 |
– |
extern char *malloc(), *realloc(), *calloc(); |
| 17 |
|
|
| 22 |
– |
|
| 18 |
|
XRASTER * |
| 19 |
|
make_raster(disp, vis, npixbits, data, width, height, bm_pad) |
| 20 |
|
Display *disp; |
| 64 |
|
register unsigned char *p; |
| 65 |
|
register int i; |
| 66 |
|
|
| 67 |
< |
if (xr->image->depth > 8 | xr->ncolors != 0) |
| 67 |
> |
if ((xr->image->depth > 8) | (xr->ncolors != 0)) |
| 68 |
|
return(xr->ncolors); |
| 69 |
|
xr->pmap = (short *)malloc(256*sizeof(short)); |
| 70 |
|
if (xr->pmap == NULL) |
| 85 |
|
xr->cdefs[xr->ncolors].flags = DoRed|DoGreen|DoBlue; |
| 86 |
|
xr->pmap[*p] = xr->ncolors++; |
| 87 |
|
} |
| 88 |
< |
xr->cdefs = (XColor *)realloc((char *)xr->cdefs, |
| 88 |
> |
xr->cdefs = (XColor *)realloc((void *)xr->cdefs, |
| 89 |
|
xr->ncolors*sizeof(XColor)); |
| 90 |
|
if (xr->cdefs == NULL) |
| 91 |
|
return(0); |
| 131 |
|
i--; |
| 132 |
|
} |
| 133 |
|
XFreeColors(disp, cmap, pixels, n, 0); |
| 134 |
< |
free((char *)pixels); |
| 134 |
> |
free((void *)pixels); |
| 135 |
|
return(cmap); |
| 136 |
|
} |
| 137 |
|
|
| 160 |
|
if (xr->cmap == DefaultColormap(xr->disp, xr->screen)) |
| 161 |
|
xr->cmap = newcmap(xr->disp, xr->screen, xr->visual); |
| 162 |
|
else { |
| 163 |
< |
free((char *)xr->pixels); |
| 163 |
> |
free((void *)xr->pixels); |
| 164 |
|
xr->pixels = NULL; |
| 165 |
|
return(NULL); |
| 166 |
|
} |
| 252 |
|
XFreeColors(xr->disp, xr->cmap, xr->pixels, xr->ncolors, 0); |
| 253 |
|
if (xr->cmap != DefaultColormap(xr->disp, xr->screen)) |
| 254 |
|
XFreeColormap(xr->disp, xr->cmap); |
| 255 |
< |
free((char *)xr->pixels); |
| 255 |
> |
free((void *)xr->pixels); |
| 256 |
|
xr->pixels = NULL; |
| 257 |
|
} |
| 258 |
|
|
| 273 |
|
free_rpixmap(xr); |
| 274 |
|
if (xr->ncolors > 0) { |
| 275 |
|
unmap_rcolors(xr); |
| 276 |
< |
free((char *)xr->pmap); |
| 277 |
< |
free((char *)xr->cdefs); |
| 276 |
> |
free((void *)xr->pmap); |
| 277 |
> |
free((void *)xr->cdefs); |
| 278 |
|
} |
| 279 |
|
XDestroyImage(xr->image); |
| 280 |
|
if (xr->gc != 0) |
| 281 |
|
XFreeGC(xr->disp, xr->gc); |
| 282 |
< |
free((char *)xr); |
| 282 |
> |
free((void *)xr); |
| 283 |
|
} |