Fix clang-tidy performance-unnecessary-copy-initialization warnings

pull/27605/head
MarcoFalke 2 years ago
parent faaa60a30e
commit fa28850562
No known key found for this signature in database

@ -42,7 +42,7 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
if (fingerprint.isNull()) { if (fingerprint.isNull()) {
throw std::runtime_error(strprintf("'%s' received invalid response, missing signer fingerprint", command)); throw std::runtime_error(strprintf("'%s' received invalid response, missing signer fingerprint", command));
} }
const std::string fingerprintStr = fingerprint.get_str(); const std::string& fingerprintStr{fingerprint.get_str()};
// Skip duplicate signer // Skip duplicate signer
bool duplicate = false; bool duplicate = false;
for (const ExternalSigner& signer : signers) { for (const ExternalSigner& signer : signers) {

@ -223,8 +223,8 @@ void ParsePrevouts(const UniValue& prevTxsUnival, FillableSigningProvider* keyst
{"redeemScript", UniValueType(UniValue::VSTR)}, {"redeemScript", UniValueType(UniValue::VSTR)},
{"witnessScript", UniValueType(UniValue::VSTR)}, {"witnessScript", UniValueType(UniValue::VSTR)},
}, true); }, true);
UniValue rs = prevOut.find_value("redeemScript"); const UniValue& rs{prevOut.find_value("redeemScript")};
UniValue ws = prevOut.find_value("witnessScript"); const UniValue& ws{prevOut.find_value("witnessScript")};
if (rs.isNull() && ws.isNull()) { if (rs.isNull() && ws.isNull()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Missing redeemScript/witnessScript"); throw JSONRPCError(RPC_INVALID_PARAMETER, "Missing redeemScript/witnessScript");
} }

@ -168,7 +168,7 @@ void JSONRPCRequest::parse(const UniValue& valRequest)
id = request.find_value("id"); id = request.find_value("id");
// Parse method // Parse method
UniValue valMethod = request.find_value("method"); const UniValue& valMethod{request.find_value("method")};
if (valMethod.isNull()) if (valMethod.isNull())
throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method"); throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method");
if (!valMethod.isStr()) if (!valMethod.isStr())
@ -181,7 +181,7 @@ void JSONRPCRequest::parse(const UniValue& valRequest)
LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s\n", SanitizeString(strMethod), this->authUser); LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s\n", SanitizeString(strMethod), this->authUser);
// Parse params // Parse params
UniValue valParams = request.find_value("params"); const UniValue& valParams{request.find_value("params")};
if (valParams.isArray() || valParams.isObject()) if (valParams.isArray() || valParams.isObject())
params = valParams; params = valParams;
else if (valParams.isNull()) else if (valParams.isNull())

@ -1133,10 +1133,10 @@ std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, Fl
if (scanobject.isStr()) { if (scanobject.isStr()) {
desc_str = scanobject.get_str(); desc_str = scanobject.get_str();
} else if (scanobject.isObject()) { } else if (scanobject.isObject()) {
UniValue desc_uni = scanobject.find_value("desc"); const UniValue& desc_uni{scanobject.find_value("desc")};
if (desc_uni.isNull()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Descriptor needs to be provided in scan object"); if (desc_uni.isNull()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Descriptor needs to be provided in scan object");
desc_str = desc_uni.get_str(); desc_str = desc_uni.get_str();
UniValue range_uni = scanobject.find_value("range"); const UniValue& range_uni{scanobject.find_value("range")};
if (!range_uni.isNull()) { if (!range_uni.isNull()) {
range = ParseDescriptorRange(range_uni); range = ParseDescriptorRange(range_uni);
} }

Loading…
Cancel
Save