lotuswordpro/source/filter/explode.cxx |    2 +-
 sc/source/core/tool/appoptio.cxx       |    2 +-
 sc/source/ui/view/tabvwsha.cxx         |    2 +-
 vcl/source/fontsubset/sft.cxx          |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit c3a8fe7b40465134e500d5698b1455d2181aed4f
Author:     Dr. David Alan Gilbert <d...@treblig.org>
AuthorDate: Sat Jan 30 17:30:39 2021 +0000
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Feb 1 12:25:35 2021 +0100

    cppcheck: Clean up signed 32 bit shift by 31
    
    cppcheck moans about 1<<n where n can be 31; ubsan also complains;
    they're probably right even if it's unlikely to ever be a problem.
    
    Use 1U << 31
    
    Change-Id: Ic83d7d240db4595c2562c1f91116491044d70bab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110173
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/lotuswordpro/source/filter/explode.cxx 
b/lotuswordpro/source/filter/explode.cxx
index 359aab5f36cd..4b4ffa25c6cf 100644
--- a/lotuswordpro/source/filter/explode.cxx
+++ b/lotuswordpro/source/filter/explode.cxx
@@ -197,7 +197,7 @@ sal_uInt32 Decompression::ReadBits(sal_uInt16 iCount, 
sal_uInt32 & nBits)
     m_nBitsLeft -= iCount;
 
     /* return need bits, zeroing the bits above that */
-    nBits = val & ((1 << iCount) - 1);
+    nBits = val & ((1U << iCount) - 1);
 
     return 0;
 }
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index fda7236be3c6..1bc0b2540e6b 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -252,7 +252,7 @@ static sal_uInt32 lcl_ConvertStatusBarFuncSetToSingle( 
sal_uInt32 nFuncSet )
     if ( !nFuncSet )
         return 0;
     for ( sal_uInt32 nFunc = 1; nFunc < 32; ++nFunc )
-        if ( nFuncSet & ( 1 << nFunc ) )
+        if ( nFuncSet & ( 1U << nFunc ) )
             return nFunc;
     return 0;
 }
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 95eb9160f772..07c915ad7b7f 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -73,7 +73,7 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, 
FormulaError nErrCode )
     bool bFirst = true;
     for ( sal_uInt16 nFunc = 0; nFunc < 32; nFunc++ )
     {
-        if ( !(nFuncs & (1 << nFunc)) )
+        if ( !(nFuncs & (1U << nFunc)) )
             continue;
         ScSubTotalFunc eFunc = static_cast<ScSubTotalFunc>(nFunc);
 
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 9fcf26f97d9c..bc4db89582d0 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -2234,7 +2234,7 @@ append(std::bitset<N> & rSet, size_t const nOffset, 
sal_uInt32 const nValue)
 {
     for (size_t i = 0; i < 32; ++i)
     {
-        rSet.set(nOffset + i, (nValue & (1 << i)) != 0);
+        rSet.set(nOffset + i, (nValue & (1U << i)) != 0);
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to