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

Comparing ray/src/common/bsdf.c (file contents):
Revision 2.37 by greg, Sun Mar 4 20:11:10 2012 UTC vs.
Revision 2.38 by greg, Sun Mar 4 23:28:34 2012 UTC

# Line 93 | Line 93 | SDloadGeometry(SDData *sd, ezxml_t wdb)
93          if (wdb == NULL)                /* no geometry section? */
94                  return SDEnone;
95          sd->dim[0] = sd->dim[1] = sd->dim[2] = .0;
96 +        SDerrorDetail[0] = '\0';
97          if ((geom = ezxml_child(wdb, "Width")) != NULL)
98                  sd->dim[0] = atof(ezxml_txt(geom)) *
99                                  to_meters(ezxml_attr(geom, "unit"));
# Line 103 | Line 104 | SDloadGeometry(SDData *sd, ezxml_t wdb)
104                  sd->dim[2] = atof(ezxml_txt(geom)) *
105                                  to_meters(ezxml_attr(geom, "unit"));
106          if ((sd->dim[0] < 0) | (sd->dim[1] < 0) | (sd->dim[2] < 0)) {
107 <                sprintf(SDerrorDetail, "Negative size in \"%s\"", sd->name);
107 >                if (!SDerrorDetail[0])
108 >                        sprintf(SDerrorDetail, "Negative dimension in \"%s\"",
109 >                                                sd->name);
110                  return SDEdata;
111          }
112          if ((geom = ezxml_child(wdb, "Geometry")) == NULL ||
# Line 121 | Line 124 | SDloadGeometry(SDData *sd, ezxml_t wdb)
124                  return SDEsupport;
125          }
126          cfact = to_meters(ezxml_attr(geom, "unit"));
127 +        if (cfact <= 0)
128 +                return SDEformat;
129          sd->mgf = (char *)malloc(strlen(mgfstr)+32);
130          if (sd->mgf == NULL) {
131                  strcpy(SDerrorDetail, "Out of memory in SDloadGeometry");
# Line 164 | Line 169 | SDloadFile(SDData *sd, const char *fname)
169          }
170          wtl = ezxml_child(ezxml_child(fl, "Optical"), "Layer");
171          if (wtl == NULL) {
172 <                sprintf(SDerrorDetail, "BSDF \"%s\": no optical layer'",
172 >                sprintf(SDerrorDetail, "BSDF \"%s\": no optical layers'",
173                                  sd->name);
174                  ezxml_free(fl);
175                  return SDEformat;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines