[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sat Jan 18 13:06:53 UTC 2020


 vcl/source/window/syswin.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 7dc50ca94ad6cc47561662424e163250a8e5957e
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Jan 18 12:34:18 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Jan 18 14:06:21 2020 +0100

    Remove redundant casts
    
    They had been added with d2986be1a8d896782b8cb846b0028eaa752e0384 "INTEGRATION:
    CWS vcl83: #i82823# remove warnings (thanks pjanik)" before
    dbbf365921b50009db8ea86b90c99f3a26c467bc "INTEGRATION: CWS vcl87: #i86882# use
    long for gemoetry like the rest of the Sal interface does" changed the
    SalFrameGeometry::n*Decoration members from 'unsinged int' to 'unsigned long'.
    So back then the sums were of type
    
      'long' + 'long' + 'long' + 'unsigned int' => 'long' or 'unsigned long'
    
    (depending on whether 'long' is larger than 'int'), while now it is
    
      'long' + 'long' + 'long' + 'unsigned long' => 'unsigned long'
    
    Change-Id: Ia8c7a8ccd858675c909e39497256be7783a8fd2f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87012
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 9d2a0b671c66..5dbcd6852859 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -705,15 +705,15 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData )
                         if( std::abs(g.nX-aState.mnX) < 2 && std::abs(g.nY-aState.mnY) < 5 )
                         {
                             long displacement = g.nTopDecoration ? g.nTopDecoration : 20;
-                            if( static_cast<unsigned long>(aState.mnX + displacement + aState.mnWidth + g.nRightDecoration) > static_cast<unsigned long>(aDesktop.Right()) ||
-                                static_cast<unsigned long>(aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration) > static_cast<unsigned long>(aDesktop.Bottom()) )
+                            if( aState.mnX + displacement + aState.mnWidth + g.nRightDecoration > static_cast<unsigned long>(aDesktop.Right()) ||
+                                aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration > static_cast<unsigned long>(aDesktop.Bottom()) )
                             {
                                 // displacing would leave screen
                                 aState.mnX = g.nLeftDecoration ? g.nLeftDecoration : 10; // should result in (0,0)
                                 aState.mnY = displacement;
                                 if( bWrapped ||
-                                    static_cast<unsigned long>(aState.mnX + displacement + aState.mnWidth + g.nRightDecoration) > static_cast<unsigned long>(aDesktop.Right()) ||
-                                    static_cast<unsigned long>(aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration) > static_cast<unsigned long>(aDesktop.Bottom()) )
+                                    aState.mnX + displacement + aState.mnWidth + g.nRightDecoration > static_cast<unsigned long>(aDesktop.Right()) ||
+                                    aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration > static_cast<unsigned long>(aDesktop.Bottom()) )
                                     break;  // further displacement not possible -> break
                                 // avoid endless testing
                                 bWrapped = true;


More information about the Libreoffice-commits mailing list