--- ray/src/util/eplus_adduvf.c 2014/02/27 20:39:04 2.13 +++ ray/src/util/eplus_adduvf.c 2014/04/04 17:56:45 2.17 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: eplus_adduvf.c,v 2.13 2014/02/27 20:39:04 greg Exp $"; +static const char RCSid[] = "$Id: eplus_adduvf.c,v 2.17 2014/04/04 17:56:45 greg Exp $"; #endif /* * Add User View Factors to EnergyPlus Input Data File @@ -176,11 +176,11 @@ add_subsurf(IDF_OBJECT *param) static IDF_FIELD * get_vlist(IDF_OBJECT *param, const char *zname) { - const int itm_len = sizeof(IDF_FIELD)+6; - static char fld_buf[4*itm_len]; - static char *next_fbp = fld_buf; - int i; - IDF_FIELD *res; +#define itm_len (sizeof(IDF_FIELD)+6) + static char fld_buf[4*itm_len]; + static char *next_fbp = fld_buf; + int i; + IDF_FIELD *res; /* check if subsurface */ if (!strcmp(param->pname, SUBSURF_PNAME)) { if (zname != NULL) { @@ -219,6 +219,7 @@ get_vlist(IDF_OBJECT *param, const char *zname) sprintf(res->val, "%d", i/3); } return(res); +#undef itm_len } /* Get/allocate surface polygon */ @@ -323,7 +324,7 @@ static double rad_subsurface(IDF_OBJECT *param, FILE *ofp) { const char *sname = idf_getfield(param,NAME_FLD)->val; - SURFACE *surf = get_surface(idf_getfield(param,SS_VERT_FLD)); + SURFACE *surf = get_surface(get_vlist(param, NULL)); double area; int i; @@ -361,7 +362,7 @@ start_rcontrib(SUBPROC *pd, ZONE *zp) IDF_FIELD *fptr; int i, j, n; /* start oconv command */ - sprintf(cbuf, "oconv - > '%s'", temp_octree); + sprintf(cbuf, "oconv - > \"%s\"", temp_octree); if ((ofp = popen(cbuf, "w")) == NULL) { fputs(progname, stderr); fputs(": cannot open oconv process\n", stderr); @@ -391,8 +392,8 @@ start_rcontrib(SUBPROC *pd, ZONE *zp) /* now subsurfaces */ if (zp->ntotal > zp->nsurf) { if (zp->area_redu != NULL) - memset(zp->area_redu, 0, sizeof(float)*zp->nsurf); - else if ((zp->area_redu = (float *)calloc(zp->nsurf, + memset(zp->area_redu, 0, sizeof(float)*zp->ntotal); + else if ((zp->area_redu = (float *)calloc(zp->ntotal, sizeof(float))) == NULL) return(0); }