mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Replace boost::lexical_cast<int> with atoi (#1926)
Also cleanup existing atoi-s in Dash code
This commit is contained in:
parent
0f4d963baf
commit
2e04864b26
@ -1809,10 +1809,10 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
LOCK(pwalletMain->cs_wallet);
|
||||
LogPrintf("Locking Masternodes:\n");
|
||||
uint256 mnTxHash;
|
||||
int outputIndex;
|
||||
uint32_t outputIndex;
|
||||
for (const auto& mne : masternodeConfig.getEntries()) {
|
||||
mnTxHash.SetHex(mne.getTxHash());
|
||||
outputIndex = boost::lexical_cast<unsigned int>(mne.getOutputIndex());
|
||||
outputIndex = (uint32_t)atoi(mne.getOutputIndex());
|
||||
COutPoint outpoint = COutPoint(mnTxHash, outputIndex);
|
||||
// don't lock non-spendable outpoint (i.e. it's already spent or it's not from this wallet at all)
|
||||
if(pwalletMain->IsMine(CTxIn(outpoint)) != ISMINE_SPENDABLE) {
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include "wallet/wallet.h"
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
UniValue gobject(const JSONRPCRequest& request)
|
||||
{
|
||||
std::string strCommand;
|
||||
@ -144,8 +142,8 @@ UniValue gobject(const JSONRPCRequest& request)
|
||||
|
||||
std::string strRevision = request.params[2].get_str();
|
||||
std::string strTime = request.params[3].get_str();
|
||||
int nRevision = boost::lexical_cast<int>(strRevision);
|
||||
int nTime = boost::lexical_cast<int>(strTime);
|
||||
int nRevision = atoi(strRevision);
|
||||
int64_t nTime = atoi64(strTime);
|
||||
std::string strData = request.params[4].get_str();
|
||||
|
||||
// CREATE A NEW COLLATERAL TRANSACTION FOR THIS SPECIFIC OBJECT
|
||||
@ -230,8 +228,8 @@ UniValue gobject(const JSONRPCRequest& request)
|
||||
|
||||
std::string strRevision = request.params[2].get_str();
|
||||
std::string strTime = request.params[3].get_str();
|
||||
int nRevision = boost::lexical_cast<int>(strRevision);
|
||||
int nTime = boost::lexical_cast<int>(strTime);
|
||||
int nRevision = atoi(strRevision);
|
||||
int64_t nTime = atoi64(strTime);
|
||||
std::string strData = request.params[4].get_str();
|
||||
|
||||
CGovernanceObject govobj(hashParent, nRevision, nTime, txidFee, strData);
|
||||
@ -817,8 +815,7 @@ UniValue gobject(const JSONRPCRequest& request)
|
||||
if (request.params.size() == 4) {
|
||||
uint256 txid = ParseHashV(request.params[2], "Masternode Collateral hash");
|
||||
std::string strVout = request.params[3].get_str();
|
||||
uint32_t vout = boost::lexical_cast<uint32_t>(strVout);
|
||||
mnCollateralOutpoint = COutPoint(txid, vout);
|
||||
mnCollateralOutpoint = COutPoint(txid, (uint32_t)atoi(strVout));
|
||||
}
|
||||
|
||||
// FIND OBJECT USER IS LOOKING FOR
|
||||
|
@ -317,7 +317,7 @@ UniValue masternode(const JSONRPCRequest& request)
|
||||
for (const auto& mne : masternodeConfig.getEntries()) {
|
||||
std::string strError;
|
||||
|
||||
COutPoint outpoint = COutPoint(uint256S(mne.getTxHash()), uint32_t(atoi(mne.getOutputIndex().c_str())));
|
||||
COutPoint outpoint = COutPoint(uint256S(mne.getTxHash()), (uint32_t)atoi(mne.getOutputIndex()));
|
||||
CMasternode mn;
|
||||
bool fFound = mnodeman.Get(outpoint, mn);
|
||||
CMasternodeBroadcast mnb;
|
||||
@ -365,7 +365,7 @@ UniValue masternode(const JSONRPCRequest& request)
|
||||
UniValue resultObj(UniValue::VOBJ);
|
||||
|
||||
for (const auto& mne : masternodeConfig.getEntries()) {
|
||||
COutPoint outpoint = COutPoint(uint256S(mne.getTxHash()), uint32_t(atoi(mne.getOutputIndex().c_str())));
|
||||
COutPoint outpoint = COutPoint(uint256S(mne.getTxHash()), (uint32_t)atoi(mne.getOutputIndex()));
|
||||
CMasternode mn;
|
||||
bool fFound = mnodeman.Get(outpoint, mn);
|
||||
|
||||
|
@ -3229,7 +3229,7 @@ bool CWallet::GetMasternodeOutpointAndKeys(COutPoint& outpointRet, CPubKey& pubK
|
||||
|
||||
// Find specific vin
|
||||
uint256 txHash = uint256S(strTxHash);
|
||||
int nOutputIndex = atoi(strOutputIndex.c_str());
|
||||
int nOutputIndex = atoi(strOutputIndex);
|
||||
|
||||
for (const auto& out : vPossibleCoins)
|
||||
if(out.tx->GetHash() == txHash && out.i == nOutputIndex) // found it!
|
||||
|
Loading…
Reference in New Issue
Block a user