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

Comparing ray/src/hd/holofile.c (file contents):
Revision 3.51 by schorsch, Mon Jul 21 22:30:18 2003 UTC vs.
Revision 3.52 by schorsch, Sun Jul 27 22:12:02 2003 UTC

# Line 143 | Line 143 | int    wr;
143   hdrelease(fd)           /* stop tracking file fragments for some section */
144   register int    fd;
145   {
146 <        if (fd < 0 | fd >= nhdfragls || !hdfragl[fd].nlinks)
146 >        if ((fd < 0) | (fd >= nhdfragls) || !hdfragl[fd].nlinks)
147                  return;
148          if (!--hdfragl[fd].nlinks && hdfragl[fd].nfrags) {
149                  free((void *)hdfragl[fd].fi);
# Line 213 | Line 213 | HDGRID *hproto;                /* holodeck section grid */
213          fpos = hdfilen(fd);
214          biglob(hp)->nrd = rtrunc = 0;
215          for (n = hproto == NULL ? nbeams(hp) : 0; n > 0; n--)
216 <                if (hp->bi[n].nrd)
216 >                if (hp->bi[n].nrd) {
217                          if (hp->bi[n].fo+hp->bi[n].nrd*sizeof(RAYVAL) > fpos) {
218                                  rtrunc += hp->bi[n].nrd;
219                                  hp->bi[n].nrd = 0;
220                          } else
221                                  biglob(hp)->nrd += hp->bi[n].nrd;
222 +                }
223          if (rtrunc) {
224                  sprintf(errmsg, "truncated section, %ld rays lost (%.1f%%)",
225                                  rtrunc, 100.*rtrunc/(rtrunc+biglob(hp)->nrd));
# Line 405 | Line 406 | int    nr;                     /* number of new rays desired */
406          int     n;
407  
408          if (nr <= 0) return(NULL);
409 <        CHECK(i < 1 | i > nbeams(hp),
409 >        CHECK((i < 1) | (i > nbeams(hp)),
410                          CONSISTENCY, "bad beam index given to hdnewrays");
411          if (hp->bl[i] != NULL)
412                  hp->bl[i]->tick = hdclock;      /* preempt swap */
# Line 446 | Line 447 | register int   i;
447   {
448          register int    n;
449  
450 <        CHECK(i < 1 | i > nbeams(hp),
450 >        CHECK((i < 1) | (i > nbeams(hp)),
451                          CONSISTENCY, "bad beam index given to hdgetbeam");
452          if (hp->bl[i] == NULL) {                /* load from disk */
453                  if (!(n = hp->bi[i].nrd))
# Line 500 | Line 501 | void   (*bf)();                /* callback function (optional) */
501                                          /* precheck consistency */
502          if (n <= 0) return;
503          for (i = n; i--; )
504 <                if (hb[i].h==NULL || hb[i].b<1 | hb[i].b>nbeams(hb[i].h))
504 >                if (hb[i].h==NULL || (hb[i].b<1) | (hb[i].b>nbeams(hb[i].h)))
505                          error(CONSISTENCY, "bad beam in hdloadbeams");
506                                          /* sort list for optimal access */
507          qsort((void *)hb, n, sizeof(HDBEAMI), hdfilord);
# Line 621 | Line 622 | register int32 *listsiz;
622          register struct fraglist        *f;
623          register int    i;
624  
625 <        if (fd < 0 | fd >= nhdfragls || !(f = &hdfragl[fd])->nlinks)
625 >        if ((fd < 0) | (fd >= nhdfragls) || !(f = &hdfragl[fd])->nlinks)
626                  return(0);              /* listless */
627          if (listlen != NULL)
628                  *listlen = f->nfrags;
# Line 761 | Line 762 | register int   i;
762                  return(nchanged);
763          }
764          if (i == 0) {                   /* clobber entire holodeck */
765 <                if (biglob(hp)->nrd == 0 & blglob(hp)->nrm == 0)
765 >                if ((biglob(hp)->nrd == 0) & (blglob(hp)->nrm == 0))
766                          return(0);              /* already empty */
767                  nchanged = 0;
768                  nchanged = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines