diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-11 13:53:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-13 08:34:28 +0200 |
commit | eb841c06f879df11142c659b372e365c361a231b (patch) | |
tree | b1e67bd2895569325d11392a3d67769e3061068c | |
parent | ff4d6a7e5b166bb98bbe8d0f59cc4db36e7002aa (diff) |
loplugin:returnconstant in linguistic,lotuswordpro
Change-Id: If5c7d936020e5470b09c2fe54d41fb006c296a34
Reviewed-on: https://gerrit.libreoffice.org/58877
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | linguistic/source/lngsvcmgr.cxx | 66 | ||||
-rw-r--r-- | lotuswordpro/source/filter/bencont.cxx | 13 | ||||
-rw-r--r-- | lotuswordpro/source/filter/bento.hxx | 6 | ||||
-rw-r--r-- | lotuswordpro/source/filter/benval.cxx | 11 | ||||
-rw-r--r-- | lotuswordpro/source/filter/tocread.cxx | 18 |
5 files changed, 44 insertions, 70 deletions
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) |