chart2/source/tools/InternalData.cxx | 8 ++------ chart2/source/view/charttypes/BarChart.cxx | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-)
New commits: commit 52522f4772806d9e74ab7df9cc3e8046f68c5809 Author: Nabeel Siddiqui <nabeel.siddiqui....@gmail.com> AuthorDate: Sun Mar 19 14:39:25 2023 +0530 Commit: Hossein <hoss...@libreoffice.org> CommitDate: Sun Apr 23 17:51:21 2023 +0200 tdf#148251 Use std::swap instead of using temporary values Change-Id: I7733ba595634f41ef0a0902ea37d694276417871 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149087 Tested-by: Jenkins Reviewed-by: Hossein <hoss...@libreoffice.org> diff --git a/chart2/source/tools/InternalData.cxx b/chart2/source/tools/InternalData.cxx index 375e639c7879..38eb848815db 100644 --- a/chart2/source/tools/InternalData.cxx +++ b/chart2/source/tools/InternalData.cxx @@ -258,9 +258,7 @@ void InternalData::swapRowWithNext( sal_Int32 nRowIndex ) { size_t nIndex1 = nColIdx + nRowIndex*m_nColumnCount; size_t nIndex2 = nIndex1 + m_nColumnCount; - double fTemp = m_aData[nIndex1]; - m_aData[nIndex1] = m_aData[nIndex2]; - m_aData[nIndex2] = fTemp; + std::swap(m_aData[nIndex1], m_aData[nIndex2]); } std::vector< uno::Any > aTemp( m_aRowLabels[nRowIndex] ); @@ -278,9 +276,7 @@ void InternalData::swapColumnWithNext( sal_Int32 nColumnIndex ) { size_t nIndex1 = nColumnIndex + nRowIdx*m_nColumnCount; size_t nIndex2 = nIndex1 + 1; - double fTemp = m_aData[nIndex1]; - m_aData[nIndex1] = m_aData[nIndex2]; - m_aData[nIndex2] = fTemp; + std::swap(m_aData[nIndex1], m_aData[nIndex2]); } std::vector< uno::Any > aTemp( m_aColumnLabels[nColumnIndex] ); diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index d265f9aa3dd1..eeb30266351b 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -123,9 +123,7 @@ drawing::Direction3D BarChart::getPreferredDiagramAspectRatio() const } if( m_pMainPosHelper && m_pMainPosHelper->isSwapXAndY() ) { - double fTemp = aRet.DirectionX; - aRet.DirectionX = aRet.DirectionY; - aRet.DirectionY = fTemp; + std::swap(aRet.DirectionX, aRet.DirectionY); } } else