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

Comparing ray/src/common/readmesh.c (file contents):
Revision 2.15 by greg, Fri Mar 4 00:21:21 2016 UTC vs.
Revision 2.16 by greg, Tue Nov 27 06:30:05 2018 UTC

# Line 35 | Line 35 | static long
35   mgetint(siz)                            /* get a siz-byte integer */
36   int  siz;
37   {
38 <        register long  r;
38 >        long  r;
39  
40          r = getint(siz, meshfp);
41          if (feof(meshfp))
# Line 60 | Line 60 | static OCTREE
60   getfullnode()                           /* get a set, return fullnode */
61   {
62          OBJECT  set[MAXSET+1];
63 <        register int  i;
63 >        int  i;
64  
65          if ((set[0] = mgetint(objsize)) > MAXSET)
66                  mesherror(USER, "bad set in getfullnode");
# Line 73 | Line 73 | getfullnode()                          /* get a set, return fullnode */
73   static OCTREE
74   gettree()                               /* get a pre-ordered octree */
75   {
76 <        register OCTREE  ot;
77 <        register int  i;
76 >        OCTREE   ot;
77 >        int  i;
78          
79          switch (getc(meshfp)) {
80                  case OT_EMPTY:
# Line 99 | Line 99 | gettree()                              /* get a pre-ordered octree */
99   static void
100   skiptree()                              /* skip octree on input */
101   {
102 <        register int  i;
102 >        int  i;
103          
104          switch (getc(meshfp)) {
105          case OT_EMPTY:
# Line 123 | Line 123 | skiptree()                             /* skip octree on input */
123  
124   static void
125   getpatch(pp)                            /* load a mesh patch */
126 < register MESHPATCH      *pp;
126 > MESHPATCH       *pp;
127   {
128          int     flags;
129          int     i, j;
# Line 133 | Line 133 | register MESHPATCH     *pp;
133                  mesherror(USER, "bad patch flags");
134                                          /* allocate vertices */
135          pp->nverts = mgetint(2);
136 <        if (pp->nverts <= 0 || pp->nverts > 256)
136 >        if ((pp->nverts <= 0) | (pp->nverts > 256))
137                  mesherror(USER, "bad number of patch vertices");
138          pp->xyz = (uint32 (*)[3])malloc(pp->nverts*3*sizeof(uint32));
139          if (pp->xyz == NULL)
# Line 165 | Line 165 | register MESHPATCH     *pp;
165                                  pp->uv[i][j] = mgetint(4);
166                                          /* local triangles */
167          pp->ntris = mgetint(2);
168 <        if (pp->ntris < 0 || pp->ntris > 512)
168 >        if ((pp->ntris < 0) | (pp->ntris > 512))
169                  mesherror(USER, "bad number of local triangles");
170          if (pp->ntris) {
171                  pp->tri = (struct PTri *)malloc(pp->ntris *
# Line 192 | Line 192 | register MESHPATCH     *pp;
192          }
193                                          /* joiner triangles */
194          pp->nj1tris = mgetint(2);
195 <        if (pp->nj1tris < 0 || pp->nj1tris > 512)
195 >        if ((pp->nj1tris < 0) | (pp->nj1tris > 256))
196                  mesherror(USER, "bad number of joiner triangles");
197          if (pp->nj1tris) {
198                  pp->j1tri = (struct PJoin1 *)malloc(pp->nj1tris *
# Line 209 | Line 209 | register MESHPATCH     *pp;
209                  pp->j1tri = NULL;
210                                          /* double joiner triangles */
211          pp->nj2tris = mgetint(2);
212 <        if (pp->nj2tris < 0 || pp->nj2tris > 256)
212 >        if ((pp->nj2tris < 0) | (pp->nj2tris > 256))
213                  mesherror(USER, "bad number of double joiner triangles");
214          if (pp->nj2tris) {
215                  pp->j2tri = (struct PJoin2 *)malloc(pp->nj2tris *
# Line 254 | Line 254 | int    flags;
254          checkheader(meshfp, MESHFMT, flags&IO_INFO ? stdout : (FILE *)NULL);
255                                          /* read format number */
256          objsize = getint(2, meshfp) - MESHMAGIC;
257 <        if (objsize <= 0 || objsize > MAXOBJSIZ || objsize > sizeof(long))
257 >        if ((objsize <= 0) | (objsize > MAXOBJSIZ) | (objsize > sizeof(long)))
258                  mesherror(USER, "incompatible mesh format");
259                                          /* read boundaries */
260          if (flags & IO_BOUNDS) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines