sw/source/filter/ww8/ww8graf.cxx | 4 ++-- sw/source/filter/ww8/ww8par.cxx | 23 +++++++++++------------ sw/source/filter/ww8/ww8par.hxx | 2 +- sw/source/filter/ww8/ww8par5.cxx | 20 ++++++++++---------- 4 files changed, 24 insertions(+), 25 deletions(-)
New commits: commit fb7c1d512f26a40a3829464cad520a88eb8bebba Author: Caolán McNamara <[email protected]> Date: Thu Jul 6 10:15:45 2017 +0100 ofz: fix some leaks Change-Id: I908114f12257fdd287cce9a108d5fb2dc7b6a8bf Reviewed-on: https://gerrit.libreoffice.org/39636 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 934c7952c0b9..4932fee0776b 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -572,7 +572,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp, paragraph mark as part of the paragraph text. */ WW8ReaderSave aSave(this); - m_xPlcxMan.reset(new WW8PLCFMan(m_pSBase, eType, nStartCp, true)); + m_xPlcxMan.reset(new WW8PLCFMan(m_xSBase.get(), eType, nStartCp, true)); WW8_CP nStart = m_xPlcxMan->Where(); WW8_CP nNext, nStartReplace=0; @@ -870,7 +870,7 @@ sal_Int32 SwWW8ImplReader::GetRangeAsDrawingString(OUString& rString, long nStar else if (nStartCp < nEndCp) { // read the text: can be split into multiple pieces - const sal_Int32 nLen = m_pSBase->WW8ReadString(*m_pStrm, rString, + const sal_Int32 nLen = m_xSBase->WW8ReadString(*m_pStrm, rString, nStartCp + nOffset, nEndCp - nStartCp, GetCurrentCharSet()); OSL_ENSURE(nLen, "+where's the text graphic (8)?"); if (nLen>0) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 322d14e22b2a..155ae68b304e 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2012,7 +2012,7 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp) : if (nStartCp != -1) { - pRdr->m_xPlcxMan.reset(new WW8PLCFMan(pRdr->m_pSBase, + pRdr->m_xPlcxMan.reset(new WW8PLCFMan(pRdr->m_xSBase.get(), mxOldPlcxMan->GetManType(), nStartCp)); } @@ -2586,7 +2586,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) // Table is considered to be imported into a fly frame and we // know where the end of the table is. bool bIsUnicode; - WW8_FC nFc = m_pSBase->WW8Cp2Fc(pPap->Where(), &bIsUnicode); + WW8_FC nFc = m_xSBase->WW8Cp2Fc(pPap->Where(), &bIsUnicode); sal_uInt64 nPos = m_pStrm->Tell(); m_pStrm->Seek(nFc); sal_uInt16 nUChar = 0; @@ -2931,7 +2931,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp if (nRequestedStrLen <= 0) return true; - sal_Int32 nRequestedPos = m_pSBase->WW8Cp2Fc(nCpOfs+rPos, &m_bIsUnicode); + sal_Int32 nRequestedPos = m_xSBase->WW8Cp2Fc(nCpOfs+rPos, &m_bIsUnicode); bool bValidPos = checkSeek(*m_pStrm, nRequestedPos); OSL_ENSURE(bValidPos, "Document claimed to have more text than available"); if (!bValidPos) @@ -3459,7 +3459,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) // Reset Unicode flag and correct FilePos if needed. // Note: Seek is not expensive, as we're checking inline whether or not // the correct FilePos has already been reached. - std::size_t nRequestedPos = m_pSBase->WW8Cp2Fc(nCpOfs+nPosCp, &m_bIsUnicode); + std::size_t nRequestedPos = m_xSBase->WW8Cp2Fc(nCpOfs+nPosCp, &m_bIsUnicode); if (!checkSeek(*m_pStrm, nRequestedPos)) return false; @@ -3786,7 +3786,7 @@ long SwWW8ImplReader::ReadTextAttr(WW8_CP& rTextPos, long nTextEnd, bool& rbStar } } - sal_Int32 nRequestedPos = m_pSBase->WW8Cp2Fc(m_xPlcxMan->GetCpOfs() + rTextPos, &m_bIsUnicode); + sal_Int32 nRequestedPos = m_xSBase->WW8Cp2Fc(m_xPlcxMan->GetCpOfs() + rTextPos, &m_bIsUnicode); bool bValidPos = checkSeek(*m_pStrm, nRequestedPos); SAL_WARN_IF(!bValidPos, "sw.ww8", "Document claimed to have text at an invalid position, skip attributes for region"); @@ -3930,7 +3930,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType) m_bSpec = false; m_bPgSecBreak = false; - m_xPlcxMan.reset(new WW8PLCFMan(m_pSBase, nType, nStartCp)); + m_xPlcxMan.reset(new WW8PLCFMan(m_xSBase.get(), nType, nStartCp)); long nCpOfs = m_xPlcxMan->GetCpOfs(); // Offset for Header/Footer, Footnote WW8_CP nNext = m_xPlcxMan->Where(); @@ -3938,7 +3938,7 @@ bool SwWW8ImplReader::ReadText(WW8_CP nStartCp, WW8_CP nTextLen, ManTypes nType) sal_uInt8 nDropLines = 0; SwCharFormat* pNewSwCharFormat = nullptr; const SwCharFormat* pFormat = nullptr; - m_pStrm->Seek( m_pSBase->WW8Cp2Fc( nStartCp + nCpOfs, &m_bIsUnicode ) ); + m_pStrm->Seek(m_xSBase->WW8Cp2Fc(nStartCp + nCpOfs, &m_bIsUnicode)); WW8_CP l = nStartCp; const WW8_CP nMaxPossible = WW8_CP_MAX-nStartCp; @@ -4143,7 +4143,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage, , m_pPostProcessAttrsInfo(nullptr) , m_pWwFib(nullptr) , m_pLstManager(nullptr) - , m_pSBase(nullptr) , m_aTextNodesHavingFirstLineOfstSet() , m_aTextNodesHavingLeftIndentSet() , m_pAktColl(nullptr) @@ -5010,7 +5009,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) if (!m_vColl.empty()) SetOutlineStyles(); - m_pSBase = new WW8ScannerBase(m_pStrm,m_pTableStream,m_pDataStream,m_pWwFib); + m_xSBase.reset(new WW8ScannerBase(m_pStrm,m_pTableStream,m_pDataStream,m_pWwFib)); static const SvxNumType eNumTA[16] = { @@ -5022,7 +5021,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) SVX_NUM_ARABIC, SVX_NUM_ARABIC }; - if (m_pSBase->AreThereFootnotes()) + if (m_xSBase->AreThereFootnotes()) { static const SwFootnoteNum eNumA[4] = { @@ -5040,7 +5039,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) aInfo.nFootnoteOffset = m_xWDop->nFootnote - 1; m_rDoc.SetFootnoteInfo( aInfo ); } - if( m_pSBase->AreThereEndnotes() ) + if (m_xSBase->AreThereEndnotes()) { SwEndNoteInfo aInfo; aInfo = m_rDoc.GetEndNoteInfo(); // Same as for Footnote @@ -5244,7 +5243,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) GrafikDtor(); DELETEZ( m_pMSDffManager ); m_xHdFt.reset(); - DELETEZ( m_pSBase ); + m_xSBase.reset(); m_xWDop.reset(); m_xFonts.reset(); delete m_pAtnNames; diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 5c4e29f40979..94aaf66325e0 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1197,7 +1197,7 @@ private: std::unique_ptr<WW8Fonts> m_xFonts; std::unique_ptr<WW8Dop> m_xWDop; WW8ListManager* m_pLstManager; - WW8ScannerBase* m_pSBase; + std::unique_ptr<WW8ScannerBase> m_xSBase; std::shared_ptr<WW8PLCFMan> m_xPlcxMan; std::map<short, OUString> m_aLinkStringMap; diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index e982db6f8b9b..26191ca0ca20 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -160,7 +160,7 @@ long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) nLen = MAX_FIELDLEN; long nOldPos = m_pStrm->Tell(); - m_pSBase->WW8ReadString( *m_pStrm, aVal, pB->GetStartPos(), nLen, + m_xSBase->WW8ReadString( *m_pStrm, aVal, pB->GetStartPos(), nLen, m_eStructCharSet ); m_pStrm->Seek( nOldPos ); @@ -904,7 +904,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) bHasHandler = false; sal_uInt64 nOldPos = m_pStrm->Tell(); OUString aStr; - aF.nLCode = m_pSBase->WW8ReadString(*m_pStrm, aStr, m_xPlcxMan->GetCpOfs() + aF.nSCode, aF.nLCode, m_eTextCharSet); + aF.nLCode = m_xSBase->WW8ReadString(*m_pStrm, aStr, m_xPlcxMan->GetCpOfs() + aF.nSCode, aF.nLCode, m_eTextCharSet); m_pStrm->Seek(nOldPos); WW8ReadFieldParams aReadParam(aStr); @@ -933,7 +933,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) long nOldPos = m_pStrm->Tell(); OUString aStr; - aF.nLCode = m_pSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs()+ + aF.nLCode = m_xSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs()+ aF.nSCode, aF.nLCode, m_eTextCharSet ); m_pStrm->Seek( nOldPos ); @@ -967,12 +967,12 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) if ( aF.nId == 6 && aF.bCodeNest ) { // TODO Extract the whole code string using the nested codes - aF.nLCode = m_pSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs() + + aF.nLCode = m_xSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs() + aF.nSCode, aF.nSRes - aF.nSCode - 1, m_eTextCharSet ); } else { - aF.nLCode = m_pSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs()+ + aF.nLCode = m_xSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs()+ aF.nSCode, aF.nLCode, m_eTextCharSet ); } @@ -1117,7 +1117,7 @@ long SwWW8ImplReader::Read_F_Tag( WW8FieldDesc* pF ) nL = MAX_FIELDLEN; // MaxLength, by quoting // max. 4 times as big OUString sFText; - m_pSBase->WW8ReadString( *m_pStrm, sFText, + m_xSBase->WW8ReadString( *m_pStrm, sFText, m_xPlcxMan->GetCpOfs() + nStart, nL, m_eStructCharSet); OUString aTagText; @@ -1181,7 +1181,7 @@ OUString SwWW8ImplReader::GetFieldResult( WW8FieldDesc* pF ) // max. 4 times as big OUString sRes; - m_pSBase->WW8ReadString( *m_pStrm, sRes, m_xPlcxMan->GetCpOfs() + nStart, + m_xSBase->WW8ReadString( *m_pStrm, sRes, m_xPlcxMan->GetCpOfs() + nStart, nL, m_eStructCharSet ); m_pStrm->Seek( nOldPos ); @@ -2514,7 +2514,7 @@ eF_ResT SwWW8ImplReader::Read_F_DBField( WW8FieldDesc* pF, OUString& rStr ) aField.SetFieldCode( rStr ); OUString aResult; - m_pSBase->WW8ReadString( *m_pStrm, aResult, m_xPlcxMan->GetCpOfs()+ + m_xSBase->WW8ReadString( *m_pStrm, aResult, m_xPlcxMan->GetCpOfs()+ pF->nSRes, pF->nLRes, m_eTextCharSet ); aResult = aResult.replace( '\xb', '\n' ); @@ -3637,7 +3637,7 @@ void SwWW8ImplReader::Read_FieldVanish( sal_uInt16, const sal_uInt8*, short nLen WW8_CP nStartCp = m_xPlcxMan->Where() + m_xPlcxMan->GetCpOfs(); OUString sFieldName; - sal_Int32 nFieldLen = m_pSBase->WW8ReadString( *m_pStrm, sFieldName, nStartCp, + sal_Int32 nFieldLen = m_xSBase->WW8ReadString( *m_pStrm, sFieldName, nStartCp, nChunk, m_eStructCharSet ); nStartCp+=nFieldLen; @@ -3663,7 +3663,7 @@ void SwWW8ImplReader::Read_FieldVanish( sal_uInt16, const sal_uInt8*, short nLen if (nFnd != -1) break; OUString sTemp; - nFieldLen = m_pSBase->WW8ReadString( *m_pStrm, sTemp, + nFieldLen = m_xSBase->WW8ReadString( *m_pStrm, sTemp, nStartCp, nChunk, m_eStructCharSet ); sFieldName+=sTemp; nStartCp+=nFieldLen;
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
