summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-06-01 09:09:46 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-06-01 10:49:20 +0200
commite89e3a8b5a7639f14833d066e8a6c445dca97cc0 (patch)
tree6cabe68756d6491658a7789deca6f0a3e3afdc16 /dbaccess
parent6dbccf3d9344be0c2ba162a8df5fc0bf425cb84e (diff)
The return value of those getLength functions is guaranteed to be non-negative
...so use o3tl::make_unsigned when comparing it against an expression of unsigned integer type, instead of casting that expression to a signed type Change-Id: Ic47c6d96919b2aba2d16ce6d1a2a8e4c5761a480 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135219 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx2
-rw-r--r--dbaccess/source/ui/dlg/CollectionView.cxx5
2 files changed, 4 insertions, 3 deletions
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 46b2cea95a02..8a23d6624180 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -207,7 +207,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
SelectColumnsMetaData aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
::dbaccess::getColumnPositions(xSelColumns,xPrimaryKeyColumns->getElementNames(),aUpdateTableName,aColumnNames);
- bAllKeysFound = !aColumnNames.empty() && sal_Int32(aColumnNames.size()) == xPrimaryKeyColumns->getElementNames().getLength();
+ bAllKeysFound = !aColumnNames.empty() && aColumnNames.size() == o3tl::make_unsigned(xPrimaryKeyColumns->getElementNames().getLength());
}
}
}
diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx
index d8a6d2621fe3..2e02fda505e0 100644
--- a/dbaccess/source/ui/dlg/CollectionView.cxx
+++ b/dbaccess/source/ui/dlg/CollectionView.cxx
@@ -26,6 +26,7 @@
#include <cppuhelper/exc_hlp.hxx>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <o3tl/safeint.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <UITools.hxx>
@@ -256,9 +257,9 @@ void OCollectionView::initCurrentPath()
static const char s_sReportsCID[] = "private:reports";
m_bCreateForm = s_sFormsCID == sCID;
OUString sPath("/");
- if ( m_bCreateForm && sCID.getLength() != static_cast<sal_Int32>(strlen(s_sFormsCID)))
+ if ( m_bCreateForm && o3tl::make_unsigned(sCID.getLength()) != strlen(s_sFormsCID))
sPath = sCID.copy(strlen(s_sFormsCID));
- else if ( !m_bCreateForm && sCID.getLength() != static_cast<sal_Int32>(strlen(s_sReportsCID)) )
+ else if ( !m_bCreateForm && o3tl::make_unsigned(sCID.getLength()) != strlen(s_sReportsCID) )
sPath = sCID.copy(strlen(s_sReportsCID) - 2);
m_xFTCurrentPath->set_label(sPath);