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.17 by greg, Thu Mar 3 22:09:59 2016 UTC vs.
Revision 2.19 by greg, Thu Aug 18 00:52:48 2016 UTC

# Line 33 | Line 33 | putint(                                /* write a siz-byte integer to fp */
33          FILE  *fp
34   )
35   {
36 <        while (siz--)
37 <                putc((int)(i>>(siz<<3) & 0xff), fp);
36 >        siz <<= 3;
37 >        while ((siz -= 8) >= 0)
38 >                putc((int)(i>>siz & 0xff), fp);
39   }
40  
41  
# Line 62 | Line 63 | putflt(                                /* put out floating point number */
63  
64   int
65   putbinary(                      /* fwrite() replacement for small objects */
66 <        char *s,
66 >        const void *p,
67          int elsiz,
68          int nel,
69          FILE *fp)
70   {
71 <        int     nbytes = elsiz*nel;
71 >        const char      *s = (const char *)p;
72 >        int             nbytes = elsiz*nel;
73  
74          if (nbytes > 512)
75 <                return(fwrite(s, elsiz, nel, fp));
75 >                return(fwrite(p, elsiz, nel, fp));
76          
77          while (nbytes-- > 0)
78                  putc(*s++, fp);
# Line 141 | Line 143 | getflt(                                /* get a floating point number */
143  
144   int
145   getbinary(                      /* fread() replacement for small objects */
146 <        char *s,
146 >        void *p,
147          int elsiz,
148          int nel,
149          FILE *fp)
150   {
151 +        char    *s = (char *)p;
152          int     nbytes = elsiz*nel;
153          int     c;
154  
155          if (nbytes > 512)
156 <                return(fread(s, elsiz, nel, fp));
156 >                return(fread(p, elsiz, nel, fp));
157          
158          while (nbytes-- > 0) {
159                  if ((c = getc(fp)) == EOF)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines