| 26 | 
  | 
 | 
| 27 | 
  | 
static char  *infn;                     /* input file name */ | 
| 28 | 
  | 
static FILE  *infp;                     /* input file stream */ | 
| 29 | 
+ | 
static int  objsize;                    /* size of stored OBJECT's */ | 
| 30 | 
  | 
static OBJECT  objorig;                 /* zeroeth object */ | 
| 31 | 
  | 
static short  otypmap[NUMOTYPE+8];      /* object type map */ | 
| 32 | 
  | 
 | 
| 59 | 
  | 
        if (checkheader(infp, OCTFMT, load&IO_INFO ? stdout : NULL) < 0) | 
| 60 | 
  | 
                octerror(USER, "not an octree"); | 
| 61 | 
  | 
                                        /* check format */ | 
| 62 | 
< | 
        if (getint(2) != OCTMAGIC) | 
| 62 | 
> | 
        if ((objsize = getint(2)-OCTMAGIC) <= 0 || | 
| 63 | 
> | 
                        objsize > MAXOBJSIZ || objsize > sizeof(long)) | 
| 64 | 
  | 
                octerror(USER, "incompatible octree format"); | 
| 65 | 
  | 
                                        /* get boundaries */ | 
| 66 | 
  | 
        if (load & IO_BOUNDS) { | 
| 83 | 
  | 
        if (load & IO_FILES) | 
| 84 | 
  | 
                ofn[nf] = NULL; | 
| 85 | 
  | 
                                        /* get number of objects */ | 
| 86 | 
< | 
        fnobjects = getint(sizeof(OBJECT)); | 
| 86 | 
> | 
        fnobjects = getint(objsize); | 
| 87 | 
  | 
 | 
| 88 | 
  | 
        if (load & IO_TREE) { | 
| 89 | 
  | 
                                                /* get the octree */ | 
| 133 | 
  | 
{ | 
| 134 | 
  | 
        OBJECT  set[MAXSET+1]; | 
| 135 | 
  | 
        register int  i; | 
| 136 | 
+ | 
        register long  m; | 
| 137 | 
  | 
 | 
| 138 | 
< | 
        set[0] = getint(sizeof(OBJECT)); | 
| 139 | 
< | 
        if (set[0] > MAXSET) | 
| 138 | 
> | 
        m = getint(objsize); | 
| 139 | 
> | 
        if (m > MAXSET) | 
| 140 | 
  | 
                octerror(USER, "bad set in getfullnode"); | 
| 141 | 
< | 
        for (i = 1; i <= set[0]; i++) | 
| 142 | 
< | 
                set[i] = getint(sizeof(OBJECT)) + objorig; | 
| 141 | 
> | 
        set[0] = m; | 
| 142 | 
> | 
        for (i = 1; i <= set[0]; i++) { | 
| 143 | 
> | 
                m = getint(objsize) + objorig; | 
| 144 | 
> | 
                if ((OBJECT)m != m) | 
| 145 | 
> | 
                        octerror(USER, "too many objects"); | 
| 146 | 
> | 
                set[i] = m; | 
| 147 | 
> | 
        } | 
| 148 | 
  | 
        return(fullnode(set)); | 
| 149 | 
  | 
}        | 
| 150 | 
  | 
 | 
| 213 | 
  | 
        char  sbuf[MAXSTR]; | 
| 214 | 
  | 
        int  obj; | 
| 215 | 
  | 
        register int  i; | 
| 216 | 
+ | 
        register long  m; | 
| 217 | 
  | 
        register OBJREC  *objp; | 
| 218 | 
  | 
 | 
| 219 | 
  | 
        i = getint(1); | 
| 224 | 
  | 
        objp = objptr(obj); | 
| 225 | 
  | 
        if ((objp->otype = otypmap[i]) < 0) | 
| 226 | 
  | 
                octerror(USER, "reference to unknown type"); | 
| 227 | 
< | 
        if ((objp->omod = getint(sizeof(OBJECT))) != OVOID) | 
| 228 | 
< | 
                objp->omod += objorig; | 
| 227 | 
> | 
        if ((m = getint(objsize)) != OVOID) { | 
| 228 | 
> | 
                m += objorig; | 
| 229 | 
> | 
                if ((OBJECT)m != m) | 
| 230 | 
> | 
                        octerror(USER, "too many objects"); | 
| 231 | 
> | 
        } | 
| 232 | 
> | 
        objp->omod = m; | 
| 233 | 
  | 
        objp->oname = savqstr(getstr(sbuf)); | 
| 234 | 
  | 
        if (objp->oargs.nsargs = getint(2)) { | 
| 235 | 
  | 
                objp->oargs.sarg = (char **)bmalloc |