Fix cppcheck warnings from params-file changes
This commit is contained in:
+9
-9
@@ -1985,24 +1985,24 @@ void p2pool::parse_get_miner_data_rpc(const char* data, size_t size)
|
||||
// At current HF (10), block_header has no pricing_record (HF_VERSION_ENABLE_ORACLE = 255).
|
||||
static bool extract_protocol_tx_from_blob(const uint8_t* data, size_t size, std::vector<uint8_t>& protocol_tx_out)
|
||||
{
|
||||
const uint8_t* const end = data + size;
|
||||
const uint8_t* const blob_end = data + size;
|
||||
|
||||
// Helper: skip a varint, return false on failure
|
||||
auto skip_varint = [&data, end]() -> bool {
|
||||
auto skip_varint = [&data, blob_end]() -> bool {
|
||||
uint64_t dummy;
|
||||
data = readVarint(data, end, dummy);
|
||||
data = readVarint(data, blob_end, dummy);
|
||||
return data != nullptr;
|
||||
};
|
||||
|
||||
// Helper: read a varint value
|
||||
auto read_varint = [&data, end](uint64_t& val) -> bool {
|
||||
data = readVarint(data, end, val);
|
||||
auto read_varint = [&data, blob_end](uint64_t& val) -> bool {
|
||||
data = readVarint(data, blob_end, val);
|
||||
return data != nullptr;
|
||||
};
|
||||
|
||||
// Helper: skip N bytes
|
||||
auto skip_bytes = [&data, end](size_t n) -> bool {
|
||||
if (static_cast<size_t>(end - data) < n) return false;
|
||||
auto skip_bytes = [&data, blob_end](size_t n) -> bool {
|
||||
if (static_cast<size_t>(blob_end - data) < n) return false;
|
||||
data += n;
|
||||
return true;
|
||||
};
|
||||
@@ -2016,7 +2016,7 @@ static bool extract_protocol_tx_from_blob(const uint8_t* data, size_t size, std:
|
||||
// Helper: skip a single tx output (amount varint + type tag + type-specific data)
|
||||
auto skip_tx_output = [&]() -> bool {
|
||||
if (!skip_varint()) return false; // amount
|
||||
if (data >= end) return false;
|
||||
if (data >= blob_end) return false;
|
||||
uint8_t tag = *(data++);
|
||||
switch (tag) {
|
||||
case 2: // txout_to_key: key(32) + asset_type(string)
|
||||
@@ -2051,7 +2051,7 @@ static bool extract_protocol_tx_from_blob(const uint8_t* data, size_t size, std:
|
||||
uint64_t vin_count;
|
||||
if (!read_varint(vin_count)) return false;
|
||||
for (uint64_t i = 0; i < vin_count; ++i) {
|
||||
if (data >= end) return false;
|
||||
if (data >= blob_end) return false;
|
||||
uint8_t vin_tag = *(data++);
|
||||
if (vin_tag == 0xff) {
|
||||
// txin_gen: height varint
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ struct PoolBlock;
|
||||
class p2pool : public MinerCallbackHandler, public nocopy_nomove
|
||||
{
|
||||
public:
|
||||
p2pool(const std::vector<std::vector<std::string>>& args);
|
||||
explicit p2pool(const std::vector<std::vector<std::string>>& args);
|
||||
~p2pool() override;
|
||||
|
||||
int run();
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ struct Params
|
||||
FORCEINLINE Params() {}
|
||||
#endif
|
||||
|
||||
Params(const std::vector<std::vector<std::string>>& args);
|
||||
explicit Params(const std::vector<std::vector<std::string>>& args);
|
||||
|
||||
bool valid() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user