comparison os2/dw.c @ 425:4fe2df53ec9f

Division by zero fix in the layout engine.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 18 May 2003 08:42:10 +0000
parents 4be57ee7e006
children f977c80a1dfa
comparison
equal deleted inserted replaced
424:5cc81d3c2bca 425:4fe2df53ec9f
1125 1125
1126 if(tmp) 1126 if(tmp)
1127 { 1127 {
1128 if(*depth > 0) 1128 if(*depth > 0)
1129 { 1129 {
1130 float calcval;
1131
1130 if(thisbox->type == DW_VERT) 1132 if(thisbox->type == DW_VERT)
1131 { 1133 {
1132 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); 1134 calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)));
1135 if(calcval == 0.0)
1136 tmp->xratio = thisbox->xratio;
1137 else
1138 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval;
1133 tmp->width = thisbox->items[z].width; 1139 tmp->width = thisbox->items[z].width;
1134 } 1140 }
1135 if(thisbox->type == DW_HORZ) 1141 if(thisbox->type == DW_HORZ)
1136 { 1142 {
1137 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); 1143 calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)));
1144 if(calcval == 0.0)
1145 tmp->yratio = thisbox->yratio;
1146 else
1147 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval;
1138 tmp->height = thisbox->items[z].height; 1148 tmp->height = thisbox->items[z].height;
1139 } 1149 }
1140 } 1150 }
1141 1151
1142 (*depth)++; 1152 (*depth)++;