svx/source/stbctrls/pszctrl.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
New commits: commit 4c577a0ada8c47483fb8a80a97478ffd3e2b37d3 Author: Dr. David Alan Gilbert <d...@treblig.org> AuthorDate: Wed Nov 10 21:44:40 2021 +0000 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Mon Nov 22 10:03:22 2021 +0100 pszctrl: cppcheck undefined shift cppcheck noticed that the shift in: for ( sal_uInt16 nCheck = 1; nCheck < 32; ++nCheck ) if ( nCheckEncoded & (1 << nCheck) ) is undefined since 1 << 31 is implementation defined. Make it 1u, and the others around. (Not that we define bits that high, but we are explicitly checking it) Change-Id: Ieb780ac999af71df2b48ce64daaf4b2878162e35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125016 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx index f273afcdbc61..129ac67eb085 100644 --- a/svx/source/stbctrls/pszctrl.cxx +++ b/svx/source/stbctrls/pszctrl.cxx @@ -162,7 +162,7 @@ FunctionPopup_Impl::FunctionPopup_Impl(sal_uInt32 nCheckEncoded) , m_nSelected(nCheckEncoded) { for ( sal_uInt16 nCheck = 1; nCheck < 32; ++nCheck ) - if ( nCheckEncoded & (1 << nCheck) ) + if ( nCheckEncoded & (1u << nCheck) ) m_xMenu->set_active(function_to_id(nCheck), true); } @@ -174,10 +174,10 @@ sal_uInt32 FunctionPopup_Impl::GetSelected(std::string_view curident) const nSelected = ( 1 << PSZ_FUNC_NONE ); else { - nSelected &= (~( 1 << PSZ_FUNC_NONE )); // Clear the "None" bit - nSelected ^= ( 1 << nCurItemId ); // Toggle the bit corresponding to nCurItemId + nSelected &= (~( 1u << PSZ_FUNC_NONE )); // Clear the "None" bit + nSelected ^= ( 1u << nCurItemId ); // Toggle the bit corresponding to nCurItemId if ( !nSelected ) - nSelected = ( 1 << PSZ_FUNC_NONE ); + nSelected = ( 1u << PSZ_FUNC_NONE ); } return nSelected; }