sw/source/filter/ww8/ww8par.hxx | 1 - sw/source/filter/ww8/ww8par2.cxx | 11 ++--------- sw/source/filter/ww8/ww8struc.hxx | 5 +++++ 3 files changed, 7 insertions(+), 10 deletions(-)
New commits: commit 2c181658e11623d750d8b4d4f971a52d0f10d1a7 Author: Stephan Bergmann <[email protected]> AuthorDate: Mon Oct 7 17:41:02 2019 +0200 Commit: Stephan Bergmann <[email protected]> CommitDate: Tue Oct 8 08:14:09 2019 +0200 Let WW8_TCell zero-initialize its members ...which removes the need for WW8TabBandDesc::setcelldefaults and its dubious memset operating on a non-trivial type (as WW8_TCell has WW8_BRCVer9 data members, which in turn has a user-provided default ctor) Change-Id: Iabb02e353387f4fc2a002578b1b2b116d2f7313c Reviewed-on: https://gerrit.libreoffice.org/80394 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 8d104eb0e45c..856923589c4b 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1042,7 +1042,6 @@ struct WW8TabBandDesc WW8TabBandDesc(); WW8TabBandDesc(WW8TabBandDesc const & rBand); // deep copy ~WW8TabBandDesc(); - static void setcelldefaults(WW8_TCell *pCells, short nCells); void ReadDef(bool bVer67, const sal_uInt8* pS, short nLen); void ProcessDirection(const sal_uInt8* pParams); void ProcessSprmTSetBRC(int nBrcVer, const sal_uInt8* pParamsTSetBRC, sal_uInt16 nParamsLen); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index c52cf0040023..936bf6789018 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -1080,7 +1080,8 @@ WW8TabBandDesc::WW8TabBandDesc( WW8TabBandDesc const & rBand ) *this = rBand; if( rBand.pTCs ) { - pTCs = new WW8_TCell[nWwCols]; + pTCs = reinterpret_cast<WW8_TCell *>(new char[nWwCols * sizeof (WW8_TCell)]); + // create uninitialized memcpy( pTCs, rBand.pTCs, nWwCols * sizeof( WW8_TCell ) ); } if( rBand.pSHDs ) @@ -1142,7 +1143,6 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS, short nLen) { // create empty TCs pTCs = new WW8_TCell[nCols]; - setcelldefaults(pTCs,nCols); } short nColsToRead = std::min<short>(nFileCols, nCols); @@ -1398,7 +1398,6 @@ void WW8TabBandDesc::ProcessSprmTInsert(const sal_uInt8* pParamsTInsert) } WW8_TCell *pTC2s = new WW8_TCell[nNewWwCols]; - setcelldefaults(pTC2s, nNewWwCols); if (pTCs) { @@ -1614,11 +1613,6 @@ void WW8TabBandDesc::ReadNewShd(const sal_uInt8* pS, bool bVer67) pNewSHDs[i++] = COL_AUTO; } -void WW8TabBandDesc::setcelldefaults(WW8_TCell *pCells, short nCols) -{ - memset(static_cast<void*>(pCells), 0, nCols * sizeof(WW8_TCell)); -} - namespace { SprmResult HasTabCellSprm(WW8PLCFx_Cp_FKP* pPap, bool bVer67) @@ -2227,7 +2221,6 @@ void WW8TabDesc::CalcDefaults() if( !pR->pTCs ) { pR->pTCs = new WW8_TCell[ pR->nWwCols ]; - WW8TabBandDesc::setcelldefaults(pR->pTCs, pR->nWwCols); } for (int k = 0; k < pR->nWwCols; ++k) { diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx index f4f50e1e748d..d8b0d026bcbc 100644 --- a/sw/source/filter/ww8/ww8struc.hxx +++ b/sw/source/filter/ww8/ww8struc.hxx @@ -548,6 +548,11 @@ struct WW8_TCell // this is the base for further work (corresponds mostly to // BRC brcLeft; // specification of left border of table row // BRC brcBottom; // specification of bottom border of table row // BRC brcRight; // specification of right border of table row. + + WW8_TCell(): + bFirstMerged(0), bMerged(0), bVertical(0), bBackward(0), bRotateFont(0), bVertMerge(0), + bVertRestart(0), nVertAlign(0), fUnused(0) {} + // default member initializers for the bitfields will only work in C++20 }; // cbTC (count of bytes of a TC) is 18(decimal), 12(hex). _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
