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

Comparing ray/src/common/portio.c (file contents):
Revision 2.19 by greg, Thu Aug 18 00:52:48 2016 UTC vs.
Revision 2.21 by greg, Fri Jul 5 03:04:22 2019 UTC

# Line 71 | Line 71 | putbinary(                     /* fwrite() replacement for small objects
71          const char      *s = (const char *)p;
72          int             nbytes = elsiz*nel;
73  
74 <        if (nbytes > 512)
74 >        if (nbytes > 256)
75                  return(fwrite(p, elsiz, nel, fp));
76          
77          while (nbytes-- > 0)
78 <                putc(*s++, fp);
78 >                if (putc(*s++, fp) == EOF)
79 >                        return((elsiz*nel - nbytes)/elsiz);
80  
81          return(nel);
82   }
# Line 152 | Line 153 | getbinary(                     /* fread() replacement for small objects
153          int     nbytes = elsiz*nel;
154          int     c;
155  
156 <        if (nbytes > 512)
156 >        if (nbytes > 256)
157                  return(fread(p, elsiz, nel, fp));
158          
159          while (nbytes-- > 0) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines