diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-03-04 14:10:05 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-03-04 16:37:27 +0100 |
commit | d66dbe0f9de76405052352d6bfc369a7c2b0a8e3 (patch) | |
tree | 5fb12117dada35c79eeee4713977d4bb1afb1b00 | |
parent | d515aaa11c42a9d5698380c2288ca7eb65228371 (diff) |
Rename SVBT16ToShort to SVBT16ToUInt16
For one, it that way matches reality (as it returns sal_uInt16, not short or
sal_Int16) and its SVBT32ToUInt32 counterpart. For another, I plan a follow-up
commit of introducing an additional SVBT16ToInt16 to explicitly return
sal_Int16.
Change-Id: I28915e6593ccdca0c11d7b2fa593e96e359a9532
Reviewed-on: https://gerrit.libreoffice.org/68686
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | include/tools/solar.h | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpobjstrm.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/excel/xistream.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8glsy.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 162 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf2.cxx | 28 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 18 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 34 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par4.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 74 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 36 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8struc.hxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/jobset.cxx | 10 |
14 files changed, 194 insertions, 194 deletions
diff --git a/include/tools/solar.h b/include/tools/solar.h index 5ea3be835525..5d078763d3f7 100644 --- a/include/tools/solar.h +++ b/include/tools/solar.h @@ -46,7 +46,7 @@ typedef sal_uInt8 SVBT64[8]; #ifdef __cplusplus -inline sal_uInt16 SVBT16ToShort( const SVBT16 p ) { return static_cast<sal_uInt16> +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_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return static_cast<sal_uInt32> diff --git a/lotuswordpro/source/filter/lwpobjstrm.cxx b/lotuswordpro/source/filter/lwpobjstrm.cxx index 86444146818b..5cd37f191fa3 100644 --- a/lotuswordpro/source/filter/lwpobjstrm.cxx +++ b/lotuswordpro/source/filter/lwpobjstrm.cxx @@ -187,7 +187,7 @@ bool LwpObjectStream::QuickReadBool() { SVBT16 aValue = {0}; QuickRead(aValue, sizeof(aValue)); - return static_cast<bool>(SVBT16ToShort(aValue)); + return static_cast<bool>(SVBT16ToUInt16(aValue)); } /** * @descr Quick read sal_uInt32 @@ -209,7 +209,7 @@ sal_uInt16 LwpObjectStream::QuickReaduInt16(bool *pFailure) sal_uInt16 nRead = QuickRead(aValue, sizeof(aValue)); if (pFailure) *pFailure = (nRead != sizeof(aValue)); - return SVBT16ToShort(aValue); + return SVBT16ToUInt16(aValue); } /** * @descr Quick read sal_Int32 @@ -228,7 +228,7 @@ sal_Int16 LwpObjectStream::QuickReadInt16() SVBT16 aValue = {0}; QuickRead(aValue, sizeof(aValue)); - return static_cast<sal_Int16>(SVBT16ToShort(aValue)); + return static_cast<sal_Int16>(SVBT16ToUInt16(aValue)); } /** * @descr Quick read sal_uInt8 diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index f58e53282690..6decac3d88ce 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -636,7 +636,7 @@ sal_Int16 XclImpStream::ReadInt16() { SVBT16 pnBuffer; mxDecrypter->Read( mrStrm, pnBuffer, 2 ); - nValue = static_cast< sal_Int16 >( SVBT16ToShort( pnBuffer ) ); + nValue = static_cast< sal_Int16 >( SVBT16ToUInt16( pnBuffer ) ); } else mrStrm.ReadInt16( nValue ); @@ -654,7 +654,7 @@ sal_uInt16 XclImpStream::ReaduInt16() { SVBT16 pnBuffer; mxDecrypter->Read( mrStrm, pnBuffer, 2 ); - nValue = SVBT16ToShort( pnBuffer ); + nValue = SVBT16ToUInt16( pnBuffer ); } else mrStrm.ReadUInt16( nValue ); diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index 811b554c15a7..96dc246e9919 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -144,7 +144,7 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, // sttbfglsystyle list that this entry belongs to. Unused at the // moment const ww::bytes &rData = rExtra[nGlosEntry]; - sal_uInt16 n = SVBT16ToShort( &(rData[2]) ); + sal_uInt16 n = SVBT16ToUInt16( &(rData[2]) ); if(n != 0xFFFF) { rBlocks.ClearDoc(); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 87e2a54f0e5f..8c4c573e93a6 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -169,10 +169,10 @@ void wwFrameNamer::SetUniqueGraphName(SwFrameFormat *pFrameFormat, const OUStrin bool SwWW8ImplReader::ReadGrafStart(void* pData, short nDataSiz, WW8_DPHEAD const * pHd, SfxAllItemSet &rSet) { - if (SVBT16ToShort(pHd->cb) < sizeof(WW8_DPHEAD) + nDataSiz) + if (SVBT16ToUInt16(pHd->cb) < sizeof(WW8_DPHEAD) + nDataSiz) { OSL_ENSURE( false, "+graphic element: too short?" ); - m_pStrm->SeekRel(SVBT16ToShort(pHd->cb) - sizeof(WW8_DPHEAD)); + m_pStrm->SeekRel(SVBT16ToUInt16(pHd->cb) - sizeof(WW8_DPHEAD)); return false; } @@ -195,19 +195,19 @@ bool SwWW8ImplReader::ReadGrafStart(void* pData, short nDataSiz, static void SetStdAttr( SfxItemSet& rSet, WW8_DP_LINETYPE& rL, WW8_DP_SHADOW const & rSh ) { - if( SVBT16ToShort( rL.lnps ) == 5 ){ // invisible + if( SVBT16ToUInt16( rL.lnps ) == 5 ){ // invisible rSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); }else{ // visible Color aCol( WW8TransCol( rL.lnpc ) ); // line color rSet.Put( XLineColorItem( OUString(), aCol ) ); - rSet.Put( XLineWidthItem( SVBT16ToShort( rL.lnpw ) ) ); + rSet.Put( XLineWidthItem( SVBT16ToUInt16( rL.lnpw ) ) ); // line thickness - if( SVBT16ToShort( rL.lnps ) >= 1 - && SVBT16ToShort(rL.lnps ) <= 4 ){ // line style + if( SVBT16ToUInt16( rL.lnps ) >= 1 + && SVBT16ToUInt16(rL.lnps ) <= 4 ){ // line style rSet.Put( XLineStyleItem( drawing::LineStyle_DASH ) ); - sal_Int16 nLen = SVBT16ToShort( rL.lnpw ); + sal_Int16 nLen = SVBT16ToUInt16( rL.lnpw ); XDash aD( css::drawing::DashStyle_RECT, 1, 2 * nLen, 1, 5 * nLen, 5 * nLen ); - switch( SVBT16ToShort( rL.lnps ) ){ + switch( SVBT16ToUInt16( rL.lnps ) ){ case 1: aD.SetDots( 0 ); // Dash aD.SetDashLen( 6 * nLen ); aD.SetDistance( 4 * nLen ); @@ -221,10 +221,10 @@ static void SetStdAttr( SfxItemSet& rSet, WW8_DP_LINETYPE& rL, rSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) ); // needed for TextBox } } - if( SVBT16ToShort( rSh.shdwpi ) ){ // shadow + if( SVBT16ToUInt16( rSh.shdwpi ) ){ // shadow rSet.Put(makeSdrShadowItem(true)); - rSet.Put( makeSdrShadowXDistItem( SVBT16ToShort( rSh.xaOffset ) ) ); - rSet.Put( makeSdrShadowYDistItem( SVBT16ToShort( rSh.yaOffset ) ) ); + rSet.Put( makeSdrShadowXDistItem( SVBT16ToUInt16( rSh.xaOffset ) ) ); + rSet.Put( makeSdrShadowYDistItem( SVBT16ToUInt16( rSh.yaOffset ) ) ); } } @@ -240,7 +240,7 @@ static void SetFill( SfxItemSet& rSet, WW8_DP_FILL& rFill ) 0, 0, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 50, 50, 50, 50, 50, 50, 33, 33, 33, 33, 33, 33 }; - sal_uInt16 nPat = SVBT16ToShort(rFill.flpp); + sal_uInt16 nPat = SVBT16ToUInt16(rFill.flpp); if (nPat == 0) // transparent rSet.Put(XFillStyleItem(drawing::FillStyle_NONE)); @@ -270,7 +270,7 @@ static void SetFill( SfxItemSet& rSet, WW8_DP_FILL& rFill ) static void SetLineEndAttr( SfxItemSet& rSet, WW8_DP_LINEEND const & rLe, WW8_DP_LINETYPE const & rLt ) { - sal_uInt16 aSB = SVBT16ToShort( rLe.aStartBits ); + sal_uInt16 aSB = SVBT16ToUInt16( rLe.aStartBits ); if( aSB & 0x3 ) { ::basegfx::B2DPolygon aPolygon; @@ -279,14 +279,14 @@ static void SetLineEndAttr( SfxItemSet& rSet, WW8_DP_LINEEND const & rLe, aPolygon.append(::basegfx::B2DPoint(200.0, 330.0)); aPolygon.setClosed(true); rSet.Put( XLineEndItem( OUString(), ::basegfx::B2DPolyPolygon(aPolygon) ) ); - sal_uInt16 nSiz = SVBT16ToShort( rLt.lnpw ) + sal_uInt16 nSiz = SVBT16ToUInt16( rLt.lnpw ) * ( ( aSB >> 2 & 0x3 ) + ( aSB >> 4 & 0x3 ) ); if( nSiz < 220 ) nSiz = 220; rSet.Put(XLineEndWidthItem(nSiz)); rSet.Put(XLineEndCenterItem(false)); } - sal_uInt16 aEB = SVBT16ToShort( rLe.aEndBits ); + sal_uInt16 aEB = SVBT16ToUInt16( rLe.aEndBits ); if( aEB & 0x3 ){ ::basegfx::B2DPolygon aPolygon; aPolygon.append(::basegfx::B2DPoint(0.0, 330.0)); @@ -294,7 +294,7 @@ static void SetLineEndAttr( SfxItemSet& rSet, WW8_DP_LINEEND const & rLe, aPolygon.append(::basegfx::B2DPoint(200.0, 330.0)); aPolygon.setClosed(true); rSet.Put( XLineStartItem( OUString(), ::basegfx::B2DPolyPolygon(aPolygon) ) ); - sal_uInt16 nSiz = SVBT16ToShort( rLt.lnpw ) + sal_uInt16 nSiz = SVBT16ToUInt16( rLt.lnpw ) * ( ( aEB >> 2 & 0x3 ) + ( aEB >> 4 & 0x3 ) ); if( nSiz < 220 ) nSiz = 220; rSet.Put(XLineStartWidthItem(nSiz)); @@ -315,13 +315,13 @@ SdrObject* SwWW8ImplReader::ReadLine(WW8_DPHEAD const * pHd, SfxAllItemSet &rSet Point& rP0 = aP[0]; Point& rP1 = aP[1]; - rP0.setX( static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )) + m_nDrawXOfs2 ); - rP0.setY( static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )) + m_nDrawYOfs2 ); + rP0.setX( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2 ); + rP0.setY( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 ); rP1 = rP0; - rP0.AdjustX(static_cast<sal_Int16>(SVBT16ToShort( aLine.xaStart )) ); - rP0.AdjustY(static_cast<sal_Int16>(SVBT16ToShort( aLine.yaStart )) ); - rP1.AdjustX(static_cast<sal_Int16>(SVBT16ToShort( aLine.xaEnd )) ); - rP1.AdjustY(static_cast<sal_Int16>(SVBT16ToShort( aLine.yaEnd )) ); + rP0.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.xaStart )) ); + rP0.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.yaStart )) ); + rP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.xaEnd )) ); + rP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( aLine.yaEnd )) ); } ::basegfx::B2DPolygon aPolygon; @@ -345,11 +345,11 @@ SdrObject* SwWW8ImplReader::ReadRect(WW8_DPHEAD const * pHd, SfxAllItemSet &rSet if( !ReadGrafStart( static_cast<void*>(&aRect), sizeof( aRect ), pHd, rSet ) ) return nullptr; - Point aP0( static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )) + m_nDrawXOfs2, - static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )) + m_nDrawYOfs2 ); + Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2, + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 ); Point aP1( aP0 ); - aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) ); - aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) ); + aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) ); + aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) ); SdrObject* pObj = new SdrRectObj( *m_pDrawModel, @@ -368,11 +368,11 @@ SdrObject* SwWW8ImplReader::ReadElipse(WW8_DPHEAD const * pHd, SfxAllItemSet &rS if( !ReadGrafStart( static_cast<void*>(&aElipse), sizeof( aElipse ), pHd, rSet ) ) return nullptr; - Point aP0( static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )) + m_nDrawXOfs2, - static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )) + m_nDrawYOfs2 ); + Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2, + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 ); Point aP1( aP0 ); - aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) ); - aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) ); + aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) ); + aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) ); SdrObject* pObj = new SdrCircObj( *m_pDrawModel, @@ -392,21 +392,21 @@ SdrObject* SwWW8ImplReader::ReadArc(WW8_DPHEAD const * pHd, SfxAllItemSet &rSet) if( !ReadGrafStart( static_cast<void*>(&aArc), sizeof( aArc ), pHd, rSet ) ) return nullptr; - Point aP0( static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )) + m_nDrawXOfs2, - static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )) + m_nDrawYOfs2 ); + Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2, + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 ); Point aP1( aP0 ); - aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) * 2 ); - aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) * 2 ); + aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) * 2 ); + aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) * 2 ); short nA[] = { 2, 3, 1, 0 }; short nW = nA[ ( ( aArc.fLeft & 1 ) << 1 ) + ( aArc.fUp & 1 ) ]; if( !aArc.fLeft ){ - aP0.AdjustY( -static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) ); - aP1.AdjustY( -static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) ); + aP0.AdjustY( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) ); + aP1.AdjustY( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) ); } if( aArc.fUp ){ - aP0.AdjustX( -static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) ); - aP1.AdjustX( -static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) ); + aP0.AdjustX( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) ); + aP1.AdjustX( -static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) ); } SdrObject* pObj = new SdrCircObj( @@ -429,7 +429,7 @@ SdrObject* SwWW8ImplReader::ReadPolyLine(WW8_DPHEAD const * pHd, SfxAllItemSet & if( !ReadGrafStart( static_cast<void*>(&aPoly), sizeof( aPoly ), pHd, rSet ) ) return nullptr; - sal_uInt16 nCount = SVBT16ToShort( aPoly.aBits1 ) >> 1 & 0x7fff; + sal_uInt16 nCount = SVBT16ToUInt16( aPoly.aBits1 ) >> 1 & 0x7fff; std::unique_ptr<SVBT16[]> xP(new SVBT16[nCount * 2]); bool bCouldRead = checkRead(*m_pStrm, xP.get(), nCount * 4); // read points @@ -441,17 +441,17 @@ SdrObject* SwWW8ImplReader::ReadPolyLine(WW8_DPHEAD const * pHd, SfxAllItemSet & Point aPt; for (sal_uInt16 i=0; i<nCount; ++i) { - aPt.setX( SVBT16ToShort( xP[i << 1] ) + m_nDrawXOfs2 - + static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )) ); - aPt.setY( SVBT16ToShort( xP[( i << 1 ) + 1] ) + m_nDrawYOfs2 - + static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )) ); + aPt.setX( SVBT16ToUInt16( xP[i << 1] ) + m_nDrawXOfs2 + + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) ); + aPt.setY( SVBT16ToUInt16( xP[( i << 1 ) + 1] ) + m_nDrawYOfs2 + + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) ); aP[i] = aPt; } xP.reset(); SdrObject* pObj = new SdrPathObj( *m_pDrawModel, - (SVBT16ToShort(aPoly.aBits1) & 0x1) ? OBJ_POLY : OBJ_PLIN, + (SVBT16ToUInt16(aPoly.aBits1) & 0x1) ? OBJ_POLY : OBJ_PLIN, ::basegfx::B2DPolyPolygon(aP.getB2DPolygon())); SetStdAttr( rSet, aPoly.aLnt, aPoly.aShd ); @@ -813,7 +813,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, if( bCheckTextBoxStory ) { - bool bReusable = (0 != SVBT16ToShort( static_cast<WW8_TXBXS*>(pT0)->fReusable )); + bool bReusable = (0 != SVBT16ToUInt16( static_cast<WW8_TXBXS*>(pT0)->fReusable )); while( bReusable ) { pT->advance(); @@ -822,7 +822,7 @@ bool SwWW8ImplReader::GetTxbxTextSttEndCp(WW8_CP& rStartCp, WW8_CP& rEndCp, OSL_ENSURE( false, "+where's the text graphic (2a)?" ); return false; } - bReusable = (0 != SVBT16ToShort( static_cast<WW8_TXBXS*>(pT0)->fReusable )); + bReusable = (0 != SVBT16ToUInt16( static_cast<WW8_TXBXS*>(pT0)->fReusable )); } } pT->advance(); @@ -1228,11 +1228,11 @@ SdrObject* SwWW8ImplReader::ReadTextBox(WW8_DPHEAD const * pHd, SfxAllItemSet &r if( !ReadGrafStart( static_cast<void*>(&aTextB), sizeof( aTextB ), pHd, rSet ) ) return nullptr; - Point aP0( static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )) + m_nDrawXOfs2, - static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )) + m_nDrawYOfs2 ); + Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + m_nDrawXOfs2, + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + m_nDrawYOfs2 ); Point aP1( aP0 ); - aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) ); - aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) ); + aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) ); + aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) ); SdrRectObj* pObj = new SdrRectObj( *m_pDrawModel, @@ -1240,8 +1240,8 @@ SdrObject* SwWW8ImplReader::ReadTextBox(WW8_DPHEAD const * pHd, SfxAllItemSet &r tools::Rectangle(aP0, aP1)); pObj->NbcSetSnapRect(tools::Rectangle(aP0, aP1)); - Size aSize( static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) , - static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) ); + Size aSize( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dxa )) , + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->dya )) ); long nStartCpFly,nEndCpFly; bool bContainsGraphics; @@ -1272,7 +1272,7 @@ SdrObject* SwWW8ImplReader::ReadCaptionBox(WW8_DPHEAD const * pHd, SfxAllItemSet if( !ReadGrafStart( static_cast<void*>(&aCallB), sizeof( aCallB ), pHd, rSet ) ) return nullptr; - sal_uInt16 nCount = SVBT16ToShort( aCallB.dpPolyLine.aBits1 ) >> 1 & 0x7fff; + sal_uInt16 nCount = SVBT16ToUInt16( aCallB.dpPolyLine.aBits1 ) >> 1 & 0x7fff; if (nCount < 1) { SAL_WARN("sw.ww8", "Short CaptionBox header"); @@ -1289,22 +1289,22 @@ SdrObject* SwWW8ImplReader::ReadCaptionBox(WW8_DPHEAD const * pHd, SfxAllItemSet } sal_uInt8 nTyp = static_cast<sal_uInt8>(nCount) - 1; - if( nTyp == 1 && SVBT16ToShort( xP[0] ) == SVBT16ToShort( xP[2] ) ) + if( nTyp == 1 && SVBT16ToUInt16( xP[0] ) == SVBT16ToUInt16( xP[2] ) ) nTyp = 0; - Point aP0( static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )) + - static_cast<sal_Int16>(SVBT16ToShort( aCallB.dpheadTxbx.xa )) + m_nDrawXOfs2, - static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )) - + static_cast<sal_Int16>(SVBT16ToShort( aCallB.dpheadTxbx.ya )) + m_nDrawYOfs2 ); + Point aP0( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.xa )) + m_nDrawXOfs2, + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.ya )) + m_nDrawYOfs2 ); Point aP1( aP0 ); - aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToShort( aCallB.dpheadTxbx.dxa )) ); - aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToShort( aCallB.dpheadTxbx.dya )) ); - Point aP2( static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )) - + static_cast<sal_Int16>(SVBT16ToShort( aCallB.dpheadPolyLine.xa )) - + m_nDrawXOfs2 + static_cast<sal_Int16>(SVBT16ToShort( xP[0] )), - static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )) - + static_cast<sal_Int16>(SVBT16ToShort( aCallB.dpheadPolyLine.ya )) - + m_nDrawYOfs2 + static_cast<sal_Int16>(SVBT16ToShort( xP[1] )) ); + aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dxa )) ); + aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dya )) ); + Point aP2( static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )) + + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadPolyLine.xa )) + + m_nDrawXOfs2 + static_cast<sal_Int16>(SVBT16ToUInt16( xP[0] )), + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )) + + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadPolyLine.ya )) + + m_nDrawYOfs2 + static_cast<sal_Int16>(SVBT16ToUInt16( xP[1] )) ); xP.reset(); SdrCaptionObj* pObj = new SdrCaptionObj( @@ -1313,13 +1313,13 @@ SdrObject* SwWW8ImplReader::ReadCaptionBox(WW8_DPHEAD const * pHd, SfxAllItemSet aP2); pObj->NbcSetSnapRect(tools::Rectangle(aP0, aP1)); - Size aSize( static_cast<sal_Int16>(SVBT16ToShort( aCallB.dpheadTxbx.dxa )), - static_cast<sal_Int16>(SVBT16ToShort( aCallB.dpheadTxbx.dya )) ); + Size aSize( static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dxa )), + static_cast<sal_Int16>(SVBT16ToUInt16( aCallB.dpheadTxbx.dya )) ); bool bEraseThisObject; InsertTxbxText(pObj, &aSize, 0, 0, 0, nullptr, false, bEraseThisObject ); - if( SVBT16ToShort( aCallB.dptxbx.aLnt.lnps ) != 5 ) // Is border visible ? + if( SVBT16ToUInt16( aCallB.dptxbx.aLnt.lnps ) != 5 ) // Is border visible ? SetStdAttr( rSet, aCallB.dptxbx.aLnt, aCallB.dptxbx.aShd ); else // no -> take lines SetStdAttr( rSet, aCallB.dpPolyLine.aLnt, aCallB.dptxbx.aShd ); @@ -1340,12 +1340,12 @@ SdrObject *SwWW8ImplReader::ReadGroup(WW8_DPHEAD const * pHd, SfxAllItemSet &rSe nGrouped = (sal_Int16)OSL_SWAPWORD( nGrouped ); #endif - m_nDrawXOfs = m_nDrawXOfs + static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )); - m_nDrawYOfs = m_nDrawYOfs + static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )); + m_nDrawXOfs = m_nDrawXOfs + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )); + m_nDrawYOfs = m_nDrawYOfs + static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )); SdrObject* pObj = new SdrObjGroup(*m_pDrawModel); - short nLeft = static_cast<sal_Int16>(SVBT16ToShort( pHd->cb )) - sizeof( WW8_DPHEAD ); + short nLeft = static_cast<sal_Int16>(SVBT16ToUInt16( pHd->cb )) - sizeof( WW8_DPHEAD ); for (int i = 0; i < nGrouped && nLeft >= static_cast<short>(sizeof(WW8_DPHEAD)); ++i) { SfxAllItemSet aSet(m_pDrawModel->GetItemPool()); @@ -1360,8 +1360,8 @@ SdrObject *SwWW8ImplReader::ReadGroup(WW8_DPHEAD const * pHd, SfxAllItemSet &rSe } } - m_nDrawXOfs = m_nDrawXOfs - static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )); - m_nDrawYOfs = m_nDrawYOfs - static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )); + m_nDrawXOfs = m_nDrawXOfs - static_cast<sal_Int16>(SVBT16ToUInt16( pHd->xa )); + m_nDrawYOfs = m_nDrawYOfs - static_cast<sal_Int16>(SVBT16ToUInt16( pHd->ya )); return pObj; } @@ -1373,7 +1373,7 @@ SdrObject* SwWW8ImplReader::ReadGrafPrimitive(short& rLeft, SfxAllItemSet &rSet) SdrObject *pRet=nullptr; WW8_DPHEAD aHd; // Read Draw-Primitive-Header bool bCouldRead = checkRead(*m_pStrm, &aHd, sizeof(WW8_DPHEAD)) && - SVBT16ToShort(aHd.cb) >= sizeof(WW8_DPHEAD); + SVBT16ToUInt16(aHd.cb) >= sizeof(WW8_DPHEAD); OSL_ENSURE(bCouldRead, "Graphic Primitive header short read" ); if (!bCouldRead) { @@ -1381,10 +1381,10 @@ SdrObject* SwWW8ImplReader::ReadGrafPrimitive(short& rLeft, SfxAllItemSet &rSet) return pRet; } - if( rLeft >= SVBT16ToShort(aHd.cb) ) // precautions + if( rLeft >= SVBT16ToUInt16(aHd.cb) ) // precautions { rSet.Put(SwFormatSurround(css::text::WrapTextMode_THROUGH)); - switch (SVBT16ToShort(aHd.dpk) & 0xff ) + switch (SVBT16ToUInt16(aHd.dpk) & 0xff ) { case 0: pRet = ReadGroup(&aHd, rSet); @@ -1411,7 +1411,7 @@ SdrObject* SwWW8ImplReader::ReadGrafPrimitive(short& rLeft, SfxAllItemSet &rSet) pRet = ReadCaptionBox(&aHd, rSet); break; default: // unknown - m_pStrm->SeekRel(SVBT16ToShort(aHd.cb) - sizeof(WW8_DPHEAD)); + m_pStrm->SeekRel(SVBT16ToUInt16(aHd.cb) - sizeof(WW8_DPHEAD)); break; } } @@ -1419,7 +1419,7 @@ SdrObject* SwWW8ImplReader::ReadGrafPrimitive(short& rLeft, SfxAllItemSet &rSet) { OSL_ENSURE( false, "+Grafik-Overlap" ); } - rLeft = rLeft - SVBT16ToShort( aHd.cb ); + rLeft = rLeft - SVBT16ToUInt16( aHd.cb ); return pRet; } @@ -1452,13 +1452,13 @@ void SwWW8ImplReader::ReadGrafLayer1( WW8PLCFspecial* pPF, long nGrafAnchorCp ) if (!bCouldRead) return; - short nLeft = SVBT16ToShort( aDo.cb ) - sizeof( WW8_DO ); + short nLeft = SVBT16ToUInt16( aDo.cb ) - sizeof( WW8_DO ); while (nLeft > static_cast<short>(sizeof(WW8_DPHEAD))) { SfxAllItemSet aSet( m_pDrawModel->GetItemPool() ); if (SdrObject *pObject = ReadGrafPrimitive(nLeft, aSet)) { - m_xWWZOrder->InsertDrawingObject(pObject, SVBT16ToShort(aDo.dhgt)); + m_xWWZOrder->InsertDrawingObject(pObject, SVBT16ToUInt16(aDo.dhgt)); tools::Rectangle aRect(pObject->GetSnapRect()); diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index db8837c82849..94c2036edace 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -730,21 +730,21 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj const * pTextObj, void WW8PicShadowToReal( WW8_PIC_SHADOW const * pPicS, WW8_PIC * pPic ) { pPic->lcb = SVBT32ToUInt32( pPicS->lcb ); - pPic->cbHeader = SVBT16ToShort( pPicS->cbHeader ); - pPic->MFP.mm = SVBT16ToShort( pPicS->MFP.mm ); - pPic->MFP.xExt = SVBT16ToShort( pPicS->MFP.xExt ); - pPic->MFP.yExt = SVBT16ToShort( pPicS->MFP.yExt ); - pPic->MFP.hMF = SVBT16ToShort( pPicS->MFP.hMF ); + pPic->cbHeader = SVBT16ToUInt16( pPicS->cbHeader ); + pPic->MFP.mm = SVBT16ToUInt16( pPicS->MFP.mm ); + pPic->MFP.xExt = SVBT16ToUInt16( pPicS->MFP.xExt ); + pPic->MFP.yExt = SVBT16ToUInt16( pPicS->MFP.yExt ); + pPic->MFP.hMF = SVBT16ToUInt16( pPicS->MFP.hMF ); for( sal_uInt16 i = 0; i < 14 ; i++ ) pPic->rcWinMF[i] = pPicS->rcWinMF[i]; - pPic->dxaGoal = SVBT16ToShort( pPicS->dxaGoal ); - pPic->dyaGoal = SVBT16ToShort( pPicS->dyaGoal ); - pPic->mx = SVBT16ToShort( pPicS->mx ); - pPic->my = SVBT16ToShort( pPicS->my ); - pPic->dxaCropLeft = SVBT16ToShort( pPicS->dxaCropLeft ); - pPic->dyaCropTop = SVBT16ToShort( pPicS->dyaCropTop ); - pPic->dxaCropRight = SVBT16ToShort( pPicS->dxaCropRight ); - pPic->dyaCropBottom = SVBT16ToShort( pPicS->dyaCropBottom ); + pPic->dxaGoal = SVBT16ToUInt16( pPicS->dxaGoal ); + pPic->dyaGoal = SVBT16ToUInt16( pPicS->dyaGoal ); + pPic->mx = SVBT16ToUInt16( pPicS->mx ); + pPic->my = SVBT16ToUInt16( pPicS->my ); + pPic->dxaCropLeft = SVBT16ToUInt16( pPicS->dxaCropLeft ); + pPic->dyaCropTop = SVBT16ToUInt16( pPicS->dyaCropTop ); + pPic->dxaCropRight = SVBT16ToUInt16( pPicS->dxaCropRight ); + pPic->dyaCropBottom = SVBT16ToUInt16( pPicS->dyaCropBottom ); pPic->brcl = pPicS->aBits1 & 0x0f; pPic->fFrameEmpty = (pPicS->aBits1 & 0x10) >> 4; pPic->fBitmap = (pPicS->aBits1 & 0x20) >> 5; @@ -761,7 +761,7 @@ void WW8FSPAShadowToReal( WW8_FSPA_SHADOW const * pFSPAS, WW8_FSPA * pFSPA ) pFSPA->nXaRight = SVBT32ToUInt32( pFSPAS->nXaRight ); pFSPA->nYaBottom = SVBT32ToUInt32( pFSPAS->nYaBottom ); - sal_uInt16 nBits = SVBT16ToShort( pFSPAS->aBits1 ); + sal_uInt16 nBits = SVBT16ToUInt16( pFSPAS->aBits1 ); pFSPA->bHdr = sal_uInt16(0 != ( nBits & 0x0001 )); pFSPA->nbx = ( nBits & 0x0006 ) >> 1; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 6b77a7fd9821..6acb64460245 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1144,7 +1144,7 @@ void SwWW8ImplReader::Read_StyleCode( sal_uInt16, const sal_uInt8* pData, short if (m_xWwFib->GetFIBVersion() <= ww::eWW2) nColl = *pData; else - nColl = SVBT16ToShort(pData); + nColl = SVBT16ToUInt16(pData); if (nColl < m_vColl.size()) { SetTextFormatCollAndListLevel( *m_pPaM, m_vColl[nColl] ); @@ -1717,14 +1717,14 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen) SvxTabStop aTabStop; for (short i=0; i < nDel; ++i) { - sal_uInt16 nPos = aAttr.GetPos(SVBT16ToShort(pDel + i*2)); + sal_uInt16 nPos = aAttr.GetPos(SVBT16ToUInt16(pDel + i*2)); if( nPos != SVX_TAB_NOTFOUND ) aAttr.Remove( nPos ); } for (short i=0; i < nIns; ++i) { - short nPos = SVBT16ToShort(pIns + i*2); + short nPos = SVBT16ToUInt16(pIns + i*2); aTabStop.GetTabPos() = nPos; switch( pTyp[i].aBits1 & 0x7 ) // pTyp[i].jc { @@ -2108,7 +2108,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) if( m_bVer67 ) { const WW67_ATRD* pDescri = static_cast<const WW67_ATRD*>(pData); - const OUString* pA = GetAnnotationAuthor(SVBT16ToShort(pDescri->ibst)); + const OUString* pA = GetAnnotationAuthor(SVBT16ToUInt16(pDescri->ibst)); if (pA) sAuthor = *pA; else @@ -2122,16 +2122,16 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) { const WW8_ATRD* pDescri = static_cast<const WW8_ATRD*>(pData); { - const sal_uInt16 nLen = std::min<sal_uInt16>(SVBT16ToShort(pDescri->xstUsrInitl[0]), + const sal_uInt16 nLen = std::min<sal_uInt16>(SVBT16ToUInt16(pDescri->xstUsrInitl[0]), SAL_N_ELEMENTS(pDescri->xstUsrInitl)-1); OUStringBuffer aBuf; aBuf.setLength(nLen); for(sal_uInt16 nIdx = 1; nIdx <= nLen; ++nIdx) - aBuf[nIdx-1] = SVBT16ToShort(pDescri->xstUsrInitl[nIdx]); + aBuf[nIdx-1] = SVBT16ToUInt16(pDescri->xstUsrInitl[nIdx]); sInitials = aBuf.makeStringAndClear(); } - if (const OUString* pA = GetAnnotationAuthor(SVBT16ToShort(pDescri->ibst))) + if (const OUString* pA = GetAnnotationAuthor(SVBT16ToUInt16(pDescri->ibst))) sAuthor = *pA; else sAuthor = sInitials; @@ -4111,7 +4111,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType) SprmResult aDistance = m_xPlcxMan->GetPapPLCF()->HasSprm(0x842F); if (aDistance.pSprm && aDistance.nRemainingData >= 2) - nDistance = SVBT16ToShort(aDistance.pSprm); + nDistance = SVBT16ToUInt16(aDistance.pSprm); else nDistance = 0; @@ -5041,7 +5041,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss) continue; } const WW8_STRINGID *stringIdStruct = reinterpret_cast<const WW8_STRINGID*>(stringId.data()); - m_aLinkStringMap[SVBT16ToShort(stringIdStruct->nStringId)] = aLinkStrings[i]; + m_aLinkStringMap[SVBT16ToUInt16(stringIdStruct->nStringId)] = aLinkStrings[i]; } ReadDocVars(); // import document variables as meta information. diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 5778a4c53414..054e7aed7f91 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -569,11 +569,11 @@ static void SetBaseAnlv(SwNumFormat &rNum, WW8_ANLV const &rAV, sal_uInt8 nSwLev { rNum.SetIncludeUpperLevels(nSwLevel + 1); } - rNum.SetStart( SVBT16ToShort( rAV.iStartAt ) ); + rNum.SetStart( SVBT16ToUInt16( rAV.iStartAt ) ); rNum.SetNumAdjust( eAdjA[ rAV.aBits1 & 0x3] ); - rNum.SetCharTextDistance( SVBT16ToShort( rAV.dxaSpace ) ); - sal_Int16 nIndent = std::abs(static_cast<sal_Int16>(SVBT16ToShort( rAV.dxaIndent ))); + rNum.SetCharTextDistance( SVBT16ToUInt16( rAV.dxaSpace ) ); + sal_Int16 nIndent = std::abs(static_cast<sal_Int16>(SVBT16ToUInt16( rAV.dxaIndent ))); if( rAV.aBits1 & 0x08 ) //fHang { rNum.SetFirstLineOffset( -nIndent ); @@ -601,7 +601,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV, bool bInsert = false; // Default rtl_TextEncoding eCharSet = m_eStructCharSet; - const WW8_FFN* pF = m_xFonts->GetFont(SVBT16ToShort(rAV.ftc)); // FontInfo + const WW8_FFN* pF = m_xFonts->GetFont(SVBT16ToUInt16(rAV.ftc)); // FontInfo bool bListSymbol = pF && ( pF->aFFNBase.chs == 2 ); // Symbol/WingDings/... OUStringBuffer sText; @@ -626,7 +626,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV, } for(sal_uInt32 i = 0; i < nLen; ++i, pText += 2) { - sText.append(static_cast<sal_Unicode>(SVBT16ToShort(*reinterpret_cast<SVBT16 const *>(pText)))); + sText.append(static_cast<sal_Unicode>(SVBT16ToUInt16(*reinterpret_cast<SVBT16 const *>(pText)))); } } @@ -658,7 +658,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV, OUString aName; FontPitch ePitch; - if( GetFontParams( SVBT16ToShort( rAV.ftc ), eFamily, aName, + if( GetFontParams( SVBT16ToUInt16( rAV.ftc ), eFamily, aName, ePitch, eCharSet ) ){ vcl::Font aFont; @@ -1124,7 +1124,7 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS, short nLen) const sal_uInt8* pT = &pS[1]; for (int i = 0; i <= nCols; i++, pT+=2) - nCenter[i] = static_cast<sal_Int16>(SVBT16ToShort( pT )); // X-borders + nCenter[i] = static_cast<sal_Int16>(SVBT16ToUInt16( pT )); // X-borders if( nCols != nOldCols ) // different column count { @@ -1195,7 +1195,7 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS, short nLen) WW8_TCellVer8 const * pTc = reinterpret_cast<WW8_TCellVer8 const *>(pT); for (int k = 0; k < nColsToRead; ++k, ++pCurrentTC, ++pTc ) { - sal_uInt16 aBits1 = SVBT16ToShort( pTc->aBits1Ver8 ); + sal_uInt16 aBits1 = SVBT16ToUInt16( pTc->aBits1Ver8 ); pCurrentTC->bFirstMerged = sal_uInt8( ( aBits1 & 0x0001 ) != 0 ); pCurrentTC->bMerged = sal_uInt8( ( aBits1 & 0x0002 ) != 0 ); pCurrentTC->bVertical = sal_uInt8( ( aBits1 & 0x0004 ) != 0 ); @@ -1348,7 +1348,7 @@ void WW8TabBandDesc::ProcessSprmTDxaCol(const sal_uInt8* pParamsTDxaCol) { sal_uInt8 nitcFirst= pParamsTDxaCol[0]; // first col to be changed sal_uInt8 nitcLim = pParamsTDxaCol[1]; // (last col to be changed)+1 - short nDxaCol = static_cast<sal_Int16>(SVBT16ToShort( pParamsTDxaCol + 2 )); + short nDxaCol = static_cast<sal_Int16>(SVBT16ToUInt16( pParamsTDxaCol + 2 )); for( int i = nitcFirst; (i < nitcLim) && (i < nWwCols); i++ ) { @@ -1371,7 +1371,7 @@ void WW8TabBandDesc::ProcessSprmTInsert(const sal_uInt8* pParamsTInsert) if (nitcInsert >= MAX_COL) // cannot insert into cell outside max possible index return; sal_uInt8 nctc = pParamsTInsert[1]; // number of cells - sal_uInt16 ndxaCol = SVBT16ToShort( pParamsTInsert+2 ); + sal_uInt16 ndxaCol = SVBT16ToUInt16( pParamsTInsert+2 ); short nNewWwCols; if (nitcInsert > nWwCols) @@ -1438,7 +1438,7 @@ void WW8TabBandDesc::ProcessDirection(const sal_uInt8* pParams) { sal_uInt8 nStartCell = *pParams++; sal_uInt8 nEndCell = *pParams++; - sal_uInt16 nCode = SVBT16ToShort(pParams); + sal_uInt16 nCode = SVBT16ToUInt16(pParams); OSL_ENSURE(nStartCell < nEndCell, "not as I thought"); OSL_ENSURE(nEndCell < MAX_COL + 1, "not as I thought"); @@ -1468,7 +1468,7 @@ void WW8TabBandDesc::ProcessSpacing(const sal_uInt8* pParams) sal_uInt8 nSideBits = *pParams++; OSL_ENSURE(nSideBits < 0x10, "Unexpected value for nSideBits"); ++pParams; //unknown byte - sal_uInt16 nValue = SVBT16ToShort( pParams ); + sal_uInt16 nValue = SVBT16ToUInt16( pParams ); for (int i = wwTOP; i <= wwRIGHT; i++) { switch (nSideBits & (1 << i)) @@ -1517,7 +1517,7 @@ void WW8TabBandDesc::ProcessSpecificSpacing(const sal_uInt8* pParams) OSL_ENSURE(nUnknown2 == 0x3, "Unexpected value for spacing2"); #endif ++pParams; - sal_uInt16 nValue = SVBT16ToShort( pParams ); + sal_uInt16 nValue = SVBT16ToUInt16( pParams ); for (int i=0; i < 4; i++) { @@ -1891,13 +1891,13 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) : m_eOri = aOriArr[*pParams & 0x3]; break; case sprmTFBiDi: - m_bIsBiDi = SVBT16ToShort(pParams) != 0; + m_bIsBiDi = SVBT16ToUInt16(pParams) != 0; break; case sprmTDxaGapHalf: - pNewBand->nGapHalf = static_cast<sal_Int16>(SVBT16ToShort( pParams )); + pNewBand->nGapHalf = static_cast<sal_Int16>(SVBT16ToUInt16( pParams )); break; case sprmTDyaRowHeight: - pNewBand->nLineHeight = static_cast<sal_Int16>(SVBT16ToShort( pParams )); + pNewBand->nLineHeight = static_cast<sal_Int16>(SVBT16ToUInt16( pParams )); m_bClaimLineFormat = true; break; case sprmTDefTable: @@ -1916,7 +1916,7 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) : // parameter (meaning the left-most position) and then // shift the whole table to that margin (see below) { - short nDxaNew = static_cast<sal_Int16>(SVBT16ToShort( pParams )); + short nDxaNew = static_cast<sal_Int16>(SVBT16ToUInt16( pParams )); if( nDxaNew < nTabeDxaNew ) nTabeDxaNew = nDxaNew; } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 0d4bed31eac3..5b79f9860d01 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -586,7 +586,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet const sal_uInt8 *pBegin = aSprm.pSprm - 2; for(int i=0;i<4;++i) rParaSprms.push_back(*pBegin++); - short nDxaLeft = SVBT16ToShort(aSprm.pSprm); + short nDxaLeft = SVBT16ToUInt16(aSprm.pSprm); aLVL.nDxaLeft = (0 < nDxaLeft) ? static_cast<sal_uInt16>(nDxaLeft) : static_cast<sal_uInt16>(-nDxaLeft); } @@ -601,7 +601,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet const sal_uInt8 *pBegin = aSprm.pSprm - 2; for(int i=0;i<4;++i) rParaSprms.push_back(*pBegin++); - aLVL.nDxaLeft1 = SVBT16ToShort(aSprm.pSprm); + aLVL.nDxaLeft1 = SVBT16ToUInt16(aSprm.pSprm); } // #i86652# - read tab setting @@ -616,7 +616,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet { if (*pSprm++ == 1) //nIns { - nTabPos = SVBT16ToShort(pSprm); + nTabPos = SVBT16ToUInt16(pSprm); pSprm+=2; if (*pSprm == 6) //type { @@ -1959,7 +1959,7 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData, if( !pData ) return; - short nData = SVBT16ToShort( pData ); + short nData = SVBT16ToUInt16( pData ); if( 0 >= nData ) { // disable the numbering/list style apply to the paragraph or the style diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 2bcc42f4987a..c18db3e366bf 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -522,7 +522,7 @@ void SwWW8ImplReader::Read_CRevisionMark(RedlineType_t eType, else { // start of new revision mark, if not there default to first entry - sal_uInt16 nWWAutNo = pSprmCIbstRMark ? SVBT16ToShort(pSprmCIbstRMark) : 0; + sal_uInt16 nWWAutNo = pSprmCIbstRMark ? SVBT16ToUInt16(pSprmCIbstRMark) : 0; sal_uInt32 nWWDate = pSprmCDttmRMark ? SVBT32ToUInt32(pSprmCDttmRMark): 0; DateTime aStamp(msfilter::util::DTTM2DateTime(nWWDate)); std::size_t nAuthorNo = m_aAuthorInfos[nWWAutNo]; diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index c9d042205016..1aa9e0946763 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) ? SVBT16ToShort(pS) : nDefaultVal; + short nVal = (pS && aRes.nRemainingData >= 2) ? SVBT16ToUInt16(pS) : nDefaultVal; return nVal; } @@ -152,7 +152,7 @@ static sal_uInt16 ReadUSprm( const WW8PLCFx_SEPX* pSep, sal_uInt16 nId, short nD { SprmResult aRes = pSep->HasSprm(nId); // sprm here? const sal_uInt8* pS = aRes.pSprm; - sal_uInt16 nVal = (pS && aRes.nRemainingData >= 2) ? SVBT16ToShort(pS) : nDefaultVal; + sal_uInt16 nVal = (pS && aRes.nRemainingData >= 2) ? SVBT16ToUInt16(pS) : nDefaultVal; return nVal; } @@ -875,7 +875,7 @@ void wwSectionManager::CreateSep(const long nTextPos) bool bSuccess = pWkb->Get(nTest, pData); if (!bSuccess) return; - OUString sSectionName = mrReader.m_aLinkStringMap[SVBT16ToShort( static_cast<WW8_WKB*>(pData)->nLinkId) ]; + OUString sSectionName = mrReader.m_aLinkStringMap[SVBT16ToUInt16( static_cast<WW8_WKB*>(pData)->nLinkId) ]; sSectionName = mrReader.ConvertFFileName(sSectionName); SwSectionData aSection(FILE_LINK_SECTION, sSectionName); aSection.SetLinkFileName( sSectionName ); @@ -990,7 +990,7 @@ void wwSectionManager::CreateSep(const long nTextPos) const sal_uInt8* pSW = aSWRes.pSprm; OSL_ENSURE( pSW, "+Sprm 136 (resp. 0xF203) (ColWidth) missing" ); - sal_uInt16 nWidth = (pSW && aSWRes.nRemainingData >= 3) ? SVBT16ToShort(pSW + 1) : 1440; + sal_uInt16 nWidth = (pSW && aSWRes.nRemainingData >= 3) ? SVBT16ToUInt16(pSW + 1) : 1440; aNewSection.maSep.rgdxaColumnWidthSpacing[++nColumnDataIdx] = nWidth; @@ -1003,7 +1003,7 @@ void wwSectionManager::CreateSep(const long nTextPos) OSL_ENSURE( pSD, "+Sprm 137 (resp. 0xF204) (Colspacing) missing" ); if (pSD && aSDRes.nRemainingData >= 3) { - nWidth = SVBT16ToShort(pSD + 1); + nWidth = SVBT16ToUInt16(pSD + 1); aNewSection.maSep.rgdxaColumnWidthSpacing[++nColumnDataIdx] = nWidth; } } @@ -1191,7 +1191,7 @@ void wwSectionManager::CreateSep(const long nTextPos) SprmResult aSprmSDxaLnn = pSep->HasSprm(pIds[6]); if (aSprmSDxaLnn.pSprm && aSprmSDxaLnn.nRemainingData >= 2) - aNewSection.maSep.dxaLnn = SVBT16ToShort(aSprmSDxaLnn.pSprm); + aNewSection.maSep.dxaLnn = SVBT16ToUInt16(aSprmSDxaLnn.pSprm); SprmResult aSprmSLnnMin = pSep->HasSprm(pIds[7]); if (aSprmSLnnMin.pSprm && aSprmSLnnMin.nRemainingData >= 1) @@ -1597,7 +1597,7 @@ static bool SetValSprm( sal_Int16* pVar, WW8PLCFx_Cp_FKP* pPap, sal_uInt16 nId ) { SprmResult aS = pPap->HasSprm(nId); if (aS.pSprm && aS.nRemainingData >= 2) - *pVar = static_cast<sal_Int16>(SVBT16ToShort(aS.pSprm)); + *pVar = static_cast<sal_Int16>(SVBT16ToUInt16(aS.pSprm)); return aS.pSprm != nullptr; } @@ -1605,7 +1605,7 @@ static bool SetValSprm( sal_Int16* pVar, const WW8RStyle* pStyle, sal_uInt16 nId { SprmResult aS = pStyle->HasParaSprm(nId); if (aS.pSprm && aS.nRemainingData >= 2) - *pVar = static_cast<sal_Int16>(SVBT16ToShort(aS.pSprm)); + *pVar = static_cast<sal_Int16>(SVBT16ToUInt16(aS.pSprm)); return aS.pSprm != nullptr; } @@ -2404,7 +2404,7 @@ bool SwWW8ImplReader::IsDropCap() 1 normal drop cap 2 drop cap in margin */ - short nDCS = SVBT16ToShort(aDCS.pSprm); + short nDCS = SVBT16ToUInt16(aDCS.pSprm); if (nDCS & 7) return true; } @@ -2919,10 +2919,10 @@ void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen //font setting will be put in as the styles charset, and for plain //text encoding for symbols is moot. Drawing boxes will check bSymbol //themselves so they don't need to add it to the stack either. - if (SetNewFontAttr(SVBT16ToShort( pData ), false, RES_CHRATR_FONT)) + if (SetNewFontAttr(SVBT16ToUInt16( pData ), false, RES_CHRATR_FONT)) { - SetNewFontAttr(SVBT16ToShort( pData ), false, RES_CHRATR_CJK_FONT); - SetNewFontAttr(SVBT16ToShort( pData ), false, RES_CHRATR_CTL_FONT); + SetNewFontAttr(SVBT16ToUInt16( pData ), false, RES_CHRATR_CJK_FONT); + SetNewFontAttr(SVBT16ToUInt16( pData ), false, RES_CHRATR_CTL_FONT); if( m_bVer67 ) { //convert single byte from MS1252 to Unicode @@ -2933,7 +2933,7 @@ void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen else { //already is Unicode - m_cSymbol = SVBT16ToShort( pData+2 ); + m_cSymbol = SVBT16ToUInt16( pData+2 ); } m_bSymbol = true; } @@ -3014,7 +3014,7 @@ void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const sal_uInt8* pData, shor SprmResult aCharIstd = m_xPlcxMan->GetChpPLCF()->HasSprm(m_bVer67 ? NS_sprm::v6::sprmCIstd : NS_sprm::sprmCIstd); if (aCharIstd.pSprm && aCharIstd.nRemainingData >= 2) - pSI = GetStyle(SVBT16ToShort(aCharIstd.pSprm)); + pSI = GetStyle(SVBT16ToUInt16(aCharIstd.pSprm)); } if( m_pCurrentColl ) // StyleDef -> remember flags @@ -3181,7 +3181,7 @@ void SwWW8ImplReader::Read_BoldBiDiUsw(sal_uInt16 nId, const sal_uInt8* pData, SprmResult aCharIstd = m_xPlcxMan->GetChpPLCF()->HasSprm(m_bVer67 ? NS_sprm::v6::sprmCIstd : NS_sprm::sprmCIstd); if (aCharIstd.pSprm && aCharIstd.nRemainingData >= 2) - pSI = GetStyle(SVBT16ToShort(aCharIstd.pSprm)); + pSI = GetStyle(SVBT16ToUInt16(aCharIstd.pSprm)); } if (m_pCurrentColl && eVersion > ww::eWW2) // StyleDef -> remember flags @@ -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 ) : SVBT16ToShort( pData ); + short nPos = eVersion <= ww::eWW2 ? static_cast< sal_Int8 >( *pData ) : SVBT16ToUInt16( pData ); sal_Int32 nPos2 = nPos * ( 10 * 100 ); // HalfPoints in 100 * tw const SvxFontHeightItem* pF = static_cast<const SvxFontHeightItem*>(GetFormatAttr(RES_CHRATR_FONTSIZE)); @@ -3528,7 +3528,7 @@ void SwWW8ImplReader::Read_DoubleLine_Rotate( sal_uInt16, const sal_uInt8* pData case 2: // double line { sal_Unicode cStt = 0, cEnd = 0; - switch( SVBT16ToShort( pData+1 ) ) + switch( SVBT16ToUInt16( pData+1 ) ) { case 1: cStt = '('; cEnd = ')'; break; case 2: cStt = '['; cEnd = ']'; break; @@ -3858,7 +3858,7 @@ void SwWW8ImplReader::Read_FontCode( sal_uInt16 nId, const sal_uInt8* pData, sho } else { - sal_uInt16 nFCode = SVBT16ToShort( pData ); // font number + sal_uInt16 nFCode = SVBT16ToUInt16( pData ); // font number openFont(nFCode, nId); if (eVersion <= ww::eWW6) { @@ -3900,7 +3900,7 @@ void SwWW8ImplReader::Read_FontSize( sal_uInt16 nId, const sal_uInt8* pData, sho else { // Font-Size in half points e.g. 10 = 1440 / ( 72 * 2 ) - sal_uLong nFSize = eVersion <= ww::eWW2 ? *pData : SVBT16ToShort(pData); + sal_uLong nFSize = eVersion <= ww::eWW2 ? *pData : SVBT16ToUInt16(pData); nFSize*= 10; SvxFontHeightItem aSz( nFSize, 100, nId ); @@ -3971,7 +3971,7 @@ void SwWW8ImplReader::Read_Language( sal_uInt16 nId, const sal_uInt8* pData, sho m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), nId ); else { - sal_uInt16 nLang = SVBT16ToShort( pData ); // Language-Id + sal_uInt16 nLang = SVBT16ToUInt16( pData ); // Language-Id NewAttr(SvxLanguageItem(LanguageType(nLang), nId)); } } @@ -3987,7 +3987,7 @@ void SwWW8ImplReader::Read_CColl( sal_uInt16, const sal_uInt8* pData, short nLen m_nCharFormat = -1; return; } - sal_uInt16 nId = SVBT16ToShort( pData ); // Style-Id (NOT Sprm-Id!) + sal_uInt16 nId = SVBT16ToUInt16( pData ); // Style-Id (NOT Sprm-Id!) if( nId >= m_vColl.size() || !m_vColl[nId].m_pFormat // invalid Id? || m_vColl[nId].m_bColl ) // or paragraph style? @@ -4016,7 +4016,7 @@ void SwWW8ImplReader::Read_Kern( sal_uInt16, const sal_uInt8* pData, short nLen m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_KERNING ); return; } - sal_Int16 nKern = SVBT16ToShort( pData ); // Kerning in Twips + sal_Int16 nKern = SVBT16ToUInt16( pData ); // Kerning in Twips NewAttr( SvxKerningItem( nKern, RES_CHRATR_KERNING ) ); } @@ -4027,7 +4027,7 @@ void SwWW8ImplReader::Read_FontKern( sal_uInt16, const sal_uInt8* pData, short n m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_AUTOKERN ); return; } - sal_Int16 nAutoKern = SVBT16ToShort( pData ); // Kerning in Twips + sal_Int16 nAutoKern = SVBT16ToUInt16( pData ); // Kerning in Twips NewAttr(SvxAutoKernItem(static_cast<bool>(nAutoKern), RES_CHRATR_AUTOKERN)); } @@ -4137,7 +4137,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe return; } - short nPara = SVBT16ToShort( pData ); + short nPara = SVBT16ToUInt16( pData ); SvxLRSpaceItem aLR( RES_LR_SPACE ); const SfxPoolItem* pLR = GetFormatAttr(RES_LR_SPACE); @@ -4292,8 +4292,8 @@ void SwWW8ImplReader::Read_LineSpace( sal_uInt16, const sal_uInt8* pData, short return; } - short nSpace = SVBT16ToShort( pData ); - short nMulti = (eVersion <= ww::eWW2) ? 1 : SVBT16ToShort( pData + 2 ); + short nSpace = SVBT16ToUInt16( pData ); + short nMulti = (eVersion <= ww::eWW2) ? 1 : SVBT16ToUInt16( pData + 2 ); SvxLineSpaceRule eLnSpc; if( 0 > nSpace ) @@ -4423,7 +4423,7 @@ void SwWW8ImplReader::Read_UL( sal_uInt16 nId, const sal_uInt8* pData, short nLe m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_UL_SPACE ); return; } - short nPara = SVBT16ToShort( pData ); + short nPara = SVBT16ToUInt16( pData ); if( nPara < 0 ) nPara = -nPara; @@ -4621,7 +4621,7 @@ void SwWW8ImplReader::Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short n aLang = m_xPlcxMan->GetChpPLCF()->HasSprm(NS_sprm::sprmCRgLid1_80); if (aLang.pSprm && aLang.nRemainingData >= 2) - nLang = LanguageType(SVBT16ToShort(aLang.pSprm)); + nLang = LanguageType(SVBT16ToUInt16(aLang.pSprm)); else { nLang = static_cast<const SvxLanguageItem *>( @@ -4669,7 +4669,7 @@ void SwWW8ImplReader::Read_ScaleWidth( sal_uInt16, const sal_uInt8* pData, short m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_SCALEW ); else { - sal_uInt16 nVal = SVBT16ToShort( pData ); + sal_uInt16 nVal = SVBT16ToUInt16( pData ); //The number must be between 1 and 600 if (nVal < 1 || nVal > 600) nVal = 100; @@ -4907,7 +4907,7 @@ Color SwWW8ImplReader::ExtractColour(const sal_uInt8* &rpData, bool bVer67) rpData+=4; Color nBack = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData)); rpData+=4; - sal_uInt16 nIndex = SVBT16ToShort(rpData); + sal_uInt16 nIndex = SVBT16ToUInt16(rpData); rpData+=2; //Being a transparent background colour doesn't actually show the page //background through, it merely acts like white @@ -5119,7 +5119,7 @@ void SwWW8ImplReader::Read_AlignFont( sal_uInt16, const sal_uInt8* pData, short m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_PARATR_VERTALIGN); else { - sal_uInt16 nVal = SVBT16ToShort( pData ); + sal_uInt16 nVal = SVBT16ToUInt16( pData ); SvxParaVertAlignItem::Align nAlign; switch (nVal) { @@ -5200,22 +5200,22 @@ bool SwWW8ImplReader::ParseTabPos(WW8_TablePos *pTabPos, WW8PLCFx_Cp_FKP* pPap) pTabPos->nSp37 = 2; //Possible fail area, always parallel wrap aRes = pPap->HasSprm(NS_sprm::sprmTDxaAbs); if (aRes.pSprm && aRes.nRemainingData >= 2) - pTabPos->nSp26 = SVBT16ToShort(aRes.pSprm); + pTabPos->nSp26 = SVBT16ToUInt16(aRes.pSprm); aRes = pPap->HasSprm(NS_sprm::sprmTDyaAbs); if (aRes.pSprm && aRes.nRemainingData >= 2) - pTabPos->nSp27 = SVBT16ToShort(aRes.pSprm); + pTabPos->nSp27 = SVBT16ToUInt16(aRes.pSprm); aRes = pPap->HasSprm(NS_sprm::sprmTDxaFromText); if (aRes.pSprm && aRes.nRemainingData >= 2) - pTabPos->nLeMgn = SVBT16ToShort(aRes.pSprm); + pTabPos->nLeMgn = SVBT16ToUInt16(aRes.pSprm); aRes = pPap->HasSprm(NS_sprm::sprmTDxaFromTextRight); if (aRes.pSprm && aRes.nRemainingData >= 2) - pTabPos->nRiMgn = SVBT16ToShort(aRes.pSprm); + pTabPos->nRiMgn = SVBT16ToUInt16(aRes.pSprm); aRes = pPap->HasSprm(NS_sprm::sprmTDyaFromText); if (aRes.pSprm && aRes.nRemainingData >= 2) - pTabPos->nUpMgn = SVBT16ToShort(aRes.pSprm); + pTabPos->nUpMgn = SVBT16ToUInt16(aRes.pSprm); aRes = pPap->HasSprm(NS_sprm::sprmTDyaFromTextBottom); if (aRes.pSprm && aRes.nRemainingData >= 2) - pTabPos->nLoMgn = SVBT16ToShort(aRes.pSprm); + pTabPos->nLoMgn = SVBT16ToUInt16(aRes.pSprm); pTabPos->bNoFly = !FloatingTableConversion(pPap); bRet = true; } diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 4902f5de2155..4d5ccaf9a1ea 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -846,7 +846,7 @@ static sal_uInt8 Get_Byte( sal_uInt8 *& p ) static sal_uInt16 Get_UShort( sal_uInt8 *& p ) { - const sal_uInt16 n = SVBT16ToShort( *reinterpret_cast<SVBT16*>(p) ); + const sal_uInt16 n = SVBT16ToUInt16( *reinterpret_cast<SVBT16*>(p) ); p += 2; return n; } @@ -986,7 +986,7 @@ void WW8PLCFx_PCDAttrs::GetSprms(WW8PLCFxDesc* p) return; } - const sal_uInt16 nPrm = SVBT16ToShort( static_cast<WW8_PCD*>(pData)->prm ); + const sal_uInt16 nPrm = SVBT16ToUInt16( static_cast<WW8_PCD*>(pData)->prm ); if ( nPrm & 1 ) { // PRM Variant 2 @@ -1002,7 +1002,7 @@ void WW8PLCFx_PCDAttrs::GetSprms(WW8PLCFxDesc* p) } const sal_uInt8* pSprms = mrGrpprls[ nSprmIdx ].get(); - p->nSprmsLen = SVBT16ToShort( pSprms ); // Length + p->nSprmsLen = SVBT16ToUInt16( pSprms ); // Length pSprms += 2; p->pMemPos = pSprms; // Position } @@ -2728,7 +2728,7 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(const WW8Fib& rFib, SvStream* pSt, //len byte + optional extra len byte std::size_t nDataOffset = nOfs + 1 + nDelta; aEntry.mnIStd = nDataOffset <= sizeof(maRawData)-sizeof(aEntry.mnIStd) ? - SVBT16ToShort(maRawData+nDataOffset) : 0; + SVBT16ToUInt16(maRawData+nDataOffset) : 0; aEntry.mnLen-=2; //istd if (aEntry.mnLen) { @@ -3063,7 +3063,7 @@ bool WW8PLCFx_Fc_FKP::NewFkp() return false; // PLCF completely processed } pPLCF->advance(); - long nPo = SVBT16ToShort( static_cast<sal_uInt8 *>(pPage) ); + long nPo = SVBT16ToUInt16( static_cast<sal_uInt8 *>(pPage) ); nPo <<= 9; // shift as LONG long nCurrentFkpFilePos = pFkp ? pFkp->GetFilePos() : -1; @@ -3165,7 +3165,7 @@ bool WW8PLCFx_Fc_FKP::SeekPos(WW8_FC nFcPos) void* pPage; if( pFkp && pPLCF->Get( nPLCFStart, nPLCFEnd, pPage ) ) { - long nPo = SVBT16ToShort( static_cast<sal_uInt8 *>(pPage) ); + long nPo = SVBT16ToUInt16( static_cast<sal_uInt8 *>(pPage) ); nPo <<= 9; // shift as LONG if (nPo != pFkp->GetFilePos()) pFkp = nullptr; @@ -4358,7 +4358,7 @@ void WW8PLCFx_Book::advance() else { const void * p = pBook[0]->GetData(pBook[0]->GetIdx()); - long nPairFor = (p == nullptr) ? 0 : SVBT16ToShort(*static_cast<SVBT16 const *>(p)); + long nPairFor = (p == nullptr) ? 0 : SVBT16ToUInt16(*static_cast<SVBT16 const *>(p)); if (nPairFor == pBook[1]->GetIdx()) nIsEnd = 0; else @@ -4381,7 +4381,7 @@ long WW8PLCFx_Book::GetLen() const OSL_ENSURE( false, "Incorrect call (2) of PLCF_Book::GetLen()" ); return 0; } - const sal_uInt16 nEndIdx = SVBT16ToShort( *static_cast<SVBT16*>(p) ); + const sal_uInt16 nEndIdx = SVBT16ToUInt16( *static_cast<SVBT16*>(p) ); long nNum = pBook[1]->GetPos( nEndIdx ); nNum -= nStartPos; return nNum; @@ -4413,7 +4413,7 @@ long WW8PLCFx_Book::GetHandle() const else { if (const void* p = pBook[0]->GetData(pBook[0]->GetIdx())) - return SVBT16ToShort( *static_cast<SVBT16 const *>(p) ); + return SVBT16ToUInt16( *static_cast<SVBT16 const *>(p) ); else return LONG_MAX; } @@ -4432,7 +4432,7 @@ OUString WW8PLCFx_Book::GetBookmark(long nStart,long nEnd, sal_uInt16 &nIndex) sal_uInt16 nEndIdx; if( pBook[0]->GetData( i, nStartCurrent, p ) && p ) - nEndIdx = SVBT16ToShort( *static_cast<SVBT16*>(p) ); + nEndIdx = SVBT16ToUInt16( *static_cast<SVBT16*>(p) ); else { OSL_ENSURE( false, "Bookmark-EndIdx not readable" ); @@ -4598,7 +4598,7 @@ void WW8PLCFx_AtnBook::advance() else { const void * p = m_pBook[0]->GetData(m_pBook[0]->GetIdx()); - long nPairFor = (p == nullptr) ? 0 : SVBT16ToShort(*static_cast<SVBT16 const *>(p)); + long nPairFor = (p == nullptr) ? 0 : SVBT16ToUInt16(*static_cast<SVBT16 const *>(p)); if (nPairFor == m_pBook[1]->GetIdx()) m_bIsEnd = false; else @@ -4617,7 +4617,7 @@ long WW8PLCFx_AtnBook::getHandle() const else { if (const void* p = m_pBook[0]->GetData(m_pBook[0]->GetIdx())) - return SVBT16ToShort(*static_cast<const SVBT16*>(p)); + return SVBT16ToUInt16(*static_cast<const SVBT16*>(p)); else return LONG_MAX; } @@ -4727,7 +4727,7 @@ void WW8PLCFx_FactoidBook::advance() else { const void * p = m_pBook[0]->GetData(m_pBook[0]->GetIdx()); - long nPairFor = (p == nullptr) ? 0 : SVBT16ToShort(*static_cast<SVBT16 const *>(p)); + long nPairFor = (p == nullptr) ? 0 : SVBT16ToUInt16(*static_cast<SVBT16 const *>(p)); if (nPairFor == m_pBook[1]->GetIdx()) m_bIsEnd = false; else @@ -4746,7 +4746,7 @@ long WW8PLCFx_FactoidBook::getHandle() const else { if (const void* p = m_pBook[0]->GetData(m_pBook[0]->GetIdx())) - return SVBT16ToShort(*static_cast<const SVBT16*>(p)); + return SVBT16ToUInt16(*static_cast<const SVBT16*>(p)); else return LONG_MAX; } @@ -7357,7 +7357,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib const & rFib ) // skip a reserve bit p->aFFNBase.ff = (c2 & 0x70) >> 4; - p->aFFNBase.wWeight = SVBT16ToShort(*reinterpret_cast<SVBT16*>(pVer8)); + p->aFFNBase.wWeight = SVBT16ToUInt16(*reinterpret_cast<SVBT16*>(pVer8)); pVer8+=2; cbFfnM1-=2; @@ -8369,7 +8369,7 @@ sal_uInt16 wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm, nL = 0; } else - nL = SVBT16ToShort(&pSprm[nIndex]); + nL = SVBT16ToUInt16(&pSprm[nIndex]); break; } default: @@ -8395,7 +8395,7 @@ sal_uInt16 wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm, nCount = 0; } else - nCount = SVBT16ToShort(&pSprm[nIndex]); + nCount = SVBT16ToUInt16(&pSprm[nIndex]); nL = static_cast< sal_uInt16 >(nCount + aSprm.nLen - 1); break; } @@ -8423,7 +8423,7 @@ sal_uInt16 wwSprmParser::GetSprmId(const sal_uInt8* pSp) const } else { - nId = SVBT16ToShort(pSp); + nId = SVBT16ToUInt16(pSp); if (0x0800 > nId) nId = 0; } diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx index 6627b352a9c8..0ce2304c1fa6 100644 --- a/sw/source/filter/ww8/ww8struc.hxx +++ b/sw/source/filter/ww8/ww8struc.hxx @@ -592,7 +592,7 @@ public: sal_uInt16 GetValue() const { return maBits; } - void SetWWValue(SVBT16 const nVal) { maBits = SVBT16ToShort(nVal); } + void SetWWValue(SVBT16 const nVal) { maBits = SVBT16ToUInt16(nVal); } void SetFore(sal_uInt8 nVal) { diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index cc82ae183875..3864442342e7 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -264,13 +264,13 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup ) nSystem == JOBSET_FILE605_SYSTEM ) { Impl364JobSetupData* pOldJobData = reinterpret_cast<Impl364JobSetupData*>(pTempBuf.get() + sizeof( ImplOldJobSetupData )); - sal_uInt16 nOldJobDataSize = SVBT16ToShort( pOldJobData->nSize ); - rJobData.SetSystem( SVBT16ToShort( pOldJobData->nSystem ) ); + sal_uInt16 nOldJobDataSize = SVBT16ToUInt16( pOldJobData->nSize ); + rJobData.SetSystem( SVBT16ToUInt16( pOldJobData->nSystem ) ); rJobData.SetDriverDataLen( SVBT32ToUInt32( pOldJobData->nDriverDataLen ) ); - rJobData.SetOrientation( static_cast<Orientation>(SVBT16ToShort( pOldJobData->nOrientation )) ); + rJobData.SetOrientation( static_cast<Orientation>(SVBT16ToUInt16( pOldJobData->nOrientation )) ); rJobData.SetDuplexMode( DuplexMode::Unknown ); - rJobData.SetPaperBin( SVBT16ToShort( pOldJobData->nPaperBin ) ); - rJobData.SetPaperFormat( static_cast<Paper>(SVBT16ToShort( pOldJobData->nPaperFormat )) ); + rJobData.SetPaperBin( SVBT16ToUInt16( pOldJobData->nPaperBin ) ); + rJobData.SetPaperFormat( static_cast<Paper>(SVBT16ToUInt16( pOldJobData->nPaperFormat )) ); rJobData.SetPaperWidth( static_cast<long>(SVBT32ToUInt32( pOldJobData->nPaperWidth )) ); rJobData.SetPaperHeight( static_cast<long>(SVBT32ToUInt32( pOldJobData->nPaperHeight )) ); if ( rJobData.GetDriverDataLen() ) |