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

Comparing ray/src/util/rmtxop.c (file contents):
Revision 2.2 by greg, Sat May 31 19:21:21 2014 UTC vs.
Revision 2.6 by greg, Tue Dec 16 20:21:46 2014 UTC

# Line 22 | Line 22 | typedef struct {
22          int             op;                     /* '*' or '+' */
23   } ROPERAT;                              /* matrix operation */
24  
25 < int     outfmt = DTascii;               /* output format */
25 > int     outfmt = DTfromHeader;          /* output format */
26   int     verbose = 0;                    /* verbose reporting? */
27  
28   static void
# Line 167 | Line 167 | main(int argc, char *argv[])
167   {
168          RMATRIX *mres = NULL;
169          ROPERAT op;
170        long    nbw;
170          int     i;
171                                          /* initialize */
172          op_default(&op);
# Line 232 | Line 231 | main(int argc, char *argv[])
231          if (mres == NULL)               /* check that we got something */
232                  goto userr;
233                                          /* write result to stdout */
234 + #ifdef getc_unlocked
235 +        flockfile(stdout);
236 + #endif
237 +        if (outfmt == DTfromHeader)
238 +                outfmt = mres->dtype;
239 + #ifdef _WIN32
240 +        if (outfmt != DTascii)
241 +                _setmode(fileno(stdout), _O_BINARY);
242 + #endif
243          newheader("RADIANCE", stdout);
244          printargs(argc, argv, stdout);
245 <        nbw = rmx_write(mres, outfmt, stdout);
238 <        /* rmx_free(mres); mres = NULL; */
239 <        if (nbw <= 0) {
245 >        if (!rmx_write(mres, outfmt, stdout)) {
246                  fprintf(stderr, "%s: error writing result matrix\n", argv[0]);
247                  return(1);
248          }
249 <        if (verbose)
244 <                fprintf(stderr, "%s: %ld bytes written\n", argv[0], nbw);
249 >        /* rmx_free(mres); mres = NULL; */
250          return(0);
251   userr:
252          fprintf(stderr,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines