[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Mar 1 12:54:11 UTC 2019


 sw/source/core/layout/atrfrm.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 5e363a4595e0a2ba2df4be940e81ec791eddfb82
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Mar 1 10:51:16 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Mar 1 13:53:41 2019 +0100

    Avoid explicit narrowing casts
    
    They had been added back in the day with
    0c0c6f2727e2b0e954e5ab7afcafe6738ddb9e98 "INTEGRATION: CWS swwarnings"
    (adressing "#i69287# warning-free code"), but don't seem to actually silence any
    warnings, at least nowadays.  Better to keep such narrowing casts implicit, so
    that tools like Clang's -fsanitize=implicit-integer-truncation can detect cases
    at runtime where a too-large value erroneously gets truncated by such a cast.
    
    Change-Id: I3bba6fff034e544cd935c0c4dbc98989052add5e
    Reviewed-on: https://gerrit.libreoffice.org/68541
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index c944fb2178a1..15d7c4b513d9 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1088,10 +1088,10 @@ bool SwFormatCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
                 for(sal_uInt16 i = 0; i < nCount; i++)
                 {
                     SwColumn aCol;
-                    aCol.SetWishWidth(static_cast<sal_uInt16>(pArray[i].Width) );
-                    nWidthSum = static_cast<sal_uInt16>(nWidthSum + pArray[i].Width);
-                    aCol.SetLeft (static_cast<sal_uInt16>(convertMm100ToTwip(pArray[i].LeftMargin)));
-                    aCol.SetRight(static_cast<sal_uInt16>(convertMm100ToTwip(pArray[i].RightMargin)));
+                    aCol.SetWishWidth(pArray[i].Width );
+                    nWidthSum = nWidthSum + pArray[i].Width;
+                    aCol.SetLeft (convertMm100ToTwip(pArray[i].LeftMargin));
+                    aCol.SetRight(convertMm100ToTwip(pArray[i].RightMargin));
                     m_aColumns.insert(m_aColumns.begin() + i, aCol);
                 }
             bRet = true;


More information about the Libreoffice-commits mailing list