Clean up and modernize code:

This commit removes obsolete comments, dead or no longer useful
code, and workarounds for several issues that were present in older
compilers that we no longer support.

Specifically:

- It improves the transaction metadata handling class, simplifying
  its use and making it less error-prone.
- It reduces the footprint of the Serializer class by consolidating
  code and leveraging templates.
- It cleanups the ST* class hierarchy, removing dead code, improving
  and consolidating code to reduce complexity and code duplication.
- It shores up the handling of currency codes and the conversation
  between 160-bit currency codes and their string representation.
- It migrates beast::secure_erase to the ripple namespace and uses
  a call to OpenSSL_cleanse instead of the custom implementation.
This commit is contained in:
Nik Bougalis
2020-03-27 14:26:46 -07:00
parent 6c72d5cf7e
commit dbee3f01b7
45 changed files with 244 additions and 703 deletions

View File

@@ -82,7 +82,7 @@ public:
BEAST_EXPECT(c.getTrackSize() == 1);
{
Cache::mapped_ptr p(c.fetch(2));
auto p = c.fetch(2);
BEAST_EXPECT(p != nullptr);
++clock;
c.sweep();
@@ -102,8 +102,8 @@ public:
BEAST_EXPECT(!c.insert(3, "three"));
{
Cache::mapped_ptr const p1(c.fetch(3));
Cache::mapped_ptr p2(std::make_shared<Value>("three"));
auto const p1 = c.fetch(3);
auto p2 = std::make_shared<Value>("three");
c.canonicalize_replace_client(3, p2);
BEAST_EXPECT(p1.get() == p2.get());
}
@@ -124,7 +124,7 @@ public:
{
// Keep a strong pointer to it
Cache::mapped_ptr p1(c.fetch(4));
auto const p1 = c.fetch(4);
BEAST_EXPECT(p1 != nullptr);
BEAST_EXPECT(c.getCacheSize() == 1);
BEAST_EXPECT(c.getTrackSize() == 1);
@@ -134,7 +134,7 @@ public:
BEAST_EXPECT(c.getCacheSize() == 0);
BEAST_EXPECT(c.getTrackSize() == 1);
// Canonicalize a new object with the same key
Cache::mapped_ptr p2(std::make_shared<std::string>("four"));
auto p2 = std::make_shared<std::string>("four");
BEAST_EXPECT(c.canonicalize_replace_client(4, p2));
BEAST_EXPECT(c.getCacheSize() == 1);
BEAST_EXPECT(c.getTrackSize() == 1);