Modernize base_uint:

*  Add construction and assignment from a generic
   contiguous container.  Both compile-time and run time
   safety checks are made to ensure the safety of this
   conversion.

*  Remove base_uint::copyFrom.  The generic copy assignment
   operator now does this functionality with enhanced
   safety and better syntax.

*  Remove construction from and dedendence on Blob.
   The generic constructor and assignment now handle this
   functionality.

*  Fix client code to adhere to this new API.

*  Removed the use of fromVoid in PeerImp.cpp as it was
   an inappropriate use of this dangerous API.  The
   generic container constructors do it with enhanced
   safety and better syntax.

*  Rename data member pn to data_ and make it private.

*  Remove constraint from hash_append

*  Remove array_type alias
This commit is contained in:
Howard Hinnant
2019-05-23 19:29:25 -04:00
committed by Manoj doshi
parent de99e79bf1
commit 773dcd1d48
18 changed files with 105 additions and 74 deletions

View File

@@ -148,7 +148,7 @@ calcAccountID (PublicKey const& pk)
AccountID const&
xrpAccount()
{
static AccountID const account(0);
static AccountID const account(beast::zero);
return account;
}

View File

@@ -60,9 +60,9 @@ STAccount::STAccount (SerialIter& sit, SField const& name)
STAccount::STAccount (SField const& n, AccountID const& v)
: STBase (n)
, value_(v)
, default_ (false)
{
value_.copyFrom (v);
}
std::string STAccount::getText () const

View File

@@ -106,12 +106,12 @@ STAmount::STAmount(SerialIter& sit, SField const& name)
}
Issue issue;
issue.currency.copyFrom (sit.get160 ());
issue.currency = sit.get160();
if (isXRP (issue.currency))
Throw<std::runtime_error> ("invalid native currency");
issue.account.copyFrom (sit.get160 ());
issue.account = sit.get160();
if (isXRP (issue.account))
Throw<std::runtime_error> ("invalid native account");

View File

@@ -91,13 +91,13 @@ STPathSet::STPathSet (SerialIter& sit, SField const& name)
AccountID issuer;
if (hasAccount)
account.copyFrom (sit.get160 ());
account = sit.get160();
if (hasCurrency)
currency.copyFrom (sit.get160 ());
currency = sit.get160();
if (hasIssuer)
issuer.copyFrom (sit.get160 ());
issuer = sit.get160();
path.emplace_back (account, currency, issuer, hasCurrency);
}

View File

@@ -110,7 +110,7 @@ Currency to_currency(std::string const& code)
Currency const& xrpCurrency()
{
static Currency const currency(0);
static Currency const currency(beast::zero);
return currency;
}