Skip to content

Commit

Permalink
Merge pull request #3335 from Holzhaus/clazy-function-args-by-ref
Browse files Browse the repository at this point in the history
Fix -Wclazy-function-arg-by-ref warnings
  • Loading branch information
daschuer authored Nov 20, 2020
2 parents 1ddb095 + 9213b41 commit f99d07b
Show file tree
Hide file tree
Showing 432 changed files with 1,556 additions and 1,582 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clazy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ jobs:
run: cmake --build . -j $(nproc)
working-directory: cmake_build
env:
CLAZY_CHECKS: level1,no-rule-of-two-soft,no-non-pod-global-static,no-qproperty-without-notify,no-wrong-qevent-cast
CLAZY_CHECKS: level2,no-rule-of-two-soft,no-non-pod-global-static,no-qproperty-without-notify,no-wrong-qevent-cast,no-qstring-allocations,no-function-args-by-value,no-copyable-polymorphic,no-ctor-missing-parent-argument,no-missing-qobject-macro,no-rule-of-three,no-returning-void-expression,no-missing-typeinfo,no-base-class-event
2 changes: 1 addition & 1 deletion src/analyzer/analyzerbeats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void AnalyzerBeats::storeResults(TrackPointer tio) {

// static
QHash<QString, QString> AnalyzerBeats::getExtraVersionInfo(
QString pluginId, bool bPreferencesFastAnalysis) {
const QString& pluginId, bool bPreferencesFastAnalysis) {
QHash<QString, QString> extraVersionInfo;
extraVersionInfo["vamp_plugin_id"] = pluginId;
if (bPreferencesFastAnalysis) {
Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/analyzerbeats.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AnalyzerBeats : public Analyzer {
private:
bool shouldAnalyze(TrackPointer tio) const;
static QHash<QString, QString> getExtraVersionInfo(
QString pluginId, bool bPreferencesFastAnalysis);
const QString& pluginId, bool bPreferencesFastAnalysis);

BeatDetectionSettings m_bpmSettings;
std::unique_ptr<mixxx::AnalyzerBeatsPlugin> m_pPlugin;
Expand Down
4 changes: 2 additions & 2 deletions src/analyzer/analyzerkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mixxx::AnalyzerPluginInfo AnalyzerKey::defaultPlugin() {
return plugins.at(0);
}

AnalyzerKey::AnalyzerKey(KeyDetectionSettings keySettings)
AnalyzerKey::AnalyzerKey(const KeyDetectionSettings& keySettings)
: m_keySettings(keySettings),
m_iSampleRate(0),
m_iTotalSamples(0),
Expand Down Expand Up @@ -185,7 +185,7 @@ void AnalyzerKey::storeResults(TrackPointer tio) {

// static
QHash<QString, QString> AnalyzerKey::getExtraVersionInfo(
QString pluginId, bool bPreferencesFastAnalysis) {
const QString& pluginId, bool bPreferencesFastAnalysis) {
QHash<QString, QString> extraVersionInfo;
extraVersionInfo["vamp_plugin_id"] = pluginId;
if (bPreferencesFastAnalysis) {
Expand Down
4 changes: 2 additions & 2 deletions src/analyzer/analyzerkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class AnalyzerKey : public Analyzer {
public:
explicit AnalyzerKey(KeyDetectionSettings keySettings);
explicit AnalyzerKey(const KeyDetectionSettings& keySettings);
~AnalyzerKey() override = default;

static QList<mixxx::AnalyzerPluginInfo> availablePlugins();
Expand All @@ -27,7 +27,7 @@ class AnalyzerKey : public Analyzer {

private:
static QHash<QString, QString> getExtraVersionInfo(
QString pluginId, bool bPreferencesFastAnalysis);
const QString& pluginId, bool bPreferencesFastAnalysis);

bool shouldAnalyze(TrackPointer tio) const;

Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/analyzerwaveform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mixxx::Logger kLogger("AnalyzerWaveform");

AnalyzerWaveform::AnalyzerWaveform(
UserSettingsPointer pConfig,
QSqlDatabase dbConnection)
const QSqlDatabase& dbConnection)
: m_analysisDao(pConfig),
m_waveformData(nullptr),
m_waveformSummaryData(nullptr),
Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/analyzerwaveform.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class AnalyzerWaveform : public Analyzer {
public:
AnalyzerWaveform(
UserSettingsPointer pConfig,
QSqlDatabase dbConnection);
const QSqlDatabase& dbConnection);
~AnalyzerWaveform() override;

bool initialize(TrackPointer tio, int sampleRate, int totalSamples) override;
Expand Down
4 changes: 3 additions & 1 deletion src/analyzer/plugins/buffering_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

namespace mixxx {

bool DownmixAndOverlapHelper::initialize(size_t windowSize, size_t stepSize, WindowReadyCallback callback) {
bool DownmixAndOverlapHelper::initialize(size_t windowSize,
size_t stepSize,
const WindowReadyCallback& callback) {
m_buffer.assign(windowSize, 0.0);
m_callback = callback;
m_windowSize = windowSize;
Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/plugins/buffering_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DownmixAndOverlapHelper {
bool initialize(
size_t windowSize,
size_t stepSize,
WindowReadyCallback callback);
const WindowReadyCallback& callback);

bool processStereoSamples(
const CSAMPLE* pInput,
Expand Down
2 changes: 1 addition & 1 deletion src/control/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ QHash<ConfigKey, ConfigKey> ControlDoublePrivate::s_qCOAliasHash
MMutex ControlDoublePrivate::s_qCOHashMutex;

ControlDoublePrivate::ControlDoublePrivate(
ConfigKey key,
const ConfigKey& key,
ControlObject* pCreatorCO,
bool bIgnoreNops,
bool bTrack,
Expand Down
2 changes: 1 addition & 1 deletion src/control/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class ControlDoublePrivate : public QObject {

private:
ControlDoublePrivate(
ConfigKey key,
const ConfigKey& key,
ControlObject* pCreatorCO,
bool bIgnoreNops,
bool bTrack,
Expand Down
8 changes: 4 additions & 4 deletions src/control/controlaudiotaperpot.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

#include "control/controlaudiotaperpot.h"

ControlAudioTaperPot::ControlAudioTaperPot(ConfigKey key,
double minDB, double maxDB,
double neutralParameter)
ControlAudioTaperPot::ControlAudioTaperPot(const ConfigKey& key,
double minDB,
double maxDB,
double neutralParameter)
: ControlPotmeter(key) {

// Override ControlPotmeters default value of 0.5
setDefaultValue(1.0);
set(1.0);
Expand Down
2 changes: 1 addition & 1 deletion src/control/controlaudiotaperpot.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ControlAudioTaperPot : public ControlPotmeter {
// minDB is the Start value of the pure db scale it cranked to -Infinity by the linear part of the AudioTaperPot
// maxDB is the Upper gain Value
// neutralParameter is a knob position between 0 and 1 where the gain is 1 (0dB)
ControlAudioTaperPot(ConfigKey key, double minDB, double maxDB, double neutralParameter);
ControlAudioTaperPot(const ConfigKey& key, double minDB, double maxDB, double neutralParameter);
};

#endif // CONTROLAUDIOTAPERPOT_H
2 changes: 1 addition & 1 deletion src/control/controleffectknob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "util/math.h"
#include "effects/effectmanifestparameter.h"

ControlEffectKnob::ControlEffectKnob(ConfigKey key, double dMinValue, double dMaxValue)
ControlEffectKnob::ControlEffectKnob(const ConfigKey& key, double dMinValue, double dMaxValue)
: ControlPotmeter(key, dMinValue, dMaxValue) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/control/controleffectknob.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class ControlEffectKnob : public ControlPotmeter {
Q_OBJECT
public:
ControlEffectKnob(ConfigKey key, double dMinValue = 0.0, double dMaxValue = 1.0);
ControlEffectKnob(const ConfigKey& key, double dMinValue = 0.0, double dMaxValue = 1.0);

void setBehaviour(EffectManifestParameter::ControlHint type,
double dMinValue, double dMaxValue);
Expand Down
2 changes: 1 addition & 1 deletion src/control/controlencoder.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "control/controlencoder.h"

ControlEncoder::ControlEncoder(ConfigKey key, bool bIgnoreNops)
ControlEncoder::ControlEncoder(const ConfigKey& key, bool bIgnoreNops)
: ControlObject(key, bIgnoreNops) {
if (m_pControl) {
m_pControl->setBehavior(new ControlEncoderBehavior());
Expand Down
2 changes: 1 addition & 1 deletion src/control/controlencoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class ControlEncoder : public ControlObject {
Q_OBJECT
public:
ControlEncoder(ConfigKey key, bool bIgnoreNops=true);
ControlEncoder(const ConfigKey& key, bool bIgnoreNops = true);
};

#endif
2 changes: 1 addition & 1 deletion src/control/controlindicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "control/controlproxy.h"
#include "util/math.h"

ControlIndicator::ControlIndicator(ConfigKey key)
ControlIndicator::ControlIndicator(const ConfigKey& key)
: ControlObject(key, false),
m_blinkValue(OFF),
m_nextSwitchTime(0.0) {
Expand Down
2 changes: 1 addition & 1 deletion src/control/controlindicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ControlIndicator : public ControlObject {
RATIO1TO1_250MS = 3, // used for Pioneer cue
};

ControlIndicator(ConfigKey key);
ControlIndicator(const ConfigKey& key);
virtual ~ControlIndicator();

void setBlinkValue(enum BlinkValue bv);
Expand Down
10 changes: 6 additions & 4 deletions src/control/controllinpotmeter.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include "control/controllinpotmeter.h"

ControlLinPotmeter::ControlLinPotmeter(ConfigKey key,
double dMinValue, double dMaxValue,
double dStep, double dSmallStep,
bool allowOutOfBounds)
ControlLinPotmeter::ControlLinPotmeter(const ConfigKey& key,
double dMinValue,
double dMaxValue,
double dStep,
double dSmallStep,
bool allowOutOfBounds)
: ControlPotmeter(key, dMinValue, dMaxValue, allowOutOfBounds) {
if (m_pControl) {
m_pControl->setBehavior(
Expand Down
8 changes: 5 additions & 3 deletions src/control/controllinpotmeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ class ControlLinPotmeter : public ControlPotmeter {
Q_OBJECT
public:
// dStep = 0 and dSmallStep = 0 defaults to 10 and 100 steps
ControlLinPotmeter(ConfigKey key,
double dMinValue = 0.0, double dMaxValue = 1.0,
double dStep = 0, double dSmallStep = 0,
ControlLinPotmeter(const ConfigKey& key,
double dMinValue = 0.0,
double dMaxValue = 1.0,
double dStep = 0,
double dSmallStep = 0,
bool allowOutOfBounds = false);
};

Expand Down
4 changes: 2 additions & 2 deletions src/control/controllogpotmeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

#include "control/controllogpotmeter.h"

ControlLogpotmeter::ControlLogpotmeter(ConfigKey key, double dMaxValue, double minDB)
: ControlPotmeter(key, 0, dMaxValue) {
ControlLogpotmeter::ControlLogpotmeter(const ConfigKey& key, double dMaxValue, double minDB)
: ControlPotmeter(key, 0, dMaxValue) {
// Override ControlPotmeters default value of 0.5
setDefaultValue(1.0);
set(1.0);
Expand Down
2 changes: 1 addition & 1 deletion src/control/controllogpotmeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class ControlLogpotmeter : public ControlPotmeter {
Q_OBJECT
public:
ControlLogpotmeter(ConfigKey key, double dMaxValue, double minDB);
ControlLogpotmeter(const ConfigKey& key, double dMaxValue, double minDB);
};

#endif
7 changes: 5 additions & 2 deletions src/control/controlobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
ControlObject::ControlObject() {
}

ControlObject::ControlObject(ConfigKey key, bool bIgnoreNops, bool bTrack,
bool bPersist, double defaultValue)
ControlObject::ControlObject(const ConfigKey& key,
bool bIgnoreNops,
bool bTrack,
bool bPersist,
double defaultValue)
: m_key(key) {
// Don't bother looking up the control if key is invalid. Prevents log spew.
if (m_key.isValid()) {
Expand Down
8 changes: 5 additions & 3 deletions src/control/controlobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ class ControlObject : public QObject {
// bPersist: Store value on exit, load on startup.
// defaultValue: default value of CO. If CO is persistent and there is no valid
// value found in the config, this is also the initial value.
ControlObject(ConfigKey key,
bool bIgnoreNops = true, bool bTrack = false,
bool bPersist = false, double defaultValue = 0.0);
ControlObject(const ConfigKey& key,
bool bIgnoreNops = true,
bool bTrack = false,
bool bPersist = false,
double defaultValue = 0.0);
virtual ~ControlObject();

// Returns a pointer to the ControlObject matching the given ConfigKey
Expand Down
14 changes: 8 additions & 6 deletions src/control/controlpotmeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
#include "control/controlpotmeter.h"
#include "control/controlproxy.h"

ControlPotmeter::ControlPotmeter(ConfigKey key, double dMinValue, double dMaxValue,
bool allowOutOfBounds,
bool bIgnoreNops,
bool bTrack,
bool bPersist,
double defaultValue)
ControlPotmeter::ControlPotmeter(const ConfigKey& key,
double dMinValue,
double dMaxValue,
bool allowOutOfBounds,
bool bIgnoreNops,
bool bTrack,
bool bPersist,
double defaultValue)
: ControlObject(key, bIgnoreNops, bTrack, bPersist, defaultValue),
m_controls(key) {
setRange(dMinValue, dMaxValue, allowOutOfBounds);
Expand Down
14 changes: 8 additions & 6 deletions src/control/controlpotmeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ class PotmeterControls : public QObject {
class ControlPotmeter : public ControlObject {
Q_OBJECT
public:
ControlPotmeter(ConfigKey key, double dMinValue = 0.0, double dMaxValue = 1.0,
bool allowOutOfBounds = false,
bool bIgnoreNops = true,
bool bTrack = false,
bool bPersist = false,
double defaultValue = 0.0);
ControlPotmeter(const ConfigKey& key,
double dMinValue = 0.0,
double dMaxValue = 1.0,
bool allowOutOfBounds = false,
bool bIgnoreNops = true,
bool bTrack = false,
bool bPersist = false,
double defaultValue = 0.0);
virtual ~ControlPotmeter();

// Sets the step count of the associated PushButtons.
Expand Down
2 changes: 1 addition & 1 deletion src/control/controlpushbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Purpose: Creates a new simulated latching push-button.
Input: key - Key for the configuration file
-------- ------------------------------------------------------ */
ControlPushButton::ControlPushButton(ConfigKey key, bool bPersist, double defaultValue)
ControlPushButton::ControlPushButton(const ConfigKey& key, bool bPersist, double defaultValue)
: ControlObject(key, false, false, bPersist, defaultValue),
m_buttonMode(PUSH),
m_iNoStates(2) {
Expand Down
2 changes: 1 addition & 1 deletion src/control/controlpushbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ControlPushButton : public ControlObject {
}
}

ControlPushButton(ConfigKey key, bool bPersist = false, double defaultValue = 0.0);
ControlPushButton(const ConfigKey& key, bool bPersist = false, double defaultValue = 0.0);
virtual ~ControlPushButton();

inline ButtonMode getButtonMode() const {
Expand Down
3 changes: 2 additions & 1 deletion src/control/controlttrotary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
Purpose: Creates a new rotary encoder
Input: key
-------- ------------------------------------------------------ */
ControlTTRotary::ControlTTRotary(ConfigKey key) : ControlObject(key) {
ControlTTRotary::ControlTTRotary(const ConfigKey& key)
: ControlObject(key) {
if (m_pControl) {
m_pControl->setBehavior(
new ControlTTRotaryBehavior());
Expand Down
2 changes: 1 addition & 1 deletion src/control/controlttrotary.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class ControlTTRotary : public ControlObject {
Q_OBJECT
public:
ControlTTRotary(ConfigKey key);
ControlTTRotary(const ConfigKey& key);
};

#endif
2 changes: 1 addition & 1 deletion src/controllers/bulk/bulkcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void BulkController::send(QList<int> data, unsigned int length) {
send(temp);
}

void BulkController::send(QByteArray data) {
void BulkController::send(const QByteArray& data) {
int ret;
int transferred;

Expand Down
4 changes: 2 additions & 2 deletions src/controllers/bulk/bulkcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class BulkReader : public QThread {
void stop();

signals:
void incomingData(QByteArray data, mixxx::Duration timestamp);
void incomingData(const QByteArray& data, mixxx::Duration timestamp);

protected:
void run();
Expand Down Expand Up @@ -81,7 +81,7 @@ class BulkController : public Controller {
private:
// For devices which only support a single report, reportID must be set to
// 0x0.
void send(QByteArray data) override;
void send(const QByteArray& data) override;

// Returns a pointer to the currently loaded controller preset. For internal
// use only.
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/colormapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class ColorMapper final {
public:
ColorMapper() = delete;
explicit ColorMapper(QMap<QRgb, QVariant> availableColors)
explicit ColorMapper(const QMap<QRgb, QVariant>& availableColors)
: m_availableColors(availableColors) {
DEBUG_ASSERT(!m_availableColors.isEmpty());
}
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/colormapperjsproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

#include "controllers/colormapperjsproxy.h"

ColorMapperJSProxy::ColorMapperJSProxy(QScriptEngine* pScriptEngine, QMap<QRgb, QVariant> availableColors)
ColorMapperJSProxy::ColorMapperJSProxy(QScriptEngine* pScriptEngine,
const QMap<QRgb, QVariant>& availableColors)
: m_pScriptEngine(pScriptEngine),
m_colorMapper(new ColorMapper(availableColors)) {
}
Expand Down
Loading

0 comments on commit f99d07b

Please sign in to comment.