mirror of https://github.com/vitalif/openscad
Merge pull request #1346 from ArchimedesPi/fixup-some-coverity-defects
Fix some defects from Coverity (WIP)master
commit
5451fabcc1
|
@ -740,6 +740,7 @@ Response GeometryEvaluator::visit(State &state, const LinearExtrudeNode &node)
|
||||||
|
|
||||||
Polygon2d *p2d = dxf.toPolygon2d();
|
Polygon2d *p2d = dxf.toPolygon2d();
|
||||||
if (p2d) geometry = ClipperUtils::sanitize(*p2d);
|
if (p2d) geometry = ClipperUtils::sanitize(*p2d);
|
||||||
|
delete p2d;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
geometry = applyToChildren2D(node, OPENSCAD_UNION);
|
geometry = applyToChildren2D(node, OPENSCAD_UNION);
|
||||||
|
@ -849,6 +850,7 @@ Response GeometryEvaluator::visit(State &state, const RotateExtrudeNode &node)
|
||||||
DxfData dxf(node.fn, node.fs, node.fa, node.filename, node.layername, node.origin_x, node.origin_y, node.scale);
|
DxfData dxf(node.fn, node.fs, node.fa, node.filename, node.layername, node.origin_x, node.origin_y, node.scale);
|
||||||
Polygon2d *p2d = dxf.toPolygon2d();
|
Polygon2d *p2d = dxf.toPolygon2d();
|
||||||
if (p2d) geometry = ClipperUtils::sanitize(*p2d);
|
if (p2d) geometry = ClipperUtils::sanitize(*p2d);
|
||||||
|
delete p2d;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
geometry = applyToChildren2D(node, OPENSCAD_UNION);
|
geometry = applyToChildren2D(node, OPENSCAD_UNION);
|
||||||
|
@ -954,6 +956,8 @@ Response GeometryEvaluator::visit(State &state, const ProjectionNode &node)
|
||||||
// Add correctly winded polygons to the main clipper
|
// Add correctly winded polygons to the main clipper
|
||||||
sumclipper.AddPaths(result, ClipperLib::ptSubject, true);
|
sumclipper.AddPaths(result, ClipperLib::ptSubject, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete poly;
|
||||||
}
|
}
|
||||||
ClipperLib::PolyTree sumresult;
|
ClipperLib::PolyTree sumresult;
|
||||||
// This is key - without StrictlySimple, we tend to get self-intersecting results
|
// This is key - without StrictlySimple, we tend to get self-intersecting results
|
||||||
|
|
|
@ -237,6 +237,7 @@ bool create_glx_dummy_window(OffscreenContext &ctx)
|
||||||
// this call alters ctx->xDisplay and ctx->openGLContext
|
// this call alters ctx->xDisplay and ctx->openGLContext
|
||||||
// and ctx->xwindow if successfull
|
// and ctx->xwindow if successfull
|
||||||
if (!create_glx_dummy_context( *ctx )) {
|
if (!create_glx_dummy_context( *ctx )) {
|
||||||
|
delete ctx;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,14 +236,14 @@ AbstractNode *ControlModule::instantiate(const Context* /*ctx*/, const ModuleIns
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
else if (value->type() == Value::RANGE) {
|
else if (value->type() == Value::RANGE) {
|
||||||
AbstractNode* node = new AbstractNode(inst);
|
|
||||||
Value::RangeType range = value->toRange();
|
Value::RangeType range = value->toRange();
|
||||||
boost::uint32_t steps = range.nbsteps();
|
boost::uint32_t steps = range.nbsteps();
|
||||||
if (steps >= 10000) {
|
if (steps >= 10000) {
|
||||||
PRINTB("WARNING: Bad range parameter for children: too many elements (%lu).", steps);
|
PRINTB("WARNING: Bad range parameter for children: too many elements (%lu).", steps);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (Value::RangeType::iterator it = range.begin();it != range.end();it++) {
|
AbstractNode* node = new AbstractNode(inst);
|
||||||
|
for (Value::RangeType::iterator it = range.begin();it != range.end();it++) {
|
||||||
AbstractNode* childnode = getChild(Value(*it),modulectx); // with error cases
|
AbstractNode* childnode = getChild(Value(*it),modulectx); // with error cases
|
||||||
if (childnode==NULL) continue; // error
|
if (childnode==NULL) continue; // error
|
||||||
node->children.push_back(childnode);
|
node->children.push_back(childnode);
|
||||||
|
|
|
@ -424,6 +424,7 @@ void export_amf(const CGAL_Nef_polyhedron *root_N, std::ostream &output)
|
||||||
coords = strtok(NULL, " ");
|
coords = strtok(NULL, " ");
|
||||||
output << " <z>" << coords << "</z>\r\n";
|
output << " <z>" << coords << "</z>\r\n";
|
||||||
output << " </coordinates></vertex>\r\n";
|
output << " </coordinates></vertex>\r\n";
|
||||||
|
delete[] chrs;
|
||||||
}
|
}
|
||||||
output << " </vertices>\r\n";
|
output << " </vertices>\r\n";
|
||||||
output << " <volume>\r\n";
|
output << " <volume>\r\n";
|
||||||
|
|
|
@ -82,7 +82,9 @@ bool report_glerror(const char * function)
|
||||||
{
|
{
|
||||||
GLenum tGLErr = glGetError();
|
GLenum tGLErr = glGetError();
|
||||||
if (tGLErr != GL_NO_ERROR) {
|
if (tGLErr != GL_NO_ERROR) {
|
||||||
cerr << "OpenGL error 0x" << hex << tGLErr << ": " << gluErrorString(tGLErr) << " after " << function << endl;
|
std::ostringstream hexErr;
|
||||||
|
hexErr << hex << tGLErr;
|
||||||
|
cerr << "OpenGL error 0x" << hexErr.str() << ": " << gluErrorString(tGLErr) << " after " << function << endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue