sc/source/filter/excel/excform.cxx | 12 ++++++------ sc/source/filter/excel/excform8.cxx | 16 ++++++++-------- sc/source/filter/inc/tokstack.hxx | 6 +++--- sc/source/filter/lotus/lotform.cxx | 4 ++-- sc/source/filter/qpro/qproform.cxx | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-)
New commits: commit 2f1ddcae5ff8b679a361a859892212ed916c25a0 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Sep 13 19:36:36 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Sep 14 09:52:48 2020 +0200 GetTokenArray always dereferences its ScDocument* argument Change-Id: I6fc77b057714fa99efa7d166c13b1e09aa9ab230 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102600 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index d3bc4afac377..be3401760fd0 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -197,7 +197,7 @@ std::unique_ptr<ScTokenArray> ExcelToSc::GetDummy() { aPool.Store( "Dummy()" ); aPool >> aStack; - return aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + return aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); } // if bAllowArrays is false stream seeks to first byte after <nFormulaLen> @@ -223,7 +223,7 @@ ConvErr ExcelToSc::Convert( std::unique_ptr<ScTokenArray>& pResult, XclImpStream { aPool.Store( "-/-" ); aPool >> aStack; - pResult = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + pResult = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); return ConvErr::OK; } @@ -860,14 +860,14 @@ ConvErr ExcelToSc::Convert( std::unique_ptr<ScTokenArray>& pResult, XclImpStream { aPool << ocBad; aPool >> aStack; - pResult = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + pResult = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); eRet = ConvErr::Ni; } else if( aIn.GetRecPos() != nEndPos ) { aPool << ocBad; aPool >> aStack; - pResult = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + pResult = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); eRet = ConvErr::Count; } else if( bArrayFormula ) @@ -877,7 +877,7 @@ ConvErr ExcelToSc::Convert( std::unique_ptr<ScTokenArray>& pResult, XclImpStream } else { - pResult = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + pResult = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); eRet = ConvErr::OK; } @@ -1692,7 +1692,7 @@ std::unique_ptr<ScTokenArray> ExcelToSc::GetBoolErr( XclBoolError eType ) aPool >> aStack; - std::unique_ptr<ScTokenArray> pResult = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + std::unique_ptr<ScTokenArray> pResult = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); if( nError != FormulaError::NONE ) pResult->SetCodeError( nError ); diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 389444c7ee96..19f2a8c66257 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -154,7 +154,7 @@ ConvErr ExcelToSc8::Convert( std::unique_ptr<ScTokenArray>& rpTokArray, XclImpSt { aPool.Store( "-/-" ); aPool >> aStack; - rpTokArray = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + rpTokArray = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); return ConvErr::OK; } @@ -917,14 +917,14 @@ ConvErr ExcelToSc8::Convert( std::unique_ptr<ScTokenArray>& rpTokArray, XclImpSt { aPool << ocBad; aPool >> aStack; - rpTokArray = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + rpTokArray = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); eRet = ConvErr::Ni; } else if( aIn.GetRecPos() != nEndPos ) { aPool << ocBad; aPool >> aStack; - rpTokArray = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + rpTokArray = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); eRet = ConvErr::Count; } else if( bArrayFormula ) @@ -934,7 +934,7 @@ ConvErr ExcelToSc8::Convert( std::unique_ptr<ScTokenArray>& rpTokArray, XclImpSt } else { - rpTokArray = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + rpTokArray = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); eRet = ConvErr::OK; } @@ -1301,7 +1301,7 @@ void ExcelToSc8::ConvertExternName( std::unique_ptr<ScTokenArray>& rpArray, XclI { aPool.Store("-/-"); aPool >> aStack; - rpArray = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + rpArray = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); return; } @@ -1417,17 +1417,17 @@ void ExcelToSc8::ConvertExternName( std::unique_ptr<ScTokenArray>& rpArray, XclI { aPool << ocBad; aPool >> aStack; - rpArray = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + rpArray = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); } else if( rStrm.GetRecPos() != nEndPos ) { aPool << ocBad; aPool >> aStack; - rpArray = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + rpArray = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); } else { - rpArray = aPool.GetTokenArray( &GetDocImport().getDoc(), aStack.Get()); + rpArray = aPool.GetTokenArray( GetDocImport().getDoc(), aStack.Get()); } rStrm.Seek(nEndPos); diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx index 74b916ddf4d5..b5c385e8ce78 100644 --- a/sc/source/filter/inc/tokstack.hxx +++ b/sc/source/filter/inc/tokstack.hxx @@ -251,7 +251,7 @@ public: TokenId StoreExtRef( sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef ); TokenId StoreExtRef( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef ); - std::unique_ptr<ScTokenArray> GetTokenArray( const ScDocument* pDoc, const TokenId& rId ); + std::unique_ptr<ScTokenArray> GetTokenArray( const ScDocument& rDoc, const TokenId& rId ); void Reset(); bool IsSingleOp( const TokenId& rId, const DefTokenId eId ) const; const OUString* GetExternal( const TokenId& rId ) const; @@ -408,9 +408,9 @@ inline TokenId TokenPool::Store() return nId; } -inline std::unique_ptr<ScTokenArray> TokenPool::GetTokenArray( const ScDocument *pDoc, const TokenId& rId ) +inline std::unique_ptr<ScTokenArray> TokenPool::GetTokenArray( const ScDocument& rDoc, const TokenId& rId ) { - std::unique_ptr<ScTokenArray> pScToken( new ScTokenArray(*pDoc) ); + std::unique_ptr<ScTokenArray> pScToken( new ScTokenArray(rDoc) ); if( rId ) {//...only if rId > 0! diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index f51ee0ab938d..c4d4dccad5f7 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -436,7 +436,7 @@ void LotusToSc::Convert( std::unique_ptr<ScTokenArray>& rpErg, sal_Int32& rRest if( nBytesLeft < 0 ) { - rpErg = aPool.GetTokenArray(&m_rContext.rDoc, aStack.Get()); + rpErg = aPool.GetTokenArray(m_rContext.rDoc, aStack.Get()); return; } @@ -655,7 +655,7 @@ void LotusToSc::Convert( std::unique_ptr<ScTokenArray>& rpErg, sal_Int32& rRest } } - rpErg = aPool.GetTokenArray( &m_rContext.rDoc, aStack.Get()); + rpErg = aPool.GetTokenArray( m_rContext.rDoc, aStack.Get()); SAL_WARN_IF( nBytesLeft < 0, "sc.filter", "*LotusToSc::Convert(): processed too much!"); SAL_WARN_IF( nBytesLeft > 0, "sc.filter", "*LotusToSc::Convert(): what happens with the rest?" ); diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx index 456d9f0760bb..8eb05e9f1ccf 100644 --- a/sc/source/filter/qpro/qproform.cxx +++ b/sc/source/filter/qpro/qproform.cxx @@ -391,7 +391,7 @@ ConvErr QProToSc::Convert( const ScDocument* pDoc, std::unique_ptr<ScTokenArray> } i++; } - pArray = aPool.GetTokenArray(pDoc, aStack.Get()); + pArray = aPool.GetTokenArray(*pDoc, aStack.Get()); return eRet; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits