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

Comparing ray/src/hd/rhcopy.c (file contents):
Revision 3.31 by greg, Fri Oct 5 19:19:16 2018 UTC vs.
Revision 3.32 by greg, Mon Oct 21 18:19:32 2019 UTC

# Line 137 | Line 137 | openholo(              /* open existing holodeck file for i/o */
137          off_t   nextloc;
138          int     n;
139                                          /* open holodeck file */
140 <        if ((fp = fopen(fname, append ? "r+" : "r")) == NULL) {
140 >        if ((fp = fopen(fname, append ? "rb+" : "rb")) == NULL) {
141                  sprintf(errmsg, "cannot open \"%s\" for %s", fname,
142                                  append ? "appending" : "reading");
143                  error(SYSTEM, errmsg);
# Line 336 | Line 336 | addpicz(               /* add a picture + depth-buffer */
336          int     j;
337          int     i;
338                                  /* open files */
339 <        if ((pfp = fopen(pcf, "r")) == NULL) {
339 >        if ((pfp = fopen(pcf, "rb")) == NULL) {
340                  sprintf(errmsg, "cannot open picture file \"%s\"", pcf);
341                  error(SYSTEM, pcf);
342          }
# Line 344 | Line 344 | addpicz(               /* add a picture + depth-buffer */
344                  sprintf(errmsg, "cannot open depth file \"%s\"", zbf);
345                  error(SYSTEM, pcf);
346          }
347 +        SET_FD_BINARY(zfd);
348                                  /* load picture header */
349          phd.vw = stdview;
350          phd.expos = 1.0;
# Line 392 | Line 393 | addpicz(               /* add a picture + depth-buffer */
393                  }
394                  if (eshft)                              /* shift exposure */
395                          shiftcolrs(cscn, i, eshft);
396 <                i *= sizeof(float);                     /* read depth */
397 <                if (read(zfd, (char *)zscn, i) != i) {
396 >                                                        /* read depth */
397 >                if (read(zfd, zscn, i*sizeof(float)) != i*sizeof(float)) {
398                          sprintf(errmsg, "error reading depth file \"%s\"", zbf);
399                          error(USER, errmsg);
400                  }
401 <                for (i = scanlen(&prs); i--; ) {        /* do each pixel */
401 >                while (i--) {                           /* process each pixel */
402                          if (zscn[i] <= 0.0)
403                                  continue;               /* illegal depth */
404                          pix2loc(vl, &prs, i, j);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines