Kaydet (Commit) 7b4d5369 authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

coverity#704566 Unchecked dynamic cast

Change-Id: I13ecfc6cd816a1653a292d00de348ca7683783f1
üst 57b89ea1
...@@ -86,23 +86,39 @@ drawing::Direction3D BarChart::getPreferredDiagramAspectRatio() const ...@@ -86,23 +86,39 @@ drawing::Direction3D BarChart::getPreferredDiagramAspectRatio() const
if( m_nDimension == 3 ) if( m_nDimension == 3 )
{ {
aRet = drawing::Direction3D(1.0,-1.0,1.0); aRet = drawing::Direction3D(1.0,-1.0,1.0);
BarPositionHelper* pPosHelper = dynamic_cast<BarPositionHelper*>(&( this->getPlottingPositionHelper( MAIN_AXIS_INDEX) ) ); BarPositionHelper* pPosHelper = dynamic_cast<BarPositionHelper*>(&( this->getPlottingPositionHelper( MAIN_AXIS_INDEX) ) );
drawing::Direction3D aScale( pPosHelper->getScaledLogicWidth() ); assert(pPosHelper);
if(aScale.DirectionX!=0.0) if(pPosHelper)
{ {
double fXSlotCount = 1.0; drawing::Direction3D aScale( pPosHelper->getScaledLogicWidth() );
if(!m_aZSlots.empty()) if(aScale.DirectionX!=0.0)
fXSlotCount = m_aZSlots.begin()->size(); {
double fXSlotCount = 1.0;
aRet.DirectionZ = aScale.DirectionZ/(aScale.DirectionX + aScale.DirectionX*(fXSlotCount-1.0)*pPosHelper->getScaledSlotWidth()); if(!m_aZSlots.empty())
{
fXSlotCount = m_aZSlots.begin()->size();
}
aRet.DirectionZ = aScale.DirectionZ /
(aScale.DirectionX + aScale.DirectionX * (fXSlotCount-1.0) * pPosHelper->getScaledSlotWidth());
}
else
{
return VSeriesPlotter::getPreferredDiagramAspectRatio();
}
} }
else else
{
return VSeriesPlotter::getPreferredDiagramAspectRatio(); return VSeriesPlotter::getPreferredDiagramAspectRatio();
}
if(aRet.DirectionZ<0.05) if(aRet.DirectionZ<0.05)
{
aRet.DirectionZ=0.05; aRet.DirectionZ=0.05;
if(aRet.DirectionZ>10) }
else if(aRet.DirectionZ>10)
{
aRet.DirectionZ=10; aRet.DirectionZ=10;
}
if( m_pMainPosHelper && m_pMainPosHelper->isSwapXAndY() ) if( m_pMainPosHelper && m_pMainPosHelper->isSwapXAndY() )
{ {
double fTemp = aRet.DirectionX; double fTemp = aRet.DirectionX;
......
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