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:
wmayer
2018-11-13 16:47:58 +01:00
parent 735b0a18b9
commit a7094210f8
7 changed files with 33 additions and 26 deletions

View File

@@ -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

View File

@@ -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()))

View File

@@ -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]];