Replace boost with C++17 std equivalents, upgrade LZ4 to 1.10.0
- boost::tuple → std::tuple (serialize.h, miner.cpp, script.cpp, walletdb.cpp) - boost::shared_ptr → std::shared_ptr (trianglesrpc.cpp) - boost::variant → std::variant for CTxDestination (script.h) - boost::get → std::get_if (main.cpp, rpcblockchain.cpp, coincontroldialog.cpp, wallet.cpp) - boost::apply_visitor → std::visit (base58.h, script.cpp, rpcwallet.cpp, test/base58_tests.cpp) - boost::static_visitor removed from all visitor classes - boost::lexical_cast → std::to_string/std::stoll (smessage.cpp, rpcsmessage.cpp) - Removed unused boost/lexical_cast.hpp includes (rest.cpp, trianglesrpc.cpp) - Removed boost/variant/get.hpp include (rpcdump.cpp) - Upgraded vendored LZ4 from 1.1.3 to 1.10.0 - Updated LZ4_compress() → LZ4_compress_default() (smessage.cpp) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -260,7 +260,7 @@ public:
|
||||
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
|
||||
*/
|
||||
class CTrianglesAddress;
|
||||
class CTrianglesAddressVisitor : public boost::static_visitor<bool>
|
||||
class CTrianglesAddressVisitor
|
||||
{
|
||||
private:
|
||||
CTrianglesAddress *addr;
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
|
||||
bool Set(const CTxDestination &dest)
|
||||
{
|
||||
return boost::apply_visitor(CTrianglesAddressVisitor(this), dest);
|
||||
return std::visit(CTrianglesAddressVisitor(this), dest);
|
||||
}
|
||||
|
||||
bool IsValid() const
|
||||
|
||||
+10
-22
@@ -1,24 +1,12 @@
|
||||
LZ4 Library
|
||||
Copyright (c) 2011-2014, Yann Collet
|
||||
All rights reserved.
|
||||
This repository uses 2 different licenses :
|
||||
- all files in the `lib` directory use a BSD 2-Clause license
|
||||
- all other files use a GPL-2.0-or-later license, unless explicitly stated otherwise
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
Relevant license is reminded at the top of each source file,
|
||||
and with presence of COPYING or LICENSE file in associated directories.
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
This model is selected to emphasize that
|
||||
files in the `lib` directory are designed to be included into 3rd party applications,
|
||||
while all other files, in `programs`, `tests` or `examples`,
|
||||
are intended to be used "as is", as part of their intended scenarios,
|
||||
with no intention to support 3rd party integration use cases.
|
||||
|
||||
+2571
-622
File diff suppressed because it is too large
Load Diff
+808
-172
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1526,14 +1526,14 @@ static bool GetAddressFromScript(const CScript& script, int& nType, uint160& has
|
||||
if (!ExtractDestination(script, dest))
|
||||
return false;
|
||||
|
||||
const CKeyID* keyId = boost::get<CKeyID>(&dest);
|
||||
const CKeyID* keyId = std::get_if<CKeyID>(&dest);
|
||||
if (keyId) {
|
||||
nType = ADDR_TYPE_P2PKH;
|
||||
hashBytes = *keyId;
|
||||
return true;
|
||||
}
|
||||
|
||||
const CScriptID* scriptId = boost::get<CScriptID>(&dest);
|
||||
const CScriptID* scriptId = std::get_if<CScriptID>(&dest);
|
||||
if (scriptId) {
|
||||
nType = ADDR_TYPE_P2SH;
|
||||
hashBytes = *scriptId;
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ uint64_t nLastBlockSize = 0;
|
||||
int64_t nLastCoinStakeSearchInterval = 0;
|
||||
|
||||
// We want to sort transactions by priority and fee, so:
|
||||
typedef boost::tuple<double, double, CTransaction*> TxPriority;
|
||||
typedef std::tuple<double, double, CTransaction*> TxPriority;
|
||||
class TxPriorityCompare
|
||||
{
|
||||
bool byFee;
|
||||
|
||||
@@ -522,7 +522,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
|
||||
{
|
||||
CPubKey pubkey;
|
||||
CKeyID *keyid = boost::get< CKeyID >(&address);
|
||||
CKeyID *keyid = std::get_if< CKeyID >(&address);
|
||||
if (keyid && model->getPubKey(*keyid, pubkey))
|
||||
nBytesInputs += (pubkey.IsCompressed() ? 148 : 180);
|
||||
else
|
||||
@@ -703,7 +703,7 @@ void CoinControlDialog::updateView()
|
||||
itemOutput->setText(COLUMN_ADDRESS, sAddress);
|
||||
|
||||
CPubKey pubkey;
|
||||
CKeyID *keyid = boost::get< CKeyID >(&outputAddress);
|
||||
CKeyID *keyid = std::get_if< CKeyID >(&outputAddress);
|
||||
if (keyid && model->getPubKey(*keyid, pubkey) && !pubkey.IsCompressed())
|
||||
nInputSize = 180;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "init.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
|
||||
@@ -431,13 +431,13 @@ static bool ParseAddress(const std::string& strAddr, int& nType, uint160& hashBy
|
||||
return false;
|
||||
|
||||
CTxDestination dest = addr.Get();
|
||||
const CKeyID* keyId = boost::get<CKeyID>(&dest);
|
||||
const CKeyID* keyId = std::get_if<CKeyID>(&dest);
|
||||
if (keyId) {
|
||||
nType = ADDR_TYPE_P2PKH;
|
||||
hashBytes = *keyId;
|
||||
return true;
|
||||
}
|
||||
const CScriptID* scriptId = boost::get<CScriptID>(&dest);
|
||||
const CScriptID* scriptId = std::get_if<CScriptID>(&dest);
|
||||
if (scriptId) {
|
||||
nType = ADDR_TYPE_P2SH;
|
||||
hashBytes = *scriptId;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "base58.h"
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/variant/get.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#define printf OutputDebugStringF
|
||||
|
||||
+6
-6
@@ -5,7 +5,7 @@
|
||||
#include "main.h"
|
||||
#include "trianglesrpc.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <string>
|
||||
|
||||
#include "smessage.h"
|
||||
#include "init.h" // pwalletMain
|
||||
@@ -802,13 +802,13 @@ Value smsgbuckets(const Array& params, bool fHelp)
|
||||
{
|
||||
std::set<SecMsgToken>& tokenSet = it->second.setTokens;
|
||||
|
||||
std::string sBucket = boost::lexical_cast<std::string>(it->first);
|
||||
std::string sBucket = std::to_string(it->first);
|
||||
std::string sFile = sBucket + "_01.dat";
|
||||
|
||||
snprintf(cbuf, sizeof(cbuf), "%"PRIszu, tokenSet.size());
|
||||
std::string snContents(cbuf);
|
||||
|
||||
std::string sHash = boost::lexical_cast<std::string>(it->second.hash);
|
||||
std::string sHash = std::to_string(it->second.hash);
|
||||
|
||||
nBuckets++;
|
||||
nMessages += tokenSet.size();
|
||||
@@ -849,8 +849,8 @@ Value smsgbuckets(const Array& params, bool fHelp)
|
||||
}; // LOCK(cs_smsg);
|
||||
|
||||
|
||||
std::string snBuckets = boost::lexical_cast<std::string>(nBuckets);
|
||||
std::string snMessages = boost::lexical_cast<std::string>(nMessages);
|
||||
std::string snBuckets = std::to_string(nBuckets);
|
||||
std::string snMessages = std::to_string(nMessages);
|
||||
|
||||
Object objM;
|
||||
objM.push_back(Pair("buckets", snBuckets));
|
||||
@@ -868,7 +868,7 @@ Value smsgbuckets(const Array& params, bool fHelp)
|
||||
|
||||
for (it = smsgBuckets.begin(); it != smsgBuckets.end(); ++it)
|
||||
{
|
||||
std::string sFile = boost::lexical_cast<std::string>(it->first) + "_01.dat";
|
||||
std::string sFile = std::to_string(it->first) + "_01.dat";
|
||||
|
||||
try {
|
||||
boost::filesystem::path fullPath = GetDataDir() / "smsgStore" / sFile;
|
||||
|
||||
+3
-3
@@ -1587,7 +1587,7 @@ Value encryptwallet(const Array& params, bool fHelp)
|
||||
return "wallet encrypted; Triangles server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup.";
|
||||
}
|
||||
|
||||
class DescribeAddressVisitor : public boost::static_visitor<Object>
|
||||
class DescribeAddressVisitor
|
||||
{
|
||||
public:
|
||||
Object operator()(const CNoDestination &dest) const { return Object(); }
|
||||
@@ -1644,7 +1644,7 @@ Value validateaddress(const Array& params, bool fHelp)
|
||||
bool fMine = IsMine(*pwalletMain, dest);
|
||||
ret.push_back(Pair("ismine", fMine));
|
||||
if (fMine) {
|
||||
Object detail = boost::apply_visitor(DescribeAddressVisitor(), dest);
|
||||
Object detail = std::visit(DescribeAddressVisitor(), dest);
|
||||
ret.insert(ret.end(), detail.begin(), detail.end());
|
||||
}
|
||||
if (pwalletMain->mapAddressBook.count(dest))
|
||||
@@ -1681,7 +1681,7 @@ Value validatepubkey(const Array& params, bool fHelp)
|
||||
ret.push_back(Pair("ismine", fMine));
|
||||
ret.push_back(Pair("iscompressed", isCompressed));
|
||||
if (fMine) {
|
||||
Object detail = boost::apply_visitor(DescribeAddressVisitor(), dest);
|
||||
Object detail = std::visit(DescribeAddressVisitor(), dest);
|
||||
ret.insert(ret.end(), detail.begin(), detail.end());
|
||||
}
|
||||
if (pwalletMain->mapAddressBook.count(dest))
|
||||
|
||||
+8
-9
@@ -3,8 +3,7 @@
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <tuple>
|
||||
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
@@ -1213,7 +1212,7 @@ class CSignatureCache
|
||||
{
|
||||
private:
|
||||
// sigdata_type is (signature hash, signature, public key):
|
||||
typedef boost::tuple<uint256, std::vector<unsigned char>, std::vector<unsigned char> > sigdata_type;
|
||||
typedef std::tuple<uint256, std::vector<unsigned char>, std::vector<unsigned char> > sigdata_type;
|
||||
std::set< sigdata_type> setValid;
|
||||
CCriticalSection cs_sigcache;
|
||||
|
||||
@@ -1542,7 +1541,7 @@ unsigned int HaveKeys(const vector<valtype>& pubkeys, const CKeyStore& keystore)
|
||||
}
|
||||
|
||||
|
||||
class CKeyStoreIsMineVisitor : public boost::static_visitor<bool>
|
||||
class CKeyStoreIsMineVisitor
|
||||
{
|
||||
private:
|
||||
const CKeyStore *keystore;
|
||||
@@ -1555,7 +1554,7 @@ public:
|
||||
|
||||
bool IsMine(const CKeyStore &keystore, const CTxDestination &dest)
|
||||
{
|
||||
return boost::apply_visitor(CKeyStoreIsMineVisitor(&keystore), dest);
|
||||
return std::visit(CKeyStoreIsMineVisitor(&keystore), dest);
|
||||
}
|
||||
|
||||
bool IsMine(const CKeyStore &keystore, const CScript& scriptPubKey)
|
||||
@@ -1623,7 +1622,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
|
||||
return false;
|
||||
}
|
||||
|
||||
class CAffectedKeysVisitor : public boost::static_visitor<void> {
|
||||
class CAffectedKeysVisitor {
|
||||
private:
|
||||
const CKeyStore &keystore;
|
||||
std::vector<CKeyID> &vKeys;
|
||||
@@ -1637,7 +1636,7 @@ public:
|
||||
int nRequired;
|
||||
if (ExtractDestinations(script, type, vDest, nRequired)) {
|
||||
for (const CTxDestination &dest : vDest)
|
||||
boost::apply_visitor(*this, dest);
|
||||
std::visit(*this, dest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1994,7 +1993,7 @@ bool CScript::HasCanonicalPushes() const
|
||||
return true;
|
||||
}
|
||||
|
||||
class CScriptVisitor : public boost::static_visitor<bool>
|
||||
class CScriptVisitor
|
||||
{
|
||||
private:
|
||||
CScript *script;
|
||||
@@ -2022,7 +2021,7 @@ public:
|
||||
|
||||
void CScript::SetDestination(const CTxDestination& dest)
|
||||
{
|
||||
boost::apply_visitor(CScriptVisitor(this), dest);
|
||||
std::visit(CScriptVisitor(this), dest);
|
||||
}
|
||||
|
||||
void CScript::SetMultisig(int nRequired, const std::vector<CKey>& keys)
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boost/variant.hpp>
|
||||
#include <variant>
|
||||
|
||||
#include "keystore.h"
|
||||
#include "bignum.h"
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
* * CScriptID: TX_SCRIPTHASH destination
|
||||
* A CTxDestination is the internal data type encoded in a CTrianglesAddress
|
||||
*/
|
||||
typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination;
|
||||
typedef std::variant<CNoDestination, CKeyID, CScriptID> CTxDestination;
|
||||
|
||||
const char* GetTxnOutputType(txnouttype t);
|
||||
|
||||
|
||||
+34
-36
@@ -17,9 +17,7 @@
|
||||
#include <cstdio>
|
||||
|
||||
#include <boost/type_traits/is_fundamental.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <boost/tuple/tuple_io.hpp>
|
||||
#include <tuple>
|
||||
|
||||
#include "allocators.h"
|
||||
#include "version.h"
|
||||
@@ -310,14 +308,14 @@ template<typename Stream, typename K, typename T> void Serialize(Stream& os, con
|
||||
template<typename Stream, typename K, typename T> void Unserialize(Stream& is, std::pair<K, T>& item, int nType, int nVersion);
|
||||
|
||||
// 3 tuple
|
||||
template<typename T0, typename T1, typename T2> unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2>& item, int nType, int nVersion);
|
||||
template<typename Stream, typename T0, typename T1, typename T2> void Serialize(Stream& os, const boost::tuple<T0, T1, T2>& item, int nType, int nVersion);
|
||||
template<typename Stream, typename T0, typename T1, typename T2> void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVersion);
|
||||
template<typename T0, typename T1, typename T2> unsigned int GetSerializeSize(const std::tuple<T0, T1, T2>& item, int nType, int nVersion);
|
||||
template<typename Stream, typename T0, typename T1, typename T2> void Serialize(Stream& os, const std::tuple<T0, T1, T2>& item, int nType, int nVersion);
|
||||
template<typename Stream, typename T0, typename T1, typename T2> void Unserialize(Stream& is, std::tuple<T0, T1, T2>& item, int nType, int nVersion);
|
||||
|
||||
// 4 tuple
|
||||
template<typename T0, typename T1, typename T2, typename T3> unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion);
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Serialize(Stream& os, const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion);
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Unserialize(Stream& is, boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion);
|
||||
template<typename T0, typename T1, typename T2, typename T3> unsigned int GetSerializeSize(const std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion);
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Serialize(Stream& os, const std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion);
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Unserialize(Stream& is, std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion);
|
||||
|
||||
// map
|
||||
template<typename K, typename T, typename Pred, typename A> unsigned int GetSerializeSize(const std::map<K, T, Pred, A>& m, int nType, int nVersion);
|
||||
@@ -530,29 +528,29 @@ void Unserialize(Stream& is, std::pair<K, T>& item, int nType, int nVersion)
|
||||
// 3 tuple
|
||||
//
|
||||
template<typename T0, typename T1, typename T2>
|
||||
unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
unsigned int GetSerializeSize(const std::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
{
|
||||
unsigned int nSize = 0;
|
||||
nSize += GetSerializeSize(boost::get<0>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(boost::get<1>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(boost::get<2>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(std::get<0>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(std::get<1>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(std::get<2>(item), nType, nVersion);
|
||||
return nSize;
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2>
|
||||
void Serialize(Stream& os, const boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
void Serialize(Stream& os, const std::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
{
|
||||
Serialize(os, boost::get<0>(item), nType, nVersion);
|
||||
Serialize(os, boost::get<1>(item), nType, nVersion);
|
||||
Serialize(os, boost::get<2>(item), nType, nVersion);
|
||||
Serialize(os, std::get<0>(item), nType, nVersion);
|
||||
Serialize(os, std::get<1>(item), nType, nVersion);
|
||||
Serialize(os, std::get<2>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2>
|
||||
void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
void Unserialize(Stream& is, std::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
{
|
||||
Unserialize(is, boost::get<0>(item), nType, nVersion);
|
||||
Unserialize(is, boost::get<1>(item), nType, nVersion);
|
||||
Unserialize(is, boost::get<2>(item), nType, nVersion);
|
||||
Unserialize(is, std::get<0>(item), nType, nVersion);
|
||||
Unserialize(is, std::get<1>(item), nType, nVersion);
|
||||
Unserialize(is, std::get<2>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
|
||||
@@ -561,32 +559,32 @@ void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVer
|
||||
// 4 tuple
|
||||
//
|
||||
template<typename T0, typename T1, typename T2, typename T3>
|
||||
unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
unsigned int GetSerializeSize(const std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
{
|
||||
unsigned int nSize = 0;
|
||||
nSize += GetSerializeSize(boost::get<0>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(boost::get<1>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(boost::get<2>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(boost::get<3>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(std::get<0>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(std::get<1>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(std::get<2>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(std::get<3>(item), nType, nVersion);
|
||||
return nSize;
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3>
|
||||
void Serialize(Stream& os, const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
void Serialize(Stream& os, const std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
{
|
||||
Serialize(os, boost::get<0>(item), nType, nVersion);
|
||||
Serialize(os, boost::get<1>(item), nType, nVersion);
|
||||
Serialize(os, boost::get<2>(item), nType, nVersion);
|
||||
Serialize(os, boost::get<3>(item), nType, nVersion);
|
||||
Serialize(os, std::get<0>(item), nType, nVersion);
|
||||
Serialize(os, std::get<1>(item), nType, nVersion);
|
||||
Serialize(os, std::get<2>(item), nType, nVersion);
|
||||
Serialize(os, std::get<3>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3>
|
||||
void Unserialize(Stream& is, boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
void Unserialize(Stream& is, std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
{
|
||||
Unserialize(is, boost::get<0>(item), nType, nVersion);
|
||||
Unserialize(is, boost::get<1>(item), nType, nVersion);
|
||||
Unserialize(is, boost::get<2>(item), nType, nVersion);
|
||||
Unserialize(is, boost::get<3>(item), nType, nVersion);
|
||||
Unserialize(is, std::get<0>(item), nType, nVersion);
|
||||
Unserialize(is, std::get<1>(item), nType, nVersion);
|
||||
Unserialize(is, std::get<2>(item), nType, nVersion);
|
||||
Unserialize(is, std::get<3>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+10
-10
@@ -44,7 +44,7 @@ Notes:
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/hmac.h>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <string>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
|
||||
@@ -627,7 +627,7 @@ void ThreadSecureMsg(void* parg)
|
||||
{
|
||||
if (fDebugSmsg)
|
||||
printf("Removing bucket %"PRId64" \n", it->first);
|
||||
std::string fileName = boost::lexical_cast<std::string>(it->first) + "_01.dat";
|
||||
std::string fileName = std::to_string(it->first) + "_01.dat";
|
||||
fs::path fullPath = GetDataDir() / "smsgStore" / fileName;
|
||||
if (fs::exists(fullPath))
|
||||
{
|
||||
@@ -641,7 +641,7 @@ void ThreadSecureMsg(void* parg)
|
||||
printf("Path %s does not exist \n", fullPath.string().c_str());
|
||||
|
||||
// -- look for a wl file, it stores incoming messages when wallet is locked
|
||||
fileName = boost::lexical_cast<std::string>(it->first) + "_01_wl.dat";
|
||||
fileName = std::to_string(it->first) + "_01_wl.dat";
|
||||
fullPath = GetDataDir() / "smsgStore" / fileName;
|
||||
if (fs::exists(fullPath))
|
||||
{
|
||||
@@ -868,7 +868,7 @@ int SecureMsgBuildBucketSet()
|
||||
|
||||
std::string stime = fileName.substr(0, sep);
|
||||
|
||||
int64_t fileTime = boost::lexical_cast<int64_t>(stime);
|
||||
int64_t fileTime = std::stoll(stime);
|
||||
|
||||
if (fileTime < now - SMSG_RETENTION)
|
||||
{
|
||||
@@ -2224,7 +2224,7 @@ bool SecureMsgScanBuckets()
|
||||
|
||||
std::string stime = fileName.substr(0, sep);
|
||||
|
||||
int64_t fileTime = boost::lexical_cast<int64_t>(stime);
|
||||
int64_t fileTime = std::stoll(stime);
|
||||
|
||||
if (fileTime < now - SMSG_RETENTION)
|
||||
{
|
||||
@@ -2378,7 +2378,7 @@ int SecureMsgWalletUnlocked()
|
||||
|
||||
std::string stime = fileName.substr(0, sep);
|
||||
|
||||
int64_t fileTime = boost::lexical_cast<int64_t>(stime);
|
||||
int64_t fileTime = std::stoll(stime);
|
||||
|
||||
if (fileTime < now - SMSG_RETENTION)
|
||||
{
|
||||
@@ -2769,7 +2769,7 @@ int SecureMsgRetrieve(SecMsgToken &token, std::vector<unsigned char>& vchData)
|
||||
|
||||
//printf("token.offset %"PRId64".\n", token.offset); // DEBUG
|
||||
int64_t bucket = token.timestamp - (token.timestamp % SMSG_BUCKET_LEN);
|
||||
std::string fileName = boost::lexical_cast<std::string>(bucket) + "_01.dat";
|
||||
std::string fileName = std::to_string(bucket) + "_01.dat";
|
||||
fs::path fullpath = pathSmsgDir / fileName;
|
||||
|
||||
//printf("bucket %"PRId64".\n", bucket);
|
||||
@@ -2972,7 +2972,7 @@ int SecureMsgStoreUnscanned(unsigned char *pHeader, unsigned char *pPayload, uin
|
||||
|
||||
int64_t bucket = psmsg->timestamp - (psmsg->timestamp % SMSG_BUCKET_LEN);
|
||||
|
||||
std::string fileName = boost::lexical_cast<std::string>(bucket) + "_01_wl.dat";
|
||||
std::string fileName = std::to_string(bucket) + "_01_wl.dat";
|
||||
fs::path fullpath = pathSmsgDir / fileName;
|
||||
|
||||
FILE *fp;
|
||||
@@ -3073,7 +3073,7 @@ int SecureMsgStore(unsigned char *pHeader, unsigned char *pPayload, uint32_t nPa
|
||||
return 1;
|
||||
};
|
||||
|
||||
std::string fileName = boost::lexical_cast<std::string>(bucket) + "_01.dat";
|
||||
std::string fileName = std::to_string(bucket) + "_01.dat";
|
||||
fs::path fullpath = pathSmsgDir / fileName;
|
||||
|
||||
FILE *fp;
|
||||
@@ -3468,7 +3468,7 @@ int SecureMsgEncrypt(SecureMessage& smsg, std::string& addressFrom, std::string&
|
||||
return 8;
|
||||
};
|
||||
|
||||
int lenComp = LZ4_compress((char*)message.c_str(), (char*)&vchCompressed[0], lenMsg);
|
||||
int lenComp = LZ4_compress_default((char*)message.c_str(), (char*)&vchCompressed[0], lenMsg, worstCase);
|
||||
if (lenComp < 1)
|
||||
{
|
||||
printf("Could not compress message data.\n");
|
||||
|
||||
@@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(base58_DecodeBase58)
|
||||
}
|
||||
|
||||
// Visitor to check address type
|
||||
class TestAddrTypeVisitor : public boost::static_visitor<bool>
|
||||
class TestAddrTypeVisitor
|
||||
{
|
||||
private:
|
||||
std::string exp_addrType;
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
};
|
||||
|
||||
// Visitor to check address payload
|
||||
class TestPayloadVisitor : public boost::static_visitor<bool>
|
||||
class TestPayloadVisitor
|
||||
{
|
||||
private:
|
||||
std::vector<unsigned char> exp_payload;
|
||||
@@ -150,7 +150,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_parse)
|
||||
BOOST_CHECK_MESSAGE(addr.IsValid(), "!IsValid:" + strTest);
|
||||
BOOST_CHECK_MESSAGE(addr.IsScript() == (exp_addrType == "script"), "isScript mismatch" + strTest);
|
||||
CTxDestination dest = addr.Get();
|
||||
BOOST_CHECK_MESSAGE(boost::apply_visitor(TestAddrTypeVisitor(exp_addrType), dest), "addrType mismatch" + strTest);
|
||||
BOOST_CHECK_MESSAGE(std::visit(TestAddrTypeVisitor(exp_addrType), dest), "addrType mismatch" + strTest);
|
||||
|
||||
// Public key must be invalid private key
|
||||
secret.SetString(exp_base58string);
|
||||
@@ -213,7 +213,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_gen)
|
||||
continue;
|
||||
}
|
||||
CTrianglesAddress addrOut;
|
||||
BOOST_CHECK_MESSAGE(boost::apply_visitor(CTrianglesAddressVisitor(&addrOut), dest), "encode dest: " + strTest);
|
||||
BOOST_CHECK_MESSAGE(std::visit(CTrianglesAddressVisitor(&addrOut), dest), "encode dest: " + strTest);
|
||||
BOOST_CHECK_MESSAGE(addrOut.ToString() == exp_base58string, "mismatch: " + strTest);
|
||||
}
|
||||
}
|
||||
@@ -221,7 +221,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_gen)
|
||||
// Visiting a CNoDestination must fail
|
||||
CTrianglesAddress dummyAddr;
|
||||
CTxDestination nodest = CNoDestination();
|
||||
BOOST_CHECK(!boost::apply_visitor(CTrianglesAddressVisitor(&dummyAddr), nodest));
|
||||
BOOST_CHECK(!std::visit(CTrianglesAddressVisitor(&dummyAddr), nodest));
|
||||
|
||||
// Restore global state
|
||||
fTestNet = fTestNet_stored;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
@@ -22,10 +22,9 @@
|
||||
#include <boost/iostreams/concepts.hpp>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <memory>
|
||||
#include <list>
|
||||
|
||||
#define printf OutputDebugStringF
|
||||
@@ -740,7 +739,7 @@ void ThreadRPCServer(void* parg)
|
||||
|
||||
// Forward declaration required for RPCListen
|
||||
template <typename Protocol, typename SocketAcceptorService>
|
||||
static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
|
||||
static void RPCAcceptHandler(std::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
|
||||
ssl::context& context,
|
||||
bool fUseSSL,
|
||||
AcceptedConnection* conn,
|
||||
@@ -750,7 +749,7 @@ static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol,
|
||||
* Sets up I/O resources to accept and handle a new connection.
|
||||
*/
|
||||
template <typename Protocol, typename SocketAcceptorService>
|
||||
static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
|
||||
static void RPCListen(std::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
|
||||
ssl::context& context,
|
||||
const bool fUseSSL)
|
||||
{
|
||||
@@ -772,7 +771,7 @@ static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketA
|
||||
* Accept and handle incoming connection.
|
||||
*/
|
||||
template <typename Protocol, typename SocketAcceptorService>
|
||||
static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
|
||||
static void RPCAcceptHandler(std::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
|
||||
ssl::context& context,
|
||||
const bool fUseSSL,
|
||||
AcceptedConnection* conn,
|
||||
@@ -875,7 +874,7 @@ void ThreadRPCServer2(void* parg)
|
||||
asio::ip::address bindAddress = loopback ? asio::ip::address_v6::loopback() : asio::ip::address_v6::any();
|
||||
ip::tcp::endpoint endpoint(bindAddress, GetArg("-rpcport", GetDefaultRPCPort()));
|
||||
boost::system::error_code v6_only_error;
|
||||
boost::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(io_service));
|
||||
std::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(io_service));
|
||||
|
||||
boost::signals2::signal<void ()> StopRequests;
|
||||
|
||||
|
||||
+1
-1
@@ -1698,7 +1698,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
|
||||
CScript scriptChange;
|
||||
|
||||
// coin control: send change to custom address
|
||||
if (coinControl && !boost::get<CNoDestination>(&coinControl->destChange))
|
||||
if (coinControl && !std::get_if<CNoDestination>(&coinControl->destChange))
|
||||
scriptChange.SetDestination(coinControl->destChange);
|
||||
|
||||
// no coin control: send change to newly generated address
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ bool CWalletDB::WriteAccount(const string& strAccount, const CAccount& account)
|
||||
|
||||
bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry& acentry)
|
||||
{
|
||||
return Write(boost::make_tuple(string("acentry"), acentry.strAccount, nAccEntryNum), acentry);
|
||||
return Write(std::make_tuple(string("acentry"), acentry.strAccount, nAccEntryNum), acentry);
|
||||
}
|
||||
|
||||
bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry)
|
||||
@@ -80,7 +80,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin
|
||||
// Read next record
|
||||
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
|
||||
if (fFlags == DB_SET_RANGE)
|
||||
ssKey << boost::make_tuple(string("acentry"), (fAllAccounts? string("") : strAccount), uint64_t(0));
|
||||
ssKey << std::make_tuple(string("acentry"), (fAllAccounts? string("") : strAccount), uint64_t(0));
|
||||
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
|
||||
int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
|
||||
fFlags = DB_NEXT;
|
||||
|
||||
Reference in New Issue
Block a user