--- ray/src/rt/ambient.c 2003/02/25 02:47:22 2.48 +++ ray/src/rt/ambient.c 2003/06/30 14:59:12 2.52 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ambient.c,v 2.48 2003/02/25 02:47:22 greg Exp $"; +static const char RCSid[] = "$Id: ambient.c,v 2.52 2003/06/30 14:59:12 schorsch Exp $"; #endif /* * ambient.c - routines dealing with ambient (inter-reflected) component. @@ -9,12 +9,12 @@ static const char RCSid[] = "$Id: ambient.c,v 2.48 200 #include "copyright.h" -#include "ray.h" +#include +#include "platform.h" +#include "ray.h" #include "otypes.h" - #include "ambient.h" - #include "random.h" #ifndef OCTSCALE @@ -35,10 +35,10 @@ static FILE *ambfp = NULL; /* ambient file pointer */ static int nunflshed = 0; /* number of unflushed ambient values */ #ifndef SORT_THRESH -#ifdef BIGMEM -#define SORT_THRESH ((9L<<20)/sizeof(AMBVAL)) -#else +#ifdef SMLMEM #define SORT_THRESH ((3L<<20)/sizeof(AMBVAL)) +#else +#define SORT_THRESH ((9L<<20)/sizeof(AMBVAL)) #endif #endif #ifndef SORT_INTVL @@ -165,7 +165,9 @@ setambient() /* initialize calculation */ (flen - pos)/AMBVALSIZ); error(WARNING, errmsg); fseek(ambfp, pos, 0); +#ifndef _WIN32 /* XXX we need a replacement for that one */ ftruncate(fileno(ambfp), (off_t)pos); +#endif } } else if ((ambfp = fopen(ambfile, "w+")) != NULL) { initambfile(1); /* else create new file */ @@ -474,9 +476,7 @@ int creat; #ifdef F_SETLKW aflock(creat ? F_WRLCK : F_RDLCK); #endif -#ifdef MSDOS - setmode(fileno(ambfp), O_BINARY); -#endif + SET_FILE_BINARY(ambfp); if (mybuf == NULL) mybuf = (char *)bmalloc(BUFSIZ+8); setbuf(ambfp, mybuf); @@ -564,7 +564,7 @@ newambtree() /* allocate 8 ambient tree structs */ } atp = atfreelist; atfreelist = atp->kid; - bzero((char *)atp, 8*sizeof(AMBTREE)); + memset((char *)atp, '\0', 8*sizeof(AMBTREE)); return(atp); }