diff options
author | Nabeel Siddiqui <nabeel.siddiqui.314@gmail.com> | 2023-03-19 14:39:25 +0530 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2023-04-23 17:51:21 +0200 |
commit | 52522f4772806d9e74ab7df9cc3e8046f68c5809 (patch) | |
tree | f6faec4f9d85fa973facdc179e1ee11654bd5024 | |
parent | ce008fa9d8f2752bdfeaeff763aafc774a4b4fb2 (diff) |
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 <hossein@libreoffice.org>
-rw-r--r-- | chart2/source/tools/InternalData.cxx | 8 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BarChart.cxx | 4 |
2 files changed, 3 insertions, 9 deletions
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 |