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

Comparing ray/src/common/readmesh.c (file contents):
Revision 2.16 by greg, Tue Nov 27 06:30:05 2018 UTC vs.
Revision 2.18 by greg, Mon Jul 12 17:42:51 2021 UTC

# Line 35 | Line 35 | static long
35   mgetint(siz)                            /* get a siz-byte integer */
36   int  siz;
37   {
38 <        long  r;
38 >        long  r = getint(siz, meshfp);
39  
40 <        r = getint(siz, meshfp);
41 <        if (feof(meshfp))
40 >        if (r == EOF && feof(meshfp))
41                  mesherror(USER, "truncated mesh file");
42 +
43          return(r);
44   }
45  
# Line 47 | Line 47 | int  siz;
47   static double
48   mgetflt()                               /* get a floating point number */
49   {
50 <        double  r;
50 >        double  r = getflt(meshfp);
51  
52 <        r = getflt(meshfp);
53 <        if (feof(meshfp))
52 >        if (r == (double)EOF && feof(meshfp))
53                  mesherror(USER, "truncated mesh file");
54 +
55          return(r);
56   }
57          
# Line 290 | Line 290 | int    flags;
290                          getpatch(&mp->patch[i]);
291          }
292                                          /* clean up */
293 <        fclose(meshfp);
293 >        if (meshfp != stdin)
294 >                fclose(meshfp);
295          mp->ldflags |= flags;
296                                          /* verify data */
297          if ((err = checkmesh(mp)) != NULL)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines