--- ray/src/common/readmesh.c 2003/03/14 21:27:46 2.2 +++ ray/src/common/readmesh.c 2003/06/08 12:03:09 2.5 @@ -1,14 +1,16 @@ #ifndef lint -static const char RCSid[] = "$Id: readmesh.c,v 2.2 2003/03/14 21:27:46 greg Exp $"; +static const char RCSid[] = "$Id: readmesh.c,v 2.5 2003/06/08 12:03:09 schorsch Exp $"; #endif /* * Routines for reading a compiled mesh from a file */ #include "standard.h" +#include "platform.h" #include "octree.h" #include "object.h" #include "mesh.h" +#include "resolu.h" static char *meshfn; /* input file name */ static FILE *meshfp; /* mesh file pointer */ @@ -73,21 +75,22 @@ gettree() /* get a pre-ordered octree */ register int i; switch (getc(meshfp)) { - case OT_EMPTY: - return(EMPTY); - case OT_FULL: - return(getfullnode()); - case OT_TREE: - if ((ot = octalloc()) == EMPTY) - mesherror(SYSTEM, "out of tree space in readmesh"); - for (i = 0; i < 8; i++) - octkid(ot, i) = gettree(); - return(ot); - case EOF: - mesherror(USER, "truncated mesh octree"); - default: - mesherror(USER, "damaged mesh octree"); + case OT_EMPTY: + return(EMPTY); + case OT_FULL: + return(getfullnode()); + case OT_TREE: + if ((ot = octalloc()) == EMPTY) + mesherror(SYSTEM, "out of tree space in readmesh"); + for (i = 0; i < 8; i++) + octkid(ot, i) = gettree(); + return(ot); + case EOF: + mesherror(USER, "truncated mesh octree"); + default: + mesherror(USER, "damaged mesh octree"); } + return NULL; /* pro forma return */ } @@ -244,9 +247,7 @@ int flags; sprintf(errmsg, "cannot open mesh file \"%s\"", path); error(SYSTEM, errmsg); } -#ifdef MSDOS - setmode(fileno(meshfp), O_BINARY); -#endif + SET_FILE_BINARY(meshfp); /* read header */ checkheader(meshfp, MESHFMT, flags&IO_INFO ? stdout : (FILE *)NULL); /* read format number */