diff --git a/TODO.txt b/TODO.txt index 1b757080d..99d3f9286 100644 --- a/TODO.txt +++ b/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 message directly to the UnitTest object. Then update the JUnit XML output routines to also write the auxiliary messages. diff --git a/modules/ripple_app/consensus/ripple_LedgerConsensus.cpp b/modules/ripple_app/consensus/ripple_LedgerConsensus.cpp index b5691b397..525d7c908 100644 --- a/modules/ripple_app/consensus/ripple_LedgerConsensus.cpp +++ b/modules/ripple_app/consensus/ripple_LedgerConsensus.cpp @@ -1310,15 +1310,15 @@ void LedgerConsensus::accept (SHAMap::ref set, LoadEvent::pointer) if (mValidating) { // see how close our close time is to other node's close time reports - WriteLog (lsINFO, LedgerConsensus) << "We closed at " << boost::lexical_cast (mCloseTime); + WriteLog (lsINFO, LedgerConsensus) << "We closed at " << lexicalCastThrow (mCloseTime); uint64 closeTotal = mCloseTime; int closeCount = 1; for (std::map::iterator it = mCloseTimes.begin (), end = mCloseTimes.end (); it != end; ++it) { // FIXME: Use median, not average - WriteLog (lsINFO, LedgerConsensus) << boost::lexical_cast (it->second) << " time votes for " - << boost::lexical_cast (it->first); + WriteLog (lsINFO, LedgerConsensus) << lexicalCastThrow (it->second) << " time votes for " + << lexicalCastThrow (it->first); closeCount += it->second; closeTotal += static_cast (it->first) * static_cast (it->second); } @@ -1464,7 +1464,7 @@ Json::Value LedgerConsensus::getJson (bool full) Json::Value ctj (Json::objectValue); BOOST_FOREACH (ct_t & ct, mCloseTimes) { - ctj[boost::lexical_cast (ct.first)] = ct.second; + ctj[lexicalCastThrow (ct.first)] = ct.second; } ret["close_times"] = ctj; } diff --git a/modules/ripple_app/ledger/Ledger.cpp b/modules/ripple_app/ledger/Ledger.cpp index 72825cf45..0ed9320ca 100644 --- a/modules/ripple_app/ledger/Ledger.cpp +++ b/modules/ripple_app/ledger/Ledger.cpp @@ -579,9 +579,9 @@ void Ledger::saveAcceptedLedger (Job&, bool fromConsensus) sql += "','"; sql += it->humanAccountID (); sql += "',"; - sql += boost::lexical_cast (getLedgerSeq ()); + sql += lexicalCastThrow (getLedgerSeq ()); sql += ","; - sql += boost::lexical_cast (vt.second->getTxnSeq ()); + sql += lexicalCastThrow (vt.second->getTxnSeq ()); sql += ")"; } @@ -603,7 +603,7 @@ void Ledger::saveAcceptedLedger (Job&, bool fromConsensus) getApp().getLedgerDB ()->getDB ()->executeSQL (boost::str (addLedger % getHash ().GetHex () % mLedgerSeq % mParentHash.GetHex () % - boost::lexical_cast (mTotCoins) % mCloseTime % mParentCloseTime % + lexicalCastThrow (mTotCoins) % mCloseTime % mParentCloseTime % 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 std::string sql = "SELECT * from Ledgers WHERE LedgerSeq='"; - sql.append (boost::lexical_cast (ledgerIndex)); + sql.append (lexicalCastThrow (ledgerIndex)); sql.append ("';"); return getSQL (sql); } @@ -813,7 +813,7 @@ uint256 Ledger::getHashByIndex (uint32 ledgerIndex) uint256 ret; std::string sql = "SELECT LedgerHash FROM Ledgers INDEXED BY SeqLedger WHERE LedgerSeq='"; - sql.append (boost::lexical_cast (ledgerIndex)); + sql.append (lexicalCastThrow (ledgerIndex)); sql.append ("';"); std::string hash; @@ -867,7 +867,7 @@ bool Ledger::getHashesByIndex (uint32 ledgerIndex, uint256& ledgerHash, uint256& #else std::string sql = "SELECT LedgerHash,PrevHash FROM Ledgers WHERE LedgerSeq='"; - sql.append (boost::lexical_cast (ledgerIndex)); + sql.append (lexicalCastThrow (ledgerIndex)); sql.append ("';"); std::string hash, prevHash; @@ -898,9 +898,9 @@ std::map< uint32, std::pair > Ledger::getHashesByIndex (uint32 std::map< uint32, std::pair > ret; std::string sql = "SELECT LedgerSeq,LedgerHash,PrevHash FROM Ledgers WHERE LedgerSeq >= "; - sql.append (boost::lexical_cast (minSeq)); + sql.append (lexicalCastThrow (minSeq)); sql.append (" AND LedgerSeq <= "); - sql.append (boost::lexical_cast (maxSeq)); + sql.append (lexicalCastThrow (maxSeq)); sql.append (";"); DatabaseCon* con = getApp().getLedgerDB (); @@ -944,10 +944,10 @@ Json::Value Ledger::getJson (int options) boost::recursive_mutex::scoped_lock sl (mLock); - ledger["seqNum"] = boost::lexical_cast (mLedgerSeq); // DEPRECATED + ledger["seqNum"] = lexicalCastThrow (mLedgerSeq); // DEPRECATED ledger["parent_hash"] = mParentHash.GetHex (); - ledger["ledger_index"] = boost::lexical_cast (mLedgerSeq); + ledger["ledger_index"] = lexicalCastThrow (mLedgerSeq); if (mClosed || bFull) { @@ -955,13 +955,13 @@ Json::Value Ledger::getJson (int options) ledger["closed"] = true; ledger["hash"] = mHash.GetHex (); // DEPRECATED - ledger["totalCoins"] = boost::lexical_cast (mTotCoins); // DEPRECATED + ledger["totalCoins"] = lexicalCastThrow (mTotCoins); // DEPRECATED ledger["ledger_hash"] = mHash.GetHex (); ledger["transaction_hash"] = mTransHash.GetHex (); ledger["account_hash"] = mAccountHash.GetHex (); ledger["accepted"] = mAccepted; - ledger["total_coins"] = boost::lexical_cast (mTotCoins); + ledger["total_coins"] = lexicalCastThrow (mTotCoins); if (mCloseTime != 0) { diff --git a/modules/ripple_app/ledger/ripple_InboundLedgers.cpp b/modules/ripple_app/ledger/ripple_InboundLedgers.cpp index 2d6a36a31..43c87f329 100644 --- a/modules/ripple_app/ledger/ripple_InboundLedgers.cpp +++ b/modules/ripple_app/ledger/ripple_InboundLedgers.cpp @@ -289,7 +289,7 @@ Json::Value InboundLedgers::getInfo() { uint32 seq = it.second->getSeq(); if (seq > 1) - ret[boost::lexical_cast(seq)] = it.second->getJson(0); + ret[lexicalCastThrow (seq)] = it.second->getJson(0); else ret[it.first.GetHex()] = it.second->getJson(0); } diff --git a/modules/ripple_app/main/ParameterTable.cpp b/modules/ripple_app/main/ParameterTable.cpp index 3152a838e..3bdf28ff0 100644 --- a/modules/ripple_app/main/ParameterTable.cpp +++ b/modules/ripple_app/main/ParameterTable.cpp @@ -164,7 +164,7 @@ bool ParameterInt::setValue (const Json::Value& value, Json::Value& error) { try { - mValue = lexical_cast_st (value.asString ()); + mValue = lexicalCastThrow (value.asString ()); } catch (...) { diff --git a/modules/ripple_app/main/ripple_Application.cpp b/modules/ripple_app/main/ripple_Application.cpp index 39d7580ce..abfd68c3f 100644 --- a/modules/ripple_app/main/ripple_Application.cpp +++ b/modules/ripple_app/main/ripple_Application.cpp @@ -722,7 +722,7 @@ bool ApplicationImp::loadOldLedger (const std::string& l, bool bReplay) loadLedger = Ledger::loadByHash (hash); } else // assume by sequence - loadLedger = Ledger::loadByIndex (boost::lexical_cast (l)); + loadLedger = Ledger::loadByIndex (lexicalCastThrow (l)); if (!loadLedger) { diff --git a/modules/ripple_app/misc/NetworkOPs.cpp b/modules/ripple_app/misc/NetworkOPs.cpp index 2d90644d8..08da9c930 100644 --- a/modules/ripple_app/misc/NetworkOPs.cpp +++ b/modules/ripple_app/misc/NetworkOPs.cpp @@ -1230,8 +1230,8 @@ NetworkOPs::transactionsSQL (std::string selection, const RippleAddress& account % (descending ? "DESC" : "ASC") % (descending ? "DESC" : "ASC") % (descending ? "DESC" : "ASC") - % boost::lexical_cast (offset) - % boost::lexical_cast (numberOfResults) + % lexicalCastThrow (offset) + % lexicalCastThrow (numberOfResults) ); WriteLog (lsTRACE, NetworkOPs) << "txSQL query: " << sql; return sql; diff --git a/modules/ripple_app/misc/ripple_ProofOfWork.cpp b/modules/ripple_app/misc/ripple_ProofOfWork.cpp index 3a6f7a083..d80dc395a 100644 --- a/modules/ripple_app/misc/ripple_ProofOfWork.cpp +++ b/modules/ripple_app/misc/ripple_ProofOfWork.cpp @@ -65,7 +65,7 @@ ProofOfWork::ProofOfWork (const std::string& token) mToken = token; mChallenge.SetHex (fields[0]); mTarget.SetHex (fields[1]); - mIterations = lexical_cast_s (fields[2]); + mIterations = lexicalCast (fields[2]); } bool ProofOfWork::isValid () const diff --git a/modules/ripple_app/misc/ripple_ProofOfWorkFactory.cpp b/modules/ripple_app/misc/ripple_ProofOfWorkFactory.cpp index 0110be69a..232e0258a 100644 --- a/modules/ripple_app/misc/ripple_ProofOfWorkFactory.cpp +++ b/modules/ripple_app/misc/ripple_ProofOfWorkFactory.cpp @@ -58,10 +58,10 @@ POWResult ProofOfWorkFactory::checkProof (const std::string& token, uint256 cons challenge.SetHex (fields[0]); target.SetHex (fields[1]); - time_t t = lexical_cast_s (fields[3]); + time_t t = lexicalCast (fields[3]); time_t now = time (NULL); - int iterations = lexical_cast_s (fields[2]); + int iterations = lexicalCast (fields[2]); { boost::mutex::scoped_lock sl (mLock); diff --git a/modules/ripple_app/peers/ripple_Peer.cpp b/modules/ripple_app/peers/ripple_Peer.cpp index 38d0b6d98..46a4a233c 100644 --- a/modules/ripple_app/peers/ripple_Peer.cpp +++ b/modules/ripple_app/peers/ripple_Peer.cpp @@ -377,7 +377,7 @@ void PeerImp::connect (const std::string& strIp, int iPort) mIpPortConnect = mIpPort; assert (!mIpPort.first.empty ()); - boost::asio::ip::tcp::resolver::query query (strIp, boost::lexical_cast (iPortAct), + boost::asio::ip::tcp::resolver::query query (strIp, lexicalCastThrow (iPortAct), 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::system::error_code err; @@ -2411,8 +2411,8 @@ Json::Value PeerImp::getJson () if (mHello.has_protoversion () && (mHello.protoversion () != MAKE_VERSION_INT (PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR))) - ret["protocol"] = boost::lexical_cast (GET_VERSION_MAJOR (mHello.protoversion ())) + "." + - boost::lexical_cast (GET_VERSION_MINOR (mHello.protoversion ())); + ret["protocol"] = lexicalCastThrow (GET_VERSION_MAJOR (mHello.protoversion ())) + "." + + lexicalCastThrow (GET_VERSION_MINOR (mHello.protoversion ())); if (!!mClosedLedgerHash) ret["ledger"] = mClosedLedgerHash.GetHex (); diff --git a/modules/ripple_app/peers/ripple_Peers.cpp b/modules/ripple_app/peers/ripple_Peers.cpp index e70b6a78f..67e54ceac 100644 --- a/modules/ripple_app/peers/ripple_Peers.cpp +++ b/modules/ripple_app/peers/ripple_Peers.cpp @@ -130,7 +130,7 @@ void splitIpPort (const std::string& strIpPort, std::string& strIp, int& iPort) boost::split (vIpPort, strIpPort, boost::is_any_of (" ")); strIp = vIpPort[0]; - iPort = boost::lexical_cast (vIpPort[1]); + iPort = lexicalCastThrow (vIpPort[1]); } void Peers::start () diff --git a/modules/ripple_app/ripple_app.cpp b/modules/ripple_app/ripple_app.cpp index ed582d3d0..11ff12915 100644 --- a/modules/ripple_app/ripple_app.cpp +++ b/modules/ripple_app/ripple_app.cpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include diff --git a/modules/ripple_app/rpc/CallRPC.cpp b/modules/ripple_app/rpc/CallRPC.cpp index b4b2383c6..127517df6 100644 --- a/modules/ripple_app/rpc/CallRPC.cpp +++ b/modules/ripple_app/rpc/CallRPC.cpp @@ -56,7 +56,7 @@ static bool jvParseLedger (Json::Value& jvRequest, const std::string& strLedger) } else { - jvRequest["ledger_index"] = lexical_cast_s (strLedger); + jvRequest["ledger_index"] = lexicalCast (strLedger); } return true; @@ -319,7 +319,7 @@ Json::Value RPCParser::parseFeature (const Json::Value& jvParams) jvRequest["feature"] = jvParams[0u].asString (); if (jvParams.size () > 1) - jvRequest["vote"] = boost::lexical_cast (jvParams[1u].asString ()); + jvRequest["vote"] = lexicalCastThrow (jvParams[1u].asString ()); return jvRequest; } @@ -387,7 +387,7 @@ Json::Value RPCParser::parseLedgerId (const Json::Value& jvParams) } else { - jvRequest["ledger_index"] = lexical_cast_s (strLedger); + jvRequest["ledger_index"] = lexicalCast (strLedger); } return jvRequest; @@ -460,7 +460,7 @@ Json::Value RPCParser::parseAccountRaw (const Json::Value& jvParams, bool bPeer) strPeer = jvParams[iCursor].asString (); int iIndex = 0; - // int iIndex = jvParams.size() >= 2 ? lexical_cast_s(jvParams[1u].asString()) : 0; + // int iIndex = jvParams.size() >= 2 ? lexicalCast (jvParams[1u].asString()) : 0; RippleAddress raAddress; @@ -934,7 +934,7 @@ int commandLineRPC (const std::vector& vCmd) jvOutput["status"] = "error"; nRet = jvOutput.isMember ("error_code") - ? lexical_cast_s (jvOutput["error_code"].asString ()) + ? lexicalCast (jvOutput["error_code"].asString ()) : 1; } diff --git a/modules/ripple_app/rpc/RPCErr.cpp b/modules/ripple_app/rpc/RPCErr.cpp index caa262fc7..e6f36666f 100644 --- a/modules/ripple_app/rpc/RPCErr.cpp +++ b/modules/ripple_app/rpc/RPCErr.cpp @@ -85,8 +85,8 @@ Json::Value rpcError (int iError, Json::Value jvResult) for (i = NUMBER (errorInfoA); i-- && errorInfoA[i].iError != iError;) ; - jvResult["error"] = i >= 0 ? errorInfoA[i].pToken : lexical_cast_i (iError); - jvResult["error_message"] = i >= 0 ? errorInfoA[i].pMessage : lexical_cast_i (iError); + jvResult["error"] = i >= 0 ? errorInfoA[i].pToken : lexicalCast (iError); + jvResult["error_message"] = i >= 0 ? errorInfoA[i].pMessage : lexicalCast (iError); jvResult["error_code"] = iError; if (i >= 0) diff --git a/modules/ripple_app/rpc/RPCHandler.cpp b/modules/ripple_app/rpc/RPCHandler.cpp index ccd0bc6d8..6e0a697c2 100644 --- a/modules/ripple_app/rpc/RPCHandler.cpp +++ b/modules/ripple_app/rpc/RPCHandler.cpp @@ -856,7 +856,7 @@ Json::Value RPCHandler::doProfile (Json::Value params, LoadType* loadType, Appli if (!STAmount::currencyFromString(uCurrencyOfferB, params[5u].asString())) // return rpcError(rpcINVALID_PARAMS); - iCount = lexical_cast_s(params[6u].asString()); + iCount = lexicalCast (params[6u].asString()); if (iArgs >= 8 && "false" != params[7u].asString()) bSubmit = true; @@ -2368,7 +2368,7 @@ static void textTime (std::string& text, int& seconds, const char* unitName, int if (!text.empty ()) text += ", "; - text += boost::lexical_cast (i); + text += lexicalCastThrow (i); text += " "; text += unitName; diff --git a/modules/ripple_app/shamap/ripple_SHAMap.cpp b/modules/ripple_app/shamap/ripple_SHAMap.cpp index 00f1d039d..69023b627 100644 --- a/modules/ripple_app/shamap/ripple_SHAMap.cpp +++ b/modules/ripple_app/shamap/ripple_SHAMap.cpp @@ -934,7 +934,7 @@ int SHAMap::flushDirty (DirtyMap& map, int maxNodes, NodeObjectType t, uint32 se if (s.getSHA512Half () != it->second->getNodeHash ()) { WriteLog (lsFATAL, SHAMap) << * (it->second); - WriteLog (lsFATAL, SHAMap) << lexical_cast_i (s.getDataLength ()); + WriteLog (lsFATAL, SHAMap) << lexicalCast (s.getDataLength ()); WriteLog (lsFATAL, SHAMap) << s.getSHA512Half () << " != " << it->second->getNodeHash (); assert (false); } diff --git a/modules/ripple_app/shamap/ripple_SHAMapNode.cpp b/modules/ripple_app/shamap/ripple_SHAMapNode.cpp index 86062eb56..70d46b653 100644 --- a/modules/ripple_app/shamap/ripple_SHAMapNode.cpp +++ b/modules/ripple_app/shamap/ripple_SHAMapNode.cpp @@ -31,7 +31,7 @@ std::string SHAMapNode::getString () const return "NodeID(root)"; return str (boost::format (NodeID) - % boost::lexical_cast (mDepth) + % lexicalCastThrow (mDepth) % mNodeID.GetHex ()); } diff --git a/modules/ripple_app/shamap/ripple_SHAMapTreeNode.cpp b/modules/ripple_app/shamap/ripple_SHAMapTreeNode.cpp index 1d244f64e..5a6b6e8d2 100644 --- a/modules/ripple_app/shamap/ripple_SHAMapTreeNode.cpp +++ b/modules/ripple_app/shamap/ripple_SHAMapTreeNode.cpp @@ -408,7 +408,7 @@ void SHAMapTreeNode::dump () std::string SHAMapTreeNode::getString () const { std::string ret = "NodeID("; - ret += boost::lexical_cast (getDepth ()); + ret += lexicalCastThrow (getDepth ()); ret += ","; ret += getNodeID ().GetHex (); ret += ")"; @@ -419,7 +419,7 @@ std::string SHAMapTreeNode::getString () const if (!isEmptyBranch (i)) { ret += "\nb"; - ret += boost::lexical_cast (i); + ret += lexicalCastThrow (i); ret += " = "; ret += mHashes[i].GetHex (); } @@ -441,7 +441,7 @@ std::string SHAMapTreeNode::getString () const ret += "\n Hash="; ret += mHash.GetHex (); ret += "/"; - ret += lexical_cast_i (mItem->peekSerializer ().getDataLength ()); + ret += lexicalCast (mItem->peekSerializer ().getDataLength ()); } return ret; diff --git a/modules/ripple_basics/containers/ripple_RangeSet.cpp b/modules/ripple_basics/containers/ripple_RangeSet.cpp index 5d3476043..72c1bf92f 100644 --- a/modules/ripple_basics/containers/ripple_RangeSet.cpp +++ b/modules/ripple_basics/containers/ripple_RangeSet.cpp @@ -175,10 +175,10 @@ std::string RangeSet::toString () const ret += ","; if (it.first == it.second) - ret += boost::lexical_cast ((it.first)); + ret += lexicalCastThrow ((it.first)); else - ret += boost::lexical_cast (it.first) + "-" - + boost::lexical_cast (it.second); + ret += lexicalCastThrow (it.first) + "-" + + lexicalCastThrow (it.second); } if (ret.empty ()) diff --git a/modules/ripple_basics/system/ripple_BoostIncludes.h b/modules/ripple_basics/system/ripple_BoostIncludes.h index 4f12237d7..3b802cbd2 100644 --- a/modules/ripple_basics/system/ripple_BoostIncludes.h +++ b/modules/ripple_basics/system/ripple_BoostIncludes.h @@ -38,7 +38,6 @@ #include #include #include -#include #include #include // VFALCO NOTE this looks like junk #include diff --git a/modules/ripple_basics/utility/ripple_StringUtilities.cpp b/modules/ripple_basics/utility/ripple_StringUtilities.cpp index 4c720eb16..2ff99307e 100644 --- a/modules/ripple_basics/utility/ripple_StringUtilities.cpp +++ b/modules/ripple_basics/utility/ripple_StringUtilities.cpp @@ -209,7 +209,7 @@ bool parseIpPort (const std::string& strSource, std::string& strIP, int& iPort) if (bValid) { strIP = addrIP.to_string (); - iPort = strPortRaw.empty () ? -1 : boost::lexical_cast (strPortRaw); + iPort = strPortRaw.empty () ? -1 : lexicalCastThrow (strPortRaw); } } @@ -235,7 +235,7 @@ bool parseUrl (const std::string& strUrl, std::string& strScheme, std::string& s boost::algorithm::to_lower (strScheme); - iPort = strPort.empty () ? -1 : lexical_cast_s (strPort); + iPort = strPort.empty () ? -1 : lexicalCast (strPort); // 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 bool parseQuality (const std::string& strSource, uint32& uQuality) { - uQuality = lexical_cast_s (strSource); + uQuality = lexicalCast (strSource); if (!uQuality) { - float fQuality = lexical_cast_s (strSource); + float fQuality = lexicalCast (strSource); if (fQuality) uQuality = (uint32) (QUALITY_ONE * fQuality); diff --git a/modules/ripple_basics/utility/ripple_StringUtilities.h b/modules/ripple_basics/utility/ripple_StringUtilities.h index 08dc14c54..014c3d842 100644 --- a/modules/ripple_basics/utility/ripple_StringUtilities.h +++ b/modules/ripple_basics/utility/ripple_StringUtilities.h @@ -168,44 +168,6 @@ inline std::string strGetEnv (const std::string& strKey) return getenv (strKey.c_str ()) ? getenv (strKey.c_str ()) : ""; } -template T lexical_cast_s (const std::string& string) -{ - // lexically cast a string to the selected type. Does not throw - try - { - return boost::lexical_cast (string); - } - catch (...) - { - return 0; - } -} - -template std::string lexical_cast_i (const T& t) -{ - // lexicaly cast the selected type to a string. Does not throw - try - { - return boost::lexical_cast (t); - } - catch (...) - { - return ""; - } -} - -template T lexical_cast_st (const std::string& string) -{ - // lexically cast a string to the selected type. Does throw - return boost::lexical_cast (string); -} - -template std::string lexical_cast_it (const T& t) -{ - // lexicaly cast the selected type to a string. Does not throw - return boost::lexical_cast (t); -} - 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))) diff --git a/modules/ripple_core/functional/ripple_Config.cpp b/modules/ripple_core/functional/ripple_Config.cpp index d1e7f505a..33db2fbd0 100644 --- a/modules/ripple_core/functional/ripple_Config.cpp +++ b/modules/ripple_core/functional/ripple_Config.cpp @@ -297,10 +297,10 @@ void Config::load () (void) SectionSingleB (secConfig, SECTION_PEER_IP, PEER_IP); if (SectionSingleB (secConfig, SECTION_PEER_PORT, strTemp)) - PEER_PORT = boost::lexical_cast (strTemp); + PEER_PORT = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_PEER_PRIVATE, strTemp)) - PEER_PRIVATE = boost::lexical_cast (strTemp); + PEER_PRIVATE = lexicalCastThrow (strTemp); smtTmp = SectionEntries (secConfig, SECTION_RPC_ADMIN_ALLOW); @@ -333,13 +333,13 @@ void Config::load () //--------------------------------------- if (SectionSingleB (secConfig, SECTION_RPC_PORT, strTemp)) - m_rpcPort = boost::lexical_cast (strTemp); + m_rpcPort = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, "ledger_creator" , strTemp)) - LEDGER_CREATOR = boost::lexical_cast (strTemp); + LEDGER_CREATOR = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp)) - RPC_ALLOW_REMOTE = boost::lexical_cast (strTemp); + RPC_ALLOW_REMOTE = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_NODE_SIZE, strTemp)) { @@ -355,7 +355,7 @@ void Config::load () NODE_SIZE = 4; else { - NODE_SIZE = boost::lexical_cast (strTemp); + NODE_SIZE = lexicalCastThrow (strTemp); if (NODE_SIZE < 0) NODE_SIZE = 0; @@ -365,33 +365,33 @@ void Config::load () } if (SectionSingleB (secConfig, SECTION_ELB_SUPPORT, strTemp)) - ELB_SUPPORT = boost::lexical_cast (strTemp); + ELB_SUPPORT = lexicalCastThrow (strTemp); (void) SectionSingleB (secConfig, SECTION_WEBSOCKET_IP, WEBSOCKET_IP); if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PORT, strTemp)) - WEBSOCKET_PORT = boost::lexical_cast (strTemp); + WEBSOCKET_PORT = lexicalCastThrow (strTemp); (void) SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_IP, WEBSOCKET_PUBLIC_IP); if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_PORT, strTemp)) - WEBSOCKET_PUBLIC_PORT = boost::lexical_cast (strTemp); + WEBSOCKET_PUBLIC_PORT = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_WEBSOCKET_SECURE, strTemp)) - WEBSOCKET_SECURE = boost::lexical_cast (strTemp); + WEBSOCKET_SECURE = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PUBLIC_SECURE, strTemp)) - WEBSOCKET_PUBLIC_SECURE = boost::lexical_cast (strTemp); + WEBSOCKET_PUBLIC_SECURE = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_WEBSOCKET_PING_FREQ, strTemp)) - WEBSOCKET_PING_FREQ = boost::lexical_cast (strTemp); + WEBSOCKET_PING_FREQ = lexicalCastThrow (strTemp); SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_CERT, WEBSOCKET_SSL_CERT); SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_CHAIN, WEBSOCKET_SSL_CHAIN); SectionSingleB (secConfig, SECTION_WEBSOCKET_SSL_KEY, WEBSOCKET_SSL_KEY); if (SectionSingleB (secConfig, SECTION_RPC_SECURE, strTemp)) - RPC_SECURE = boost::lexical_cast (strTemp); + RPC_SECURE = lexicalCastThrow (strTemp); SectionSingleB (secConfig, SECTION_RPC_SSL_CERT, RPC_SSL_CERT); 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); if (SectionSingleB (secConfig, SECTION_SSL_VERIFY, strTemp)) - SSL_VERIFY = boost::lexical_cast (strTemp); + SSL_VERIFY = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_VALIDATION_SEED, strTemp)) { @@ -430,37 +430,37 @@ void Config::load () if (SectionSingleB (secConfig, SECTION_PEER_SCAN_INTERVAL_MIN, strTemp)) // Minimum for min is 60 seconds. - PEER_SCAN_INTERVAL_MIN = std::max (60, boost::lexical_cast (strTemp)); + PEER_SCAN_INTERVAL_MIN = std::max (60, lexicalCastThrow (strTemp)); if (SectionSingleB (secConfig, SECTION_PEER_START_MAX, strTemp)) - PEER_START_MAX = std::max (1, boost::lexical_cast (strTemp)); + PEER_START_MAX = std::max (1, lexicalCastThrow (strTemp)); if (SectionSingleB (secConfig, SECTION_PEER_CONNECT_LOW_WATER, strTemp)) - PEER_CONNECT_LOW_WATER = std::max (1, boost::lexical_cast (strTemp)); + PEER_CONNECT_LOW_WATER = std::max (1, lexicalCastThrow (strTemp)); if (SectionSingleB (secConfig, SECTION_NETWORK_QUORUM, strTemp)) - NETWORK_QUORUM = std::max (0, boost::lexical_cast (strTemp)); + NETWORK_QUORUM = std::max (0, lexicalCastThrow (strTemp)); if (SectionSingleB (secConfig, SECTION_VALIDATION_QUORUM, strTemp)) - VALIDATION_QUORUM = std::max (0, boost::lexical_cast (strTemp)); + VALIDATION_QUORUM = std::max (0, lexicalCastThrow (strTemp)); if (SectionSingleB (secConfig, SECTION_FEE_ACCOUNT_RESERVE, strTemp)) - FEE_ACCOUNT_RESERVE = boost::lexical_cast (strTemp); + FEE_ACCOUNT_RESERVE = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_FEE_OWNER_RESERVE, strTemp)) - FEE_OWNER_RESERVE = boost::lexical_cast (strTemp); + FEE_OWNER_RESERVE = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_FEE_NICKNAME_CREATE, strTemp)) - FEE_NICKNAME_CREATE = boost::lexical_cast (strTemp); + FEE_NICKNAME_CREATE = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_FEE_OFFER, strTemp)) - FEE_OFFER = boost::lexical_cast (strTemp); + FEE_OFFER = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_FEE_DEFAULT, strTemp)) - FEE_DEFAULT = boost::lexical_cast (strTemp); + FEE_DEFAULT = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_FEE_OPERATION, strTemp)) - FEE_CONTRACT_OPERATION = boost::lexical_cast (strTemp); + FEE_CONTRACT_OPERATION = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_LEDGER_HISTORY, strTemp)) { @@ -471,14 +471,14 @@ void Config::load () else if (strTemp == "full") LEDGER_HISTORY = 1000000000u; else - LEDGER_HISTORY = boost::lexical_cast (strTemp); + LEDGER_HISTORY = lexicalCastThrow (strTemp); } if (SectionSingleB (secConfig, SECTION_PATH_SEARCH_SIZE, strTemp)) - PATH_SEARCH_SIZE = boost::lexical_cast (strTemp); + PATH_SEARCH_SIZE = lexicalCastThrow (strTemp); if (SectionSingleB (secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp)) - ACCOUNT_PROBE_MAX = boost::lexical_cast (strTemp); + ACCOUNT_PROBE_MAX = lexicalCastThrow (strTemp); (void) SectionSingleB (secConfig, SECTION_SMS_FROM, SMS_FROM); (void) SectionSingleB (secConfig, SECTION_SMS_KEY, SMS_KEY); diff --git a/modules/ripple_data/protocol/ripple_FieldNames.cpp b/modules/ripple_data/protocol/ripple_FieldNames.cpp index 8b8f6282d..0459e1f49 100644 --- a/modules/ripple_data/protocol/ripple_FieldNames.cpp +++ b/modules/ripple_data/protocol/ripple_FieldNames.cpp @@ -43,7 +43,7 @@ SField::SField (SerializedTypeID tid, int fv) : fieldCode (FIELD_CODE (tid, fv)) fieldMeta (sMD_Default), fieldNum (++num), signingField (true) { // call with the map mutex - fieldName = lexical_cast_i (tid) + "/" + lexical_cast_i (fv); + fieldName = lexicalCast (tid) + "/" + lexicalCast (fv); codeToField[fieldCode] = this; assert ((fv != 1) || ((tid != STI_ARRAY) && (tid != STI_OBJECT))); } @@ -108,8 +108,8 @@ std::string SField::getName () const if (fieldValue == 0) return ""; - return boost::lexical_cast (static_cast (fieldType)) + "/" + - boost::lexical_cast (fieldValue); + return lexicalCastThrow (static_cast (fieldType)) + "/" + + lexicalCastThrow (fieldValue); } SField::ref SField::getField (const std::string& fieldName) diff --git a/modules/ripple_data/protocol/ripple_STAmount.cpp b/modules/ripple_data/protocol/ripple_STAmount.cpp index 464cc4f61..bbe2915a2 100644 --- a/modules/ripple_data/protocol/ripple_STAmount.cpp +++ b/modules/ripple_data/protocol/ripple_STAmount.cpp @@ -181,7 +181,7 @@ STAmount::STAmount (SField::ref n, const Json::Value& v) { if (mIsNative) { - int64 val = lexical_cast_st (value.asString ()); + int64 val = lexicalCastThrow (value.asString ()); if (val >= 0) mValue = val; @@ -276,13 +276,13 @@ bool STAmount::setValue (const std::string& sAmount) if (!smMatch[4].matched) // integer only { - mValue = lexical_cast_s (smMatch[2]); + mValue = lexicalCast (std::string (smMatch[2])); mOffset = 0; } else { // integer and fraction - mValue = lexical_cast_s (smMatch[2] + smMatch[4]); + mValue = lexicalCast (smMatch[2] + smMatch[4]); mOffset = - (smMatch[4].length ()); } @@ -290,9 +290,9 @@ bool STAmount::setValue (const std::string& sAmount) { // we have an exponent if (smMatch[6].matched && (smMatch[6] == "-")) - mOffset -= lexical_cast_s (smMatch[7]); + mOffset -= lexicalCast (std::string (smMatch[7])); else - mOffset += lexical_cast_s (smMatch[7]); + mOffset += lexicalCast (std::string (smMatch[7])); } } catch (...) @@ -593,15 +593,15 @@ std::string STAmount::getRaw () const if (mIsNative) { - if (mIsNegative) return std::string ("-") + lexical_cast_i (mValue); - else return lexical_cast_i (mValue); + if (mIsNegative) return std::string ("-") + lexicalCast (mValue); + else return lexicalCast (mValue); } if (mIsNegative) return mCurrency.GetHex () + ": -" + - lexical_cast_i (mValue) + "e" + lexical_cast_i (mOffset); + lexicalCast (mValue) + "e" + lexicalCast (mOffset); else return mCurrency.GetHex () + ": " + - lexical_cast_i (mValue) + "e" + lexical_cast_i (mOffset); + lexicalCast (mValue) + "e" + lexicalCast (mOffset); } std::string STAmount::getText () const @@ -612,21 +612,21 @@ std::string STAmount::getText () const if (mIsNative) { if (mIsNegative) - return std::string ("-") + lexical_cast_i (mValue); - else return lexical_cast_i (mValue); + return std::string ("-") + lexicalCast (mValue); + else return lexicalCast (mValue); } if ((mOffset != 0) && ((mOffset < -25) || (mOffset > -5))) { if (mIsNegative) - return std::string ("-") + lexical_cast_i (mValue) + - "e" + lexical_cast_i (mOffset); + return std::string ("-") + lexicalCast (mValue) + + "e" + lexicalCast (mOffset); else - return lexical_cast_i (mValue) + "e" + lexical_cast_i (mOffset); + return lexicalCast (mValue) + "e" + lexicalCast (mOffset); } std::string val = "000000000000000000000000000"; - val += lexical_cast_i (mValue); + val += lexicalCast (mValue); val += "00000000000000000000000"; std::string pre = val.substr (0, mOffset + 43); diff --git a/modules/ripple_data/protocol/ripple_SerializedObject.cpp b/modules/ripple_data/protocol/ripple_SerializedObject.cpp index 91466e7fd..1b7920393 100644 --- a/modules/ripple_data/protocol/ripple_SerializedObject.cpp +++ b/modules/ripple_data/protocol/ripple_SerializedObject.cpp @@ -58,7 +58,7 @@ UPTR_T STObject::makeDefaultObject (SerializedTypeID id, SField: return UPTR_T (new STArray (name)); default: - WriteLog (lsFATAL, STObject) << "Object type: " << lexical_cast_i (id); + WriteLog (lsFATAL, STObject) << "Object type: " << lexicalCast (id); assert (false); 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.getFName ().hasName ()) - ret[lexical_cast_i (index)] = it.getJson (options); + ret[lexicalCast (index)] = it.getJson (options); else ret[it.getName ()] = it.getJson (options); } @@ -1153,7 +1153,7 @@ Json::Value STArray::getJson (int p) const Json::Value inner = Json::objectValue; if (!object.getFName ().hasName ()) - inner[lexical_cast_i (index)] = object.getJson (p); + inner[lexicalCast (index)] = object.getJson (p); else inner[object.getName ()] = object.getJson (p); @@ -1253,10 +1253,10 @@ UPTR_T STObject::parseJson (const Json::Value& object, SField::ref inN if (FUNCTION_THAT_DOESNT_EXIST (value.asString (), terCode)) value = static_cast (terCode); else - data.push_back (new STUInt8 (field, lexical_cast_st (value.asString ()))); + data.push_back (new STUInt8 (field, lexicalCastThrow (value.asString ()))); } - data.push_back (new STUInt8 (field, lexical_cast_st (value.asString ()))); + data.push_back (new STUInt8 (field, lexicalCastThrow (value.asString ()))); #endif } else if (value.isInt ()) @@ -1308,7 +1308,7 @@ UPTR_T STObject::parseJson (const Json::Value& object, SField::ref inN throw std::runtime_error ("Invalid field data"); } else - data.push_back (new STUInt16 (field, lexical_cast_st (strValue))); + data.push_back (new STUInt16 (field, lexicalCastThrow (strValue))); } else if (value.isInt ()) data.push_back (new STUInt16 (field, range_check_cast (value.asInt (), 0, 65535))); @@ -1322,7 +1322,7 @@ UPTR_T STObject::parseJson (const Json::Value& object, SField::ref inN case STI_UINT32: if (value.isString ()) { - data.push_back (new STUInt32 (field, lexical_cast_st (value.asString ()))); + data.push_back (new STUInt32 (field, lexicalCastThrow (value.asString ()))); } else if (value.isInt ()) { diff --git a/modules/ripple_data/protocol/ripple_SerializedTypes.cpp b/modules/ripple_data/protocol/ripple_SerializedTypes.cpp index 7d60b2791..24771669f 100644 --- a/modules/ripple_data/protocol/ripple_SerializedTypes.cpp +++ b/modules/ripple_data/protocol/ripple_SerializedTypes.cpp @@ -98,7 +98,7 @@ std::string STUInt8::getText () const return human; } - return boost::lexical_cast (value); + return lexicalCastThrow (value); } Json::Value STUInt8::getJson (int) const @@ -147,7 +147,7 @@ std::string STUInt16::getText () const return item->getName (); } - return boost::lexical_cast (value); + return lexicalCastThrow (value); } Json::Value STUInt16::getJson (int) const @@ -186,7 +186,7 @@ STUInt32* STUInt32::construct (SerializerIterator& u, SField::ref name) std::string STUInt32::getText () const { - return boost::lexical_cast (value); + return lexicalCastThrow (value); } Json::Value STUInt32::getJson (int) const @@ -207,7 +207,7 @@ STUInt64* STUInt64::construct (SerializerIterator& u, SField::ref name) std::string STUInt64::getText () const { - return boost::lexical_cast (value); + return lexicalCastThrow (value); } Json::Value STUInt64::getJson (int) const diff --git a/modules/ripple_data/ripple_data.cpp b/modules/ripple_data/ripple_data.cpp index 8feac8911..55db3617f 100644 --- a/modules/ripple_data/ripple_data.cpp +++ b/modules/ripple_data/ripple_data.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/modules/ripple_json/json/json_value.cpp b/modules/ripple_json/json/json_value.cpp index d7f2404ad..4e732fac7 100644 --- a/modules/ripple_json/json/json_value.cpp +++ b/modules/ripple_json/json/json_value.cpp @@ -738,7 +738,7 @@ Value::asString () const return value_.bool_ ? "true" : "false"; case intValue: - return boost::lexical_cast (value_.int_); + return lexicalCastThrow (value_.int_); case uintValue: case realValue: @@ -784,7 +784,7 @@ Value::asInt () const return value_.bool_ ? 1 : 0; case stringValue: - return boost::lexical_cast (value_.string_); + return lexicalCastThrow (value_.string_); case arrayValue: case objectValue: @@ -820,7 +820,7 @@ Value::asUInt () const return value_.bool_ ? 1 : 0; case stringValue: - return boost::lexical_cast (value_.string_); + return lexicalCastThrow (value_.string_); case arrayValue: case objectValue: diff --git a/modules/ripple_json/ripple_json.cpp b/modules/ripple_json/ripple_json.cpp index 419905dcc..fc19ce5d4 100644 --- a/modules/ripple_json/ripple_json.cpp +++ b/modules/ripple_json/ripple_json.cpp @@ -21,9 +21,6 @@ # include #endif -// VFALCO TODO eliminate this boost dependency -#include - #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR #include "json/json_batchallocator.h" #endif diff --git a/modules/ripple_net/basics/ripple_HTTPRequest.cpp b/modules/ripple_net/basics/ripple_HTTPRequest.cpp index 2c066c799..6065a2e52 100644 --- a/modules/ripple_net/basics/ripple_HTTPRequest.cpp +++ b/modules/ripple_net/basics/ripple_HTTPRequest.cpp @@ -98,7 +98,7 @@ HTTPRequest::Action HTTPRequest::consume (boost::asio::streambuf& buf) } if (headerName == "content-length") - iDataSize = boost::lexical_cast (headerValue); + iDataSize = lexicalCastThrow (headerValue); if (headerName == "authorization") sAuthorization = headerValue; diff --git a/modules/ripple_net/basics/ripple_HttpsClient.cpp b/modules/ripple_net/basics/ripple_HttpsClient.cpp index b53f844a3..3a43be464 100644 --- a/modules/ripple_net/basics/ripple_HttpsClient.cpp +++ b/modules/ripple_net/basics/ripple_HttpsClient.cpp @@ -80,7 +80,7 @@ void HttpsClient::httpsNext () boost::shared_ptr query ( new boost::asio::ip::tcp::resolver::query ( mDeqSites[0], - boost::lexical_cast (mPort), + lexicalCast (mPort), boost::asio::ip::resolver_query_base::numeric_service)); mQuery = query; @@ -303,14 +303,14 @@ void HttpsClient::handleHeader (const boost::system::error_code& ecResult, std:: return; } - mStatus = lexical_cast_st (smMatch[1]); + mStatus = lexicalCastThrow (std::string (smMatch[1])); if (boost::regex_match (strHeader, smMatch, reBody)) // we got some body mBody = smMatch[1]; if (boost::regex_match (strHeader, smMatch, reSize)) { - int size = lexical_cast_st (smMatch[1]); + int size = lexicalCastThrow (std::string(smMatch[1])); if (size < mResponseMax) mResponseMax = size;