ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/readoct.c
(Generate patch)

Comparing ray/src/common/readoct.c (file contents):
Revision 1.7 by greg, Mon Mar 12 10:39:17 1990 UTC vs.
Revision 1.12 by greg, Thu Apr 18 13:01:28 1991 UTC

# Line 37 | Line 37 | int  load;
37   CUBE  *scene;
38   char  *ofn[];
39   {
40 <        char  sbuf[128];
40 >        extern int  fputs();
41 >        char  sbuf[512];
42          int  nf;
43 +        OBJECT  fnobjects;
44          register int  i;
45          
46          if (fname == NULL) {
# Line 53 | Line 55 | char  *ofn[];
55                  }
56          }
57                                          /* get header */
58 <        if (load & IO_INFO)
59 <                copyheader(infp, stdout);
58 <        else
59 <                getheader(infp, NULL);
58 >        if (checkheader(infp, OCTFMT, load&IO_INFO ? stdout : NULL) < 0)
59 >                octerror(USER, "not an octree");
60                                          /* check format */
61          if (getint(2) != OCTMAGIC)
62 <                octerror(USER, "invalid octree format");
62 >                octerror(USER, "incompatible octree format");
63                                          /* get boundaries */
64          if (load & IO_BOUNDS) {
65                  for (i = 0; i < 3; i++)
# Line 80 | Line 80 | char  *ofn[];
80          }
81          if (load & IO_FILES)
82                  ofn[nf] = NULL;
83 +                                        /* get number of objects */
84 +        fnobjects = getint(sizeof(OBJECT));
85  
86          if (load & IO_TREE) {
87                                                  /* get the octree */
# Line 97 | Line 99 | char  *ofn[];
99                  }
100          }
101          fclose(infp);
102 +                                        /* consistency checks */
103 +        if (load & IO_SCENE) {
104 +                                        /* check object count */
105 +                if (nobjects != objorig+fnobjects)
106 +                        octerror(USER, "bad object count; octree stale?");
107 +                                        /* check for non-surfaces */
108 +                if (nonsurfinset(objorig, fnobjects))
109 +                        octerror(USER, "non-surface in set; octree stale?");
110 +        }
111          return(nf);
112   }
113  
# Line 161 | Line 172 | getflt()                       /* get a floating point number */
172          double  d;
173  
174          d = (double)getint(4)/0x7fffffff;
175 <        return(ldexp(d, getint(1)));
175 >        return(ldexp(d, (int)getint(1)));
176   }
177          
178  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines