ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/clrtab.c
(Generate patch)

Comparing ray/src/px/clrtab.c (file contents):
Revision 2.6 by greg, Wed May 5 10:18:05 1993 UTC vs.
Revision 2.8 by greg, Thu Dec 9 11:57:15 1993 UTC

# Line 107 | Line 107 | register BYTE  *bs;
107   register COLR   *cs;
108   int     n;
109   {
110 <        static short    (*cerr)[3];
110 >        static short    (*cerr)[3] = NULL;
111          static int      N = 0;
112          int     err[3], errp[3];
113          register int    x, i;
114  
115          if (n != N) {           /* get error propogation array */
116 <                if (N)
117 <                        cerr = (short (*)[3])realloc((char *)cerr,
118 <                                        3*n*sizeof(short));
119 <                else
116 >                if (N) {
117 >                        free((char *)cerr);
118 >                        cerr = NULL;
119 >                }
120 >                if (n)
121                          cerr = (short (*)[3])malloc(3*n*sizeof(short));
122                  if (cerr == NULL) {
123                          N = 0;
# Line 238 | Line 239 | int    p;
239   register int    box[3][2];
240   {
241          unsigned long   sum[3];
242 <        unsigned        r, g, n;
242 >        unsigned        r, g;
243 >        unsigned long   n;
244          register unsigned       b, c;
245                                                  /* sum pixels in box */
246          n = 0;
# Line 254 | Line 256 | register int   box[3][2];
256                      }
257                      histo[r][g][b] = p;         /* assign pixel */
258                  }
259 <        if (n >= (1<<23)/HMAX) {                /* avoid overflow */
259 >        if (n >= (1L<<23)/HMAX) {               /* avoid overflow */
260                  sum[RED] /= n;
261                  sum[GRN] /= n;
262                  sum[BLU] /= n;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines