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

Comparing ray/src/util/cmatrix.c (file contents):
Revision 2.2 by greg, Sat Feb 8 01:28:06 2014 UTC vs.
Revision 2.3 by greg, Tue Apr 8 23:45:33 2014 UTC

# Line 337 | Line 337 | cm_multiply(const CMATRIX *cm1, const CMATRIX *cm2)
337   int
338   cm_write(const CMATRIX *cm, int dtype, FILE *fp)
339   {
340 <        const COLORV    *mp = cm->cmem;
341 <        int             r, c;
340 >        static const char       tabEOL[2] = {'\t','\n'};
341 >        const COLORV            *mp = cm->cmem;
342 >        int                     r, c;
343  
344          switch (dtype) {
345          case DTascii:
346 <                for (r = 0; r < cm->nrows; r++) {
346 >                for (r = 0; r < cm->nrows; r++)
347                          for (c = 0; c < cm->ncols; c++, mp += 3)
348 <                                fprintf(fp, "\t%.6e %.6e %.6e",
349 <                                                mp[0], mp[1], mp[2]);
350 <                        fputc('\n', fp);
350 <                }
348 >                                fprintf(fp, "%.6e %.6e %.6e%c",
349 >                                                mp[0], mp[1], mp[2],
350 >                                                tabEOL[c >= cm->ncols-1]);
351                  break;
352          case DTfloat:
353          case DTdouble:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines