Commit 4765a95a authored by David Lonie's avatar David Lonie Committed by Kitware Robot
Browse files

Merge topic 'gl2ps-coverity'

1fa97d19

 Fix/suppress issues uncovered by coverity.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1231
parents ca65662f 1fa97d19
Pipeline #7557 canceled with stage
......@@ -63,6 +63,9 @@ int PNGCompare(int argc, char *argv[])
if (result == vtkTesting::PASSED)
{
// Coverity complains that we don't check the result of remove(), but
// we really don't care about it. Suppressing:
// coverity[CHECKED_RETURN]
remove(testImageFileName.c_str());
return EXIT_SUCCESS;
}
......
......@@ -466,12 +466,11 @@ vtkOpenGLGL2PSHelperImpl::TextPropertyToPSFontName(vtkTextProperty *tprop)
{
return "Helvetica-Bold";
}
else if (italic)
else // (italic)
{
return "Helvetica-Italic";
}
}
break;
case VTK_TIMES:
{
if (!bold && !italic)
......@@ -486,12 +485,11 @@ vtkOpenGLGL2PSHelperImpl::TextPropertyToPSFontName(vtkTextProperty *tprop)
{
return "Times-Bold";
}
else if (italic)
else // (italic)
{
return "Times-Oblique";
}
}
break;
case VTK_COURIER:
{
if (!bold && !italic)
......@@ -506,12 +504,11 @@ vtkOpenGLGL2PSHelperImpl::TextPropertyToPSFontName(vtkTextProperty *tprop)
{
return "Courier-Bold";
}
else if (italic)
else // (italic)
{
return "Courier-Oblique";
}
}
break;
case VTK_UNKNOWN_FONT:
default:
break;
......@@ -1131,18 +1128,15 @@ void vtkOpenGLGL2PSHelperImpl::DrawPathSVG(
{
// Next point should be a CONIC_CURVE as well
code += 1;
const float &conicX = *pt;
const float &conicY = *(++pt);
// Perform degree elevation:
curveto[0][0] = *pt;
curveto[0][1] = *(++pt);
++pt; // Flush z
const float &nextX = *(++pt);
const float &nextY = *(++pt);
curveto[1][0] = *(++pt);
curveto[1][1] = *(++pt);
++pt; // Flush z
// Perform degree elevation:
curveto[0][0] = conicX;
curveto[0][1] = conicY;
curveto[1][0] = curX = nextX;
curveto[1][1] = curY = nextY;
out << " Q " << curveto[0][0] << " " << curveto[0][1] << endl
<< " " << curveto[1][0] << " " << curveto[1][1] << endl;
}
......@@ -1158,9 +1152,10 @@ void vtkOpenGLGL2PSHelperImpl::DrawPathSVG(
curveto[1][0] = *(++pt);
curveto[1][1] = *(++pt);
++pt;
curveto[2][0] = curX = *(++pt);
curveto[2][1] = curY = *(++pt);
curveto[2][0] = *(++pt);
curveto[2][1] = *(++pt);
++pt;
out << " C " << curveto[0][0] << " " << curveto[0][1] << endl
<< " " << curveto[1][0] << " " << curveto[1][1] << endl
<< " " << curveto[2][0] << " " << curveto[2][1] << endl;
......
......@@ -305,6 +305,11 @@ vtkShaderProgram *vtkOpenGLShaderCache::ReadyShaderProgram(
vtkShaderProgram *vtkOpenGLShaderCache::ReadyShaderProgram(
vtkShaderProgram *shader, vtkTransformFeedback *cap)
{
if (!shader)
{
return NULL;
}
if (shader->GetTransformFeedback() != cap)
{
this->ReleaseCurrentShader();
......@@ -312,11 +317,6 @@ vtkShaderProgram *vtkOpenGLShaderCache::ReadyShaderProgram(
shader->SetTransformFeedback(cap);
}
if (!shader)
{
return NULL;
}
// compile if needed
if (!shader->GetCompiled() && !shader->CompileShader())
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment