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

Comparing ray/src/util/rcollate.c (file contents):
Revision 2.32 by greg, Fri Nov 8 05:39:05 2019 UTC vs.
Revision 2.33 by greg, Fri Nov 8 16:36:36 2019 UTC

# Line 421 | Line 421 | do_reorder(const MEMLOAD *mp)
421          } else if ((ni_rows > 0) & (ni_columns > 0)) {
422                  nrecords = ni_rows*ni_columns;
423                  if (nrecords > mp->len/(n_comp*comp_size)) {
424 <                        fprintf(stderr,
425 <                            "Input too small for specified size and type\n");
424 >                        fputs("Input too small for specified size and type\n",
425 >                                        stderr);
426                          return(0);
427                  }
428          } else
# Line 441 | Line 441 | do_reorder(const MEMLOAD *mp)
441                          no_rows = ni_columns;
442                  if ((no_rows != ni_columns) | (no_columns != ni_rows))
443                          goto badspec;
444 +        } else {
445 +                if (no_columns <= 0)
446 +                        no_columns = ni_columns;
447 +                if (no_rows <= 0)
448 +                        no_rows = ni_rows;
449          }
450 +        if (ni_rows*ni_columns != no_rows*no_columns) {
451 +                fputs("Number of input and output records do not match\n",
452 +                                stderr);
453 +                return(0);
454 +        }
455                                                  /* reorder records */
456          for (i = 0; i < no_rows; i++) {
457              for (j = 0; j < no_columns; j++) {
458                  long    n = get_input_pos(i, j);
459 +                if (n >= nrecords) {
460 +                        fputs("Index past end-of-file\n", stderr);
461 +                        return(0);
462 +                }
463                  if (rp != NULL) {               /* ASCII output */
464                          print_record(rp, n);
465                          putc(tabEOL[j >= no_columns-1], stdout);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines