diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-11-19 22:58:41 +0100 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-11-19 23:09:17 +0100 |
commit | 6841b6d9bb78af28c4d89c936c5663b31aa4fd5a (patch) | |
tree | 4e1106c00da7192c5617681b6dce0493eac335a3 | |
parent | 2d45cd84e262d7a4c6b977e7c6c26ce8d92c2615 (diff) |
Do not return void expressions
Fixes a bunch of `-Wclazy-returning-void-expression` warnings, since
returning void expressions is confusing and may hide subtle bugs. See
https://github.com/KDE/clazy/blob/master/docs/checks/README-returning-void-expression.md
for details.
-rw-r--r-- | src/engine/sidechain/shoutconnection.h | 2 | ||||
-rw-r--r-- | src/library/browse/browsethread.cpp | 3 | ||||
-rw-r--r-- | src/library/librarycontrol.cpp | 6 | ||||
-rw-r--r-- | src/skin/skincontext.h | 2 | ||||
-rw-r--r-- | src/track/globaltrackcache.cpp | 2 | ||||
-rw-r--r-- | src/track/track.cpp | 2 | ||||
-rw-r--r-- | src/util/sample.cpp | 18 | ||||
-rw-r--r-- | src/widget/paintable.cpp | 20 |
8 files changed, 32 insertions, 23 deletions
diff --git a/src/engine/sidechain/shoutconnection.h b/src/engine/sidechain/shoutconnection.h index 5147515669..0f61c86d01 100644 --- a/src/engine/sidechain/shoutconnection.h +++ b/src/engine/sidechain/shoutconnection.h @@ -74,7 +74,7 @@ class ShoutConnection } void setStatus(int newState) { - return m_pProfile->setConnectionStatus(newState); + m_pProfile->setConnectionStatus(newState); } int getStatus() { return m_pProfile->connectionStatus(); diff --git a/src/library/browse/browsethread.cpp b/src/library/browse/browsethread.cpp index e3badf5d3d..774e56f9fc 100644 --- a/src/library/browse/browsethread.cpp +++ b/src/library/browse/browsethread.cpp @@ -142,7 +142,8 @@ void BrowseThread::populateModel() { if (thisPath.dir() != newPath.dir()) { qDebug() << "Abort populateModel()"; - return populateModel(); + populateModel(); + return; } QList<QStandardItem*> row_data; diff --git a/src/library/librarycontrol.cpp b/src/library/librarycontrol.cpp index 4366962e71..dc2f648ecc 100644 --- a/src/library/librarycontrol.cpp +++ b/src/library/librarycontrol.cpp @@ -643,7 +643,8 @@ void LibraryControl::slotGoToItem(double v) { // expanding those root items via controllers is considered dispensable // because the subfeatures' actions can't be accessed by controllers anyway. if (m_pSidebarWidget->isLeafNodeSelected()) { - return setLibraryFocus(); + setLibraryFocus(); + return; } else { // Otherwise toggle the sidebar item expanded state slotToggleSelectedSidebarItem(v); @@ -653,7 +654,8 @@ void LibraryControl::slotGoToItem(double v) { // Load current track if a LibraryView object has focus LibraryView* activeView = m_pLibraryWidget->getActiveView(); if (activeView && activeView->hasFocus()) { - return activeView->loadSelectedTrack(); + activeView->loadSelectedTrack(); + return; } // Clear the search if the searchbox has focus diff --git a/src/skin/skincontext.h b/src/skin/skincontext.h index d89e7d9205..672368a6aa 100644 --- a/src/skin/skincontext.h +++ b/src/skin/skincontext.h @@ -240,7 +240,7 @@ class SkinContext { QDebug logWarning(const char* file, const int line, const QDomNode& node) const; void defineSingleton(QString objectName, QWidget* widget) { - return m_pSharedState->singletons.insertSingleton(objectName, widget); + m_pSharedState->singletons.insertSingleton(objectName, widget); } QWidget* getSingletonWidget(QString objectName) const { diff --git a/src/track/globaltrackcache.cpp b/src/track/globaltrackcache.cpp index 58637ffbcd..62688deedd 100644 --- a/src/track/globaltrackcache.cpp +++ b/src/track/globaltrackcache.cpp @@ -147,7 +147,7 @@ void GlobalTrackCacheLocker::relocateCachedTracks( void GlobalTrackCacheLocker::purgeTrackId(const TrackId& trackId) { DEBUG_ASSERT(m_pInstance); - return m_pInstance->purgeTrackId(trackId); + m_pInstance->purgeTrackId(trackId); } void GlobalTrackCacheLocker::deactivateCache() const { diff --git a/src/track/track.cpp b/src/track/track.cpp index a02810343b..24cd01303a 100644 --- a/src/track/track.cpp +++ b/src/track/track.cpp @@ -414,7 +414,7 @@ QDateTime Track::getDateAdded() const { void Track::setDateAdded(const QDateTime& dateAdded) { QMutexLocker lock(&m_qMutex); - return m_record.setDateAdded(dateAdded); + m_record.setDateAdded(dateAdded); } void Track::setDuration(mixxx::Duration duration) { diff --git a/src/util/sample.cpp b/src/util/sample.cpp index 6c3183fe08..f560294a39 100644 --- a/src/util/sample.cpp +++ b/src/util/sample.cpp @@ -157,7 +157,8 @@ void SampleUtil::applyAlternatingGain(CSAMPLE* pBuffer, CSAMPLE gain1, CSAMPLE gain2, SINT numSamples) { // This handles gain1 == CSAMPLE_GAIN_ONE && gain2 == CSAMPLE_GAIN_ONE as well. if (gain1 == gain2) { - return applyGain(pBuffer, gain1, numSamples); + applyGain(pBuffer, gain1, numSamples); + return; } // note: LOOP VECTORIZED. @@ -265,9 +266,11 @@ void SampleUtil::add2WithGain(CSAMPLE* M_RESTRICT pDest, const CSAMPLE* M_RESTRICT pSrc2, CSAMPLE_GAIN gain2, SINT numSamples) { if (gain1 == CSAMPLE_GAIN_ZERO) { - return addWithGain(pDest, pSrc2, gain2, numSamples); + addWithGain(pDest, pSrc2, gain2, numSamples); + return; } else if (gain2 == CSAMPLE_GAIN_ZERO) { - return addWithGain(pDest, pSrc1, gain1, numSamples); + addWithGain(pDest, pSrc1, gain1, numSamples); + return; } // note: LOOP VECTORIZED. @@ -283,11 +286,14 @@ void SampleUtil::add3WithGain(CSAMPLE* pDest, const CSAMPLE* M_RESTRICT pSrc3, CSAMPLE_GAIN gain3, SINT numSamples) { if (gain1 == CSAMPLE_GAIN_ZERO) { - return add2WithGain(pDest, pSrc2, gain2, pSrc3, gain3, numSamples); + add2WithGain(pDest, pSrc2, gain2, pSrc3, gain3, numSamples); + return; } else if (gain2 == CSAMPLE_GAIN_ZERO) { - return add2WithGain(pDest, pSrc1, gain1, pSrc3, gain3, numSamples); + add2WithGain(pDest, pSrc1, gain1, pSrc3, gain3, numSamples); + return; } else if (gain3 == CSAMPLE_GAIN_ZERO) { - return add2WithGain(pDest, pSrc1, gain1, pSrc2, gain2, numSamples); + add2WithGain(pDest, pSrc1, gain1, pSrc2, gain2, numSamples); + return; } // note: LOOP VECTORIZED. diff --git a/src/widget/paintable.cpp b/src/widget/paintable.cpp index 13716274b7..f9676ad15a 100644 --- a/src/widget/paintable.cpp +++ b/src/widget/paintable.cpp @@ -159,7 +159,7 @@ void Paintable::draw(const QRectF& targetRect, QPainter* pPainter, math_min(sourceRect.height(), targetRect.height())); QRectF adjustedTarget(targetRect.topLeft(), fixedSize); QRectF adjustedSource(sourceRect.topLeft(), fixedSize); - return drawInternal(adjustedTarget, pPainter, adjustedSource); + drawInternal(adjustedTarget, pPainter, adjustedSource); } else if (m_drawMode == STRETCH_ASPECT) { qreal sx = targetRect.width() / sourceRect.width(); qreal sy = targetRect.height() / sourceRect.height(); @@ -171,14 +171,14 @@ void Paintable::draw(const QRectF& targetRect, QPainter* pPainter, targetRect.y(), scale * sourceRect.width(), scale * sourceRect.height()); - return drawInternal(adjustedTarget, pPainter, sourceRect); + drawInternal(adjustedTarget, pPainter, sourceRect); } else { - return drawInternal(targetRect, pPainter, sourceRect); + drawInternal(targetRect, pPainter, sourceRect); } } else if (m_drawMode == STRETCH) { - return drawInternal(targetRect, pPainter, sourceRect); + drawInternal(targetRect, pPainter, sourceRect); } else if (m_drawMode == TILE) { - return drawInternal(targetRect, pPainter, sourceRect); + drawInternal(targetRect, pPainter, sourceRect); } } @@ -194,7 +194,7 @@ void Paintable::drawCentered(const QRectF& targetRect, QPainter* pPainter, QRectF adjustedTarget(QPointF(-adjustedSource.width() / 2.0, -adjustedSource.height() / 2.0), fixedSize); - return drawInternal(adjustedTarget, pPainter, adjustedSource); + drawInternal(adjustedTarget, pPainter, adjustedSource); } else if (m_drawMode == STRETCH_ASPECT) { qreal sx = targetRect.width() / sourceRect.width(); qreal sy = targetRect.height() / sourceRect.height(); @@ -206,16 +206,16 @@ void Paintable::drawCentered(const QRectF& targetRect, QPainter* pPainter, qreal scaledHeight = scale * sourceRect.height(); QRectF adjustedTarget(-scaledWidth / 2.0, -scaledHeight / 2.0, scaledWidth, scaledHeight); - return drawInternal(adjustedTarget, pPainter, sourceRect); + drawInternal(adjustedTarget, pPainter, sourceRect); } else { - return drawInternal(targetRect, pPainter, sourceRect); + drawInternal(targetRect, pPainter, sourceRect); } } else if (m_drawMode == STRETCH) { - return drawInternal(targetRect, pPainter, sourceRect); + drawInternal(targetRect, pPainter, sourceRect); } else if (m_drawMode == TILE) { // TODO(XXX): What's the right behavior here? Draw the first tile at the // center point and then tile all around it based on that? - return drawInternal(targetRect, pPainter, sourceRect); + drawInternal(targetRect, pPainter, sourceRect); } } |