Fix build warning issues

This commit is contained in:
root
2026-04-28 07:34:45 +00:00
parent 0d9afa3986
commit 34864c5254
11 changed files with 18 additions and 21 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ inline std::string Hash(std::string input)
unsigned char hash[CSHA256::OUTPUT_SIZE];
CSHA256().Write((const unsigned char*)input.data(), input.size()).Finalize(hash);
stringstream ss;
for (int i = 0; i < CSHA256::OUTPUT_SIZE; i++) {
for (size_t i = 0; i < CSHA256::OUTPUT_SIZE; i++) {
ss << hex << setw(2) << setfill('0') << (int)hash[i];
}
return ss.str();
+3 -4
View File
@@ -33,7 +33,7 @@ namespace invalid_out
const UniValue &val = v[idx];
const UniValue &o = val.get_obj();
const UniValue &vTxid = find_value(o, "txid");
const UniValue vTxid = find_value(o, "txid");
if (!vTxid.isStr())
return false;
@@ -41,7 +41,7 @@ namespace invalid_out
if (txid == 0)
return false;
const UniValue &vN = find_value(o, "n");
const UniValue vN = find_value(o, "n");
if (!vN.isNum())
return false;
@@ -63,7 +63,7 @@ namespace invalid_out
const UniValue &val = v[idx];
const UniValue &o = val.get_obj();
const UniValue &vSerial = find_value(o, "s");
const UniValue vSerial = find_value(o, "s");
if (!vSerial.isStr())
return false;
@@ -87,4 +87,3 @@ namespace invalid_out
return static_cast<bool>(setInvalidSerials.count(bnSerial));
}
}
@@ -170,7 +170,7 @@ bool SerialNumberSignatureOfKnowledge::Verify(const CBigNum& coinSerialNumber, c
hasher << tprime[i];
}
return hasher.GetHash() == hash;
}catch (std::range_error e){
}catch (const std::range_error& e){
return error("SoK Verify() :: sprime invalid range.");
}
}
+1 -1
View File
@@ -96,7 +96,7 @@ bool CMasternodeConfig::CMasternodeEntry::castOutputIndex(int &n)
{
try {
n = std::stoi(outputIndex);
} catch (const std::exception e) {
} catch (const std::exception& e) {
LogPrintf("%s: %s on getOutputIndex\n", __func__, e.what());
return false;
}
+1 -1
View File
@@ -434,7 +434,7 @@ UniValue mempoolToJSON(bool fVerbose = false)
if (fVerbose) {
LOCK(mempool.cs);
UniValue o(UniValue::VOBJ);
for (const PAIRTYPE(uint256, CTxMemPoolEntry) & entry : mempool.mapTx) {
for (const auto& entry : mempool.mapTx) {
const uint256& hash = entry.first;
const CTxMemPoolEntry& e = entry.second;
UniValue info(UniValue::VOBJ);
+2 -2
View File
@@ -418,7 +418,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
UniValue lpval = NullUniValue;
if (params.size() > 0) {
const UniValue& oparam = params[0].get_obj();
const UniValue& modeval = find_value(oparam, "mode");
const UniValue modeval = find_value(oparam, "mode");
if (modeval.isStr())
strMode = modeval.get_str();
else if (modeval.isNull()) {
@@ -428,7 +428,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
lpval = find_value(oparam, "longpollid");
if (strMode == "proposal") {
const UniValue& dataval = find_value(oparam, "data");
const UniValue dataval = find_value(oparam, "data");
if (!dataval.isStr())
throw JSONRPCError(RPC_TYPE_ERROR, "Missing data String key for proposal");
+2 -3
View File
@@ -383,7 +383,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
uint256 txid = ParseHashO(o, "txid");
const UniValue& vout_v = find_value(o, "vout");
const UniValue vout_v = find_value(o, "vout");
if (!vout_v.isNum())
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key");
int nOutput = vout_v.get_int();
@@ -393,7 +393,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
uint32_t nSequence = (rawTx.nLockTime ? std::numeric_limits<uint32_t>::max() - 1 : std::numeric_limits<uint32_t>::max());
// set the sequence number if passed in the parameters object
const UniValue& sequenceObj = find_value(o, "sequence");
const UniValue sequenceObj = find_value(o, "sequence");
if (sequenceObj.isNum()) {
int64_t seqNr64 = sequenceObj.get_int64();
if (seqNr64 < 0 || seqNr64 > std::numeric_limits<uint32_t>::max())
@@ -1057,4 +1057,3 @@ UniValue createrawzerocoinpublicspend(const UniValue& params, bool fHelp)
return EncodeHexTx(rawTx);
}
#endif
+2 -2
View File
@@ -93,8 +93,8 @@ void RPCTypeCheckObj(const UniValue& o,
const map<string, UniValue::VType>& typesExpected,
bool fAllowNull)
{
for (const PAIRTYPE(string, UniValue::VType)& t : typesExpected) {
const UniValue& v = find_value(o, t.first);
for (const auto& t : typesExpected) {
const UniValue v = find_value(o, t.first);
if (!fAllowNull && v.isNull())
throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing %s", t.first));
+2 -2
View File
@@ -3365,7 +3365,7 @@ UniValue importzerocoins(const UniValue& params, bool fHelp)
const UniValue &val = arrMints[idx];
const UniValue &o = val.get_obj();
const UniValue& vDenom = find_value(o, "d");
const UniValue vDenom = find_value(o, "d");
if (!vDenom.isNum())
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing d key");
int d = vDenom.get_int();
@@ -3389,7 +3389,7 @@ UniValue importzerocoins(const UniValue& params, bool fHelp)
//Assume coin is version 1 unless it has the version actually set
uint8_t nVersion = 1;
const UniValue& vVersion = find_value(o, "v");
const UniValue vVersion = find_value(o, "v");
if (vVersion.isNum())
nVersion = static_cast<uint8_t>(vVersion.get_int());
+1 -1
View File
@@ -1077,7 +1077,7 @@ bool AttemptBackupWallet(const CWallet& wallet, const filesystem::path& pathSrc,
return false;
}
#if BOOST_VERSION >= 105800 /* BOOST_LIB_VERSION 1_58 */
filesystem::copy_file(pathSrc.c_str(), pathDest, filesystem::copy_options::overwrite_existing);
filesystem::copy_file(pathSrc.c_str(), pathDest, filesystem::copy_option::overwrite_if_exists);
#else
std::ifstream src(pathSrc.c_str(), std::ios::binary | std::ios::in);
std::ofstream dst(pathDest.c_str(), std::ios::binary | std::ios::out | std::ios::trunc);
+2 -3
View File
@@ -39,7 +39,7 @@ namespace AccumulatorCheckpoints
const UniValue &val = v[idx];
const UniValue &o = val.get_obj();
const UniValue &vHeight = find_value(o, "height");
const UniValue vHeight = find_value(o, "height");
if (!vHeight.isNum())
return false;
@@ -49,7 +49,7 @@ namespace AccumulatorCheckpoints
Checkpoint checkpoint;
for (auto denom : libzerocoin::zerocoinDenomList) {
const UniValue& vDenomValue = find_value(o, std::to_string(denom));
const UniValue vDenomValue = find_value(o, std::to_string(denom));
if (!vDenomValue.isStr()) {
return false;
}
@@ -82,4 +82,3 @@ namespace AccumulatorCheckpoints
return Checkpoint();
}
}