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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sun Jan 26 14:51:52 UTC 2020


 accessibility/source/standard/vclxaccessiblelist.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 0f6bbde666382f1517e8ba7d94e692a86ebca28b
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sun Jan 26 14:53:23 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sun Jan 26 15:51:15 2020 +0100

    Use properly typed variable for iteration
    
    ...avoiding explicit casts to smaller sal_uInt16 from larger sal_Int32.  (Adding
    a o3tl::make_unsigned to silence a resulting -Werror,-Wsign-compare.)
    
    Change-Id: Iff1636e961db6edfac274cf8f7440369e841f9c3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87441
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx
index 2077fcdf874b..b549c6d0c008 100644
--- a/accessibility/source/standard/vclxaccessiblelist.cxx
+++ b/accessibility/source/standard/vclxaccessiblelist.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <o3tl/safeint.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/combobox.hxx>
 #include <vcl/lstbox.hxx>
@@ -620,11 +621,11 @@ void VCLXAccessibleList::UpdateEntryRange_Impl()
         UpdateVisibleLineCount();
         sal_Int32 nBegin = std::min( m_nLastTopEntry, nTop );
         sal_Int32 nEnd = std::max( m_nLastTopEntry + m_nVisibleLineCount, nTop + m_nVisibleLineCount );
-        for (sal_uInt16 i = static_cast<sal_uInt16>(nBegin); (i <= static_cast<sal_uInt16>(nEnd)); ++i)
+        for (sal_Int32 i = nBegin; (i <= nEnd); ++i)
         {
             bool bVisible = ( i >= nTop && i < ( nTop + m_nVisibleLineCount ) );
             Reference< XAccessible > xHold;
-            if ( i < m_aAccessibleChildren.size() )
+            if ( o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
                 xHold = m_aAccessibleChildren[i];
             else if ( bVisible )
                 xHold = CreateChild(i);


More information about the Libreoffice-commits mailing list