sc/source/ui/view/hdrcont.cxx |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

New commits:
commit 9ba89c54076990b21b8e052fdd8d43bf8688edbe
Author:     Supriyo Paul <paulsupriyo6...@gmail.com>
AuthorDate: Fri Mar 3 23:41:54 2023 +0530
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Mon Mar 6 12:38:57 2023 +0000

    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 <hoss...@libreoffice.org>
    Tested-by: Hossein <hoss...@libreoffice.org>

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

Reply via email to