Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace boost::lexical_cast<int> with atoi #1926

Merged
merged 1 commit into from
Feb 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1772,10 +1772,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) {
Expand Down
13 changes: 5 additions & 8 deletions src/rpc/governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include "wallet/wallet.h"
#endif // ENABLE_WALLET

#include <boost/lexical_cast.hpp>

UniValue gobject(const JSONRPCRequest& request)
{
std::string strCommand;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/rpc/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3226,7 +3226,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!
Expand Down