cppcheck: use auto when copies are cheap

Found with constVariableReference

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 2 years ago
parent 0432a6ed3c
commit f9845b35e7

@ -984,7 +984,7 @@ std::ostream& SonyMakerNote::printFocusMode2(std::ostream& os, const Value& valu
constexpr std::array models{"DSC-RX10M4", "DSC-RX100M6", "DSC-RX100M7", "DSC-RX100M5A", "DSC-HX99", "DSC-RX0M2"};
if (!startsWith(model, "DSC-") ||
std::any_of(models.begin(), models.end(), [&model](auto& m) { return startsWith(model, m); })) {
std::any_of(models.begin(), models.end(), [&model](auto m) { return startsWith(model, m); })) {
EXV_PRINT_TAG(sonyFocusMode2)(os, v0, metadata);
return os;
}
@ -1010,14 +1010,14 @@ std::ostream& SonyMakerNote::printAFAreaModeSetting(std::ostream& os, const Valu
const auto v0 = value.toUint32(0);
constexpr std::array models1{"SLT-", "HV"};
if (std::any_of(models1.begin(), models1.end(), [&model](auto& m) { return startsWith(model, m); })) {
if (std::any_of(models1.begin(), models1.end(), [&model](auto m) { return startsWith(model, m); })) {
EXV_PRINT_TAG(sonyAFAreaModeSettingSet1)(os, v0, metadata);
return os;
}
constexpr std::array models2{"NEX-", "ILCE-", "ILME-", "DSC-RX10M4", "DSC-RX100M6",
"DSC-RX100M7", "DSC-RX100M5A", "DSC-HX99", "DSC-RX0M2"};
if (std::any_of(models2.begin(), models2.end(), [&model](auto& m) { return startsWith(model, m); })) {
if (std::any_of(models2.begin(), models2.end(), [&model](auto m) { return startsWith(model, m); })) {
EXV_PRINT_TAG(sonyAFAreaModeSettingSet2)(os, v0, metadata);
return os;
}
@ -1047,7 +1047,7 @@ std::ostream& SonyMakerNote::printFlexibleSpotPosition(std::ostream& os, const V
constexpr std::array models{"NEX-", "ILCE-", "ILME-", "DSC-RX10M4", "DSC-RX100M6",
"DSC-RX100M7", "DSC-RX100M5A", "DSC-HX99", "DSC-RX0M2"};
if (std::any_of(models.begin(), models.end(), [&model](auto& m) { return startsWith(model, m); })) {
if (std::any_of(models.begin(), models.end(), [&model](auto m) { return startsWith(model, m); })) {
os << value.toUint32(0) << ", " << value.toUint32(1);
return os;
}
@ -1077,16 +1077,16 @@ std::ostream& SonyMakerNote::printAFPointSelected(std::ostream& os, const Value&
constexpr std::array models3{"ILCA-68", "ILCA-77M2"};
constexpr std::array models4{"NEX-", "ILCE-", "ILME-"};
if (std::any_of(models1.begin(), models1.end(), [&model](auto& m) { return startsWith(model, m); })) {
if (std::any_of(models1.begin(), models1.end(), [&model](auto m) { return startsWith(model, m); })) {
EXV_PRINT_TAG(sonyAFPointSelectedSet1)(os, value.toUint32(0), metadata);
return os;
}
if (std::any_of(models2.begin(), models2.end(), [&model](auto& m) { return startsWith(model, m); }) && status &&
if (std::any_of(models2.begin(), models2.end(), [&model](auto m) { return startsWith(model, m); }) && status &&
aFAreaModeSetting == 4) {
EXV_PRINT_TAG(sonyAFPointSelectedSet1)(os, value.toUint32(0), metadata);
return os;
}
if (std::any_of(models3.begin(), models3.end(), [&model](auto& m) { return startsWith(model, m); }) && status &&
if (std::any_of(models3.begin(), models3.end(), [&model](auto m) { return startsWith(model, m); }) && status &&
aFAreaModeSetting != 8) {
EXV_PRINT_TAG(sonyAFPointSelectedSet2)(os, value, metadata);
return os;
@ -1099,7 +1099,7 @@ std::ostream& SonyMakerNote::printAFPointSelected(std::ostream& os, const Value&
EXV_PRINT_TAG(sonyAFPointSelectedSet4)(os, value.toUint32(0), metadata);
return os;
}
if (std::any_of(models4.begin(), models4.end(), [&model](auto& m) { return startsWith(model, m); })) {
if (std::any_of(models4.begin(), models4.end(), [&model](auto m) { return startsWith(model, m); })) {
EXV_PRINT_TAG(sonyAFPointSelectedSet5)(os, value.toUint32(0), metadata);
return os;
}
@ -1122,11 +1122,11 @@ std::ostream& SonyMakerNote::printAFPointsUsed(std::ostream& os, const Value& va
constexpr std::array models1{"ILCA-", "DSC-"};
constexpr std::array models2{"ILCA-68", "ILCA-77M2"};
if (std::none_of(models1.begin(), models1.end(), [&model](auto& m) { return startsWith(model, m); })) {
if (std::none_of(models1.begin(), models1.end(), [&model](auto m) { return startsWith(model, m); })) {
EXV_PRINT_TAG_BITLIST_ALL_LE(sonyAFPointsUsedSet1)(os, value, metadata);
return os;
}
if (std::any_of(models2.begin(), models2.end(), [&model](auto& m) { return startsWith(model, m); })) {
if (std::any_of(models2.begin(), models2.end(), [&model](auto m) { return startsWith(model, m); })) {
EXV_PRINT_TAG_BITLIST_ALL_LE(sonyAFPointsUsedSet2)(os, value, metadata);
return os;
}
@ -1150,7 +1150,7 @@ std::ostream& SonyMakerNote::printAFTracking(std::ostream& os, const Value& valu
constexpr std::array models{"DSC-RX10M4", "DSC-RX100M6", "DSC-RX100M7", "DSC-RX100M5A", "DSC-HX99", "DSC-RX0M2"};
if (!startsWith(model, "DSC-") ||
std::any_of(models.begin(), models.end(), [&model](auto& m) { return startsWith(model, m); })) {
std::any_of(models.begin(), models.end(), [&model](auto m) { return startsWith(model, m); })) {
EXV_PRINT_TAG(sonyAFTracking)(os, value.toUint32(0), metadata);
return os;
}
@ -2020,7 +2020,7 @@ std::ostream& SonyMakerNote::printSony2FpFocusPosition2(std::ostream& os, const
}
// Ranges of models that do not support this tag
for (const auto& m : {"DSC-", "Stellar"}) {
for (auto m : {"DSC-", "Stellar"}) {
if (startsWith(model, m)) {
os << N_("n/a");
return os;
@ -2128,7 +2128,7 @@ std::ostream& SonyMakerNote::printSonyMisc2bLensZoomPosition(std::ostream& os, c
}
// Models that do not support this tag
for (auto& m : {"SLT-", "HV", "ILCA-"}) {
for (auto m : {"SLT-", "HV", "ILCA-"}) {
if (Internal::contains(model, m))
return os << N_("n/a");
}
@ -2150,7 +2150,7 @@ std::ostream& SonyMakerNote::printSonyMisc2bFocusPosition2(std::ostream& os, con
}
// Models that do not support this tag
for (auto& m : {"SLT-", "HV", "ILCA-"}) {
for (auto m : {"SLT-", "HV", "ILCA-"}) {
if (Internal::contains(model, m))
return os << N_("n/a");
}

Loading…
Cancel
Save