diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-03-04 20:11:20 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-03-05 08:46:36 +0100 |
commit | bc3c181b81f931a931e822ab0fe51a22bdd433ba (patch) | |
tree | 9dbe81c933a09c8a2e08879122e1eee3d5b9c576 | |
parent | Remove redundant assignment (diff) | |
download | core-bc3c181b81f931a931e822ab0fe51a22bdd433ba.tar.gz core-bc3c181b81f931a931e822ab0fe51a22bdd433ba.zip |
Introduce SVBT16ToInt16 for reading sal_Int16 instead of sal_uInt16
This change does not change the actual results, but avoids Clang
-fsanitize=implicit-signed-integer-truncation warnings
Change-Id: If82193d7a6ad6bdadb4e8a8b3ed3bbdf3d88c4a3
Reviewed-on: https://gerrit.libreoffice.org/68706
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | include/tools/solar.h | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/include/tools/solar.h b/include/tools/solar.h index 5d078763d3f7..3fd676acbc2a 100644 --- a/include/tools/solar.h +++ b/include/tools/solar.h @@ -49,6 +49,7 @@ typedef sal_uInt8 SVBT64[8]; inline sal_uInt16 SVBT16ToUInt16( const SVBT16 p ) { return static_cast<sal_uInt16> (static_cast<sal_uInt16>(p[0]) + (static_cast<sal_uInt16>(p[1]) << 8)); } +inline sal_Int16 SVBT16ToInt16( const SVBT16 p ) { return sal_Int16(SVBT16ToUInt16(p)); } inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return static_cast<sal_uInt32> (static_cast<sal_uInt32>(p[0]) + (static_cast<sal_uInt32>(p[1]) << 8) diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 1aa9e0946763..f95859e553a5 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -144,7 +144,7 @@ static short ReadSprm( const WW8PLCFx_SEPX* pSep, sal_uInt16 nId, short nDefault { SprmResult aRes = pSep->HasSprm(nId); // sprm here? const sal_uInt8* pS = aRes.pSprm; - short nVal = (pS && aRes.nRemainingData >= 2) ? SVBT16ToUInt16(pS) : nDefaultVal; + short nVal = (pS && aRes.nRemainingData >= 2) ? SVBT16ToInt16(pS) : nDefaultVal; return nVal; } @@ -3439,7 +3439,7 @@ void SwWW8ImplReader::Read_SubSuperProp( sal_uInt16, const sal_uInt8* pData, sho } // font position in HalfPoints - short nPos = eVersion <= ww::eWW2 ? static_cast< sal_Int8 >( *pData ) : SVBT16ToUInt16( pData ); + short nPos = eVersion <= ww::eWW2 ? static_cast< sal_Int8 >( *pData ) : SVBT16ToInt16( pData ); sal_Int32 nPos2 = nPos * ( 10 * 100 ); // HalfPoints in 100 * tw const SvxFontHeightItem* pF = static_cast<const SvxFontHeightItem*>(GetFormatAttr(RES_CHRATR_FONTSIZE)); |