From e6ecd5a32c457a1049b601b84b93899cb6ddaefa Mon Sep 17 00:00:00 2001 From: AhmedHamed Date: Tue, 27 Feb 2024 23:35:13 +0200 Subject: [PATCH] tdf#114441 Convert sal_uLong to sal_uInt32 in TreeControlPeer We are talking about a tree list in a gui which logically will not exceed sal_uInt32 They also must be unsigned integers because they represent counts & positions changes are done to these variables: - nPos (node position) In all base classes you will found that all functions deal with and return sal_int32 concerning it - nChild (node child) It is assigned to TREELIST_APPEND which is MAX for sal_uInt32 and it is considered like that in all other functions - nSelectionCount all functions that deal with it (like GetSelectionCount()) returns sal_uInt32 Change-Id: I1771b9aa52c351063d007d7014484861d4b3e02a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164067 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas Reviewed-by: Ilmari Lauhakangas --- toolkit/inc/controls/treecontrolpeer.hxx | 2 +- toolkit/source/controls/tree/treecontrolpeer.cxx | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/toolkit/inc/controls/treecontrolpeer.hxx b/toolkit/inc/controls/treecontrolpeer.hxx index d584516ae35b..d5ecf23ae673 100644 --- a/toolkit/inc/controls/treecontrolpeer.hxx +++ b/toolkit/inc/controls/treecontrolpeer.hxx @@ -117,7 +117,7 @@ private: void fillTree( UnoTreeListBoxImpl& rTree, const css::uno::Reference< css::awt::tree::XTreeDataModel >& xDataModel ); void addNode( UnoTreeListBoxImpl& rTree, const css::uno::Reference< css::awt::tree::XTreeNode >& xNode, UnoTreeListEntry* pParentEntry ); - UnoTreeListEntry* createEntry( const css::uno::Reference< css::awt::tree::XTreeNode >& xNode, UnoTreeListEntry* pParent, sal_uLong nPos ); + UnoTreeListEntry* createEntry( const css::uno::Reference< css::awt::tree::XTreeNode >& xNode, UnoTreeListEntry* pParent, sal_uInt32 nPos ); void updateEntry( UnoTreeListEntry* pEntry ); void updateTree( const css::awt::tree::TreeDataModelEvent& rEvent ); diff --git a/toolkit/source/controls/tree/treecontrolpeer.cxx b/toolkit/source/controls/tree/treecontrolpeer.cxx index c05650f972fb..a26b0b6567da 100644 --- a/toolkit/source/controls/tree/treecontrolpeer.cxx +++ b/toolkit/source/controls/tree/treecontrolpeer.cxx @@ -94,7 +94,7 @@ public: virtual ~UnoTreeListBoxImpl() override; virtual void dispose() override; - void insert( SvTreeListEntry* pEntry, SvTreeListEntry* pParent, sal_uLong nPos ); + void insert( SvTreeListEntry* pEntry, SvTreeListEntry* pParent, sal_uInt32 nPos ); virtual void RequestingChildren( SvTreeListEntry* pParent ) override; @@ -218,7 +218,7 @@ void TreeControlPeer::disposeControl() } -UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xNode, UnoTreeListEntry* pParent, sal_uLong nPos /* = TREELIST_APPEND */ ) +UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xNode, UnoTreeListEntry* pParent, sal_uInt32 nPos /* = TREELIST_APPEND */ ) { UnoTreeListEntry* pEntry = nullptr; if( mpTreeImpl ) @@ -503,7 +503,7 @@ Any SAL_CALL TreeControlPeer::getSelection() Any aRet; - sal_uLong nSelectionCount = rTree.GetSelectionCount(); + sal_uInt32 nSelectionCount = rTree.GetSelectionCount(); if( nSelectionCount == 1 ) { UnoTreeListEntry* pEntry = dynamic_cast< UnoTreeListEntry* >( rTree.FirstSelected() ); @@ -1017,7 +1017,7 @@ void TreeControlPeer::updateNode( UnoTreeListBoxImpl const & rTree, const Refere { Reference< XTreeNode > xParentNode( xNode->getParent() ); UnoTreeListEntry* pParentEntry = nullptr; - sal_uLong nChild = TREELIST_APPEND; + sal_uInt32 nChild = TREELIST_APPEND; if( xParentNode.is() ) { @@ -1463,7 +1463,7 @@ IMPL_LINK_NOARG(UnoTreeListBoxImpl, OnExpandedHdl, SvTreeListBox*, void) } -void UnoTreeListBoxImpl::insert( SvTreeListEntry* pEntry,SvTreeListEntry* pParent,sal_uLong nPos ) +void UnoTreeListBoxImpl::insert( SvTreeListEntry* pEntry,SvTreeListEntry* pParent,sal_uInt32 nPos ) { if( pParent ) SvTreeListBox::Insert( pEntry, pParent, nPos );