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

Comparing ray/src/common/fltdepth.c (file contents):
Revision 3.4 by greg, Mon Nov 11 16:45:30 2019 UTC vs.
Revision 3.5 by greg, Thu Mar 5 17:37:09 2020 UTC

# Line 113 | Line 113 | open_float_depth(const char *fname, long expected_leng
113          for (nleft = (ssize_t)dc.res.xr*dc.res.yr; nleft > 0; nleft -= FBUFLEN) {
114                  for (n = 0; n < FBUFLEN; n++) {
115                          double  d = decode_depth_next(&dc);
116 <                        if (d < 0) {
116 >                        if (d < -FTINY) {
117                                  if (n < nleft)
118                                          goto badEOF;
119                                  break;
# Line 129 | Line 129 | open_float_depth(const char *fname, long expected_leng
129                  }
130          }
131          fclose(dc.finp);                /* all done -- clean up */
132 <        if (lseek(fd, 0, SEEK_SET) != 0)
133 <                goto seek_error;
134 <        return(fd);
132 >        if (lseek(fd, 0, SEEK_SET) == 0)
133 >                return(fd);
134 > seek_error:
135 >        perror("lseek");
136 >        close(fd);
137 >        return(-1);
138   badEOF:
139          fputs(fname, stderr);
140          fputs(": unexpected end-of-file\n", stderr);
141          if (dc.finp) fclose(dc.finp);
139        close(fd);
140        return(-1);
141 seek_error:
142        perror("lseek");
142          close(fd);
143          return(-1);
144   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines