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

Comparing ray/src/rt/rc2.c (file contents):
Revision 2.16 by greg, Tue Mar 1 00:58:31 2016 UTC vs.
Revision 2.18 by greg, Thu Aug 18 00:52:48 2016 UTC

# Line 6 | Line 6 | static const char RCSid[] = "$Id$";
6   * File i/o and recovery
7   */
8  
9 + #include <ctype.h>
10 + #include "platform.h"
11   #include "rcontrib.h"
12   #include "resolu.h"
11 #include <ctype.h>
13  
14   /* Close output stream and free record */
15   static void
# Line 261 | Line 262 | getvec(FVECT vec)
262                  }
263                  break;
264          case 'f':                                       /* binary float */
265 <                if (fread((char *)vf, sizeof(float), 3, stdin) != 3)
265 >                if (getbinary((char *)vf, sizeof(float), 3, stdin) != 3)
266                          return(-1);
267                  VCOPY(vec, vf);
268                  break;
269          case 'd':                                       /* binary double */
270 <                if (fread((char *)vd, sizeof(double), 3, stdin) != 3)
270 >                if (getbinary((char *)vd, sizeof(double), 3, stdin) != 3)
271                          return(-1);
272                  VCOPY(vec, vd);
273                  break;
# Line 302 | Line 303 | put_contrib(const DCOLOR cnt, FILE *fout)
303                          scalecolor(fv, sf);
304                  } else
305                          copycolor(fv, cnt);
306 <                fwrite(fv, sizeof(float), 3, fout);
306 >                putbinary(fv, sizeof(float), 3, fout);
307                  break;
308          case 'd':
309                  if (accumulate > 1) {
310                          DCOLOR  dv;
311                          copycolor(dv, cnt);
312                          scalecolor(dv, sf);
313 <                        fwrite(dv, sizeof(double), 3, fout);
313 >                        putbinary(dv, sizeof(double), 3, fout);
314                  } else
315 <                        fwrite(cnt, sizeof(double), 3, fout);
315 >                        putbinary(cnt, sizeof(double), 3, fout);
316                  break;
317          case 'c':
318                  if (accumulate > 1)
319                          setcolr(cv, sf*cnt[0], sf*cnt[1], sf*cnt[2]);
320                  else
321                          setcolr(cv, cnt[0], cnt[1], cnt[2]);
322 <                fwrite(cv, sizeof(cv), 1, fout);
322 >                putbinary(cv, sizeof(cv), 1, fout);
323                  break;
324          default:
325                  error(INTERNAL, "botched output format");
# Line 393 | Line 394 | get_contrib(DCOLOR cnt, FILE *finp)
394          case 'a':
395                  return(fscanf(finp,"%lf %lf %lf",&cnt[0],&cnt[1],&cnt[2]) == 3);
396          case 'f':
397 <                if (fread(fv, sizeof(fv[0]), 3, finp) != 3)
397 >                if (getbinary(fv, sizeof(fv[0]), 3, finp) != 3)
398                          return(0);
399                  copycolor(cnt, fv);
400                  return(1);
401          case 'd':
402 <                return(fread(cnt, sizeof(cnt[0]), 3, finp) == 3);
402 >                return(getbinary(cnt, sizeof(cnt[0]), 3, finp) == 3);
403          case 'c':
404 <                if (fread(cv, sizeof(cv), 1, finp) != 1)
404 >                if (getbinary(cv, sizeof(cv), 1, finp) != 1)
405                          return(0);
406                  colr_color(fv, cv);
407                  copycolor(cnt, fv);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines