Skip to content

Commit

Permalink
do not pass POD types by reference (based on clazy `function-args-by-…
Browse files Browse the repository at this point in the history
…value` check)
  • Loading branch information
firewave committed Sep 1, 2023
1 parent c3136db commit 7c4941e
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 30 deletions.
10 changes: 5 additions & 5 deletions gui/codeeditorstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ CodeEditorStyle::CodeEditorStyle(
// cppcheck-suppress naming-varname - TODO: fix this
QColor LnNumFGColor, QColor LnNumBGColor,
// cppcheck-suppress naming-varname - TODO: fix this
QColor KeyWdFGColor, const QFont::Weight& KeyWdWeight,
QColor KeyWdFGColor, QFont::Weight KeyWdWeight,
// cppcheck-suppress naming-varname - TODO: fix this
QColor ClsFGColor, const QFont::Weight& ClsWeight,
QColor ClsFGColor, QFont::Weight ClsWeight,
// cppcheck-suppress naming-varname - TODO: fix this
QColor QteFGColor, const QFont::Weight& QteWeight,
QColor QteFGColor, QFont::Weight QteWeight,
// cppcheck-suppress naming-varname - TODO: fix this
QColor CmtFGColor, const QFont::Weight& CmtWeight,
QColor CmtFGColor, QFont::Weight CmtWeight,
// cppcheck-suppress naming-varname - TODO: fix this
QColor SymbFGColor, QColor SymbBGColor,
const QFont::Weight& SymbWeight) :
QFont::Weight SymbWeight) :
widgetFGColor(std::move(CtrlFGColor)),
widgetBGColor(std::move(CtrlBGColor)),
highlightBGColor(std::move(HiLiBGColor)),
Expand Down
10 changes: 5 additions & 5 deletions gui/codeeditorstyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ class CodeEditorStyle {
// cppcheck-suppress naming-varname - TODO: fix this
QColor LnNumFGColor, QColor LnNumBGColor,
// cppcheck-suppress naming-varname - TODO: fix this
QColor KeyWdFGColor, const QFont::Weight& KeyWdWeight,
QColor KeyWdFGColor, QFont::Weight KeyWdWeight,
// cppcheck-suppress naming-varname - TODO: fix this
QColor ClsFGColor, const QFont::Weight& ClsWeight,
QColor ClsFGColor, QFont::Weight ClsWeight,
// cppcheck-suppress naming-varname - TODO: fix this
QColor QteFGColor, const QFont::Weight& QteWeight,
QColor QteFGColor, QFont::Weight QteWeight,
// cppcheck-suppress naming-varname - TODO: fix this
QColor CmtFGColor, const QFont::Weight& CmtWeight,
QColor CmtFGColor, QFont::Weight CmtWeight,
// cppcheck-suppress naming-varname - TODO: fix this
QColor SymbFGColor, QColor SymbBGColor,
const QFont::Weight& SymbWeight);
QFont::Weight SymbWeight);

bool operator==(const CodeEditorStyle& rhs) const;
bool operator!=(const CodeEditorStyle& rhs) const;
Expand Down
2 changes: 1 addition & 1 deletion gui/codeeditstylecontrols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void SelectFontWeightCombo::changeWeight(int index)
}
}

void SelectFontWeightCombo::setWeight(const QFont::Weight& weight)
void SelectFontWeightCombo::setWeight(QFont::Weight weight)
{
mWeight = weight;
updateWeight();
Expand Down
4 changes: 2 additions & 2 deletions gui/codeeditstylecontrols.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ class SelectFontWeightCombo : public QComboBox {
public:
explicit SelectFontWeightCombo(QWidget* parent);

void setWeight(const QFont::Weight& weight);
void setWeight(QFont::Weight weight);
const QFont::Weight& getWeight();

signals:
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
void weightChanged(const QFont::Weight& newWeight);
void weightChanged(QFont::Weight newWeight);

public slots:
void updateWeight();
Expand Down
10 changes: 5 additions & 5 deletions gui/codeeditstyledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void StyleEditDialog::colorChangedKeywordFG(const QColor& newColor)
updateStyle();
}

void StyleEditDialog::weightChangedKeyword(const QFont::Weight& newWeight)
void StyleEditDialog::weightChangedKeyword(QFont::Weight newWeight)
{
mStyleOutgoing.keywordWeight = newWeight;
updateStyle();
Expand All @@ -308,7 +308,7 @@ void StyleEditDialog::colorChangedClassFG(const QColor& newColor)
updateStyle();
}

void StyleEditDialog::weightChangedClass(const QFont::Weight& newWeight)
void StyleEditDialog::weightChangedClass(QFont::Weight newWeight)
{
mStyleOutgoing.classWeight = newWeight;
updateStyle();
Expand All @@ -320,7 +320,7 @@ void StyleEditDialog::colorChangedQuoteFG(const QColor& newColor)
updateStyle();
}

void StyleEditDialog::weightChangedQuote(const QFont::Weight& newWeight)
void StyleEditDialog::weightChangedQuote(QFont::Weight newWeight)
{
mStyleOutgoing.quoteWeight = newWeight;
updateStyle();
Expand All @@ -332,7 +332,7 @@ void StyleEditDialog::colorChangedCommentFG(const QColor& newColor)
updateStyle();
}

void StyleEditDialog::weightChangedComment(const QFont::Weight& newWeight)
void StyleEditDialog::weightChangedComment(QFont::Weight newWeight)
{
mStyleOutgoing.commentWeight = newWeight;
updateStyle();
Expand All @@ -350,7 +350,7 @@ void StyleEditDialog::colorChangedSymbolBG(const QColor& newColor)
updateStyle();
}

void StyleEditDialog::weightChangedSymbol(const QFont::Weight& newWeight)
void StyleEditDialog::weightChangedSymbol(QFont::Weight newWeight)
{
mStyleOutgoing.symbolWeight = newWeight;
updateStyle();
Expand Down
10 changes: 5 additions & 5 deletions gui/codeeditstyledialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ public slots:
void colorChangedLineNumFG(const QColor& newColor);
void colorChangedLineNumBG(const QColor& newColor);
void colorChangedKeywordFG(const QColor& newColor);
void weightChangedKeyword(const QFont::Weight& newWeight);
void weightChangedKeyword(QFont::Weight newWeight);
void colorChangedClassFG(const QColor& newColor);
void weightChangedClass(const QFont::Weight& newWeight);
void weightChangedClass(QFont::Weight newWeight);
void colorChangedQuoteFG(const QColor& newColor);
void weightChangedQuote(const QFont::Weight& newWeight);
void weightChangedQuote(QFont::Weight newWeight);
void colorChangedCommentFG(const QColor& newColor);
void weightChangedComment(const QFont::Weight& newWeight);
void weightChangedComment(QFont::Weight newWeight);
void colorChangedSymbolFG(const QColor& newColor);
void colorChangedSymbolBG(const QColor& newColor);
void weightChangedSymbol(const QFont::Weight& newWeight);
void weightChangedSymbol(QFont::Weight newWeight);

private:
CodeEditorStyle mStyleIncoming;
Expand Down
2 changes: 1 addition & 1 deletion lib/checkstl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static const struct CWE CWE825(825U); // Expired Pointer Dereference
static const struct CWE CWE833(833U); // Deadlock
static const struct CWE CWE834(834U); // Excessive Iteration

static bool isElementAccessYield(const Library::Container::Yield& yield)
static bool isElementAccessYield(Library::Container::Yield yield)
{
return contains({Library::Container::Yield::ITEM, Library::Container::Yield::AT_INDEX}, yield);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static bool isStreamATty(const std::ostream & os)
}
#endif

std::ostream& operator<<(std::ostream & os, const Color& c)
std::ostream& operator<<(std::ostream & os, Color c)
{
#ifndef _WIN32
if (!gDisableColors && isStreamATty(os))
Expand All @@ -51,7 +51,7 @@ std::ostream& operator<<(std::ostream & os, const Color& c)
return os;
}

std::string toString(const Color& c)
std::string toString(Color c)
{
#ifndef _WIN32
std::stringstream ss;
Expand Down
4 changes: 2 additions & 2 deletions lib/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ enum class Color {
FgMagenta = 35,
FgDefault = 39
};
CPPCHECKLIB std::ostream& operator<<(std::ostream& os, const Color& c);
CPPCHECKLIB std::ostream& operator<<(std::ostream& os, Color c);

CPPCHECKLIB std::string toString(const Color& c);
CPPCHECKLIB std::string toString(Color c);

extern CPPCHECKLIB bool gDisableColors; // for testing

Expand Down
2 changes: 1 addition & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3662,7 +3662,7 @@ static std::ostream & operator << (std::ostream & s, Scope::ScopeType type)
return s;
}

static std::string accessControlToString(const AccessControl& access)
static std::string accessControlToString(AccessControl access)
{
switch (access) {
case AccessControl::Public:
Expand Down
2 changes: 1 addition & 1 deletion lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7965,7 +7965,7 @@ void Tokenizer::unhandledCharLiteral(const Token *tok, const std::string& msg) c
* @param floatConstant the string with stringified float constant to check against
* @return true in case s is equal to X or X.0 and false otherwise.
*/
static bool isNumberOneOf(const std::string &s, const MathLib::bigint& intConstant, const char* floatConstant)
static bool isNumberOneOf(const std::string &s, MathLib::bigint intConstant, const char* floatConstant)
{
if (MathLib::isInt(s)) {
if (MathLib::toLongNumber(s) == intConstant)
Expand Down

0 comments on commit 7c4941e

Please sign in to comment.