--- ray/src/common/readoct.c 1989/09/19 13:40:48 1.6 +++ ray/src/common/readoct.c 1990/09/10 10:01:21 1.9 @@ -18,11 +18,11 @@ static char SCCSid[] = "$SunId$ LBL"; #include "otypes.h" -double atof(); -double getflt(); -long getint(); -char *getstr(); -OCTREE getfullnode(), gettree(); +extern double atof(); +static double getflt(); +static long getint(); +static char *getstr(); +static OCTREE getfullnode(), gettree(); static char *infn; /* input file name */ static FILE *infp; /* input file stream */ @@ -39,6 +39,7 @@ char *ofn[]; { char sbuf[128]; 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); }