--- ray/src/rt/rc2.c 2017/02/07 16:48:14 2.22 +++ ray/src/rt/rc2.c 2019/09/04 20:19:51 2.24 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rc2.c,v 2.22 2017/02/07 16:48:14 greg Exp $"; +static const char RCSid[] = "$Id: rc2.c,v 2.24 2019/09/04 20:19:51 greg Exp $"; #endif /* * Accumulate ray contributions for a set of materials @@ -116,6 +116,8 @@ printheader(FILE *fout, const char *info) fputs("NCOMP=3\n", fout); /* always RGB */ if (info != NULL) /* add extra info if given */ fputs(info, fout); + if ((outfmt == 'f') | (outfmt == 'd')) + fputendian(fout); fputformat(formstr(outfmt), fout); fputc('\n', fout); /* empty line ends header */ } @@ -146,6 +148,9 @@ getostream(const char *ospec, const char *mname, int b if (!noopen & !using_stdout) { if (outfmt != 'a') SET_FILE_BINARY(stdout); +#ifdef getc_unlocked + flockfile(stdout); /* avoid lock/unlock overhead */ +#endif if (header) { cp = info; if (yres > 0) { @@ -162,9 +167,6 @@ getostream(const char *ospec, const char *mname, int b if (waitflush > 0) fflush(stdout); stdos.xr = xres; stdos.yr = yres; -#ifdef getc_unlocked - flockfile(stdout); /* avoid lock/unlock overhead */ -#endif using_stdout = 1; } stdos.ofp = stdout;