--- ray/src/rt/ambient.c 2003/05/15 05:13:35 2.49 +++ ray/src/rt/ambient.c 2003/07/21 22:30:19 2.53 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ambient.c,v 2.49 2003/05/15 05:13:35 greg Exp $"; +static const char RCSid[] = "$Id: ambient.c,v 2.53 2003/07/21 22:30:19 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.49 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 @@ -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); @@ -529,7 +529,7 @@ register AMBVAL *aval; if ((av = newambval()) == NULL) error(SYSTEM, "out of memory in avstore"); - copystruct(av, aval); + *av = *aval; av->latick = ambclock; av->next = NULL; nambvals++; @@ -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); } @@ -741,7 +741,7 @@ int always; if (avlist2 != NULL) free((void *)avlist2); if (always) { /* rebuild without sorting */ - copystruct(&oldatrunk, &atrunk); + oldatrunk = atrunk; atrunk.alist = NULL; atrunk.kid = NULL; unloadatree(&oldatrunk, avinsert); @@ -772,14 +772,14 @@ int always; if (avlist1[i].p == NULL) continue; tap = avlist2[i]; - copystruct(&tav, tap); + tav = *tap; for (j = i; (pnext = avlist1[j].p) != tap; j = avlmemi(pnext)) { - copystruct(avlist2[j], pnext); + *(avlist2[j]) = *pnext; avinsert(avlist2[j]); avlist1[j].p = NULL; } - copystruct(avlist2[j], &tav); + *(avlist2[j]) = tav; avinsert(avlist2[j]); avlist1[j].p = NULL; }