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()) if (!ledger->info().accountHash.isNonZero())
{ {
JLOG(j.fatal()) << "AH is zero: " << getJson({*ledger, {}}); JLOG(j.fatal())
<< "AH is zero: " << getJson({*ledger, {}}).asString();
assert(false); assert(false);
} }

View File

@@ -239,8 +239,7 @@ verifyHandshake(
throw std::runtime_error("Invalid server domain"); throw std::runtime_error("Invalid server domain");
} }
// Check the network. Omitting Network-ID (on either side ours, or theirs) if (auto const iter = headers.find("Network-ID"); iter != headers.end())
// means NID=0
{ {
uint32_t peer_nid = 0; uint32_t peer_nid = 0;
if (auto const iter = headers.find("Network-ID"); iter != headers.end()) if (auto const iter = headers.find("Network-ID"); iter != headers.end())
@@ -250,8 +249,10 @@ verifyHandshake(
throw std::runtime_error("Invalid peer network identifier"); throw std::runtime_error("Invalid peer network identifier");
} }
uint32_t our_nid = networkID ? *networkID : 0; if (!beast::lexicalCastChecked(peer_nid, std::string(iter->value())))
if (peer_nid != our_nid) throw std::runtime_error("Invalid peer network identifier");
if (networkID && peer_nid != *networkID)
throw std::runtime_error("Peer is on a different network"); 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 // SOCI requires boost::optional (not std::optional) as
// parameters. // parameters.
boost::optional<std::int32_t> ig; 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::int64_t> big;
boost::optional<std::uint64_t> ubig; boost::optional<std::uint64_t> ubig;
s << "SELECT I, UI, BI, UBI from STT;", soci::into(ig), s << "SELECT I, UI, BI, UBI from STT;", soci::into(ig),
soci::into(uig), soci::into(big), soci::into(ubig); soci::into(uig), soci::into(big), soci::into(ubig);
BEAST_EXPECT( BEAST_EXPECT(
*ig == id[0] && *uig == uid[0] && *big == bid[0] && *ig == id[0] && uig == uid[0] && *big == bid[0] &&
*ubig == ubid[0]); *ubig == ubid[0]);
} }
catch (std::exception&) catch (std::exception&)
@@ -357,18 +359,13 @@ public:
bfs::remove(dbPath); bfs::remove(dbPath);
} }
void void
testSQLite() run() override
{ {
testSQLiteFileNames(); testSQLiteFileNames();
testSQLiteSession(); testSQLiteSession();
testSQLiteSelect(); testSQLiteSelect();
testSQLiteDeleteWithSubselect(); testSQLiteDeleteWithSubselect();
} }
void
run() override
{
testSQLite();
}
}; };
BEAST_DEFINE_TESTSUITE(SociDB, core, ripple); BEAST_DEFINE_TESTSUITE(SociDB, core, ripple);