--- ray/src/px/clrtab.c 2003/02/22 02:07:27 2.12 +++ ray/src/px/clrtab.c 2003/07/27 22:12:03 2.16 @@ -1,13 +1,17 @@ #ifndef lint -static const char RCSid[] = "$Id: clrtab.c,v 2.12 2003/02/22 02:07:27 greg Exp $"; +static const char RCSid[] = "$Id: clrtab.c,v 2.16 2003/07/27 22:12:03 schorsch Exp $"; #endif /* * Simple median-cut color quantization based on colortab.c */ -#include "standard.h" +#include "copyright.h" +#include + +#include "standard.h" #include "color.h" + /* histogram resolution */ #define NRED 36 #define NGRN 48 @@ -45,7 +49,7 @@ static unsigned dist(); new_histo(n) /* clear our histogram */ int n; { - bzero((char *)histo, sizeof(histo)); + memset((void *)histo, '\0', sizeof(histo)); return(0); } @@ -130,7 +134,7 @@ int n; return; } N = n; - bzero((char *)cerr, 3*N*sizeof(short)); + memset((void *)cerr, '\0', 3*N*sizeof(short)); } err[0] = err[1] = err[2] = 0; for (x = 0; x < n; x++) { @@ -169,7 +173,7 @@ int c0, c1; } /* split box */ branch = split(box); - bcopy((char *)box, (char *)kb, sizeof(kb)); + memcpy((void *)kb, (void *)box, sizeof(kb)); /* do left (lesser) branch */ kb[prim(branch)][1] = part(branch); cut(kb, c0, (c0+c1)>>1); @@ -253,7 +257,7 @@ register int box[3][2]; for (r = box[RED][0]; r < box[RED][1]; r++) for (g = box[GRN][0]; g < box[GRN][1]; g++) for (b = box[BLU][0]; b < box[BLU][1]; b++) { - if (c = histo[r][g][b]) { + if ( (c = histo[r][g][b]) ) { n += c; sum[RED] += (long)c*r; sum[GRN] += (long)c*g; @@ -337,7 +341,8 @@ int j; if (nl[i][t] == i) { /* add to list */ nl[i][t++] = j; if (t % NBSIZ == 0) { /* enlarge list */ - if ((nnl = realloc(nl[i], t+NBSIZ)) == NULL) + if ((nnl = realloc((void *)nl[i], + t+NBSIZ)) == NULL) t--; else nl[i] = (BYTE *)nnl;