summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorNabeel Siddiqui <nabeel.siddiqui.314@gmail.com>2023-03-19 14:39:25 +0530
committerHossein <hossein@libreoffice.org>2023-04-23 17:51:21 +0200
commit52522f4772806d9e74ab7df9cc3e8046f68c5809 (patch)
treef6faec4f9d85fa973facdc179e1ee11654bd5024 /chart2
parentce008fa9d8f2752bdfeaeff763aafc774a4b4fb2 (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>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/tools/InternalData.cxx8
-rw-r--r--chart2/source/view/charttypes/BarChart.cxx4
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