mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Replace stoul with ToIntegral in dbwrapper
This commit is contained in:
parent
c0b6c96eee
commit
fa165e9545
2 changed files with 5 additions and 4 deletions
|
@ -197,13 +197,15 @@ bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync)
|
|||
return true;
|
||||
}
|
||||
|
||||
size_t CDBWrapper::DynamicMemoryUsage() const {
|
||||
size_t CDBWrapper::DynamicMemoryUsage() const
|
||||
{
|
||||
std::string memory;
|
||||
if (!pdb->GetProperty("leveldb.approximate-memory-usage", &memory)) {
|
||||
std::optional<size_t> parsed;
|
||||
if (!pdb->GetProperty("leveldb.approximate-memory-usage", &memory) || !(parsed = ToIntegral<size_t>(memory))) {
|
||||
LogPrint(BCLog::LEVELDB, "Failed to get approximate-memory-usage property\n");
|
||||
return 0;
|
||||
}
|
||||
return stoul(memory);
|
||||
return parsed.value();
|
||||
}
|
||||
|
||||
// Prefixed with null character to avoid collisions with other keys
|
||||
|
|
|
@ -42,7 +42,6 @@ export LC_ALL=C
|
|||
# TODO: Reduce KNOWN_VIOLATIONS by replacing uses of locale dependent snprintf with strprintf.
|
||||
KNOWN_VIOLATIONS=(
|
||||
"src/bitcoin-tx.cpp.*stoul"
|
||||
"src/dbwrapper.cpp.*stoul"
|
||||
"src/dbwrapper.cpp:.*vsnprintf"
|
||||
"src/rest.cpp:.*strtol"
|
||||
"src/test/dbwrapper_tests.cpp:.*snprintf"
|
||||
|
|
Loading…
Add table
Reference in a new issue