vcl/source/treelist/treelist.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
New commits: commit 87b4701c07fa0bb80985319042e9139a2ffd6af4 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Sep 11 09:42:12 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Oct 31 16:59:27 2024 +0100 cid#1607569 silence Overflowed return value and cid#1607406 Overflowed return value Change-Id: Ia7917f9046382c25232415b7eb1de3b60071957a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175838 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx index 50003c621fe7..94323be03bdb 100644 --- a/vcl/source/treelist/treelist.cxx +++ b/vcl/source/treelist/treelist.cxx @@ -410,8 +410,9 @@ sal_uInt32 SvTreeList::GetChildCount( const SvTreeListEntry* pParent ) const pParent = Next(const_cast<SvTreeListEntry*>(pParent), &nActDepth); nCount++; } while( pParent && nRefDepth < nActDepth ); - nCount--; - return nCount; + + assert(nCount > 0 && "given do...while"); + return nCount - 1; } sal_uInt32 SvTreeList::GetVisibleChildCount(const SvListView* pView, SvTreeListEntry* pParent) const @@ -431,9 +432,9 @@ sal_uInt32 SvTreeList::GetVisibleChildCount(const SvListView* pView, SvTreeListE pParent = NextVisible( pView, pParent, &nActDepth ); nCount++; } while( pParent && nRefDepth < nActDepth ); - assert(nCount >= 1 && "given do...while"); - nCount--; - return nCount; + + assert(nCount > 0 && "given do...while"); + return nCount - 1; } sal_uInt32 SvTreeList::GetChildSelectionCount(const SvListView* pView,SvTreeListEntry* pParent) const @@ -454,7 +455,7 @@ sal_uInt32 SvTreeList::GetChildSelectionCount(const SvListView* pView,SvTreeList if( pParent && pView->IsSelected( pParent ) && nRefDepth < nActDepth) nCount++; } while( pParent && nRefDepth < nActDepth ); -// nCount--; + return nCount; }