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.25 by greg, Wed Nov 29 18:57:10 2023 UTC vs.
Revision 2.26 by greg, Fri Dec 1 02:05:00 2023 UTC

# Line 5 | Line 5 | static const char RCSid[] = "$Id$";
5   * General component matrix operations.
6   */
7  
8 #include <stdlib.h>
8   #include <errno.h>
9   #include <ctype.h>
10   #include "rtio.h"
# Line 236 | Line 235 | loadop(ROPMAT *rop)
235                                          rop->inspec, mres->ncomp,
236                                          rop->mtx->ncomp,
237                                          rop->preop.nsf ? " (* scalar)" : "");
238 <                rop->preop.nsf = 0;
238 >                rop->preop.nsf = 0;             /* now folded in */
239                  if ((mres->ncomp > 3) & (mres->dtype <= DTspec))
240                          outtype = DTfloat;      /* probably not actual spectrum */
241                  rmx_free(rop->mtx);
# Line 449 | Line 448 | get_factors(double da[], int n, char *av[])
448   }
449  
450   static ROPMAT *
451 < grow_moparray(ROPMAT *mop, int n2alloc)
451 > resize_moparr(ROPMAT *mop, int n2alloc)
452   {
453          int     nmats = 0;
454 +        int     i;
455  
456          while (mop[nmats++].binop)
457                  ;
458 +        for (i = nmats; i > n2alloc; i--)
459 +                rmx_free(mop[i].mtx);
460          mop = (ROPMAT *)realloc(mop, n2alloc*sizeof(ROPMAT));
461          if (mop == NULL) {
462 <                fputs("Out of memory in grow_moparray()\n", stderr);
462 >                fputs("Out of memory in resize_moparr()\n", stderr);
463                  exit(1);
464          }
465          if (n2alloc > nmats)
# Line 573 | Line 575 | main(int argc, char *argv[])
575                          }
576                  }
577                  if (nmats >= nall)
578 <                        mop = grow_moparray(mop, nall += 2);
578 >                        mop = resize_moparr(mop, nall += 2);
579          }
580          if (mop[0].inspec == NULL)      /* nothing to do? */
581                  goto userr;
# Line 601 | Line 603 | main(int argc, char *argv[])
603                  else if (mres->dtype == DTxyze)
604                          outfmt = DTxyze;
605          }
606 <        if (outfmt != DTascii)          /* write result to stdout */
605 <                SET_FILE_BINARY(stdout);
606 <        newheader("RADIANCE", stdout);
606 >        newheader("RADIANCE", stdout);  /* write result to stdout */
607          printargs(argc, argv, stdout);
608
608          return(rmx_write(mres, outfmt, stdout) ? 0 : 1);
609   userr:
610          fprintf(stderr,
611 <        "Usage: %s [-v][-f[adfc][-t][-s sf .. | -c ce ..][-rf|-rb] m1 [.+*/] .. > mres\n",
611 >        "Usage: %s [-v][-f{adfc}][-t][-s sf .. | -c ce ..][-rf|-rb] m1 [.+*/] .. > mres\n",
612                          argv[0]);
613          return(1);
614   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines