chore: fix warnings

This commit is contained in:
Nicholas Dudfield
2025-05-06 09:25:32 +07:00
parent 615f56570a
commit 0814a63232
3 changed files with 12 additions and 13 deletions

View File

@@ -224,7 +224,8 @@ public:
if (!ledger->info().accountHash.isNonZero())
{
JLOG(j.fatal()) << "AH is zero: " << getJson({*ledger, {}});
JLOG(j.fatal())
<< "AH is zero: " << getJson({*ledger, {}}).asString();
assert(false);
}

View File

@@ -239,8 +239,7 @@ verifyHandshake(
throw std::runtime_error("Invalid server domain");
}
// Check the network. Omitting Network-ID (on either side ours, or theirs)
// means NID=0
if (auto const iter = headers.find("Network-ID"); iter != headers.end())
{
uint32_t peer_nid = 0;
if (auto const iter = headers.find("Network-ID"); iter != headers.end())
@@ -250,8 +249,10 @@ verifyHandshake(
throw std::runtime_error("Invalid peer network identifier");
}
uint32_t our_nid = networkID ? *networkID : 0;
if (peer_nid != our_nid)
if (!beast::lexicalCastChecked(peer_nid, std::string(iter->value())))
throw std::runtime_error("Invalid peer network identifier");
if (networkID && peer_nid != *networkID)
throw std::runtime_error("Peer is on a different network");
}

View File

@@ -226,13 +226,15 @@ public:
// SOCI requires boost::optional (not std::optional) as
// parameters.
boost::optional<std::int32_t> ig;
boost::optional<std::uint32_t> uig;
// Known bug: https://github.com/SOCI/soci/issues/926
// boost::optional<std::uint32_t> uig;
uint32_t uig = 0;
boost::optional<std::int64_t> big;
boost::optional<std::uint64_t> ubig;
s << "SELECT I, UI, BI, UBI from STT;", soci::into(ig),
soci::into(uig), soci::into(big), soci::into(ubig);
BEAST_EXPECT(
*ig == id[0] && *uig == uid[0] && *big == bid[0] &&
*ig == id[0] && uig == uid[0] && *big == bid[0] &&
*ubig == ubid[0]);
}
catch (std::exception&)
@@ -357,18 +359,13 @@ public:
bfs::remove(dbPath);
}
void
testSQLite()
run() override
{
testSQLiteFileNames();
testSQLiteSession();
testSQLiteSelect();
testSQLiteDeleteWithSubselect();
}
void
run() override
{
testSQLite();
}
};
BEAST_DEFINE_TESTSUITE(SociDB, core, ripple);