forms/source/component/DatabaseForm.cxx | 4 - forms/source/component/DatabaseForm.hxx | 2 forms/source/component/ImageControl.cxx | 10 +--- forms/source/component/ImageControl.hxx | 2 formula/source/core/api/FormulaCompiler.cxx | 6 -- formula/source/ui/dlg/formula.cxx | 5 -- fpicker/source/office/RemoteFilesDialog.cxx | 6 -- fpicker/source/office/RemoteFilesDialog.hxx | 2 include/formula/FormulaCompiler.hxx | 2 linguistic/source/lngsvcmgr.cxx | 66 ++++++++++++---------------- lotuswordpro/source/filter/bencont.cxx | 13 +---- lotuswordpro/source/filter/bento.hxx | 6 +- lotuswordpro/source/filter/benval.cxx | 11 +--- lotuswordpro/source/filter/tocread.cxx | 18 ++----- 14 files changed, 57 insertions(+), 96 deletions(-)
New commits: commit eb841c06f879df11142c659b372e365c361a231b Author: Noel Grandin <[email protected]> AuthorDate: Sat Aug 11 13:53:37 2018 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Aug 13 08:34:28 2018 +0200 loplugin:returnconstant in linguistic,lotuswordpro Change-Id: If5c7d936020e5470b09c2fe54d41fb006c296a34 Reviewed-on: https://gerrit.libreoffice.org/58877 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index e50d607caa4d..83668cc06dfa 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -208,14 +208,14 @@ public: processDictionaryListEvent( const linguistic2::DictionaryListEvent& rDicListEvent ) override; - inline bool AddLngSvcMgrListener( + inline void AddLngSvcMgrListener( const uno::Reference< lang::XEventListener >& rxListener ); - inline bool RemoveLngSvcMgrListener( + inline void RemoveLngSvcMgrListener( const uno::Reference< lang::XEventListener >& rxListener ); void DisposeAndClear( const lang::EventObject &rEvtObj ); - bool AddLngSvcEvtBroadcaster( + void AddLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ); - bool RemoveLngSvcEvtBroadcaster( + void RemoveLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ); void AddLngSvcEvt( sal_Int16 nLngSvcEvt ); @@ -349,19 +349,17 @@ void LngSvcMgrListenerHelper::LaunchEvent( sal_Int16 nLngSvcEvtFlags ) } -inline bool LngSvcMgrListenerHelper::AddLngSvcMgrListener( +inline void LngSvcMgrListenerHelper::AddLngSvcMgrListener( const uno::Reference< lang::XEventListener >& rxListener ) { aLngSvcMgrListeners.addInterface( rxListener ); - return true; } -inline bool LngSvcMgrListenerHelper::RemoveLngSvcMgrListener( +inline void LngSvcMgrListenerHelper::RemoveLngSvcMgrListener( const uno::Reference< lang::XEventListener >& rxListener ) { aLngSvcMgrListeners.removeInterface( rxListener ); - return true; } @@ -389,7 +387,7 @@ void LngSvcMgrListenerHelper::DisposeAndClear( const lang::EventObject &rEvtObj } -bool LngSvcMgrListenerHelper::AddLngSvcEvtBroadcaster( +void LngSvcMgrListenerHelper::AddLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ) { if (rxBroadcaster.is()) @@ -398,11 +396,10 @@ bool LngSvcMgrListenerHelper::AddLngSvcEvtBroadcaster( rxBroadcaster->addLinguServiceEventListener( static_cast<linguistic2::XLinguServiceEventListener *>(this) ); } - return false; } -bool LngSvcMgrListenerHelper::RemoveLngSvcEvtBroadcaster( +void LngSvcMgrListenerHelper::RemoveLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ) { if (rxBroadcaster.is()) @@ -411,7 +408,6 @@ bool LngSvcMgrListenerHelper::RemoveLngSvcEvtBroadcaster( rxBroadcaster->removeLinguServiceEventListener( static_cast<linguistic2::XLinguServiceEventListener *>(this) ); } - return false; } @@ -1436,14 +1432,13 @@ sal_Bool SAL_CALL { osl::MutexGuard aGuard( GetLinguMutex() ); - bool bRes = false; - if (!bDisposing && xListener.is()) - { - if (!mxListenerHelper.is()) - GetListenerHelper_Impl(); - bRes = mxListenerHelper->AddLngSvcMgrListener( xListener ); - } - return bRes; + if (bDisposing || !xListener.is()) + return false; + + if (!mxListenerHelper.is()) + GetListenerHelper_Impl(); + mxListenerHelper->AddLngSvcMgrListener( xListener ); + return true; } @@ -1453,15 +1448,14 @@ sal_Bool SAL_CALL { osl::MutexGuard aGuard( GetLinguMutex() ); - bool bRes = false; - if (!bDisposing && xListener.is()) - { - DBG_ASSERT( mxListenerHelper.is(), "listener removed without being added" ); - if (!mxListenerHelper.is()) - GetListenerHelper_Impl(); - bRes = mxListenerHelper->RemoveLngSvcMgrListener( xListener ); - } - return bRes; + if (bDisposing || !xListener.is()) + return false; + + DBG_ASSERT( mxListenerHelper.is(), "listener removed without being added" ); + if (!mxListenerHelper.is()) + GetListenerHelper_Impl(); + mxListenerHelper->RemoveLngSvcMgrListener( xListener ); + return true; } @@ -1918,14 +1912,12 @@ void SAL_CALL bool LngSvcMgr::AddLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ) { - bool bRes = false; - if (rxBroadcaster.is()) - { - if (!mxListenerHelper.is()) - GetListenerHelper_Impl(); - bRes = mxListenerHelper->AddLngSvcEvtBroadcaster( rxBroadcaster ); - } - return bRes; + if (!rxBroadcaster.is()) + return false; + if (!mxListenerHelper.is()) + GetListenerHelper_Impl(); + mxListenerHelper->AddLngSvcEvtBroadcaster( rxBroadcaster ); + return true; } diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx index a39650c6de01..19c7a446eaba 100644 --- a/lotuswordpro/source/filter/bencont.cxx +++ b/lotuswordpro/source/filter/bencont.cxx @@ -168,13 +168,11 @@ LtcBenContainer::LtcBenContainer(LwpSvStream * pStream) * @param buffer pointer * @param buffer size * @param number of bytes read -* @return BenError */ -BenError LtcBenContainer::Read(void * pBuffer, size_t MaxSize, +void LtcBenContainer::Read(void * pBuffer, size_t MaxSize, size_t* pAmtRead) { *pAmtRead = cpStream->Read(pBuffer, MaxSize); - return BenErr_OK; } /** * Read buffer from bento file with specified size @@ -194,24 +192,19 @@ BenError LtcBenContainer::ReadKnownSize(void * pBuffer, size_t Amt) /** * Seek to position from the beginning of the bento file * @param position in container file from beginning -* @return BenError */ -BenError LtcBenContainer::SeekToPosition(BenContainerPos Pos) +void LtcBenContainer::SeekToPosition(BenContainerPos Pos) { cpStream->Seek(Pos); - return BenErr_OK; } /** * Seek to position compare to end of bento file * @param position in container file from end -* @return BenError */ -BenError LtcBenContainer::SeekFromEnd(long Offset) +void LtcBenContainer::SeekFromEnd(long Offset) { cpStream->Seek(STREAM_SEEK_TO_END); cpStream->SeekRel(Offset); - - return BenErr_OK; } /** * Find the next value stream with property name diff --git a/lotuswordpro/source/filter/bento.hxx b/lotuswordpro/source/filter/bento.hxx index dd1692af1ce7..4b294183a8eb 100644 --- a/lotuswordpro/source/filter/bento.hxx +++ b/lotuswordpro/source/filter/bento.hxx @@ -209,11 +209,11 @@ public: // Internal methods ~LtcBenContainer(); sal_uLong remainingSize() const; - BenError Read(void * pBuffer, size_t MaxSize, + void Read(void * pBuffer, size_t MaxSize, size_t* pAmtRead); BenError ReadKnownSize(void * pBuffer, size_t Amt); - BenError SeekToPosition(BenContainerPos Pos); - BenError SeekFromEnd(long Offset); + void SeekToPosition(BenContainerPos Pos); + void SeekFromEnd(long Offset); void SetNextAvailObjectID(BenObjectID ID) { cNextAvailObjectID = ID; } CUtList& GetObjects() { return cObjects; } diff --git a/lotuswordpro/source/filter/benval.cxx b/lotuswordpro/source/filter/benval.cxx index 9cd7404f996d..2d93626ececd 100644 --- a/lotuswordpro/source/filter/benval.cxx +++ b/lotuswordpro/source/filter/benval.cxx @@ -78,7 +78,6 @@ void CBenValue::ReadValueData(void * pReadBuffer, size_t Offset, size_t Amt, size_t* pAmtRead) { - BenError Err; size_t SegOffset = 0; *pAmtRead = 0; CBenValueSegment * pCurrSeg = nullptr; @@ -114,13 +113,9 @@ CBenValue::ReadValueData(void * pReadBuffer, size_t Offset, } else { - if ((Err = pContainer->SeekToPosition(pCurrSeg->GetPosition() + - OffsetIntoSeg)) != BenErr_OK) - return; - - if ((Err = pContainer->Read(pBuffer, AmtThisSeg, - &AmtReadThisSeg)) != BenErr_OK) - return; + pContainer->SeekToPosition(pCurrSeg->GetPosition() + + OffsetIntoSeg); + pContainer->Read(pBuffer, AmtThisSeg, &AmtReadThisSeg); } *pAmtRead += AmtReadThisSeg; diff --git a/lotuswordpro/source/filter/tocread.cxx b/lotuswordpro/source/filter/tocread.cxx index 93d5a451d993..baf84184319b 100644 --- a/lotuswordpro/source/filter/tocread.cxx +++ b/lotuswordpro/source/filter/tocread.cxx @@ -81,8 +81,7 @@ CBenTOCReader::ReadLabelAndTOC() if (cTOCSize > nLength - TOCOffset) return BenErr_ReadPastEndOfTOC; - if ((Err = cpContainer->SeekToPosition(TOCOffset)) != BenErr_OK) - return Err; + cpContainer->SeekToPosition(TOCOffset); cpTOC.reset( new BenByte[cTOCSize] ); if ((Err = cpContainer->ReadKnownSize(cpTOC.get(), cTOCSize)) != BenErr_OK) @@ -100,8 +99,7 @@ CBenTOCReader::ReadLabel(unsigned long * pTOCOffset, unsigned long * pTOCSize) // If seek fails, then probably because stream is smaller than // BEN_LABEL_SIZE and thus can't be Bento container BenError Err; - if ((Err = cpContainer->SeekFromEnd(-BEN_LABEL_SIZE)) != BenErr_OK) - return BenErr_NotBentoContainer; + cpContainer->SeekFromEnd(-BEN_LABEL_SIZE); BenByte Label[BEN_LABEL_SIZE]; if ((Err = cpContainer->ReadKnownSize(Label, BEN_LABEL_SIZE)) != BenErr_OK) @@ -172,9 +170,7 @@ CBenTOCReader::SearchForLabel(BenByte * pLabel) UsedBufferSize = CurrOffset; else UsedBufferSize = LABEL_READ_BUFFER_SIZE; - if ((Err = cpContainer->SeekToPosition(CurrOffset - UsedBufferSize)) - != BenErr_OK) - return Err; + cpContainer->SeekToPosition(CurrOffset - UsedBufferSize); if ((Err = cpContainer->ReadKnownSize(Buffer, UsedBufferSize)) != BenErr_OK) @@ -186,9 +182,8 @@ CBenTOCReader::SearchForLabel(BenByte * pLabel) if (memcmp(Buffer + (CurrOffset - BEN_MAGIC_BYTES_SIZE - BufferStartOffset), gsBenMagicBytes, BEN_MAGIC_BYTES_SIZE) == 0) { - if ((Err = cpContainer->SeekToPosition(CurrOffset - - BEN_MAGIC_BYTES_SIZE)) != BenErr_OK) - return Err; + cpContainer->SeekToPosition(CurrOffset - + BEN_MAGIC_BYTES_SIZE); return cpContainer->ReadKnownSize(pLabel, BEN_LABEL_SIZE); } @@ -265,8 +260,7 @@ CBenTOCReader::ReadTOC() return Err; LookAhead = GetCode(); - if ((Err = cpContainer->SeekToPosition(Pos)) != BenErr_OK) - return Err; + cpContainer->SeekToPosition(Pos); const auto nRemainingSize = cpContainer->remainingSize(); if (Length > nRemainingSize) commit ff4d6a7e5b166bb98bbe8d0f59cc4db36e7002aa Author: Noel Grandin <[email protected]> AuthorDate: Sat Aug 11 13:52:39 2018 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Aug 13 08:34:21 2018 +0200 loplugin:returnconstant in forms..fpicker Change-Id: I3f0bead636632682488cbe677fd7fee60350f04d Reviewed-on: https://gerrit.libreoffice.org/58876 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 0808b029edf7..8c7f9a227774 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -958,7 +958,7 @@ void ODatabaseForm::InsertTextPart( INetMIMEMessage& rParent, const OUString& rN } -bool ODatabaseForm::InsertFilePart( INetMIMEMessage& rParent, const OUString& rName, +void ODatabaseForm::InsertFilePart( INetMIMEMessage& rParent, const OUString& rName, const OUString& rFileName ) { OUString aFileName(rFileName); @@ -1014,8 +1014,6 @@ bool ODatabaseForm::InsertFilePart( INetMIMEMessage& rParent, const OUString& rN // Body pChild->SetDocumentLB( new SvLockBytes(pStream.release(), true) ); rParent.AttachChild( std::move(pChild) ); - - return true; } diff --git a/forms/source/component/DatabaseForm.hxx b/forms/source/component/DatabaseForm.hxx index 920a1b8ead21..19483b27db5e 100644 --- a/forms/source/component/DatabaseForm.hxx +++ b/forms/source/component/DatabaseForm.hxx @@ -512,7 +512,7 @@ private: void FillSuccessfulList(HtmlSuccessfulObjList& rList, const css::uno::Reference< css::awt::XControl>& rxSubmitButton, const css::awt::MouseEvent& MouseEvt); static void InsertTextPart(INetMIMEMessage& rParent, const OUString& rName, const OUString& rData); - static bool InsertFilePart(INetMIMEMessage& rParent, const OUString& rName, const OUString& rFileName); + static void InsertFilePart(INetMIMEMessage& rParent, const OUString& rName, const OUString& rFileName); static void Encode(OUString& rString); css::uno::Reference< css::sdbc::XConnection > getConnection(); diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx index 0db96134a902..b5b85d77b1fa 100644 --- a/forms/source/component/ImageControl.cxx +++ b/forms/source/component/ImageControl.cxx @@ -429,13 +429,13 @@ bool OImageControlModel::impl_updateStreamForURL_lck( const OUString& _rURL, Val } -bool OImageControlModel::impl_handleNewImageURL_lck( ValueChangeInstigator _eInstigator ) +void OImageControlModel::impl_handleNewImageURL_lck( ValueChangeInstigator _eInstigator ) { switch ( lcl_getImageStoreType( getFieldType() ) ) { case ImageStoreBinary: if ( impl_updateStreamForURL_lck( m_sImageURL, _eInstigator ) ) - return true; + return; break; case ImageStoreLink: @@ -447,7 +447,7 @@ bool OImageControlModel::impl_handleNewImageURL_lck( ValueChangeInstigator _eIns if ( m_xColumnUpdate.is() ) { m_xColumnUpdate->updateString( sCommitURL ); - return true; + return; } } break; @@ -463,8 +463,6 @@ bool OImageControlModel::impl_handleNewImageURL_lck( ValueChangeInstigator _eIns m_xColumnUpdate->updateNull(); else setControlValue( Any(), _eInstigator ); - - return true; } @@ -480,7 +478,7 @@ bool OImageControlModel::commitControlValueToDbColumn( bool _bPostReset ) else { ::osl::MutexGuard aGuard(m_aMutex); - return impl_handleNewImageURL_lck( eDbColumnBinding ); + impl_handleNewImageURL_lck( eDbColumnBinding ); } return true; diff --git a/forms/source/component/ImageControl.hxx b/forms/source/component/ImageControl.hxx index f72d69cda836..df6914825e47 100644 --- a/forms/source/component/ImageControl.hxx +++ b/forms/source/component/ImageControl.hxx @@ -122,7 +122,7 @@ private: @precond our own mutex is locked */ - bool impl_handleNewImageURL_lck( ValueChangeInstigator _eInstigator ); + void impl_handleNewImageURL_lck( ValueChangeInstigator _eInstigator ); /** updates the binary stream, created from loading the file which the given URL points to, into our bound field, or the control itself if there is no bound field diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 019a4b292267..6580ea898e75 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1233,12 +1233,6 @@ void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, FormulaError } -sal_Int32 FormulaCompiler::OpCodeMap::getOpCodeUnknown() -{ - static const sal_Int32 kOpCodeUnknown = -1; - return kOpCodeUnknown; -} - bool FormulaCompiler::GetToken() { static const short nRecursionMax = 42; diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index 183a6fb1440c..136fd8087e66 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -82,7 +82,7 @@ public: void RefInputStartAfter(); void RefInputDoneAfter( bool bForced ); bool CalcValue( const OUString& rStrExp, OUString& rStrResult, bool bForceMatrixFormula = false ); - bool CalcStruct( const OUString& rStrExp, bool bForceRecalcStruct = false ); + void CalcStruct( const OUString& rStrExp, bool bForceRecalcStruct = false ); void UpdateValues( bool bForceRecalcStruct = false ); void DeleteArgs(); sal_Int32 GetFunctionPos(sal_Int32 nPos); @@ -608,7 +608,7 @@ void FormulaDlg_Impl::UpdateValues( bool bForceRecalcStruct ) CalcStruct( m_pMEdit->GetText(), bForceRecalcStruct); } -bool FormulaDlg_Impl::CalcStruct( const OUString& rStrExp, bool bForceRecalcStruct ) +void FormulaDlg_Impl::CalcStruct( const OUString& rStrExp, bool bForceRecalcStruct ) { sal_Int32 nLength = rStrExp.getLength(); @@ -635,7 +635,6 @@ bool FormulaDlg_Impl::CalcStruct( const OUString& rStrExp, bool bForceRecalcStru if (rStrExp[nLength-1] == '(') UpdateTokenArray(rStrExp); } - return true; } diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 7825064c3d25..55026fb228cb 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -561,7 +561,7 @@ void RemoteFilesDialog::AddFilter( const OUString& rFilter, const OUString& rTyp } -FileViewResult RemoteFilesDialog::OpenURL( OUString const & sURL ) +void RemoteFilesDialog::OpenURL( OUString const & sURL ) { if( m_pFileView ) { @@ -604,14 +604,12 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString const & sURL ) ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTS ); EnableControls(); - return eFailure; + return; } SetPointer( PointerStyle::Arrow ); EnableChildPointerOverwrite( false ); } - - return eFailure; } void RemoteFilesDialog::AddFileExtension() diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx index c53f660e46f6..61d4575fd23a 100644 --- a/fpicker/source/office/RemoteFilesDialog.hxx +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -166,7 +166,7 @@ private: /* If failure returns < 0 */ int GetSelectedServicePos(); - FileViewResult OpenURL( OUString const & sURL ); + void OpenURL( OUString const & sURL ); void AddFileExtension(); diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx index d50a2e2f8be1..fef6e82e39e1 100644 --- a/include/formula/FormulaCompiler.hxx +++ b/include/formula/FormulaCompiler.hxx @@ -182,7 +182,7 @@ public: /** The value used in createSequenceOfAvailableMappings() and thus in XFormulaOpCodeMapper::getMappings() for an unknown symbol. */ - static sal_Int32 getOpCodeUnknown(); + static sal_Int32 getOpCodeUnknown() { return -1; } private: _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
