--- ray/src/common/readoct.c 1990/03/12 10:39:17 1.7 +++ ray/src/common/readoct.c 1991/02/07 11:00:42 1.11 @@ -37,8 +37,9 @@ int load; CUBE *scene; char *ofn[]; { - char sbuf[128]; + char sbuf[512]; int nf; + OBJECT fnobjects; register int i; if (fname == NULL) { @@ -80,6 +81,8 @@ char *ofn[]; } if (load & IO_FILES) ofn[nf] = NULL; + /* get number of objects */ + fnobjects = getint(sizeof(OBJECT)); if (load & IO_TREE) { /* get the octree */ @@ -97,6 +100,15 @@ char *ofn[]; } } fclose(infp); + /* consistency checks */ + if (load & IO_SCENE) { + /* check object count */ + if (nobjects != objorig+fnobjects) + octerror(USER, "bad object count; octree stale?"); + /* check for non-surfaces */ + if (nonsurfinset(objorig, fnobjects)) + octerror(USER, "non-surface in set; octree stale?"); + } return(nf); } @@ -161,7 +173,7 @@ getflt() /* get a floating point number */ double d; d = (double)getint(4)/0x7fffffff; - return(ldexp(d, getint(1))); + return(ldexp(d, (int)getint(1))); }