mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Replace boost::lexical_cast with beast::lexicalCast
This commit is contained in:
3
TODO.txt
3
TODO.txt
@@ -40,6 +40,9 @@ David Feature:
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- Add "skipped" field to beginTestCase() to disable a test but still record
|
||||||
|
that it was skipped in the output. Like for mdb import.
|
||||||
|
|
||||||
- Get rid of the WriteLog() stuff in the ripple tests and make it report the
|
- Get rid of the WriteLog() stuff in the ripple tests and make it report the
|
||||||
message directly to the UnitTest object. Then update the JUnit XML output
|
message directly to the UnitTest object. Then update the JUnit XML output
|
||||||
routines to also write the auxiliary messages.
|
routines to also write the auxiliary messages.
|
||||||
|
|||||||
@@ -1310,15 +1310,15 @@ void LedgerConsensus::accept (SHAMap::ref set, LoadEvent::pointer)
|
|||||||
if (mValidating)
|
if (mValidating)
|
||||||
{
|
{
|
||||||
// see how close our close time is to other node's close time reports
|
// see how close our close time is to other node's close time reports
|
||||||
WriteLog (lsINFO, LedgerConsensus) << "We closed at " << boost::lexical_cast<std::string> (mCloseTime);
|
WriteLog (lsINFO, LedgerConsensus) << "We closed at " << lexicalCastThrow <std::string> (mCloseTime);
|
||||||
uint64 closeTotal = mCloseTime;
|
uint64 closeTotal = mCloseTime;
|
||||||
int closeCount = 1;
|
int closeCount = 1;
|
||||||
|
|
||||||
for (std::map<uint32, int>::iterator it = mCloseTimes.begin (), end = mCloseTimes.end (); it != end; ++it)
|
for (std::map<uint32, int>::iterator it = mCloseTimes.begin (), end = mCloseTimes.end (); it != end; ++it)
|
||||||
{
|
{
|
||||||
// FIXME: Use median, not average
|
// FIXME: Use median, not average
|
||||||
WriteLog (lsINFO, LedgerConsensus) << boost::lexical_cast<std::string> (it->second) << " time votes for "
|
WriteLog (lsINFO, LedgerConsensus) << lexicalCastThrow <std::string> (it->second) << " time votes for "
|
||||||
<< boost::lexical_cast<std::string> (it->first);
|
<< lexicalCastThrow <std::string> (it->first);
|
||||||
closeCount += it->second;
|
closeCount += it->second;
|
||||||
closeTotal += static_cast<uint64> (it->first) * static_cast<uint64> (it->second);
|
closeTotal += static_cast<uint64> (it->first) * static_cast<uint64> (it->second);
|
||||||
}
|
}
|
||||||
@@ -1464,7 +1464,7 @@ Json::Value LedgerConsensus::getJson (bool full)
|
|||||||
Json::Value ctj (Json::objectValue);
|
Json::Value ctj (Json::objectValue);
|
||||||
BOOST_FOREACH (ct_t & ct, mCloseTimes)
|
BOOST_FOREACH (ct_t & ct, mCloseTimes)
|
||||||
{
|
{
|
||||||
ctj[boost::lexical_cast<std::string> (ct.first)] = ct.second;
|
ctj[lexicalCastThrow <std::string> (ct.first)] = ct.second;
|
||||||
}
|
}
|
||||||
ret["close_times"] = ctj;
|
ret["close_times"] = ctj;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -579,9 +579,9 @@ void Ledger::saveAcceptedLedger (Job&, bool fromConsensus)
|
|||||||
sql += "','";
|
sql += "','";
|
||||||
sql += it->humanAccountID ();
|
sql += it->humanAccountID ();
|
||||||
sql += "',";
|
sql += "',";
|
||||||
sql += boost::lexical_cast<std::string> (getLedgerSeq ());
|
sql += lexicalCastThrow <std::string> (getLedgerSeq ());
|
||||||
sql += ",";
|
sql += ",";
|
||||||
sql += boost::lexical_cast<std::string> (vt.second->getTxnSeq ());
|
sql += lexicalCastThrow <std::string> (vt.second->getTxnSeq ());
|
||||||
sql += ")";
|
sql += ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ void Ledger::saveAcceptedLedger (Job&, bool fromConsensus)
|
|||||||
|
|
||||||
getApp().getLedgerDB ()->getDB ()->executeSQL (boost::str (addLedger %
|
getApp().getLedgerDB ()->getDB ()->executeSQL (boost::str (addLedger %
|
||||||
getHash ().GetHex () % mLedgerSeq % mParentHash.GetHex () %
|
getHash ().GetHex () % mLedgerSeq % mParentHash.GetHex () %
|
||||||
boost::lexical_cast<std::string> (mTotCoins) % mCloseTime % mParentCloseTime %
|
lexicalCastThrow <std::string> (mTotCoins) % mCloseTime % mParentCloseTime %
|
||||||
mCloseResolution % mCloseFlags % mAccountHash.GetHex () % mTransHash.GetHex ()));
|
mCloseResolution % mCloseFlags % mAccountHash.GetHex () % mTransHash.GetHex ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,7 +675,7 @@ Ledger::pointer Ledger::loadByIndex (uint32 ledgerIndex)
|
|||||||
{
|
{
|
||||||
// This is a low-level function with no caching
|
// This is a low-level function with no caching
|
||||||
std::string sql = "SELECT * from Ledgers WHERE LedgerSeq='";
|
std::string sql = "SELECT * from Ledgers WHERE LedgerSeq='";
|
||||||
sql.append (boost::lexical_cast<std::string> (ledgerIndex));
|
sql.append (lexicalCastThrow <std::string> (ledgerIndex));
|
||||||
sql.append ("';");
|
sql.append ("';");
|
||||||
return getSQL (sql);
|
return getSQL (sql);
|
||||||
}
|
}
|
||||||
@@ -813,7 +813,7 @@ uint256 Ledger::getHashByIndex (uint32 ledgerIndex)
|
|||||||
uint256 ret;
|
uint256 ret;
|
||||||
|
|
||||||
std::string sql = "SELECT LedgerHash FROM Ledgers INDEXED BY SeqLedger WHERE LedgerSeq='";
|
std::string sql = "SELECT LedgerHash FROM Ledgers INDEXED BY SeqLedger WHERE LedgerSeq='";
|
||||||
sql.append (boost::lexical_cast<std::string> (ledgerIndex));
|
sql.append (lexicalCastThrow <std::string> (ledgerIndex));
|
||||||
sql.append ("';");
|
sql.append ("';");
|
||||||
|
|
||||||
std::string hash;
|
std::string hash;
|
||||||
@@ -867,7 +867,7 @@ bool Ledger::getHashesByIndex (uint32 ledgerIndex, uint256& ledgerHash, uint256&
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
std::string sql = "SELECT LedgerHash,PrevHash FROM Ledgers WHERE LedgerSeq='";
|
std::string sql = "SELECT LedgerHash,PrevHash FROM Ledgers WHERE LedgerSeq='";
|
||||||
sql.append (boost::lexical_cast<std::string> (ledgerIndex));
|
sql.append (lexicalCastThrow <std::string> (ledgerIndex));
|
||||||
sql.append ("';");
|
sql.append ("';");
|
||||||
|
|
||||||
std::string hash, prevHash;
|
std::string hash, prevHash;
|
||||||
@@ -898,9 +898,9 @@ std::map< uint32, std::pair<uint256, uint256> > Ledger::getHashesByIndex (uint32
|
|||||||
std::map< uint32, std::pair<uint256, uint256> > ret;
|
std::map< uint32, std::pair<uint256, uint256> > ret;
|
||||||
|
|
||||||
std::string sql = "SELECT LedgerSeq,LedgerHash,PrevHash FROM Ledgers WHERE LedgerSeq >= ";
|
std::string sql = "SELECT LedgerSeq,LedgerHash,PrevHash FROM Ledgers WHERE LedgerSeq >= ";
|
||||||
sql.append (boost::lexical_cast<std::string> (minSeq));
|
sql.append (lexicalCastThrow <std::string> (minSeq));
|
||||||
sql.append (" AND LedgerSeq <= ");
|
sql.append (" AND LedgerSeq <= ");
|
||||||
sql.append (boost::lexical_cast<std::string> (maxSeq));
|
sql.append (lexicalCastThrow <std::string> (maxSeq));
|
||||||
sql.append (";");
|
sql.append (";");
|
||||||
|
|
||||||
DatabaseCon* con = getApp().getLedgerDB ();
|
DatabaseCon* con = getApp().getLedgerDB ();
|
||||||
@@ -944,10 +944,10 @@ Json::Value Ledger::getJson (int options)
|
|||||||
|
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
ledger["seqNum"] = boost::lexical_cast<std::string> (mLedgerSeq); // DEPRECATED
|
ledger["seqNum"] = lexicalCastThrow <std::string> (mLedgerSeq); // DEPRECATED
|
||||||
|
|
||||||
ledger["parent_hash"] = mParentHash.GetHex ();
|
ledger["parent_hash"] = mParentHash.GetHex ();
|
||||||
ledger["ledger_index"] = boost::lexical_cast<std::string> (mLedgerSeq);
|
ledger["ledger_index"] = lexicalCastThrow <std::string> (mLedgerSeq);
|
||||||
|
|
||||||
if (mClosed || bFull)
|
if (mClosed || bFull)
|
||||||
{
|
{
|
||||||
@@ -955,13 +955,13 @@ Json::Value Ledger::getJson (int options)
|
|||||||
ledger["closed"] = true;
|
ledger["closed"] = true;
|
||||||
|
|
||||||
ledger["hash"] = mHash.GetHex (); // DEPRECATED
|
ledger["hash"] = mHash.GetHex (); // DEPRECATED
|
||||||
ledger["totalCoins"] = boost::lexical_cast<std::string> (mTotCoins); // DEPRECATED
|
ledger["totalCoins"] = lexicalCastThrow <std::string> (mTotCoins); // DEPRECATED
|
||||||
|
|
||||||
ledger["ledger_hash"] = mHash.GetHex ();
|
ledger["ledger_hash"] = mHash.GetHex ();
|
||||||
ledger["transaction_hash"] = mTransHash.GetHex ();
|
ledger["transaction_hash"] = mTransHash.GetHex ();
|
||||||
ledger["account_hash"] = mAccountHash.GetHex ();
|
ledger["account_hash"] = mAccountHash.GetHex ();
|
||||||
ledger["accepted"] = mAccepted;
|
ledger["accepted"] = mAccepted;
|
||||||
ledger["total_coins"] = boost::lexical_cast<std::string> (mTotCoins);
|
ledger["total_coins"] = lexicalCastThrow <std::string> (mTotCoins);
|
||||||
|
|
||||||
if (mCloseTime != 0)
|
if (mCloseTime != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ Json::Value InboundLedgers::getInfo()
|
|||||||
{
|
{
|
||||||
uint32 seq = it.second->getSeq();
|
uint32 seq = it.second->getSeq();
|
||||||
if (seq > 1)
|
if (seq > 1)
|
||||||
ret[boost::lexical_cast<std::string>(seq)] = it.second->getJson(0);
|
ret[lexicalCastThrow <std::string>(seq)] = it.second->getJson(0);
|
||||||
else
|
else
|
||||||
ret[it.first.GetHex()] = it.second->getJson(0);
|
ret[it.first.GetHex()] = it.second->getJson(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ bool ParameterInt::setValue (const Json::Value& value, Json::Value& error)
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mValue = lexical_cast_st<int> (value.asString ());
|
mValue = lexicalCastThrow <int> (value.asString ());
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -722,7 +722,7 @@ bool ApplicationImp::loadOldLedger (const std::string& l, bool bReplay)
|
|||||||
loadLedger = Ledger::loadByHash (hash);
|
loadLedger = Ledger::loadByHash (hash);
|
||||||
}
|
}
|
||||||
else // assume by sequence
|
else // assume by sequence
|
||||||
loadLedger = Ledger::loadByIndex (boost::lexical_cast<uint32> (l));
|
loadLedger = Ledger::loadByIndex (lexicalCastThrow <uint32> (l));
|
||||||
|
|
||||||
if (!loadLedger)
|
if (!loadLedger)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1230,8 +1230,8 @@ NetworkOPs::transactionsSQL (std::string selection, const RippleAddress& account
|
|||||||
% (descending ? "DESC" : "ASC")
|
% (descending ? "DESC" : "ASC")
|
||||||
% (descending ? "DESC" : "ASC")
|
% (descending ? "DESC" : "ASC")
|
||||||
% (descending ? "DESC" : "ASC")
|
% (descending ? "DESC" : "ASC")
|
||||||
% boost::lexical_cast<std::string> (offset)
|
% lexicalCastThrow <std::string> (offset)
|
||||||
% boost::lexical_cast<std::string> (numberOfResults)
|
% lexicalCastThrow <std::string> (numberOfResults)
|
||||||
);
|
);
|
||||||
WriteLog (lsTRACE, NetworkOPs) << "txSQL query: " << sql;
|
WriteLog (lsTRACE, NetworkOPs) << "txSQL query: " << sql;
|
||||||
return sql;
|
return sql;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ ProofOfWork::ProofOfWork (const std::string& token)
|
|||||||
mToken = token;
|
mToken = token;
|
||||||
mChallenge.SetHex (fields[0]);
|
mChallenge.SetHex (fields[0]);
|
||||||
mTarget.SetHex (fields[1]);
|
mTarget.SetHex (fields[1]);
|
||||||
mIterations = lexical_cast_s<int> (fields[2]);
|
mIterations = lexicalCast <int> (fields[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProofOfWork::isValid () const
|
bool ProofOfWork::isValid () const
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ POWResult ProofOfWorkFactory::checkProof (const std::string& token, uint256 cons
|
|||||||
challenge.SetHex (fields[0]);
|
challenge.SetHex (fields[0]);
|
||||||
target.SetHex (fields[1]);
|
target.SetHex (fields[1]);
|
||||||
|
|
||||||
time_t t = lexical_cast_s<time_t> (fields[3]);
|
time_t t = lexicalCast <time_t> (fields[3]);
|
||||||
time_t now = time (NULL);
|
time_t now = time (NULL);
|
||||||
|
|
||||||
int iterations = lexical_cast_s<int> (fields[2]);
|
int iterations = lexicalCast <int> (fields[2]);
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock sl (mLock);
|
boost::mutex::scoped_lock sl (mLock);
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ void PeerImp::connect (const std::string& strIp, int iPort)
|
|||||||
mIpPortConnect = mIpPort;
|
mIpPortConnect = mIpPort;
|
||||||
assert (!mIpPort.first.empty ());
|
assert (!mIpPort.first.empty ());
|
||||||
|
|
||||||
boost::asio::ip::tcp::resolver::query query (strIp, boost::lexical_cast<std::string> (iPortAct),
|
boost::asio::ip::tcp::resolver::query query (strIp, lexicalCastThrow <std::string> (iPortAct),
|
||||||
boost::asio::ip::resolver_query_base::numeric_host | boost::asio::ip::resolver_query_base::numeric_service);
|
boost::asio::ip::resolver_query_base::numeric_host | boost::asio::ip::resolver_query_base::numeric_service);
|
||||||
boost::asio::ip::tcp::resolver resolver (getApp().getIOService ());
|
boost::asio::ip::tcp::resolver resolver (getApp().getIOService ());
|
||||||
boost::system::error_code err;
|
boost::system::error_code err;
|
||||||
@@ -2411,8 +2411,8 @@ Json::Value PeerImp::getJson ()
|
|||||||
|
|
||||||
if (mHello.has_protoversion () &&
|
if (mHello.has_protoversion () &&
|
||||||
(mHello.protoversion () != MAKE_VERSION_INT (PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR)))
|
(mHello.protoversion () != MAKE_VERSION_INT (PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR)))
|
||||||
ret["protocol"] = boost::lexical_cast<std::string> (GET_VERSION_MAJOR (mHello.protoversion ())) + "." +
|
ret["protocol"] = lexicalCastThrow <std::string> (GET_VERSION_MAJOR (mHello.protoversion ())) + "." +
|
||||||
boost::lexical_cast<std::string> (GET_VERSION_MINOR (mHello.protoversion ()));
|
lexicalCastThrow <std::string> (GET_VERSION_MINOR (mHello.protoversion ()));
|
||||||
|
|
||||||
if (!!mClosedLedgerHash)
|
if (!!mClosedLedgerHash)
|
||||||
ret["ledger"] = mClosedLedgerHash.GetHex ();
|
ret["ledger"] = mClosedLedgerHash.GetHex ();
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ void splitIpPort (const std::string& strIpPort, std::string& strIp, int& iPort)
|
|||||||
boost::split (vIpPort, strIpPort, boost::is_any_of (" "));
|
boost::split (vIpPort, strIpPort, boost::is_any_of (" "));
|
||||||
|
|
||||||
strIp = vIpPort[0];
|
strIp = vIpPort[0];
|
||||||
iPort = boost::lexical_cast<int> (vIpPort[1]);
|
iPort = lexicalCastThrow <int> (vIpPort[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Peers::start ()
|
void Peers::start ()
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
#include <boost/iostreams/concepts.hpp>
|
#include <boost/iostreams/concepts.hpp>
|
||||||
#include <boost/iostreams/stream.hpp>
|
#include <boost/iostreams/stream.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
#include <boost/mem_fn.hpp>
|
#include <boost/mem_fn.hpp>
|
||||||
#include <boost/pointer_cast.hpp>
|
#include <boost/pointer_cast.hpp>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ static bool jvParseLedger (Json::Value& jvRequest, const std::string& strLedger)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jvRequest["ledger_index"] = lexical_cast_s<uint32> (strLedger);
|
jvRequest["ledger_index"] = lexicalCast <uint32> (strLedger);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -319,7 +319,7 @@ Json::Value RPCParser::parseFeature (const Json::Value& jvParams)
|
|||||||
jvRequest["feature"] = jvParams[0u].asString ();
|
jvRequest["feature"] = jvParams[0u].asString ();
|
||||||
|
|
||||||
if (jvParams.size () > 1)
|
if (jvParams.size () > 1)
|
||||||
jvRequest["vote"] = boost::lexical_cast<bool> (jvParams[1u].asString ());
|
jvRequest["vote"] = lexicalCastThrow <bool> (jvParams[1u].asString ());
|
||||||
|
|
||||||
return jvRequest;
|
return jvRequest;
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ Json::Value RPCParser::parseLedgerId (const Json::Value& jvParams)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jvRequest["ledger_index"] = lexical_cast_s<uint32> (strLedger);
|
jvRequest["ledger_index"] = lexicalCast <uint32> (strLedger);
|
||||||
}
|
}
|
||||||
|
|
||||||
return jvRequest;
|
return jvRequest;
|
||||||
@@ -460,7 +460,7 @@ Json::Value RPCParser::parseAccountRaw (const Json::Value& jvParams, bool bPeer)
|
|||||||
strPeer = jvParams[iCursor].asString ();
|
strPeer = jvParams[iCursor].asString ();
|
||||||
|
|
||||||
int iIndex = 0;
|
int iIndex = 0;
|
||||||
// int iIndex = jvParams.size() >= 2 ? lexical_cast_s<int>(jvParams[1u].asString()) : 0;
|
// int iIndex = jvParams.size() >= 2 ? lexicalCast <int>(jvParams[1u].asString()) : 0;
|
||||||
|
|
||||||
RippleAddress raAddress;
|
RippleAddress raAddress;
|
||||||
|
|
||||||
@@ -934,7 +934,7 @@ int commandLineRPC (const std::vector<std::string>& vCmd)
|
|||||||
jvOutput["status"] = "error";
|
jvOutput["status"] = "error";
|
||||||
|
|
||||||
nRet = jvOutput.isMember ("error_code")
|
nRet = jvOutput.isMember ("error_code")
|
||||||
? lexical_cast_s<int> (jvOutput["error_code"].asString ())
|
? lexicalCast <int> (jvOutput["error_code"].asString ())
|
||||||
: 1;
|
: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ Json::Value rpcError (int iError, Json::Value jvResult)
|
|||||||
for (i = NUMBER (errorInfoA); i-- && errorInfoA[i].iError != iError;)
|
for (i = NUMBER (errorInfoA); i-- && errorInfoA[i].iError != iError;)
|
||||||
;
|
;
|
||||||
|
|
||||||
jvResult["error"] = i >= 0 ? errorInfoA[i].pToken : lexical_cast_i (iError);
|
jvResult["error"] = i >= 0 ? errorInfoA[i].pToken : lexicalCast <std::string> (iError);
|
||||||
jvResult["error_message"] = i >= 0 ? errorInfoA[i].pMessage : lexical_cast_i (iError);
|
jvResult["error_message"] = i >= 0 ? errorInfoA[i].pMessage : lexicalCast <std::string> (iError);
|
||||||
jvResult["error_code"] = iError;
|
jvResult["error_code"] = iError;
|
||||||
|
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
|
|||||||
@@ -856,7 +856,7 @@ Json::Value RPCHandler::doProfile (Json::Value params, LoadType* loadType, Appli
|
|||||||
if (!STAmount::currencyFromString(uCurrencyOfferB, params[5u].asString())) // <currency_offer_b>
|
if (!STAmount::currencyFromString(uCurrencyOfferB, params[5u].asString())) // <currency_offer_b>
|
||||||
return rpcError(rpcINVALID_PARAMS);
|
return rpcError(rpcINVALID_PARAMS);
|
||||||
|
|
||||||
iCount = lexical_cast_s<uint32>(params[6u].asString());
|
iCount = lexicalCast <uint32>(params[6u].asString());
|
||||||
|
|
||||||
if (iArgs >= 8 && "false" != params[7u].asString())
|
if (iArgs >= 8 && "false" != params[7u].asString())
|
||||||
bSubmit = true;
|
bSubmit = true;
|
||||||
@@ -2368,7 +2368,7 @@ static void textTime (std::string& text, int& seconds, const char* unitName, int
|
|||||||
if (!text.empty ())
|
if (!text.empty ())
|
||||||
text += ", ";
|
text += ", ";
|
||||||
|
|
||||||
text += boost::lexical_cast<std::string> (i);
|
text += lexicalCastThrow <std::string> (i);
|
||||||
text += " ";
|
text += " ";
|
||||||
text += unitName;
|
text += unitName;
|
||||||
|
|
||||||
|
|||||||
@@ -934,7 +934,7 @@ int SHAMap::flushDirty (DirtyMap& map, int maxNodes, NodeObjectType t, uint32 se
|
|||||||
if (s.getSHA512Half () != it->second->getNodeHash ())
|
if (s.getSHA512Half () != it->second->getNodeHash ())
|
||||||
{
|
{
|
||||||
WriteLog (lsFATAL, SHAMap) << * (it->second);
|
WriteLog (lsFATAL, SHAMap) << * (it->second);
|
||||||
WriteLog (lsFATAL, SHAMap) << lexical_cast_i (s.getDataLength ());
|
WriteLog (lsFATAL, SHAMap) << lexicalCast <std::string> (s.getDataLength ());
|
||||||
WriteLog (lsFATAL, SHAMap) << s.getSHA512Half () << " != " << it->second->getNodeHash ();
|
WriteLog (lsFATAL, SHAMap) << s.getSHA512Half () << " != " << it->second->getNodeHash ();
|
||||||
assert (false);
|
assert (false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ std::string SHAMapNode::getString () const
|
|||||||
return "NodeID(root)";
|
return "NodeID(root)";
|
||||||
|
|
||||||
return str (boost::format (NodeID)
|
return str (boost::format (NodeID)
|
||||||
% boost::lexical_cast<std::string> (mDepth)
|
% lexicalCastThrow <std::string> (mDepth)
|
||||||
% mNodeID.GetHex ());
|
% mNodeID.GetHex ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ void SHAMapTreeNode::dump ()
|
|||||||
std::string SHAMapTreeNode::getString () const
|
std::string SHAMapTreeNode::getString () const
|
||||||
{
|
{
|
||||||
std::string ret = "NodeID(";
|
std::string ret = "NodeID(";
|
||||||
ret += boost::lexical_cast<std::string> (getDepth ());
|
ret += lexicalCastThrow <std::string> (getDepth ());
|
||||||
ret += ",";
|
ret += ",";
|
||||||
ret += getNodeID ().GetHex ();
|
ret += getNodeID ().GetHex ();
|
||||||
ret += ")";
|
ret += ")";
|
||||||
@@ -419,7 +419,7 @@ std::string SHAMapTreeNode::getString () const
|
|||||||
if (!isEmptyBranch (i))
|
if (!isEmptyBranch (i))
|
||||||
{
|
{
|
||||||
ret += "\nb";
|
ret += "\nb";
|
||||||
ret += boost::lexical_cast<std::string> (i);
|
ret += lexicalCastThrow <std::string> (i);
|
||||||
ret += " = ";
|
ret += " = ";
|
||||||
ret += mHashes[i].GetHex ();
|
ret += mHashes[i].GetHex ();
|
||||||
}
|
}
|
||||||
@@ -441,7 +441,7 @@ std::string SHAMapTreeNode::getString () const
|
|||||||
ret += "\n Hash=";
|
ret += "\n Hash=";
|
||||||
ret += mHash.GetHex ();
|
ret += mHash.GetHex ();
|
||||||
ret += "/";
|
ret += "/";
|
||||||
ret += lexical_cast_i (mItem->peekSerializer ().getDataLength ());
|
ret += lexicalCast <std::string> (mItem->peekSerializer ().getDataLength ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -175,10 +175,10 @@ std::string RangeSet::toString () const
|
|||||||
ret += ",";
|
ret += ",";
|
||||||
|
|
||||||
if (it.first == it.second)
|
if (it.first == it.second)
|
||||||
ret += boost::lexical_cast<std::string> ((it.first));
|
ret += lexicalCastThrow <std::string> ((it.first));
|
||||||
else
|
else
|
||||||
ret += boost::lexical_cast<std::string> (it.first) + "-"
|
ret += lexicalCastThrow <std::string> (it.first) + "-"
|
||||||
+ boost::lexical_cast<std::string> (it.second);
|
+ lexicalCastThrow <std::string> (it.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret.empty ())
|
if (ret.empty ())
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
#include <boost/functional/hash.hpp>
|
#include <boost/functional/hash.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
#include <boost/ptr_container/ptr_vector.hpp> // VFALCO NOTE this looks like junk
|
#include <boost/ptr_container/ptr_vector.hpp> // VFALCO NOTE this looks like junk
|
||||||
#include <boost/ref.hpp>
|
#include <boost/ref.hpp>
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ bool parseIpPort (const std::string& strSource, std::string& strIP, int& iPort)
|
|||||||
if (bValid)
|
if (bValid)
|
||||||
{
|
{
|
||||||
strIP = addrIP.to_string ();
|
strIP = addrIP.to_string ();
|
||||||
iPort = strPortRaw.empty () ? -1 : boost::lexical_cast<int> (strPortRaw);
|
iPort = strPortRaw.empty () ? -1 : lexicalCastThrow <int> (strPortRaw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ bool parseUrl (const std::string& strUrl, std::string& strScheme, std::string& s
|
|||||||
|
|
||||||
boost::algorithm::to_lower (strScheme);
|
boost::algorithm::to_lower (strScheme);
|
||||||
|
|
||||||
iPort = strPort.empty () ? -1 : lexical_cast_s<int> (strPort);
|
iPort = strPort.empty () ? -1 : lexicalCast <int> (strPort);
|
||||||
// Log::out() << strUrl << " : " << bMatch << " : '" << strDomain << "' : '" << strPort << "' : " << iPort << " : '" << strPath << "'";
|
// Log::out() << strUrl << " : " << bMatch << " : '" << strDomain << "' : '" << strPort << "' : " << iPort << " : '" << strPath << "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,11 +250,11 @@ bool parseUrl (const std::string& strUrl, std::string& strScheme, std::string& s
|
|||||||
// - floats multiplied by a billion
|
// - floats multiplied by a billion
|
||||||
bool parseQuality (const std::string& strSource, uint32& uQuality)
|
bool parseQuality (const std::string& strSource, uint32& uQuality)
|
||||||
{
|
{
|
||||||
uQuality = lexical_cast_s<uint32> (strSource);
|
uQuality = lexicalCast <uint32> (strSource);
|
||||||
|
|
||||||
if (!uQuality)
|
if (!uQuality)
|
||||||
{
|
{
|
||||||
float fQuality = lexical_cast_s<float> (strSource);
|
float fQuality = lexicalCast <float> (strSource);
|
||||||
|
|
||||||
if (fQuality)
|
if (fQuality)
|
||||||
uQuality = (uint32) (QUALITY_ONE * fQuality);
|
uQuality = (uint32) (QUALITY_ONE * fQuality);
|
||||||
|
|||||||
@@ -168,44 +168,6 @@ inline std::string strGetEnv (const std::string& strKey)
|
|||||||
return getenv (strKey.c_str ()) ? getenv (strKey.c_str ()) : "";
|
return getenv (strKey.c_str ()) ? getenv (strKey.c_str ()) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> T lexical_cast_s (const std::string& string)
|
|
||||||
{
|
|
||||||
// lexically cast a string to the selected type. Does not throw
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return boost::lexical_cast<T> (string);
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T> std::string lexical_cast_i (const T& t)
|
|
||||||
{
|
|
||||||
// lexicaly cast the selected type to a string. Does not throw
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return boost::lexical_cast<std::string> (t);
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T> T lexical_cast_st (const std::string& string)
|
|
||||||
{
|
|
||||||
// lexically cast a string to the selected type. Does throw
|
|
||||||
return boost::lexical_cast<T> (string);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T> std::string lexical_cast_it (const T& t)
|
|
||||||
{
|
|
||||||
// lexicaly cast the selected type to a string. Does not throw
|
|
||||||
return boost::lexical_cast<std::string> (t);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool parseUrl (const std::string& strUrl, std::string& strScheme, std::string& strDomain, int& iPort, std::string& strPath);
|
bool parseUrl (const std::string& strUrl, std::string& strScheme, std::string& strDomain, int& iPort, std::string& strPath);
|
||||||
|
|
||||||
#define ADDRESS(p) strHex(uint64( ((char*) p) - ((char*) 0)))
|
#define ADDRESS(p) strHex(uint64( ((char*) p) - ((char*) 0)))
|
||||||
|
|||||||
@@ -297,10 +297,10 @@ void Config::load ()
|
|||||||
(void) SectionSingleB (secConfig, SECTION_PEER_IP, PEER_IP);
|
(void) SectionSingleB (secConfig, SECTION_PEER_IP, PEER_IP);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_PORT, strTemp))
|
if (SectionSingleB (secConfig, SECTION_PEER_PORT, strTemp))
|
||||||
PEER_PORT = boost::lexical_cast<int> (strTemp);
|
PEER_PORT = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_PRIVATE, strTemp))
|
if (SectionSingleB (secConfig, SECTION_PEER_PRIVATE, strTemp))
|
||||||
PEER_PRIVATE = boost::lexical_cast<bool> (strTemp);
|
PEER_PRIVATE = lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
smtTmp = SectionEntries (secConfig, SECTION_RPC_ADMIN_ALLOW);
|
smtTmp = SectionEntries (secConfig, SECTION_RPC_ADMIN_ALLOW);
|
||||||
|
|
||||||
@@ -333,13 +333,13 @@ void Config::load ()
|
|||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_RPC_PORT, strTemp))
|
if (SectionSingleB (secConfig, SECTION_RPC_PORT, strTemp))
|
||||||
m_rpcPort = boost::lexical_cast<int> (strTemp);
|
m_rpcPort = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, "ledger_creator" , strTemp))
|
if (SectionSingleB (secConfig, "ledger_creator" , strTemp))
|
||||||
LEDGER_CREATOR = boost::lexical_cast<bool> (strTemp);
|
LEDGER_CREATOR = lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp))
|
if (SectionSingleB (secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp))
|
||||||
RPC_ALLOW_REMOTE = boost::lexical_cast<bool> (strTemp);
|
RPC_ALLOW_REMOTE = lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_NODE_SIZE, strTemp))
|
if (SectionSingleB (secConfig, SECTION_NODE_SIZE, strTemp))
|
||||||
{
|
{
|
||||||
@@ -355,7 +355,7 @@ void Config::load ()
|
|||||||
NODE_SIZE = 4;
|
NODE_SIZE = 4;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NODE_SIZE = boost::lexical_cast<int> (strTemp);
|
NODE_SIZE = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (NODE_SIZE < 0)
|
if (NODE_SIZE < 0)
|
||||||
NODE_SIZE = 0;
|
NODE_SIZE = 0;
|
||||||
@@ -365,33 +365,33 @@ void Config::load ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_ELB_SUPPORT, strTemp))
|
if (SectionSingleB (secConfig, SECTION_ELB_SUPPORT, strTemp))
|
||||||
ELB_SUPPORT = boost::lexical_cast<bool> (strTemp);
|
ELB_SUPPORT = lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_WEBSOCKET_IP, WEBSOCKET_IP);
|
(void) SectionSingleB (secConfig, SECTION_WEBSOCKET_IP, WEBSOCKET_IP);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PORT, strTemp))
|
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PORT, strTemp))
|
||||||
WEBSOCKET_PORT = boost::lexical_cast<int> (strTemp);
|
WEBSOCKET_PORT = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_IP, WEBSOCKET_PUBLIC_IP);
|
(void) SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_IP, WEBSOCKET_PUBLIC_IP);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_PORT, strTemp))
|
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_PORT, strTemp))
|
||||||
WEBSOCKET_PUBLIC_PORT = boost::lexical_cast<int> (strTemp);
|
WEBSOCKET_PUBLIC_PORT = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_SECURE, strTemp))
|
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_SECURE, strTemp))
|
||||||
WEBSOCKET_SECURE = boost::lexical_cast<int> (strTemp);
|
WEBSOCKET_SECURE = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_SECURE, strTemp))
|
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_SECURE, strTemp))
|
||||||
WEBSOCKET_PUBLIC_SECURE = boost::lexical_cast<int> (strTemp);
|
WEBSOCKET_PUBLIC_SECURE = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PING_FREQ, strTemp))
|
if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PING_FREQ, strTemp))
|
||||||
WEBSOCKET_PING_FREQ = boost::lexical_cast<int> (strTemp);
|
WEBSOCKET_PING_FREQ = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_CERT, WEBSOCKET_SSL_CERT);
|
SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_CERT, WEBSOCKET_SSL_CERT);
|
||||||
SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_CHAIN, WEBSOCKET_SSL_CHAIN);
|
SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_CHAIN, WEBSOCKET_SSL_CHAIN);
|
||||||
SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_KEY, WEBSOCKET_SSL_KEY);
|
SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_KEY, WEBSOCKET_SSL_KEY);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_RPC_SECURE, strTemp))
|
if (SectionSingleB (secConfig, SECTION_RPC_SECURE, strTemp))
|
||||||
RPC_SECURE = boost::lexical_cast<int> (strTemp);
|
RPC_SECURE = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
SectionSingleB (secConfig, SECTION_RPC_SSL_CERT, RPC_SSL_CERT);
|
SectionSingleB (secConfig, SECTION_RPC_SSL_CERT, RPC_SSL_CERT);
|
||||||
SectionSingleB (secConfig, SECTION_RPC_SSL_CHAIN, RPC_SSL_CHAIN);
|
SectionSingleB (secConfig, SECTION_RPC_SSL_CHAIN, RPC_SSL_CHAIN);
|
||||||
@@ -402,7 +402,7 @@ void Config::load ()
|
|||||||
SectionSingleB (secConfig, SECTION_SSL_VERIFY_DIR, SSL_VERIFY_DIR);
|
SectionSingleB (secConfig, SECTION_SSL_VERIFY_DIR, SSL_VERIFY_DIR);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_SSL_VERIFY, strTemp))
|
if (SectionSingleB (secConfig, SECTION_SSL_VERIFY, strTemp))
|
||||||
SSL_VERIFY = boost::lexical_cast<bool> (strTemp);
|
SSL_VERIFY = lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_VALIDATION_SEED, strTemp))
|
if (SectionSingleB (secConfig, SECTION_VALIDATION_SEED, strTemp))
|
||||||
{
|
{
|
||||||
@@ -430,37 +430,37 @@ void Config::load ()
|
|||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_SCAN_INTERVAL_MIN, strTemp))
|
if (SectionSingleB (secConfig, SECTION_PEER_SCAN_INTERVAL_MIN, strTemp))
|
||||||
// Minimum for min is 60 seconds.
|
// Minimum for min is 60 seconds.
|
||||||
PEER_SCAN_INTERVAL_MIN = std::max (60, boost::lexical_cast<int> (strTemp));
|
PEER_SCAN_INTERVAL_MIN = std::max (60, lexicalCastThrow <int> (strTemp));
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_START_MAX, strTemp))
|
if (SectionSingleB (secConfig, SECTION_PEER_START_MAX, strTemp))
|
||||||
PEER_START_MAX = std::max (1, boost::lexical_cast<int> (strTemp));
|
PEER_START_MAX = std::max (1, lexicalCastThrow <int> (strTemp));
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PEER_CONNECT_LOW_WATER, strTemp))
|
if (SectionSingleB (secConfig, SECTION_PEER_CONNECT_LOW_WATER, strTemp))
|
||||||
PEER_CONNECT_LOW_WATER = std::max (1, boost::lexical_cast<int> (strTemp));
|
PEER_CONNECT_LOW_WATER = std::max (1, lexicalCastThrow <int> (strTemp));
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_NETWORK_QUORUM, strTemp))
|
if (SectionSingleB (secConfig, SECTION_NETWORK_QUORUM, strTemp))
|
||||||
NETWORK_QUORUM = std::max (0, boost::lexical_cast<int> (strTemp));
|
NETWORK_QUORUM = std::max (0, lexicalCastThrow <int> (strTemp));
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_VALIDATION_QUORUM, strTemp))
|
if (SectionSingleB (secConfig, SECTION_VALIDATION_QUORUM, strTemp))
|
||||||
VALIDATION_QUORUM = std::max (0, boost::lexical_cast<int> (strTemp));
|
VALIDATION_QUORUM = std::max (0, lexicalCastThrow <int> (strTemp));
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_ACCOUNT_RESERVE, strTemp))
|
if (SectionSingleB (secConfig, SECTION_FEE_ACCOUNT_RESERVE, strTemp))
|
||||||
FEE_ACCOUNT_RESERVE = boost::lexical_cast<uint64> (strTemp);
|
FEE_ACCOUNT_RESERVE = lexicalCastThrow <uint64> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_OWNER_RESERVE, strTemp))
|
if (SectionSingleB (secConfig, SECTION_FEE_OWNER_RESERVE, strTemp))
|
||||||
FEE_OWNER_RESERVE = boost::lexical_cast<uint64> (strTemp);
|
FEE_OWNER_RESERVE = lexicalCastThrow <uint64> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_NICKNAME_CREATE, strTemp))
|
if (SectionSingleB (secConfig, SECTION_FEE_NICKNAME_CREATE, strTemp))
|
||||||
FEE_NICKNAME_CREATE = boost::lexical_cast<int> (strTemp);
|
FEE_NICKNAME_CREATE = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_OFFER, strTemp))
|
if (SectionSingleB (secConfig, SECTION_FEE_OFFER, strTemp))
|
||||||
FEE_OFFER = boost::lexical_cast<int> (strTemp);
|
FEE_OFFER = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_DEFAULT, strTemp))
|
if (SectionSingleB (secConfig, SECTION_FEE_DEFAULT, strTemp))
|
||||||
FEE_DEFAULT = boost::lexical_cast<int> (strTemp);
|
FEE_DEFAULT = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_FEE_OPERATION, strTemp))
|
if (SectionSingleB (secConfig, SECTION_FEE_OPERATION, strTemp))
|
||||||
FEE_CONTRACT_OPERATION = boost::lexical_cast<int> (strTemp);
|
FEE_CONTRACT_OPERATION = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_LEDGER_HISTORY, strTemp))
|
if (SectionSingleB (secConfig, SECTION_LEDGER_HISTORY, strTemp))
|
||||||
{
|
{
|
||||||
@@ -471,14 +471,14 @@ void Config::load ()
|
|||||||
else if (strTemp == "full")
|
else if (strTemp == "full")
|
||||||
LEDGER_HISTORY = 1000000000u;
|
LEDGER_HISTORY = 1000000000u;
|
||||||
else
|
else
|
||||||
LEDGER_HISTORY = boost::lexical_cast<uint32> (strTemp);
|
LEDGER_HISTORY = lexicalCastThrow <uint32> (strTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_PATH_SEARCH_SIZE, strTemp))
|
if (SectionSingleB (secConfig, SECTION_PATH_SEARCH_SIZE, strTemp))
|
||||||
PATH_SEARCH_SIZE = boost::lexical_cast<int> (strTemp);
|
PATH_SEARCH_SIZE = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (SectionSingleB (secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp))
|
if (SectionSingleB (secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp))
|
||||||
ACCOUNT_PROBE_MAX = boost::lexical_cast<int> (strTemp);
|
ACCOUNT_PROBE_MAX = lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
(void) SectionSingleB (secConfig, SECTION_SMS_FROM, SMS_FROM);
|
(void) SectionSingleB (secConfig, SECTION_SMS_FROM, SMS_FROM);
|
||||||
(void) SectionSingleB (secConfig, SECTION_SMS_KEY, SMS_KEY);
|
(void) SectionSingleB (secConfig, SECTION_SMS_KEY, SMS_KEY);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ SField::SField (SerializedTypeID tid, int fv) : fieldCode (FIELD_CODE (tid, fv))
|
|||||||
fieldMeta (sMD_Default), fieldNum (++num), signingField (true)
|
fieldMeta (sMD_Default), fieldNum (++num), signingField (true)
|
||||||
{
|
{
|
||||||
// call with the map mutex
|
// call with the map mutex
|
||||||
fieldName = lexical_cast_i (tid) + "/" + lexical_cast_i (fv);
|
fieldName = lexicalCast <std::string> (tid) + "/" + lexicalCast <std::string> (fv);
|
||||||
codeToField[fieldCode] = this;
|
codeToField[fieldCode] = this;
|
||||||
assert ((fv != 1) || ((tid != STI_ARRAY) && (tid != STI_OBJECT)));
|
assert ((fv != 1) || ((tid != STI_ARRAY) && (tid != STI_OBJECT)));
|
||||||
}
|
}
|
||||||
@@ -108,8 +108,8 @@ std::string SField::getName () const
|
|||||||
if (fieldValue == 0)
|
if (fieldValue == 0)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return boost::lexical_cast<std::string> (static_cast<int> (fieldType)) + "/" +
|
return lexicalCastThrow <std::string> (static_cast<int> (fieldType)) + "/" +
|
||||||
boost::lexical_cast<std::string> (fieldValue);
|
lexicalCastThrow <std::string> (fieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
SField::ref SField::getField (const std::string& fieldName)
|
SField::ref SField::getField (const std::string& fieldName)
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ STAmount::STAmount (SField::ref n, const Json::Value& v)
|
|||||||
{
|
{
|
||||||
if (mIsNative)
|
if (mIsNative)
|
||||||
{
|
{
|
||||||
int64 val = lexical_cast_st<int64> (value.asString ());
|
int64 val = lexicalCastThrow <int64> (value.asString ());
|
||||||
|
|
||||||
if (val >= 0)
|
if (val >= 0)
|
||||||
mValue = val;
|
mValue = val;
|
||||||
@@ -276,13 +276,13 @@ bool STAmount::setValue (const std::string& sAmount)
|
|||||||
|
|
||||||
if (!smMatch[4].matched) // integer only
|
if (!smMatch[4].matched) // integer only
|
||||||
{
|
{
|
||||||
mValue = lexical_cast_s<uint64> (smMatch[2]);
|
mValue = lexicalCast <uint64> (std::string (smMatch[2]));
|
||||||
mOffset = 0;
|
mOffset = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// integer and fraction
|
// integer and fraction
|
||||||
mValue = lexical_cast_s<uint64> (smMatch[2] + smMatch[4]);
|
mValue = lexicalCast <uint64> (smMatch[2] + smMatch[4]);
|
||||||
mOffset = - (smMatch[4].length ());
|
mOffset = - (smMatch[4].length ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,9 +290,9 @@ bool STAmount::setValue (const std::string& sAmount)
|
|||||||
{
|
{
|
||||||
// we have an exponent
|
// we have an exponent
|
||||||
if (smMatch[6].matched && (smMatch[6] == "-"))
|
if (smMatch[6].matched && (smMatch[6] == "-"))
|
||||||
mOffset -= lexical_cast_s<int> (smMatch[7]);
|
mOffset -= lexicalCast <int> (std::string (smMatch[7]));
|
||||||
else
|
else
|
||||||
mOffset += lexical_cast_s<int> (smMatch[7]);
|
mOffset += lexicalCast <int> (std::string (smMatch[7]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
@@ -593,15 +593,15 @@ std::string STAmount::getRaw () const
|
|||||||
|
|
||||||
if (mIsNative)
|
if (mIsNative)
|
||||||
{
|
{
|
||||||
if (mIsNegative) return std::string ("-") + lexical_cast_i (mValue);
|
if (mIsNegative) return std::string ("-") + lexicalCast <std::string> (mValue);
|
||||||
else return lexical_cast_i (mValue);
|
else return lexicalCast <std::string> (mValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsNegative)
|
if (mIsNegative)
|
||||||
return mCurrency.GetHex () + ": -" +
|
return mCurrency.GetHex () + ": -" +
|
||||||
lexical_cast_i (mValue) + "e" + lexical_cast_i (mOffset);
|
lexicalCast <std::string> (mValue) + "e" + lexicalCast <std::string> (mOffset);
|
||||||
else return mCurrency.GetHex () + ": " +
|
else return mCurrency.GetHex () + ": " +
|
||||||
lexical_cast_i (mValue) + "e" + lexical_cast_i (mOffset);
|
lexicalCast <std::string> (mValue) + "e" + lexicalCast <std::string> (mOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string STAmount::getText () const
|
std::string STAmount::getText () const
|
||||||
@@ -612,21 +612,21 @@ std::string STAmount::getText () const
|
|||||||
if (mIsNative)
|
if (mIsNative)
|
||||||
{
|
{
|
||||||
if (mIsNegative)
|
if (mIsNegative)
|
||||||
return std::string ("-") + lexical_cast_i (mValue);
|
return std::string ("-") + lexicalCast <std::string> (mValue);
|
||||||
else return lexical_cast_i (mValue);
|
else return lexicalCast <std::string> (mValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mOffset != 0) && ((mOffset < -25) || (mOffset > -5)))
|
if ((mOffset != 0) && ((mOffset < -25) || (mOffset > -5)))
|
||||||
{
|
{
|
||||||
if (mIsNegative)
|
if (mIsNegative)
|
||||||
return std::string ("-") + lexical_cast_i (mValue) +
|
return std::string ("-") + lexicalCast <std::string> (mValue) +
|
||||||
"e" + lexical_cast_i (mOffset);
|
"e" + lexicalCast <std::string> (mOffset);
|
||||||
else
|
else
|
||||||
return lexical_cast_i (mValue) + "e" + lexical_cast_i (mOffset);
|
return lexicalCast <std::string> (mValue) + "e" + lexicalCast <std::string> (mOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string val = "000000000000000000000000000";
|
std::string val = "000000000000000000000000000";
|
||||||
val += lexical_cast_i (mValue);
|
val += lexicalCast <std::string> (mValue);
|
||||||
val += "00000000000000000000000";
|
val += "00000000000000000000000";
|
||||||
|
|
||||||
std::string pre = val.substr (0, mOffset + 43);
|
std::string pre = val.substr (0, mOffset + 43);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ UPTR_T<SerializedType> STObject::makeDefaultObject (SerializedTypeID id, SField:
|
|||||||
return UPTR_T<SerializedType> (new STArray (name));
|
return UPTR_T<SerializedType> (new STArray (name));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WriteLog (lsFATAL, STObject) << "Object type: " << lexical_cast_i (id);
|
WriteLog (lsFATAL, STObject) << "Object type: " << lexicalCast <std::string> (id);
|
||||||
assert (false);
|
assert (false);
|
||||||
throw std::runtime_error ("Unknown object type");
|
throw std::runtime_error ("Unknown object type");
|
||||||
}
|
}
|
||||||
@@ -1044,7 +1044,7 @@ Json::Value STObject::getJson (int options) const
|
|||||||
if (it.getSType () != STI_NOTPRESENT)
|
if (it.getSType () != STI_NOTPRESENT)
|
||||||
{
|
{
|
||||||
if (!it.getFName ().hasName ())
|
if (!it.getFName ().hasName ())
|
||||||
ret[lexical_cast_i (index)] = it.getJson (options);
|
ret[lexicalCast <std::string> (index)] = it.getJson (options);
|
||||||
else
|
else
|
||||||
ret[it.getName ()] = it.getJson (options);
|
ret[it.getName ()] = it.getJson (options);
|
||||||
}
|
}
|
||||||
@@ -1153,7 +1153,7 @@ Json::Value STArray::getJson (int p) const
|
|||||||
Json::Value inner = Json::objectValue;
|
Json::Value inner = Json::objectValue;
|
||||||
|
|
||||||
if (!object.getFName ().hasName ())
|
if (!object.getFName ().hasName ())
|
||||||
inner[lexical_cast_i (index)] = object.getJson (p);
|
inner[lexicalCast <std::string> (index)] = object.getJson (p);
|
||||||
else
|
else
|
||||||
inner[object.getName ()] = object.getJson (p);
|
inner[object.getName ()] = object.getJson (p);
|
||||||
|
|
||||||
@@ -1253,10 +1253,10 @@ UPTR_T<STObject> STObject::parseJson (const Json::Value& object, SField::ref inN
|
|||||||
if (FUNCTION_THAT_DOESNT_EXIST (value.asString (), terCode))
|
if (FUNCTION_THAT_DOESNT_EXIST (value.asString (), terCode))
|
||||||
value = static_cast<int> (terCode);
|
value = static_cast<int> (terCode);
|
||||||
else
|
else
|
||||||
data.push_back (new STUInt8 (field, lexical_cast_st<unsigned char> (value.asString ())));
|
data.push_back (new STUInt8 (field, lexicalCastThrow <unsigned char> (value.asString ())));
|
||||||
}
|
}
|
||||||
|
|
||||||
data.push_back (new STUInt8 (field, lexical_cast_st<unsigned char> (value.asString ())));
|
data.push_back (new STUInt8 (field, lexicalCastThrow <unsigned char> (value.asString ())));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (value.isInt ())
|
else if (value.isInt ())
|
||||||
@@ -1308,7 +1308,7 @@ UPTR_T<STObject> STObject::parseJson (const Json::Value& object, SField::ref inN
|
|||||||
throw std::runtime_error ("Invalid field data");
|
throw std::runtime_error ("Invalid field data");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
data.push_back (new STUInt16 (field, lexical_cast_st<uint16> (strValue)));
|
data.push_back (new STUInt16 (field, lexicalCastThrow <uint16> (strValue)));
|
||||||
}
|
}
|
||||||
else if (value.isInt ())
|
else if (value.isInt ())
|
||||||
data.push_back (new STUInt16 (field, range_check_cast<uint16> (value.asInt (), 0, 65535)));
|
data.push_back (new STUInt16 (field, range_check_cast<uint16> (value.asInt (), 0, 65535)));
|
||||||
@@ -1322,7 +1322,7 @@ UPTR_T<STObject> STObject::parseJson (const Json::Value& object, SField::ref inN
|
|||||||
case STI_UINT32:
|
case STI_UINT32:
|
||||||
if (value.isString ())
|
if (value.isString ())
|
||||||
{
|
{
|
||||||
data.push_back (new STUInt32 (field, lexical_cast_st<uint32> (value.asString ())));
|
data.push_back (new STUInt32 (field, lexicalCastThrow <uint32> (value.asString ())));
|
||||||
}
|
}
|
||||||
else if (value.isInt ())
|
else if (value.isInt ())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ std::string STUInt8::getText () const
|
|||||||
return human;
|
return human;
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::lexical_cast<std::string> (value);
|
return lexicalCastThrow <std::string> (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value STUInt8::getJson (int) const
|
Json::Value STUInt8::getJson (int) const
|
||||||
@@ -147,7 +147,7 @@ std::string STUInt16::getText () const
|
|||||||
return item->getName ();
|
return item->getName ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::lexical_cast<std::string> (value);
|
return lexicalCastThrow <std::string> (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value STUInt16::getJson (int) const
|
Json::Value STUInt16::getJson (int) const
|
||||||
@@ -186,7 +186,7 @@ STUInt32* STUInt32::construct (SerializerIterator& u, SField::ref name)
|
|||||||
|
|
||||||
std::string STUInt32::getText () const
|
std::string STUInt32::getText () const
|
||||||
{
|
{
|
||||||
return boost::lexical_cast<std::string> (value);
|
return lexicalCastThrow <std::string> (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value STUInt32::getJson (int) const
|
Json::Value STUInt32::getJson (int) const
|
||||||
@@ -207,7 +207,7 @@ STUInt64* STUInt64::construct (SerializerIterator& u, SField::ref name)
|
|||||||
|
|
||||||
std::string STUInt64::getText () const
|
std::string STUInt64::getText () const
|
||||||
{
|
{
|
||||||
return boost::lexical_cast<std::string> (value);
|
return lexicalCastThrow <std::string> (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value STUInt64::getJson (int) const
|
Json::Value STUInt64::getJson (int) const
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/functional/hash.hpp>
|
#include <boost/functional/hash.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include <boost/range/adaptor/copied.hpp>
|
#include <boost/range/adaptor/copied.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
|
|||||||
@@ -738,7 +738,7 @@ Value::asString () const
|
|||||||
return value_.bool_ ? "true" : "false";
|
return value_.bool_ ? "true" : "false";
|
||||||
|
|
||||||
case intValue:
|
case intValue:
|
||||||
return boost::lexical_cast<std::string> (value_.int_);
|
return lexicalCastThrow <std::string> (value_.int_);
|
||||||
|
|
||||||
case uintValue:
|
case uintValue:
|
||||||
case realValue:
|
case realValue:
|
||||||
@@ -784,7 +784,7 @@ Value::asInt () const
|
|||||||
return value_.bool_ ? 1 : 0;
|
return value_.bool_ ? 1 : 0;
|
||||||
|
|
||||||
case stringValue:
|
case stringValue:
|
||||||
return boost::lexical_cast<int> (value_.string_);
|
return lexicalCastThrow <int> (value_.string_);
|
||||||
|
|
||||||
case arrayValue:
|
case arrayValue:
|
||||||
case objectValue:
|
case objectValue:
|
||||||
@@ -820,7 +820,7 @@ Value::asUInt () const
|
|||||||
return value_.bool_ ? 1 : 0;
|
return value_.bool_ ? 1 : 0;
|
||||||
|
|
||||||
case stringValue:
|
case stringValue:
|
||||||
return boost::lexical_cast<unsigned int> (value_.string_);
|
return lexicalCastThrow <unsigned int> (value_.string_);
|
||||||
|
|
||||||
case arrayValue:
|
case arrayValue:
|
||||||
case objectValue:
|
case objectValue:
|
||||||
|
|||||||
@@ -21,9 +21,6 @@
|
|||||||
# include <cpptl/conststring.h>
|
# include <cpptl/conststring.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VFALCO TODO eliminate this boost dependency
|
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
|
|
||||||
#ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
|
#ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
|
||||||
#include "json/json_batchallocator.h"
|
#include "json/json_batchallocator.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ HTTPRequest::Action HTTPRequest::consume (boost::asio::streambuf& buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (headerName == "content-length")
|
if (headerName == "content-length")
|
||||||
iDataSize = boost::lexical_cast<int> (headerValue);
|
iDataSize = lexicalCastThrow <int> (headerValue);
|
||||||
|
|
||||||
if (headerName == "authorization")
|
if (headerName == "authorization")
|
||||||
sAuthorization = headerValue;
|
sAuthorization = headerValue;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ void HttpsClient::httpsNext ()
|
|||||||
boost::shared_ptr <boost::asio::ip::tcp::resolver::query> query (
|
boost::shared_ptr <boost::asio::ip::tcp::resolver::query> query (
|
||||||
new boost::asio::ip::tcp::resolver::query (
|
new boost::asio::ip::tcp::resolver::query (
|
||||||
mDeqSites[0],
|
mDeqSites[0],
|
||||||
boost::lexical_cast <std::string> (mPort),
|
lexicalCast <std::string> (mPort),
|
||||||
boost::asio::ip::resolver_query_base::numeric_service));
|
boost::asio::ip::resolver_query_base::numeric_service));
|
||||||
mQuery = query;
|
mQuery = query;
|
||||||
|
|
||||||
@@ -303,14 +303,14 @@ void HttpsClient::handleHeader (const boost::system::error_code& ecResult, std::
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mStatus = lexical_cast_st<int> (smMatch[1]);
|
mStatus = lexicalCastThrow <int> (std::string (smMatch[1]));
|
||||||
|
|
||||||
if (boost::regex_match (strHeader, smMatch, reBody)) // we got some body
|
if (boost::regex_match (strHeader, smMatch, reBody)) // we got some body
|
||||||
mBody = smMatch[1];
|
mBody = smMatch[1];
|
||||||
|
|
||||||
if (boost::regex_match (strHeader, smMatch, reSize))
|
if (boost::regex_match (strHeader, smMatch, reSize))
|
||||||
{
|
{
|
||||||
int size = lexical_cast_st<int> (smMatch[1]);
|
int size = lexicalCastThrow <int> (std::string(smMatch[1]));
|
||||||
|
|
||||||
if (size < mResponseMax)
|
if (size < mResponseMax)
|
||||||
mResponseMax = size;
|
mResponseMax = size;
|
||||||
|
|||||||
Reference in New Issue
Block a user