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

Comparing ray/src/common/readwfobj.c (file contents):
Revision 2.4 by greg, Sat May 2 00:12:45 2020 UTC vs.
Revision 2.10 by greg, Tue Feb 7 20:28:16 2023 UTC

# Line 160 | Line 160 | add_face(Scene *sc, const VNDX ondx, int ac, char *av[
160          if (i < 0)                              /* create face if indices OK */
161                  f = addFace(sc, varr, ac);
162          if (varr != vdef)
163 <                efree((char *)varr);
163 >                efree(varr);
164          return(f != NULL);
165   }
166  
# Line 171 | Line 171 | loadOBJ(Scene *sc, const char *fspec)
171          FILE    *fp;
172          char    *argv[MAXARG];
173          int     argc;
174 <        char    buf[256];
174 >        char    buf[1024];
175          int     nstats=0, nunknown=0;
176          int     onfaces;
177          VNDX    ondx;
# Line 192 | Line 192 | loadOBJ(Scene *sc, const char *fspec)
192                  error(SYSTEM, errmsg);
193                  return(NULL);
194          }
195 + #ifdef getc_unlocked                    /* avoid stupid semaphores */
196 +        flockfile(fp);
197 + #endif
198          if (sc == NULL)
199                  sc = newScene();
200          lineno = 0;
# Line 276 | Line 279 | loadOBJ(Scene *sc, const char *fspec)
279                          fprintf(stderr, " %8d statements\r", nstats);
280          }
281   #if POPEN_SUPPORT
282 <        if (fspec[0] == '!')
283 <                pclose(fp);
284 <        else
282 >        if (fspec[0] == '!') {
283 >                if (pclose(fp) != 0) {
284 >                        sprintf(errmsg, "Bad return status from: %s", fspec+1);
285 >                        error(USER, errmsg);
286 >                        freeScene(sc);
287 >                        return(NULL);
288 >                }
289 >        } else
290   #endif
291          if (fp != stdin)
292                  fclose(fp);
293 <        sprintf(buf, "%d statements read from \"%s\"", nstats, fspec);
293 > #ifdef getc_unlocked
294 >        else
295 >                funlockfile(fp);
296 > #endif
297 >        if (verbose)
298 >                fprintf(stderr, "Read %d statements\n", nstats);
299 >        if (strlen(fspec) < sizeof(buf)-32)
300 >                sprintf(buf, "%d statements read from \"%s\"", nstats, fspec);
301 >        else
302 >                sprintf(buf, "%d statements read from (TOO LONG TO SHOW)", nstats);
303          addComment(sc, buf);
304          if (nunknown) {
305                  sprintf(buf, "\t%d unrecognized", nunknown);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines