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.3 by greg, Mon Jun 11 05:07:55 2012 UTC

# Line 10 | Line 10 | static const char RCSid[] = "$Id$";
10   #include "resolu.h"
11   #include "platform.h"
12  
13 + /* Close output stream and free record */
14 + static void
15 + closestream(void *p)
16 + {
17 +        STREAMOUT       *sop = (STREAMOUT *)p;
18 +        
19 +        if (sop->ofp != NULL) {
20 +                int     status = 0;
21 +                if (sop->outpipe)
22 +                        status = pclose(sop->ofp);
23 +                else if (sop->ofp != stdout)
24 +                        status = fclose(sop->ofp);
25 +                if (status)
26 +                        error(SYSTEM, "error closing output stream");
27 +        }
28 +        free(p);
29 + }
30 +
31 + LUTAB   ofiletab = LU_SINIT(free,closestream);  /* output file table */
32 +
33   #define OF_MODIFIER     01
34   #define OF_BIN          02
35  
# Line 120 | Line 140 | getostream(const char *ospec, const char *mname, int b
140          STREAMOUT               *sop;
141          
142          if (ospec == NULL) {                    /* use stdout? */
143 <                if (!noopen && !using_stdout) {
143 >                if (!noopen & !using_stdout) {
144                          if (outfmt != 'a')
145                                  SET_FILE_BINARY(stdout);
146                          if (header)
# Line 309 | Line 329 | mod_output(MODCONT *mp)
329  
330          put_contrib(mp->cbin[0], sop->ofp);
331          if (mp->nbins > 3 &&    /* minor optimization */
332 <                        sop == getostream(mp->outspec, mp->modname, 1, 0))
332 >                        sop == getostream(mp->outspec, mp->modname, 1, 0)) {
333                  for (j = 1; j < mp->nbins; j++)
334                          put_contrib(mp->cbin[j], sop->ofp);
335 <        else
335 >        } else {
336                  for (j = 1; j < mp->nbins; j++) {
337                          sop = getostream(mp->outspec, mp->modname, j, 0);
338                          put_contrib(mp->cbin[j], sop->ofp);
339                  }
340 +        }
341   }
342  
343  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines