Kaydet (Commit) 3948dee4 authored tarafından Michael Weghorn's avatar Michael Weghorn Kaydeden (comit) Markus Mohrhard

reduce scope of local variables

This addresses some cppcheck warnings.

Change-Id: I864a4e84326633d33f09324247cbe439fba801c8
Reviewed-on: https://gerrit.libreoffice.org/13336Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst aafcbb3e
...@@ -1539,11 +1539,11 @@ void WrappedVerticalProperty::setPropertyValue( const Any& rOuterValue, const Re ...@@ -1539,11 +1539,11 @@ void WrappedVerticalProperty::setPropertyValue( const Any& rOuterValue, const Re
Any WrappedVerticalProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const Any WrappedVerticalProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{ {
bool bFound = false;
bool bAmbiguous = false;
Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
if( xDiagram.is() ) if( xDiagram.is() )
{ {
bool bFound = false;
bool bAmbiguous = false;
bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous ); bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
if( bFound ) if( bFound )
m_aOuterValue <<= bVertical; m_aOuterValue <<= bVertical;
...@@ -1883,11 +1883,11 @@ void WrappedSolidTypeProperty::setPropertyValue( const Any& rOuterValue, const R ...@@ -1883,11 +1883,11 @@ void WrappedSolidTypeProperty::setPropertyValue( const Any& rOuterValue, const R
Any WrappedSolidTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const Any WrappedSolidTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{ {
bool bFound = false;
bool bAmbiguous = false;
Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
if( xDiagram.is() ) if( xDiagram.is() )
{ {
bool bFound = false;
bool bAmbiguous = false;
sal_Int32 nGeometry = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous ); sal_Int32 nGeometry = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
if( bFound ) if( bFound )
m_aOuterValue <<= nGeometry; m_aOuterValue <<= nGeometry;
......
...@@ -130,12 +130,11 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( vcl::Window* pWindow ...@@ -130,12 +130,11 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( vcl::Window* pWindow
m_pMFPerspective->Enable( m_pCbxPerspective->IsChecked() ); m_pMFPerspective->Enable( m_pCbxPerspective->IsChecked() );
//RightAngledAxes //RightAngledAxes
bool bRightAngledAxes = false;
uno::Reference< chart2::XDiagram > xDiagram( m_xSceneProperties, uno::UNO_QUERY ); uno::Reference< chart2::XDiagram > xDiagram( m_xSceneProperties, uno::UNO_QUERY );
if( ChartTypeHelper::isSupportingRightAngledAxes( if( ChartTypeHelper::isSupportingRightAngledAxes(
DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) ) DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) )
{ {
bool bRightAngledAxes = false;
m_xSceneProperties->getPropertyValue( "RightAngledAxes" ) >>= bRightAngledAxes; m_xSceneProperties->getPropertyValue( "RightAngledAxes" ) >>= bRightAngledAxes;
m_pCbxRightAngledAxes->SetToggleHdl( LINK( this, ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled )); m_pCbxRightAngledAxes->SetToggleHdl( LINK( this, ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled ));
m_pCbxRightAngledAxes->Check( bRightAngledAxes ); m_pCbxRightAngledAxes->Check( bRightAngledAxes );
......
...@@ -246,11 +246,11 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf ...@@ -246,11 +246,11 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
case SCHATTR_BAR_CONNECT: case SCHATTR_BAR_CONNECT:
{ {
bool bOldConnectBars = false;
m_bConnectBars = static_cast< const SfxBoolItem & >( m_bConnectBars = static_cast< const SfxBoolItem & >(
rItemSet.Get( nWhichId )).GetValue(); rItemSet.Get( nWhichId )).GetValue();
if( m_bSupportingBarConnectors ) if( m_bSupportingBarConnectors )
{ {
bool bOldConnectBars = false;
uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY ); uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
if( xDiagramProperties.is() && if( xDiagramProperties.is() &&
(xDiagramProperties->getPropertyValue( "ConnectBars" ) >>= bOldConnectBars) && (xDiagramProperties->getPropertyValue( "ConnectBars" ) >>= bOldConnectBars) &&
...@@ -265,11 +265,11 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf ...@@ -265,11 +265,11 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
case SCHATTR_GROUP_BARS_PER_AXIS: case SCHATTR_GROUP_BARS_PER_AXIS:
{ {
bool bOldGroupBarsPerAxis = true;
m_bGroupBarsPerAxis = static_cast< const SfxBoolItem & >( m_bGroupBarsPerAxis = static_cast< const SfxBoolItem & >(
rItemSet.Get( nWhichId )).GetValue(); rItemSet.Get( nWhichId )).GetValue();
if( m_bSupportingAxisSideBySide ) if( m_bSupportingAxisSideBySide )
{ {
bool bOldGroupBarsPerAxis = true;
uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY ); uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
if( xDiagramProperties.is() && if( xDiagramProperties.is() &&
(xDiagramProperties->getPropertyValue( "GroupBarsPerAxis" ) >>= bOldGroupBarsPerAxis) && (xDiagramProperties->getPropertyValue( "GroupBarsPerAxis" ) >>= bOldGroupBarsPerAxis) &&
......
...@@ -823,9 +823,9 @@ std::vector< Reference< XAxis > > AxisHelper::getAllAxesOfCoordinateSystem( ...@@ -823,9 +823,9 @@ std::vector< Reference< XAxis > > AxisHelper::getAllAxesOfCoordinateSystem(
try try
{ {
Reference< XAxis > xAxis( xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) ); Reference< XAxis > xAxis( xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) );
bool bAddAxis = true;
if( xAxis.is() ) if( xAxis.is() )
{ {
bool bAddAxis = true;
if( bOnlyVisible ) if( bOnlyVisible )
{ {
Reference< beans::XPropertySet > xAxisProp( xAxis, uno::UNO_QUERY ); Reference< beans::XPropertySet > xAxisProp( xAxis, uno::UNO_QUERY );
......
...@@ -46,9 +46,9 @@ namespace ...@@ -46,9 +46,9 @@ namespace
bool lcl_isRightAngledAxesSetAndSupported( const Reference< beans::XPropertySet >& xSceneProperties ) bool lcl_isRightAngledAxesSetAndSupported( const Reference< beans::XPropertySet >& xSceneProperties )
{ {
bool bRightAngledAxes = false;
if( xSceneProperties.is() ) if( xSceneProperties.is() )
{ {
bool bRightAngledAxes = false;
xSceneProperties->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes; xSceneProperties->getPropertyValue( "RightAngledAxes") >>= bRightAngledAxes;
if(bRightAngledAxes) if(bRightAngledAxes)
{ {
......
...@@ -325,10 +325,9 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co ...@@ -325,10 +325,9 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co
aAllTicks[0].realloc(nMaxMajorTickCount); aAllTicks[0].realloc(nMaxMajorTickCount);
sal_Int32 nRealMajorTickCount = 0; sal_Int32 nRealMajorTickCount = 0;
double* pValue = NULL;
for( sal_Int32 nMajorTick=0; nMajorTick<nMaxMajorTickCount; nMajorTick++ ) for( sal_Int32 nMajorTick=0; nMajorTick<nMaxMajorTickCount; nMajorTick++ )
{ {
pValue = this->getMajorTick( nMajorTick ); double* pValue = this->getMajorTick( nMajorTick );
if(!pValue) if(!pValue)
continue; continue;
aAllTicks[0][nRealMajorTickCount] = *pValue; aAllTicks[0][nRealMajorTickCount] = *pValue;
......
...@@ -481,10 +481,9 @@ void createKnotVector(const lcl_tSizeType n, const sal_uInt32 p, double* t, doub ...@@ -481,10 +481,9 @@ void createKnotVector(const lcl_tSizeType n, const sal_uInt32 p, double* t, doub
{ {
u[j] = 0.0; u[j] = 0.0;
} }
double fSum = 0.0;
for (lcl_tSizeType j = 1; j <= n-p; ++j ) for (lcl_tSizeType j = 1; j <= n-p; ++j )
{ {
fSum = 0.0; double fSum = 0.0;
for (lcl_tSizeType i = j; i <= j+p-1; ++i) for (lcl_tSizeType i = j; i <= j+p-1; ++i)
{ {
fSum += t[i]; fSum += t[i];
......
...@@ -1938,17 +1938,15 @@ void OpenGL3DRenderer::RenderScreenTextShape() ...@@ -1938,17 +1938,15 @@ void OpenGL3DRenderer::RenderScreenTextShape()
for (size_t i = 0; i < m_ScreenTextInfoList.size(); i++) for (size_t i = 0; i < m_ScreenTextInfoList.size(); i++)
{ {
TextInfo textInfo = m_ScreenTextInfoList[i]; TextInfo textInfo = m_ScreenTextInfoList[i];
//calc the postition and check whether it can be displayed //calc the position and check whether it can be displayed
float xTrans = 0.0f;
float yTrans = 0.0f;
if (textInfo.uniqueId) if (textInfo.uniqueId)
{ {
glm::vec3 worldPos = glm::vec3(m_ScrollMoveMatrix * m_GlobalScaleMatrix * glm::vec4(textInfo.pos, 1)); glm::vec3 worldPos = glm::vec3(m_ScrollMoveMatrix * m_GlobalScaleMatrix * glm::vec4(textInfo.pos, 1));
if ((worldPos.x < m_fMinCoordX) || (worldPos.x > m_fMaxCoordX)) if ((worldPos.x < m_fMinCoordX) || (worldPos.x > m_fMaxCoordX))
continue; continue;
glm::vec4 pos = m_3DProjection * m_3DView * glm::vec4(worldPos, 1); glm::vec4 pos = m_3DProjection * m_3DView * glm::vec4(worldPos, 1);
xTrans = pos.x / pos.w; const float xTrans = pos.x / pos.w;
yTrans = pos.y / pos.w; const float yTrans = pos.y / pos.w;
for (int j = 0; j < 12; j++) for (int j = 0; j < 12; j++)
{ {
if (j % 3 == 0) if (j % 3 == 0)
......
...@@ -520,13 +520,11 @@ void VDataSeries::getMinMaxXValue(double& fMin, double& fMax) const ...@@ -520,13 +520,11 @@ void VDataSeries::getMinMaxXValue(double& fMin, double& fMax) const
if(aValuesX.getLength() > 0) if(aValuesX.getLength() > 0)
{ {
double aValue;
fMax = fMin = aValuesX[0]; fMax = fMin = aValuesX[0];
for (sal_Int32 i = 1; i < aValuesX.getLength(); i++) for (sal_Int32 i = 1; i < aValuesX.getLength(); i++)
{ {
aValue = aValuesX[i]; const double aValue = aValuesX[i];
if ( aValue > fMax) if ( aValue > fMax)
{ {
fMax = aValue; fMax = aValue;
......
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