[Libreoffice-commits] core.git: 2 commits - sd/source svtools/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 20 07:05:18 UTC 2020


 sd/source/ui/view/drviews3.cxx   |    2 +-
 svtools/source/brwbox/datwin.cxx |    2 +-
 svtools/source/brwbox/datwin.hxx |    7 +++++--
 3 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 7c3aeac2b96dd71860fb0eabc943b9de278fe775
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Nov 19 18:47:07 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Nov 20 08:04:44 2020 +0100

    ScrollBar::GetThumbPos returns tools::Long
    
    Change-Id: I493e241e590325306a59fda89a30f1c97410c373
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106180
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index fd1e12a0d46d..d88b41e146cd 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -669,7 +669,7 @@ void BrowserScrollBar::dispose()
 
 void BrowserScrollBar::Tracking( const TrackingEvent& rTEvt )
 {
-    sal_uLong nPos = GetThumbPos();
+    tools::Long nPos = GetThumbPos();
     if ( nPos != _nLastPos )
     {
         OUString aTip = OUString::number(nPos) + "/";
diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
index 34e30c1812f5..b01e63fbbc7d 100644
--- a/svtools/source/brwbox/datwin.hxx
+++ b/svtools/source/brwbox/datwin.hxx
@@ -21,9 +21,12 @@
 
 #include <svtools/brwbox.hxx>
 #include <svtools/brwhead.hxx>
+#include <tools/long.hxx>
 #include <vcl/scrbar.hxx>
 #include <vcl/timer.hxx>
 #include <vcl/transfer.hxx>
+
+#include <limits>
 #include <vector>
 
 #define MIN_COLUMNWIDTH  2
@@ -82,14 +85,14 @@ public:
 
 class BrowserScrollBar: public ScrollBar
 {
-    sal_uLong           _nLastPos;
+    tools::Long _nLastPos;
     VclPtr<BrowserDataWin> _pDataWin;
 
 public:
                     BrowserScrollBar( vcl::Window* pParent, WinBits nStyle,
                                       BrowserDataWin *pDataWin )
                     :   ScrollBar( pParent, nStyle ),
-                        _nLastPos( ULONG_MAX ),
+                        _nLastPos( std::numeric_limits<tools::Long>::max() ),
                         _pDataWin( pDataWin )
                     {}
    virtual          ~BrowserScrollBar() override;
commit 528a3afa2497aa8bc0fcfda21b3a66c2fa014bda
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Nov 19 21:23:05 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Nov 20 08:04:29 2020 +0100

    This presumably wants to be Size(-1, -1)
    
    The code had been introduced with bd837fcbae7662bd127cb214f1497e4bf750cab0
    "#92085# GetRulerState(): setting of SID_RULER_LR_MIN_MAX corrected" (where the
    referenced bug is apparently from the lost Sun-internal bug tracker), at a time
    when Size was presumably based on signed long, so ULONG_MAX presumably already
    effectively meant -1 back then.
    
    I don't understand what this code does, but when using a
    
      Size(std::numeric_limits<::tools::Long>::max(),
           std::numeric_limits<::tools::Long>::max())
    
    instead, in a 64-bit Linux UBSan build I got
    
    > include/tools/gen.hxx:527:37: runtime error: signed integer overflow: 11767 + 9223372036854775806 cannot be represented in type 'long'
    >  #0 in tools::Rectangle::Rectangle(Point const&, Size const&) at include/tools/gen.hxx:527:37
    >  #1 in sd::DrawViewShell::GetRulerState(SfxItemSet&) at sd/source/ui/view/drviews3.cxx:915:28
    >  #2 in SfxStubGraphicViewShellGetRulerState(SfxShell*, SfxItemSet&) at workdir/SdiTarget/sd/sdi/sdgslots.hxx:1540:1
    >  #3 in SfxShell::CallState(void (*)(SfxShell*, SfxItemSet&), SfxItemSet&) at include/sfx2/shell.hxx:199:35
    >  #4 in SfxDispatcher::FillState_(SfxSlotServer const&, SfxItemSet&, SfxSlot const*) at sfx2/source/control/dispatch.cxx:1657:14
    >  #5 in SfxBindings::Update_Impl(SfxStateCache&) at sfx2/source/control/bindings.cxx:260:22
    >  #6 in SfxBindings::NextJob_Impl(Timer const*) at sfx2/source/control/bindings.cxx:1274:17
    >  #7 in SfxBindings::NextJob(Timer*) at sfx2/source/control/bindings.cxx:1219:5
    >  #8 in SfxBindings::LinkStubNextJob(void*, Timer*) at sfx2/source/control/bindings.cxx:1217:1
    >  #9 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45
    >  #10 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21
    >  #11 in Scheduler::ProcessTaskScheduling() at vcl/source/app/scheduler.cxx:486:20
    >  #12 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:288:5
    >  #13 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13
    
    when creating a rectangle in Draw and clicking around in it.  Whereas with
    
      Size(-1, -1)
    
    things appear to work fine.
    
    Change-Id: I7368b510113a34fec5c1cabfc35a369cac2fcda1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106187
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 18ec833b160f..ed28a4370ebc 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -911,7 +911,7 @@ void  DrawViewShell::GetRulerState(SfxItemSet& rSet)
     if( mpDrawView->IsTextEdit() )
     {
         Point aPnt1 = GetActiveWindow()->GetWinViewPos();
-        ::tools::Rectangle aMinMaxRect( aPnt1, Size(ULONG_MAX, ULONG_MAX) );
+        ::tools::Rectangle aMinMaxRect( aPnt1, Size(-1, -1) );
         rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aMinMaxRect) );
     }
     else


More information about the Libreoffice-commits mailing list