Fix scan coverity issues:
CID 184294: Uncaught exception CID 183597: Unchecked return value CID 175809: Dereference before null check CID 175810: Logically dead code CID 133000: Uninitialized scalar variable CID 133001: Uninitialized scalar variable CID 183591: Explicit null dereferenced
This commit is contained in:
@@ -1283,7 +1283,11 @@ Document::~Document()
|
||||
Console().Log("-App::Document: %s %p\n",getName(), this);
|
||||
#endif
|
||||
|
||||
clearUndos();
|
||||
try {
|
||||
clearUndos();
|
||||
}
|
||||
catch (const boost::exception&) {
|
||||
}
|
||||
|
||||
std::map<std::string,DocumentObject*>::iterator it;
|
||||
|
||||
|
||||
@@ -610,9 +610,12 @@ PyObject* Application::sGetMainWindow(PyObject * /*self*/, PyObject *args)
|
||||
return NULL;
|
||||
|
||||
PythonWrapper wrap;
|
||||
wrap.loadCoreModule();
|
||||
wrap.loadGuiModule();
|
||||
wrap.loadWidgetsModule();
|
||||
if (!wrap.loadCoreModule() ||
|
||||
!wrap.loadGuiModule() ||
|
||||
!wrap.loadWidgetsModule()) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Failed to load Python wrapper for Qt");
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
return Py::new_reference_to(wrap.fromQWidget(Gui::getMainWindow(), "QMainWindow"));
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ void DlgPropertyLink::findObjects(bool on, const QString& searchText)
|
||||
std::vector<App::DocumentObject*> ignoreList;
|
||||
App::DocumentObject* par = doc->getObject((const char*)parName.toLatin1());
|
||||
App::Property* prop = par->getPropertyByName((const char*)proName.toLatin1());
|
||||
if (par) {
|
||||
if (prop) {
|
||||
// for multi-selection we need all objects
|
||||
if (isSingleSelection) {
|
||||
ignoreList = par->getOutListOfProperty(prop);
|
||||
|
||||
@@ -964,16 +964,16 @@ void NaviCubeImplementation::drawNaviCube(bool pickMode) {
|
||||
else {
|
||||
for (int pass = 0; pass < 3 ; pass++) {
|
||||
for (vector<Face*>::iterator f = m_Faces.begin(); f != m_Faces.end(); f++) {
|
||||
if (pickMode) { // pick should not be drawn in tree passes
|
||||
glColor3ub((*f)->m_PickId, 0, 0);
|
||||
glBindTexture(GL_TEXTURE_2D, (*f)->m_PickTextureId);
|
||||
} else {
|
||||
//if (pickMode) { // pick should not be drawn in tree passes
|
||||
// glColor3ub((*f)->m_PickId, 0, 0);
|
||||
// glBindTexture(GL_TEXTURE_2D, (*f)->m_PickTextureId);
|
||||
//} else {
|
||||
if (pass != (*f)->m_RenderPass)
|
||||
continue;
|
||||
QColor& c = (m_HiliteId == (*f)->m_PickId) && (pass < 2) ? m_HiliteColor : (*f)->m_Color;
|
||||
glColor4f(c.redF(), c.greenF(), c.blueF(),c.alphaF());
|
||||
glBindTexture(GL_TEXTURE_2D, (*f)->m_TextureId);
|
||||
}
|
||||
//}
|
||||
glDrawElements(GL_TRIANGLE_FAN, (*f)->m_VertexCount, GL_UNSIGNED_BYTE, (void*) &m_IndexArray[(*f)->m_FirstVertex]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,7 +687,7 @@ bool CDxfRead::ReadSpline()
|
||||
bool CDxfRead::ReadCircle()
|
||||
{
|
||||
double radius = 0.0;
|
||||
double c[3]; // centre
|
||||
double c[3] = {0,0,0}; // centre
|
||||
bool hidden = false;
|
||||
|
||||
while(!((*m_ifs).eof()))
|
||||
@@ -845,8 +845,8 @@ bool CDxfRead::ReadText()
|
||||
|
||||
bool CDxfRead::ReadEllipse()
|
||||
{
|
||||
double c[3]; // centre
|
||||
double m[3]; //major axis point
|
||||
double c[3] = {0,0,0}; // centre
|
||||
double m[3] = {0,0,0}; //major axis point
|
||||
double ratio=0; //ratio of major to minor axis
|
||||
double start=0; //start of arc
|
||||
double end=0; // end of arc
|
||||
|
||||
@@ -1901,7 +1901,7 @@ bool CDxfRead::ReadArc()
|
||||
double start_angle = 0.0;// in degrees
|
||||
double end_angle = 0.0;
|
||||
double radius = 0.0;
|
||||
double c[3]; // centre
|
||||
double c[3] = {0,0,0}; // centre
|
||||
double z_extrusion_dir = 1.0;
|
||||
bool hidden = false;
|
||||
|
||||
@@ -2182,7 +2182,7 @@ bool CDxfRead::ReadSpline()
|
||||
bool CDxfRead::ReadCircle()
|
||||
{
|
||||
double radius = 0.0;
|
||||
double c[3]; // centre
|
||||
double c[3] = {0,0,0}; // centre
|
||||
bool hidden = false;
|
||||
|
||||
while(!((*m_ifs).eof()))
|
||||
@@ -2340,8 +2340,8 @@ bool CDxfRead::ReadText()
|
||||
|
||||
bool CDxfRead::ReadEllipse()
|
||||
{
|
||||
double c[3]; // centre
|
||||
double m[3]; //major axis point
|
||||
double c[3] = {0,0,0}; // centre
|
||||
double m[3] = {0,0,0}; //major axis point
|
||||
double ratio=0; //ratio of major to minor axis
|
||||
double start=0; //start of arc
|
||||
double end=0; // end of arc
|
||||
@@ -2714,7 +2714,7 @@ bool CDxfRead::ReadPolyLine()
|
||||
get_line();
|
||||
if (! strcmp(m_str,"VERTEX"))
|
||||
{
|
||||
double vertex[3];
|
||||
double vertex[3] = {0,0,0};
|
||||
if (CDxfRead::ReadVertex(vertex, &bulge_found, &bulge))
|
||||
{
|
||||
if(!first_vertex_section_found) {
|
||||
@@ -2757,7 +2757,7 @@ bool CDxfRead::ReadPolyLine()
|
||||
}
|
||||
|
||||
void CDxfRead::OnReadArc(double start_angle, double end_angle, double radius, const double* c, double z_extrusion_dir, bool hidden){
|
||||
double s[3], e[3], temp[3] ;
|
||||
double s[3] = {0,0,0}, e[3] = {0,0,0}, temp[3] = {0,0,0};
|
||||
if (z_extrusion_dir==1.0)
|
||||
{
|
||||
temp[0] =c[0];
|
||||
@@ -2813,8 +2813,8 @@ void CDxfRead::OnReadEllipse(const double* c, const double* m, double ratio, dou
|
||||
|
||||
bool CDxfRead::ReadInsert()
|
||||
{
|
||||
double c[3]; // coordinate
|
||||
double s[3]; // scale
|
||||
double c[3] = {0,0,0}; // coordinate
|
||||
double s[3] = {0,0,0}; // scale
|
||||
double rot = 0.0; // rotation
|
||||
char name[1024];
|
||||
s[0] = 1.0;
|
||||
@@ -2908,9 +2908,9 @@ bool CDxfRead::ReadInsert()
|
||||
|
||||
bool CDxfRead::ReadDimension()
|
||||
{
|
||||
double s[3]; // startpoint
|
||||
double e[3]; // endpoint
|
||||
double p[3]; // dimpoint
|
||||
double s[3] = {0,0,0}; // startpoint
|
||||
double e[3] = {0,0,0}; // endpoint
|
||||
double p[3] = {0,0,0}; // dimpoint
|
||||
double rot = -1.0; // rotation
|
||||
|
||||
while(!((*m_ifs).eof()))
|
||||
|
||||
@@ -728,7 +728,7 @@ void SoFCIndexedFaceSet::generateGLArrays(SoGLRenderAction * action)
|
||||
// the nindices must have the length of numindices
|
||||
int32_t vertex = 0;
|
||||
int index = 0;
|
||||
float t = transp[0];
|
||||
float t = transp ? transp[0] : 0;
|
||||
for (std::size_t i=0; i<numTria; i++) {
|
||||
const SbColor& c = pcolors[i];
|
||||
for (int j=0; j<3; j++) {
|
||||
@@ -766,7 +766,7 @@ void SoFCIndexedFaceSet::generateGLArrays(SoGLRenderAction * action)
|
||||
// the nindices must have the length of numindices
|
||||
int32_t vertex = 0;
|
||||
int index = 0;
|
||||
float t = transp[0];
|
||||
float t = transp ? transp[0] : 0;
|
||||
for (std::size_t i=0; i<numTria; i++) {
|
||||
for (int j=0; j<3; j++) {
|
||||
const SbColor& c = pcolors[mindices[index]];
|
||||
|
||||
Reference in New Issue
Block a user