diff options
author | Supriyo Paul <paulsupriyo64nk@gmail.com> | 2023-03-03 23:41:54 +0530 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2023-03-06 12:38:57 +0000 |
commit | 9ba89c54076990b21b8e052fdd8d43bf8688edbe (patch) | |
tree | d426e97bebddd73870737b190d61d10472a698bd | |
parent | de236de7fded4b6d1eb5f4623d411e674125ebb9 (diff) |
tdf#148251 Use std::swap instead of using temporary values
Part of the code uses a temporary variable for swapping variables.
This is hard to read, so we are now using std::swap which improves
readability. We also remove the temporary local variable.
Change-Id: If6e97f7d464aa21cf4b9c64e630769949cfaa6af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148197
Reviewed-by: Hossein <hossein@libreoffice.org>
Tested-by: Hossein <hossein@libreoffice.org>
-rw-r--r-- | sc/source/ui/view/hdrcont.cxx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index 805326330ae4..305ada306856 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -270,12 +270,8 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools tools::Long nInitScrPos = 0; if ( bLayoutRTL ) { - tools::Long nTemp = nPStart; // swap nPStart / nPEnd - nPStart = nPEnd; - nPEnd = nTemp; - nTemp = nTransStart; // swap nTransStart / nTransEnd - nTransStart = nTransEnd; - nTransEnd = nTemp; + std::swap(nPStart, nPEnd); + std::swap(nTransStart, nTransEnd); if ( bVertical ) // start loops from the end nInitScrPos = GetSizePixel().Height() - 1; else |