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.1 by greg, Thu Sep 5 17:53:23 2013 UTC vs.
Revision 2.3 by greg, Thu Sep 5 18:47:12 2013 UTC

# Line 73 | Line 73 | load_file(MEMLOAD *mp, FILE *fp)
73          mp->len = (size_t)(flen - skip);
74   #ifdef MAP_FILE
75          if (mp->len > 1L<<20) {         /* map file if > 1 MByte */
76 <                mp->base = mmap(NULL, mp->len, PROT_READ|PROT_WRITE,
77 <                                                MAP_PRIVATE, fd, skip);
76 >                mp->base = mmap(NULL, mp->len, PROT_READ, MAP_PRIVATE, fd, skip);
77                  if (mp->base != MAP_FAILED) {
78                          mp->mapped = 1;
79                          return(1);      /* mmap() success */
# Line 280 | Line 279 | do_transpose(const MEMLOAD *mp)
279                  if (ni_columns <= 0)
280                          ni_columns = count_columns(rp);
281                  nrecords = rp->nrecs;
282 <        } else if ((ni_rows > 0) & (ni_columns > 0))
282 >        } else if ((ni_rows > 0) & (ni_columns > 0)) {
283                  nrecords = ni_rows*ni_columns;
284 <        else
284 >                if (nrecords > mp->len / -record_width) {
285 >                        fprintf(stderr,
286 >                            "Input too small for specified size and type\n");
287 >                        return(0);
288 >                }
289 >        } else
290                  nrecords = mp->len / -record_width;
291                                                  /* check sizes */
292          if (ni_rows <= 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines