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

Comparing ray/src/util/rcomb.c (file contents):
Revision 2.3 by greg, Tue Dec 19 00:39:03 2023 UTC vs.
Revision 2.9 by greg, Sun May 19 15:32:24 2024 UTC

# Line 9 | Line 9 | static const char RCSid[] = "$Id$";
9   #include <math.h>
10   #include "platform.h"
11   #include "rtio.h"
12 #include "resolu.h"
12   #include "rmatrix.h"
13   #include "calcomp.h"
14   #include "paths.h"
# Line 284 | Line 283 | checksymbolic(ROPMAT *rop)
283          memcpy(rop->rmp->wlpart, WLPART, sizeof(rop->rmp->wlpart));
284          rop->rmp->ncomp = rop->preop.clen / nc;
285                                          /* decide on output type */
286 <        if (!strcmp(rop->preop.csym, "XYZ")) {
286 >        if (!strcasecmp(rop->preop.csym, "XYZ")) {
287                  if (dt <= DTspec)
288                          rop->rmp->dtype = DTxyze;
289 <        } else if (!strcmp(rop->preop.csym, "RGB")) {
289 >        } else if (!strcasecmp(rop->preop.csym, "RGB")) {
290                  if (dt <= DTspec)
291                          rop->rmp->dtype = DTrgbe;
292          } else if (rop->rmp->dtype == DTspec)
# Line 391 | Line 390 | apply_op(RMATRIX *dst, const RMATRIX *src, const RUNAR
390                          return(0);
391                  rmx_free(res);
392          } else if (dst != src)
393 <                memcpy(dst->mtx, src->mtx,
395 <                                sizeof(double)*dst->ncomp*dst->ncols*dst->nrows);
393 >                memcpy(dst->mtx, src->mtx, rmx_array_size(dst));
394          if (ro->nsf == dst->ncomp)
395                  rmx_scale(dst, ro->sca);
396          return(1);
# Line 592 | Line 590 | combine_input(ROPMAT *res, FILE *fout)
590              RMATRIX     *mres = NULL;
591              for (i = 0; i < nmats; i++) {
592                  if (!rmx_load_row(mop[i].imx.mtx, &mop[i].imx, mop[i].infp)) {
593 <                        if (in_nrows <= 0)      /* normal end? */
593 >                        if (cur_row > in_nrows) /* unknown #input rows? */
594                                  goto loop_exit;
595                          fprintf(stderr, "%s: read error at row %d\n",
596                                          mop[i].inspec, cur_row);
# Line 680 | Line 678 | resize_inparr(int n2alloc)
678   {
679          int     i;
680  
681 <        for (i = nmats; i > n2alloc; i--) {
681 >        if (n2alloc == nall)
682 >                return;
683 >        for (i = nall; i > n2alloc; i--) {
684                  rmx_reset(&mop[i].imx);
685                  if (mop[i].rmp != &mop[i].imx)
686                          rmx_free(mop[i].rmp);
# Line 690 | Line 690 | resize_inparr(int n2alloc)
690                  fputs("Out of memory in resize_inparr()\n", stderr);
691                  exit(1);
692          }
693 <        if (n2alloc > nmats)
694 <                memset(mop+nmats, 0, (n2alloc-nmats)*sizeof(ROPMAT));
693 >        if (n2alloc > nall)
694 >                memset(mop+nall, 0, (n2alloc-nall)*sizeof(ROPMAT));
695          nall = n2alloc;
696   }
697  
# Line 868 | Line 868 | main(int argc, char *argv[])
868                  fprintf(stderr, "%s: unsupported output format\n", argv[0]);
869                  return(1);
870          }
871 +        doptimize(1);                   /* optimize definitions */
872                                          /* process & write rows */
873          return(combine_input(&mop[nmats], stdout) ? 0 : 1);
874   stdin_error:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines