Kaydet (Commit) 596f866e authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Noel Grandin

cppcheck: Using 'memset' on struct that contains a 'std::unique_ptr'

+ use constructor initialization

Change-Id: I52cb85bf7102dd3f8cf2105fc1c23229b76f28bc
Reviewed-on: https://gerrit.libreoffice.org/41107Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst fa05d760
...@@ -1780,12 +1780,34 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM, ...@@ -1780,12 +1780,34 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM,
const sal_uInt32 nWWPgTop, const sal_uInt32 nWWPgTop,
const sal_uInt32 nPgWidth, const sal_uInt32 nPgWidth,
const sal_Int32 nIniFlyDx, const sal_Int32 nIniFlyDx,
const sal_Int32 nIniFlyDy ) const sal_Int32 nIniFlyDy ):
pFlyFormat(nullptr),
nXPos(0),
nYPos(0),
nLeMgn(rWW.nLeMgn),
nRiMgn(rWW.nRiMgn),
nUpMgn(rWW.nUpMgn),
nLoMgn(rWW.nLoMgn),
nWidth(rWW.nSp28),
nHeight(rWW.nSp45),
nNetWidth(rWW.nSp28),
eHeightFix(ATT_FIX_SIZE),
eAnchor(RndStdIds::FLY_AT_PARA),
eHRel(text::RelOrientation::PAGE_FRAME),
eVRel(text::RelOrientation::FRAME),
eVAlign(text::VertOrientation::NONE),
eHAlign(text::HoriOrientation::NONE),
eSurround(( rWW.nSp37 > 1 ) ? css::text::WrapTextMode_DYNAMIC : css::text::WrapTextMode_NONE),
nXBind(( rWW.nSp29 & 0xc0 ) >> 6),
nYBind(( rWW.nSp29 & 0x30 ) >> 4),
nNewNetWidth(MINFLY),
xMainTextPos(nullptr),
nLineSpace(0),
bAutoWidth(false),
bToggelPos(false)
{ {
memset( this, 0, sizeof( WW8SwFlyPara ) ); // initialize memset( this, 0, sizeof( WW8SwFlyPara ) ); // initialize
nNewNetWidth = MINFLY; // minimum
eSurround = ( rWW.nSp37 > 1 ) ? css::text::WrapTextMode_DYNAMIC : css::text::WrapTextMode_NONE;
//#i119466 mapping "Around" wrap setting to "Parallel" for table //#i119466 mapping "Around" wrap setting to "Parallel" for table
const bool bIsTable = rIo.m_xPlcxMan->HasParaSprm(0x2416).pSprm; const bool bIsTable = rIo.m_xPlcxMan->HasParaSprm(0x2416).pSprm;
if (bIsTable && rWW.nSp37 == 2) if (bIsTable && rWW.nSp37 == 2)
...@@ -1797,14 +1819,11 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM, ...@@ -1797,14 +1819,11 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM,
have an explicitly specified behaviour for these circumstances. have an explicitly specified behaviour for these circumstances.
*/ */
nHeight = rWW.nSp45;
if( nHeight & 0x8000 ) if( nHeight & 0x8000 )
{ {
nHeight &= 0x7fff; nHeight &= 0x7fff;
eHeightFix = ATT_MIN_SIZE; eHeightFix = ATT_MIN_SIZE;
} }
else
eHeightFix = ATT_FIX_SIZE;
if( nHeight <= MINFLY ) if( nHeight <= MINFLY )
{ // no data, or bad data { // no data, or bad data
...@@ -1812,7 +1831,6 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM, ...@@ -1812,7 +1831,6 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM,
nHeight = MINFLY; nHeight = MINFLY;
} }
nWidth = nNetWidth = rWW.nSp28;
if( nWidth <= 10 ) // auto width if( nWidth <= 10 ) // auto width
{ {
bAutoWidth = true; bAutoWidth = true;
...@@ -1822,16 +1840,6 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM, ...@@ -1822,16 +1840,6 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM,
if( nWidth <= MINFLY ) if( nWidth <= MINFLY )
nWidth = nNetWidth = MINFLY; // minimum width nWidth = nNetWidth = MINFLY; // minimum width
eVAlign = text::VertOrientation::NONE; // defaults
eHAlign = text::HoriOrientation::NONE;
nYPos = 0;
nXPos = 0;
nRiMgn = rWW.nRiMgn;
nLeMgn = rWW.nLeMgn;
nLoMgn = rWW.nLoMgn;
nUpMgn = rWW.nUpMgn;
/* /*
See issue #i9178# for the 9 anchoring options, and make sure they stay See issue #i9178# for the 9 anchoring options, and make sure they stay
working if you modify the anchoring logic here. working if you modify the anchoring logic here.
...@@ -1842,11 +1850,8 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM, ...@@ -1842,11 +1850,8 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM,
// the Fly will end up in the wrong position. // the Fly will end up in the wrong position.
// The only problem is with inside/outside. // The only problem is with inside/outside.
// Bindung
nYBind = (( rWW.nSp29 & 0x30 ) >> 4);
//#i53725# - absolute positioned objects have to be //#i53725# - absolute positioned objects have to be
// anchored at-paragraph to assure its correct anchor position. // anchored at-paragraph to assure its correct anchor position.
eAnchor = RndStdIds::FLY_AT_PARA;
rIo.m_pLastAnchorPos.reset( new SwPosition(*rPaM.GetPoint())); rIo.m_pLastAnchorPos.reset( new SwPosition(*rPaM.GetPoint()));
switch (nYBind) switch (nYBind)
...@@ -1858,7 +1863,7 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM, ...@@ -1858,7 +1863,7 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM,
eVRel = text::RelOrientation::PAGE_FRAME; eVRel = text::RelOrientation::PAGE_FRAME;
break; break;
default: //relative to text default: //relative to text
eVRel = text::RelOrientation::FRAME; // put in initialization part eVRel = text::RelOrientation::FRAME;
break; break;
} }
...@@ -1909,7 +1914,6 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM, ...@@ -1909,7 +1914,6 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM,
break; // corrections from ini file break; // corrections from ini file
} }
nXBind = ( rWW.nSp29 & 0xc0 ) >> 6;
// #i18732# // #i18732#
switch (nXBind) // X - binding -> transform coordinates switch (nXBind) // X - binding -> transform coordinates
{ {
...@@ -1920,7 +1924,7 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM, ...@@ -1920,7 +1924,7 @@ WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM,
eHRel = text::RelOrientation::PAGE_PRINT_AREA; eHRel = text::RelOrientation::PAGE_PRINT_AREA;
break; break;
default: //relative to page default: //relative to page
eHRel = text::RelOrientation::PAGE_FRAME; // put in initialization part eHRel= text::RelOrientation::PAGE_FRAME;
break; break;
} }
......
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