--- ray/src/rt/ambient.c 2003/07/21 22:30:19 2.53 +++ ray/src/rt/ambient.c 2003/10/20 16:01:55 2.55 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ambient.c,v 2.53 2003/07/21 22:30:19 schorsch Exp $"; +static const char RCSid[] = "$Id: ambient.c,v 2.55 2003/10/20 16:01:55 greg Exp $"; #endif /* * ambient.c - routines dealing with ambient (inter-reflected) component. @@ -158,7 +158,7 @@ setambient() /* initialize calculation */ } /* align file pointer */ pos += (long)nambvals*AMBVALSIZ; - flen = lseek(fileno(ambfp), (off_t)0L, 2); + flen = lseek(fileno(ambfp), (off_t)0, SEEK_END); if (flen != pos) { sprintf(errmsg, "ignoring last %ld values in ambient file (corrupted)", @@ -280,7 +280,7 @@ FVECT nrm; return; dumbamb: /* return global value */ copycolor(acol, ambval); - if (ambvwt <= 0 | navsum == 0) + if ((ambvwt <= 0) | (navsum == 0)) return; l = bright(ambval); /* average in computations */ if (l > FTINY) { @@ -829,9 +829,9 @@ ambsync() /* synchronize ambient file */ /* gain exclusive access */ aflock(F_WRLCK); /* see if file has grown */ - if ((flen = lseek(fileno(ambfp), (off_t)0L, 2)) < 0) + if ((flen = lseek(fileno(ambfp), (off_t)0, SEEK_END)) < 0) goto seekerr; - if (n = flen - lastpos) { /* file has grown */ + if ( (n = flen - lastpos) ) { /* file has grown */ if (ambinp == NULL) { /* use duplicate filedes */ ambinp = fdopen(dup(fileno(ambfp)), "r"); if (ambinp == NULL) @@ -852,7 +852,7 @@ ambsync() /* synchronize ambient file */ } /*** seek always as safety measure if (n) ***/ /* alignment */ - if (lseek(fileno(ambfp), (off_t)(flen-n), 0) < 0) + if (lseek(fileno(ambfp), (off_t)(flen-n), SEEK_SET) < 0) goto seekerr; } #ifdef DEBUG @@ -865,7 +865,7 @@ ambsync() /* synchronize ambient file */ #endif syncend: n = fflush(ambfp); /* calls write() at last */ - if ((lastpos = lseek(fileno(ambfp), (off_t)0L, 1)) < 0) + if ((lastpos = lseek(fileno(ambfp), (off_t)0, SEEK_CUR)) < 0) goto seekerr; aflock(F_UNLCK); /* release file */ nunflshed = 0;