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

Comparing ray/src/rt/rc2.c (file contents):
Revision 2.2 by greg, Sun Jun 10 05:25:42 2012 UTC vs.
Revision 2.6 by greg, Thu Jun 21 17:14:32 2012 UTC

# Line 8 | Line 8 | static const char RCSid[] = "$Id$";
8  
9   #include "rcontrib.h"
10   #include "resolu.h"
11 #include "platform.h"
11  
12 + /* Close output stream and free record */
13 + static void
14 + closestream(void *p)
15 + {
16 +        STREAMOUT       *sop = (STREAMOUT *)p;
17 +        
18 +        if (sop->ofp != NULL) {
19 +                int     status = 0;
20 +                if (sop->outpipe)
21 +                        status = pclose(sop->ofp);
22 +                else if (sop->ofp != stdout)
23 +                        status = fclose(sop->ofp);
24 +                if (status)
25 +                        error(SYSTEM, "error closing output stream");
26 +        }
27 +        free(p);
28 + }
29 +
30 + LUTAB   ofiletab = LU_SINIT(free,closestream);  /* output file table */
31 +
32   #define OF_MODIFIER     01
33   #define OF_BIN          02
34  
# Line 120 | Line 139 | getostream(const char *ospec, const char *mname, int b
139          STREAMOUT               *sop;
140          
141          if (ospec == NULL) {                    /* use stdout? */
142 <                if (!noopen && !using_stdout) {
142 >                if (!noopen & !using_stdout) {
143                          if (outfmt != 'a')
144                                  SET_FILE_BINARY(stdout);
145                          if (header)
# Line 309 | Line 328 | mod_output(MODCONT *mp)
328  
329          put_contrib(mp->cbin[0], sop->ofp);
330          if (mp->nbins > 3 &&    /* minor optimization */
331 <                        sop == getostream(mp->outspec, mp->modname, 1, 0))
331 >                        sop == getostream(mp->outspec, mp->modname, 1, 0)) {
332                  for (j = 1; j < mp->nbins; j++)
333                          put_contrib(mp->cbin[j], sop->ofp);
334 <        else
334 >        } else {
335                  for (j = 1; j < mp->nbins; j++) {
336                          sop = getostream(mp->outspec, mp->modname, j, 0);
337                          put_contrib(mp->cbin[j], sop->ofp);
338                  }
339 +        }
340   }
341  
342  
# Line 651 | Line 671 | recover_output()
671          nvals = lastout * outvsiz;
672          lu_doall(&ofiletab, myseeko, &nvals);
673                                                  /* skip repeated input */
674 +        lastout *= accumulate;
675          for (nvals = 0; nvals < lastout; nvals++) {
676                  FVECT   vdummy;
677                  if (getvec(vdummy) < 0 || getvec(vdummy) < 0)
678                          error(USER, "unexpected EOF on input");
679          }
680 <        lastray = lastdone = lastout * accumulate;
680 >        lastray = lastdone = (RNUMBER)lastout;
681          if (raysleft)
682                  raysleft -= lastray;
683   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines