--- ray/src/px/x11image.c 2005/01/07 22:05:30 2.70 +++ ray/src/px/x11image.c 2011/08/16 18:09:53 2.75 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: x11image.c,v 2.70 2005/01/07 22:05:30 greg Exp $"; +static const char RCSid[] = "$Id: x11image.c,v 2.75 2011/08/16 18:09:53 greg Exp $"; #endif /* * x11image.c - driver for X-windows @@ -83,8 +83,8 @@ int gotview = 0; /* got parameters from file */ COLR *scanline; /* scan line buffer */ TMbright *lscan; /* encoded luminance scanline */ -BYTE *cscan; /* encoded chroma scanline */ -BYTE *pscan; /* compute pixel scanline */ +uby8 *cscan; /* encoded chroma scanline */ +uby8 *pscan; /* compute pixel scanline */ RESOLU inpres; /* input resolution and ordering */ int xmax, ymax; /* picture dimensions */ @@ -122,7 +122,7 @@ char *progname; char errmsg[128]; -BYTE clrtab[256][3]; /* global color map */ +uby8 clrtab[256][3]; /* global color map */ Display *thedisplay; @@ -271,7 +271,7 @@ main(int argc, char *argv[]) getevent(); /* main loop */ userr: fprintf(stderr, -"Usage: %s [-di disp][[-ge] spec][-b][-m][-d][-f][-c nclrs][-e spec][-g gamcor][-s][-ospec][-t intvl] pic ..\n", +"Usage: %s [-di disp][[-ge] spec][-b][-m][-d][-f][-c nclrs][-e spec][-g gamcor][-s][-ospec][-t intvl] hdr ..\n", progname); exit(1); } @@ -397,9 +397,9 @@ init( /* get data and open window */ windowName.encoding = iconName.encoding = XA_STRING; windowName.format = iconName.format = 8; windowName.value = (u_char *)name; - windowName.nitems = strlen(windowName.value); + windowName.nitems = strlen((char *)windowName.value); iconName.value = (u_char *)name; - iconName.nitems = strlen(windowName.value); + iconName.nitems = strlen((char *)windowName.value); xclshints.res_name = NULL; xclshints.res_class = "Ximage"; @@ -421,7 +421,7 @@ quiterr( /* print message and exit */ register int es; int cs; - if ( (es = err != NULL) ) + if ( (es = (err != NULL)) ) fprintf(stderr, "%s: %s: %s\n", progname, fname==NULL?"":fname, err); if (thedisplay != NULL) @@ -447,25 +447,25 @@ viscmp( /* compare visual to see which is better, des register int *rp; if (v1->class == v2->class) { - if (v1->class == TrueColor || v1->class == DirectColor) { - /* prefer 24-bit to 32-bit */ - if (v1->depth == 24 && v2->depth == 32) + if ((v1->class == TrueColor) | (v1->class == DirectColor)) { + /* prefer 24-bit */ + if ((v1->depth == 24) & (v2->depth > 24)) return(-1); - if (v1->depth == 32 && v2->depth == 24) + if ((v1->depth > 24) & (v2->depth == 24)) return(1); /* go for maximum depth otherwise */ return(v2->depth - v1->depth); } /* don't be too greedy */ - if (maxcolors <= 1<depth && maxcolors <= 1<depth) + if ((maxcolors <= 1<depth) & (maxcolors <= 1<depth)) return(v1->depth - v2->depth); return(v2->depth - v1->depth); } /* prefer Pseudo when < 15-bit */ - if ((v1->class == TrueColor || v1->class == DirectColor) && + if ((v1->class == TrueColor) | (v1->class == DirectColor) && v1->depth < 15) bad1 = 1; - if ((v2->class == TrueColor || v2->class == DirectColor) && + if ((v2->class == TrueColor) | (v2->class == DirectColor) && v2->depth < 15) bad2 = -1; if (bad1 | bad2) @@ -571,7 +571,7 @@ getras(void) /* get raster file */ ourdata = (unsigned char *)malloc(ymax*((xmax+7)/8)); if (ourdata == NULL) goto fail; - ourras = make_raster(thedisplay, &ourvis, 1, ourdata, + ourras = make_raster(thedisplay, &ourvis, 1, (char *)ourdata, xmax, ymax, 8); if (ourras == NULL) goto fail; @@ -582,7 +582,7 @@ getras(void) /* get raster file */ if (ourdata == NULL) goto fail; ourras = make_raster(thedisplay, &ourvis, datsiz*8, - ourdata, xmax, ymax, datsiz*8); + (char *)ourdata, xmax, ymax, datsiz*8); if (ourras == NULL) goto fail; getfull(); @@ -590,7 +590,7 @@ getras(void) /* get raster file */ ourdata = (unsigned char *)malloc(xmax*ymax); if (ourdata == NULL) goto fail; - ourras = make_raster(thedisplay, &ourvis, 8, ourdata, + ourras = make_raster(thedisplay, &ourvis, 8, (char *)ourdata, xmax, ymax, 8); if (ourras == NULL) goto fail; @@ -1060,9 +1060,9 @@ make_tonemap(void) /* initialize tone mapping */ goto memerr; if (greyscale) { cscan = TM_NOCHROM; - if ((pscan = (BYTE *)malloc(sizeof(BYTE)*xmax)) == NULL) + if ((pscan = (uby8 *)malloc(sizeof(uby8)*xmax)) == NULL) goto memerr; - } else if ((pscan=cscan = (BYTE *)malloc(3*sizeof(BYTE)*xmax)) + } else if ((pscan=cscan = (uby8 *)malloc(3*sizeof(uby8)*xmax)) == NULL) goto memerr; /* initialize tm library */ @@ -1100,7 +1100,7 @@ tmap_colrs( /* apply tone mapping to scanline */ int len ) { - register BYTE *ps; + register uby8 *ps; if (tmflags == TM_F_LINEAR) { if (scale)