Kaydet (Commit) bc3c181b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 2cf8e2b9
......@@ -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)
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment