Skip to content

Commit bfae70a

Browse files
committed
Merge pull request #4129
d56e30c removed a few unnecessary casts (Kamil Domanski) 3e74ac2 json_spirit: #include <stdint.h> (Kamil Domanski) 4b61a6a switch from boost int types to <stdint.h> (Kamil Domanski)
2 parents 29c1fbb + d56e30c commit bfae70a

File tree

9 files changed

+82
-82
lines changed

9 files changed

+82
-82
lines changed

src/json/json_spirit_reader_template.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333

3434
namespace json_spirit
3535
{
36-
const spirit_namespace::int_parser < boost::int64_t > int64_p = spirit_namespace::int_parser < boost::int64_t >();
37-
const spirit_namespace::uint_parser< boost::uint64_t > uint64_p = spirit_namespace::uint_parser< boost::uint64_t >();
36+
const spirit_namespace::int_parser < int64_t > int64_p = spirit_namespace::int_parser < int64_t >();
37+
const spirit_namespace::uint_parser< uint64_t > uint64_p = spirit_namespace::uint_parser< uint64_t >();
3838

3939
template< class Iter_type >
4040
bool is_eq( Iter_type first, Iter_type last, const char* c_str )
@@ -270,12 +270,12 @@ namespace json_spirit
270270
add_to_current( Value_type() );
271271
}
272272

273-
void new_int( boost::int64_t i )
273+
void new_int( int64_t i )
274274
{
275275
add_to_current( i );
276276
}
277277

278-
void new_uint64( boost::uint64_t ui )
278+
void new_uint64( uint64_t ui )
279279
{
280280
add_to_current( ui );
281281
}
@@ -425,8 +425,8 @@ namespace json_spirit
425425
typedef boost::function< void( Char_type ) > Char_action;
426426
typedef boost::function< void( Iter_type, Iter_type ) > Str_action;
427427
typedef boost::function< void( double ) > Real_action;
428-
typedef boost::function< void( boost::int64_t ) > Int_action;
429-
typedef boost::function< void( boost::uint64_t ) > Uint64_action;
428+
typedef boost::function< void( int64_t ) > Int_action;
429+
typedef boost::function< void( uint64_t ) > Uint64_action;
430430

431431
Char_action begin_obj ( boost::bind( &Semantic_actions_t::begin_obj, &self.actions_, _1 ) );
432432
Char_action end_obj ( boost::bind( &Semantic_actions_t::end_obj, &self.actions_, _1 ) );

src/json/json_spirit_value.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include <cassert>
1717
#include <sstream>
1818
#include <stdexcept>
19+
#include <stdint.h>
1920
#include <boost/config.hpp>
20-
#include <boost/cstdint.hpp>
2121
#include <boost/shared_ptr.hpp>
2222
#include <boost/variant.hpp>
2323

@@ -45,8 +45,8 @@ namespace json_spirit
4545
Value_impl( const Array& value );
4646
Value_impl( bool value );
4747
Value_impl( int value );
48-
Value_impl( boost::int64_t value );
49-
Value_impl( boost::uint64_t value );
48+
Value_impl( int64_t value );
49+
Value_impl( uint64_t value );
5050
Value_impl( double value );
5151

5252
Value_impl( const Value_impl& other );
@@ -65,8 +65,8 @@ namespace json_spirit
6565
const Array& get_array() const;
6666
bool get_bool() const;
6767
int get_int() const;
68-
boost::int64_t get_int64() const;
69-
boost::uint64_t get_uint64() const;
68+
int64_t get_int64() const;
69+
uint64_t get_uint64() const;
7070
double get_real() const;
7171

7272
Object& get_obj();
@@ -83,7 +83,7 @@ namespace json_spirit
8383

8484
typedef boost::variant< String_type,
8585
boost::recursive_wrapper< Object >, boost::recursive_wrapper< Array >,
86-
bool, boost::int64_t, double > Variant;
86+
bool, int64_t, double > Variant;
8787

8888
Value_type type_;
8989
Variant v_;
@@ -258,23 +258,23 @@ namespace json_spirit
258258
template< class Config >
259259
Value_impl< Config >::Value_impl( int value )
260260
: type_( int_type )
261-
, v_( static_cast< boost::int64_t >( value ) )
261+
, v_( static_cast< int64_t >( value ) )
262262
, is_uint64_( false )
263263
{
264264
}
265265

266266
template< class Config >
267-
Value_impl< Config >::Value_impl( boost::int64_t value )
267+
Value_impl< Config >::Value_impl( int64_t value )
268268
: type_( int_type )
269269
, v_( value )
270270
, is_uint64_( false )
271271
{
272272
}
273273

274274
template< class Config >
275-
Value_impl< Config >::Value_impl( boost::uint64_t value )
275+
Value_impl< Config >::Value_impl( uint64_t value )
276276
: type_( int_type )
277-
, v_( static_cast< boost::int64_t >( value ) )
277+
, v_( static_cast< int64_t >( value ) )
278278
, is_uint64_( true )
279279
{
280280
}
@@ -390,19 +390,19 @@ namespace json_spirit
390390
}
391391

392392
template< class Config >
393-
boost::int64_t Value_impl< Config >::get_int64() const
393+
int64_t Value_impl< Config >::get_int64() const
394394
{
395395
check_type( int_type );
396396

397-
return boost::get< boost::int64_t >( v_ );
397+
return boost::get< int64_t >( v_ );
398398
}
399399

400400
template< class Config >
401-
boost::uint64_t Value_impl< Config >::get_uint64() const
401+
uint64_t Value_impl< Config >::get_uint64() const
402402
{
403403
check_type( int_type );
404404

405-
return static_cast< boost::uint64_t >( get_int64() );
405+
return static_cast< uint64_t >( get_int64() );
406406
}
407407

408408
template< class Config >
@@ -481,13 +481,13 @@ namespace json_spirit
481481
}
482482

483483
template< class Value >
484-
boost::int64_t get_value( const Value& value, Type_to_type< boost::int64_t > )
484+
int64_t get_value( const Value& value, Type_to_type< int64_t > )
485485
{
486486
return value.get_int64();
487487
}
488488

489489
template< class Value >
490-
boost::uint64_t get_value( const Value& value, Type_to_type< boost::uint64_t > )
490+
uint64_t get_value( const Value& value, Type_to_type< uint64_t > )
491491
{
492492
return value.get_uint64();
493493
}

src/rpcblockchain.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex)
6464
BOOST_FOREACH(const CTransaction&tx, block.vtx)
6565
txs.push_back(tx.GetHash().GetHex());
6666
result.push_back(Pair("tx", txs));
67-
result.push_back(Pair("time", (boost::int64_t)block.GetBlockTime()));
68-
result.push_back(Pair("nonce", (boost::uint64_t)block.nNonce));
67+
result.push_back(Pair("time", block.GetBlockTime()));
68+
result.push_back(Pair("nonce", (uint64_t)block.nNonce));
6969
result.push_back(Pair("bits", HexBits(block.nBits)));
7070
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
7171
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
@@ -175,7 +175,7 @@ Value getrawmempool(const Array& params, bool fHelp)
175175
Object info;
176176
info.push_back(Pair("size", (int)e.GetTxSize()));
177177
info.push_back(Pair("fee", ValueFromAmount(e.GetFee())));
178-
info.push_back(Pair("time", (boost::int64_t)e.GetTime()));
178+
info.push_back(Pair("time", e.GetTime()));
179179
info.push_back(Pair("height", (int)e.GetHeight()));
180180
info.push_back(Pair("startingpriority", e.GetPriority(e.GetHeight())));
181181
info.push_back(Pair("currentpriority", e.GetPriority(chainActive.Height())));
@@ -315,11 +315,11 @@ Value gettxoutsetinfo(const Array& params, bool fHelp)
315315

316316
CCoinsStats stats;
317317
if (pcoinsTip->GetStats(stats)) {
318-
ret.push_back(Pair("height", (boost::int64_t)stats.nHeight));
318+
ret.push_back(Pair("height", (int64_t)stats.nHeight));
319319
ret.push_back(Pair("bestblock", stats.hashBlock.GetHex()));
320-
ret.push_back(Pair("transactions", (boost::int64_t)stats.nTransactions));
321-
ret.push_back(Pair("txouts", (boost::int64_t)stats.nTransactionOutputs));
322-
ret.push_back(Pair("bytes_serialized", (boost::int64_t)stats.nSerializedSize));
320+
ret.push_back(Pair("transactions", (int64_t)stats.nTransactions));
321+
ret.push_back(Pair("txouts", (int64_t)stats.nTransactionOutputs));
322+
ret.push_back(Pair("bytes_serialized", (int64_t)stats.nSerializedSize));
323323
ret.push_back(Pair("hash_serialized", stats.hashSerialized.GetHex()));
324324
ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount)));
325325
}

src/rpcclient.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -128,53 +128,53 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
128128
if (strMethod == "stop" && n > 0) ConvertTo<bool>(params[0]);
129129
if (strMethod == "getaddednodeinfo" && n > 0) ConvertTo<bool>(params[0]);
130130
if (strMethod == "setgenerate" && n > 0) ConvertTo<bool>(params[0]);
131-
if (strMethod == "setgenerate" && n > 1) ConvertTo<boost::int64_t>(params[1]);
132-
if (strMethod == "getnetworkhashps" && n > 0) ConvertTo<boost::int64_t>(params[0]);
133-
if (strMethod == "getnetworkhashps" && n > 1) ConvertTo<boost::int64_t>(params[1]);
131+
if (strMethod == "setgenerate" && n > 1) ConvertTo<int64_t>(params[1]);
132+
if (strMethod == "getnetworkhashps" && n > 0) ConvertTo<int64_t>(params[0]);
133+
if (strMethod == "getnetworkhashps" && n > 1) ConvertTo<int64_t>(params[1]);
134134
if (strMethod == "sendtoaddress" && n > 1) ConvertTo<double>(params[1]);
135135
if (strMethod == "settxfee" && n > 0) ConvertTo<double>(params[0]);
136-
if (strMethod == "getreceivedbyaddress" && n > 1) ConvertTo<boost::int64_t>(params[1]);
137-
if (strMethod == "getreceivedbyaccount" && n > 1) ConvertTo<boost::int64_t>(params[1]);
138-
if (strMethod == "listreceivedbyaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]);
136+
if (strMethod == "getreceivedbyaddress" && n > 1) ConvertTo<int64_t>(params[1]);
137+
if (strMethod == "getreceivedbyaccount" && n > 1) ConvertTo<int64_t>(params[1]);
138+
if (strMethod == "listreceivedbyaddress" && n > 0) ConvertTo<int64_t>(params[0]);
139139
if (strMethod == "listreceivedbyaddress" && n > 1) ConvertTo<bool>(params[1]);
140-
if (strMethod == "listreceivedbyaccount" && n > 0) ConvertTo<boost::int64_t>(params[0]);
140+
if (strMethod == "listreceivedbyaccount" && n > 0) ConvertTo<int64_t>(params[0]);
141141
if (strMethod == "listreceivedbyaccount" && n > 1) ConvertTo<bool>(params[1]);
142-
if (strMethod == "getbalance" && n > 1) ConvertTo<boost::int64_t>(params[1]);
143-
if (strMethod == "getblockhash" && n > 0) ConvertTo<boost::int64_t>(params[0]);
142+
if (strMethod == "getbalance" && n > 1) ConvertTo<int64_t>(params[1]);
143+
if (strMethod == "getblockhash" && n > 0) ConvertTo<int64_t>(params[0]);
144144
if (strMethod == "move" && n > 2) ConvertTo<double>(params[2]);
145-
if (strMethod == "move" && n > 3) ConvertTo<boost::int64_t>(params[3]);
145+
if (strMethod == "move" && n > 3) ConvertTo<int64_t>(params[3]);
146146
if (strMethod == "sendfrom" && n > 2) ConvertTo<double>(params[2]);
147-
if (strMethod == "sendfrom" && n > 3) ConvertTo<boost::int64_t>(params[3]);
148-
if (strMethod == "listtransactions" && n > 1) ConvertTo<boost::int64_t>(params[1]);
149-
if (strMethod == "listtransactions" && n > 2) ConvertTo<boost::int64_t>(params[2]);
150-
if (strMethod == "listaccounts" && n > 0) ConvertTo<boost::int64_t>(params[0]);
151-
if (strMethod == "walletpassphrase" && n > 1) ConvertTo<boost::int64_t>(params[1]);
147+
if (strMethod == "sendfrom" && n > 3) ConvertTo<int64_t>(params[3]);
148+
if (strMethod == "listtransactions" && n > 1) ConvertTo<int64_t>(params[1]);
149+
if (strMethod == "listtransactions" && n > 2) ConvertTo<int64_t>(params[2]);
150+
if (strMethod == "listaccounts" && n > 0) ConvertTo<int64_t>(params[0]);
151+
if (strMethod == "walletpassphrase" && n > 1) ConvertTo<int64_t>(params[1]);
152152
if (strMethod == "getblocktemplate" && n > 0) ConvertTo<Object>(params[0]);
153-
if (strMethod == "listsinceblock" && n > 1) ConvertTo<boost::int64_t>(params[1]);
153+
if (strMethod == "listsinceblock" && n > 1) ConvertTo<int64_t>(params[1]);
154154
if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]);
155-
if (strMethod == "sendmany" && n > 2) ConvertTo<boost::int64_t>(params[2]);
156-
if (strMethod == "addmultisigaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]);
155+
if (strMethod == "sendmany" && n > 2) ConvertTo<int64_t>(params[2]);
156+
if (strMethod == "addmultisigaddress" && n > 0) ConvertTo<int64_t>(params[0]);
157157
if (strMethod == "addmultisigaddress" && n > 1) ConvertTo<Array>(params[1]);
158-
if (strMethod == "createmultisig" && n > 0) ConvertTo<boost::int64_t>(params[0]);
158+
if (strMethod == "createmultisig" && n > 0) ConvertTo<int64_t>(params[0]);
159159
if (strMethod == "createmultisig" && n > 1) ConvertTo<Array>(params[1]);
160-
if (strMethod == "listunspent" && n > 0) ConvertTo<boost::int64_t>(params[0]);
161-
if (strMethod == "listunspent" && n > 1) ConvertTo<boost::int64_t>(params[1]);
160+
if (strMethod == "listunspent" && n > 0) ConvertTo<int64_t>(params[0]);
161+
if (strMethod == "listunspent" && n > 1) ConvertTo<int64_t>(params[1]);
162162
if (strMethod == "listunspent" && n > 2) ConvertTo<Array>(params[2]);
163163
if (strMethod == "getblock" && n > 1) ConvertTo<bool>(params[1]);
164-
if (strMethod == "getrawtransaction" && n > 1) ConvertTo<boost::int64_t>(params[1]);
164+
if (strMethod == "getrawtransaction" && n > 1) ConvertTo<int64_t>(params[1]);
165165
if (strMethod == "createrawtransaction" && n > 0) ConvertTo<Array>(params[0]);
166166
if (strMethod == "createrawtransaction" && n > 1) ConvertTo<Object>(params[1]);
167167
if (strMethod == "signrawtransaction" && n > 1) ConvertTo<Array>(params[1], true);
168168
if (strMethod == "signrawtransaction" && n > 2) ConvertTo<Array>(params[2], true);
169169
if (strMethod == "sendrawtransaction" && n > 1) ConvertTo<bool>(params[1], true);
170-
if (strMethod == "gettxout" && n > 1) ConvertTo<boost::int64_t>(params[1]);
170+
if (strMethod == "gettxout" && n > 1) ConvertTo<int64_t>(params[1]);
171171
if (strMethod == "gettxout" && n > 2) ConvertTo<bool>(params[2]);
172172
if (strMethod == "lockunspent" && n > 0) ConvertTo<bool>(params[0]);
173173
if (strMethod == "lockunspent" && n > 1) ConvertTo<Array>(params[1]);
174174
if (strMethod == "importprivkey" && n > 2) ConvertTo<bool>(params[2]);
175-
if (strMethod == "verifychain" && n > 0) ConvertTo<boost::int64_t>(params[0]);
176-
if (strMethod == "verifychain" && n > 1) ConvertTo<boost::int64_t>(params[1]);
177-
if (strMethod == "keypoolrefill" && n > 0) ConvertTo<boost::int64_t>(params[0]);
175+
if (strMethod == "verifychain" && n > 0) ConvertTo<int64_t>(params[0]);
176+
if (strMethod == "verifychain" && n > 1) ConvertTo<int64_t>(params[1]);
177+
if (strMethod == "keypoolrefill" && n > 0) ConvertTo<int64_t>(params[0]);
178178
if (strMethod == "getrawmempool" && n > 0) ConvertTo<bool>(params[0]);
179179

180180
return params;

src/rpcmining.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Value GetNetworkHashPS(int lookup, int height) {
8888
uint256 workDiff = pb->nChainWork - pb0->nChainWork;
8989
int64_t timeDiff = maxTime - minTime;
9090

91-
return (boost::int64_t)(workDiff.getdouble() / timeDiff);
91+
return (int64_t)(workDiff.getdouble() / timeDiff);
9292
}
9393

9494
Value getnetworkhashps(const Array& params, bool fHelp)
@@ -226,8 +226,8 @@ Value gethashespersec(const Array& params, bool fHelp)
226226
);
227227

228228
if (GetTimeMillis() - nHPSTimerStart > 8000)
229-
return (boost::int64_t)0;
230-
return (boost::int64_t)dHashesPerSec;
229+
return (int64_t)0;
230+
return (int64_t)dHashesPerSec;
231231
}
232232
#endif
233233

src/rpcmisc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@ Value getinfo(const Array& params, bool fHelp)
6969
}
7070
#endif
7171
obj.push_back(Pair("blocks", (int)chainActive.Height()));
72-
obj.push_back(Pair("timeoffset", (boost::int64_t)GetTimeOffset()));
72+
obj.push_back(Pair("timeoffset", GetTimeOffset()));
7373
obj.push_back(Pair("connections", (int)vNodes.size()));
7474
obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
7575
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
7676
obj.push_back(Pair("testnet", TestNet()));
7777
#ifdef ENABLE_WALLET
7878
if (pwalletMain) {
79-
obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime()));
79+
obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime()));
8080
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
8181
}
8282
if (pwalletMain && pwalletMain->IsCrypted())
83-
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime));
83+
obj.push_back(Pair("unlocked_until", nWalletUnlockTime));
8484
obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee)));
8585
#endif
8686
obj.push_back(Pair("relayfee", ValueFromAmount(CTransaction::nMinRelayTxFee)));

src/rpcnet.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ Value getpeerinfo(const Array& params, bool fHelp)
116116
if (!(stats.addrLocal.empty()))
117117
obj.push_back(Pair("addrlocal", stats.addrLocal));
118118
obj.push_back(Pair("services", strprintf("%08x", stats.nServices)));
119-
obj.push_back(Pair("lastsend", (boost::int64_t)stats.nLastSend));
120-
obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv));
121-
obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes));
122-
obj.push_back(Pair("bytesrecv", (boost::int64_t)stats.nRecvBytes));
123-
obj.push_back(Pair("conntime", (boost::int64_t)stats.nTimeConnected));
119+
obj.push_back(Pair("lastsend", stats.nLastSend));
120+
obj.push_back(Pair("lastrecv", stats.nLastRecv));
121+
obj.push_back(Pair("bytessent", stats.nSendBytes));
122+
obj.push_back(Pair("bytesrecv", stats.nRecvBytes));
123+
obj.push_back(Pair("conntime", stats.nTimeConnected));
124124
obj.push_back(Pair("pingtime", stats.dPingTime));
125125
if (stats.dPingWait > 0.0)
126126
obj.push_back(Pair("pingwait", stats.dPingWait));
@@ -328,9 +328,9 @@ Value getnettotals(const Array& params, bool fHelp)
328328
);
329329

330330
Object obj;
331-
obj.push_back(Pair("totalbytesrecv", static_cast< boost::uint64_t>(CNode::GetTotalBytesRecv())));
332-
obj.push_back(Pair("totalbytessent", static_cast<boost::uint64_t>(CNode::GetTotalBytesSent())));
333-
obj.push_back(Pair("timemillis", static_cast<boost::int64_t>(GetTimeMillis())));
331+
obj.push_back(Pair("totalbytesrecv", CNode::GetTotalBytesRecv()));
332+
obj.push_back(Pair("totalbytessent", CNode::GetTotalBytesSent()));
333+
obj.push_back(Pair("timemillis", GetTimeMillis()));
334334
return obj;
335335
}
336336

@@ -365,7 +365,7 @@ Value getnetworkinfo(const Array& params, bool fHelp)
365365
Object obj;
366366
obj.push_back(Pair("version", (int)CLIENT_VERSION));
367367
obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION));
368-
obj.push_back(Pair("timeoffset", (boost::int64_t)GetTimeOffset()));
368+
obj.push_back(Pair("timeoffset", GetTimeOffset()));
369369
obj.push_back(Pair("connections", (int)vNodes.size()));
370370
obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
371371
obj.push_back(Pair("relayfee", ValueFromAmount(CTransaction::nMinRelayTxFee)));

0 commit comments

Comments
 (0)