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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sun Jan 26 16:36:43 UTC 2020


 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 3a5b8e039dcb6cfe68505de3440c4bcdaeb7a94a
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sun Jan 26 14:59:23 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sun Jan 26 17:36:10 2020 +0100

    Avoid explicit casts to smaller sal_uInt16 from larger int
    
    ...in what might be attempts to avoid warnings about signed vs. unsigned
    comparisons.
    
    Change-Id: I8eceaa989c35558e37cb815d997dda88d17c22b8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87444
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index f0f383b126e2..7fd11331b640 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -40,6 +40,7 @@
 #include "QueryDesignFieldUndoAct.hxx"
 #include <sqlmessage.hxx>
 #include <UITools.hxx>
+#include <o3tl/safeint.hxx>
 #include <osl/diagnose.h>
 #include <i18nlangtag/languagetag.hxx>
 #include <vcl/treelistentry.hxx>
@@ -289,7 +290,7 @@ void OSelectionBrowseBox::ColumnMoved( sal_uInt16 nColId, bool _bCreateUndo )
     // swap the two columns
     sal_uInt16 nNewPos = GetColumnPos( nColId );
     OTableFields& rFields = getFields();
-    if ( rFields.size() > sal_uInt16(nNewPos-1) )
+    if ( rFields.size() > o3tl::make_unsigned(nNewPos-1) )
     {
         sal_uInt16 nOldPos = 0;
         bool bFoundElem = false;
@@ -888,7 +889,7 @@ bool OSelectionBrowseBox::SaveModified()
     OQueryController& rController = static_cast<OQueryController&>(getDesignView()->getController());
     OTableFieldDescRef pEntry;
     sal_uInt16 nCurrentColumnPos = GetColumnPos(GetCurColumnId());
-    if(getFields().size() > static_cast<sal_uInt16>(nCurrentColumnPos - 1))
+    if(getFields().size() > o3tl::make_unsigned(nCurrentColumnPos - 1))
         pEntry = getEntry(nCurrentColumnPos - 1);
 
     bool bWasEmpty      = pEntry.is() && pEntry->IsEmpty();
@@ -1213,7 +1214,7 @@ void OSelectionBrowseBox::PaintCell(OutputDevice& rDev, const tools::Rectangle&
 
     OTableFieldDescRef pEntry;
     sal_uInt16 nPos = GetColumnPos(nColumnId);
-    if(getFields().size() > sal_uInt16(nPos - 1))
+    if(getFields().size() > o3tl::make_unsigned(nPos - 1))
         pEntry = getFields()[nPos - 1];
 
     if (!pEntry.is())
@@ -1278,7 +1279,7 @@ void OSelectionBrowseBox::RemoveField(sal_uInt16 nColumnId )
     OQueryController& rController = static_cast<OQueryController&>(getDesignView()->getController());
 
     sal_uInt16 nPos = GetColumnPos(nColumnId);
-    OSL_ENSURE(getFields().size() > sal_uInt16(nPos-1),"ID is to great!");
+    OSL_ENSURE(getFields().size() > o3tl::make_unsigned(nPos-1),"ID is to great!");
 
     OTableFieldDescRef pDesc = getEntry(static_cast<sal_uInt32>(nPos - 1)) ;
     pDesc->SetColWidth( static_cast<sal_uInt16>(GetColumnWidth(nColumnId)) );    // was not stored this before
@@ -2642,7 +2643,7 @@ void OSelectionBrowseBox::setFunctionCell(OTableFieldDescRef const & _pEntry)
 Reference< XAccessible > OSelectionBrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos )
 {
     OTableFieldDescRef pEntry;
-    if(getFields().size() > sal_uInt16(_nColumnPos - 1))
+    if(getFields().size() > o3tl::make_unsigned(_nColumnPos - 1))
         pEntry = getFields()[_nColumnPos - 1];
 
     if ( _nRow == BROW_VIS_ROW && pEntry.is() )


More information about the Libreoffice-commits mailing list