--- ray/src/common/readwfobj.c 2020/12/14 20:07:34 2.6 +++ ray/src/common/readwfobj.c 2023/02/07 20:28:16 2.10 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: readwfobj.c,v 2.6 2020/12/14 20:07:34 greg Exp $"; +static const char RCSid[] = "$Id: readwfobj.c,v 2.10 2023/02/07 20:28:16 greg Exp $"; #endif /* * readobj.c @@ -160,7 +160,7 @@ add_face(Scene *sc, const VNDX ondx, int ac, char *av[ if (i < 0) /* create face if indices OK */ f = addFace(sc, varr, ac); if (varr != vdef) - efree((char *)varr); + efree(varr); return(f != NULL); } @@ -171,7 +171,7 @@ loadOBJ(Scene *sc, const char *fspec) FILE *fp; char *argv[MAXARG]; int argc; - char buf[256]; + char buf[1024]; int nstats=0, nunknown=0; int onfaces; VNDX ondx; @@ -192,6 +192,9 @@ loadOBJ(Scene *sc, const char *fspec) error(SYSTEM, errmsg); return(NULL); } +#ifdef getc_unlocked /* avoid stupid semaphores */ + flockfile(fp); +#endif if (sc == NULL) sc = newScene(); lineno = 0; @@ -287,7 +290,16 @@ loadOBJ(Scene *sc, const char *fspec) #endif if (fp != stdin) fclose(fp); - sprintf(buf, "%d statements read from \"%s\"", nstats, fspec); +#ifdef getc_unlocked + else + funlockfile(fp); +#endif + if (verbose) + fprintf(stderr, "Read %d statements\n", nstats); + if (strlen(fspec) < sizeof(buf)-32) + sprintf(buf, "%d statements read from \"%s\"", nstats, fspec); + else + sprintf(buf, "%d statements read from (TOO LONG TO SHOW)", nstats); addComment(sc, buf); if (nunknown) { sprintf(buf, "\t%d unrecognized", nunknown);