diff --git a/src/allocators.h b/src/allocators.h index 9b58c27..f328cbf 100644 --- a/src/allocators.h +++ b/src/allocators.h @@ -254,7 +254,7 @@ struct zero_after_free_allocator : public std::allocator }; // This is exactly like std::string, but with a custom allocator. -typedef std::basic_string, secure_allocator > SecureString; +using SecureString = std::basic_string, secure_allocator>; static inline SecureString MakeSecureString(const std::string& value) { diff --git a/src/crypter.h b/src/crypter.h index 61c563d..63b64dd 100644 --- a/src/crypter.h +++ b/src/crypter.h @@ -80,7 +80,7 @@ public: }; -typedef std::vector > CKeyingMaterial; +using CKeyingMaterial = std::vector>; /** Encryption/decryption context with key information */ class CCrypter diff --git a/src/kernel.cpp b/src/kernel.cpp index 0d54652..efdac80 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -14,7 +14,7 @@ extern unsigned int nTargetSpacing; // Set to 20-minute for production network //unsigned int nModifierInterval = MODIFIER_INTERVAL; -typedef std::map MapModifierCheckpoints; +using MapModifierCheckpoints = std::map; // Hard checkpoints of stake modifiers to ensure they are deterministic static std::map mapStakeModifierCheckpoints = { diff --git a/src/key.h b/src/key.h index 93d8c8a..8954504 100644 --- a/src/key.h +++ b/src/key.h @@ -99,9 +99,8 @@ public: // secure_allocator is defined in allocators.h // CPrivKey is a serialized private key, with all parameters included (279 bytes) -typedef std::vector > CPrivKey; -// CSecret is a serialization of just the secret parameter (32 bytes) -typedef std::vector > CSecret; +using CPrivKey = std::vector>; +using CSecret = std::vector>; /** An encapsulated secp256k1 elliptic-curve key (public and/or private). */ class CKey diff --git a/src/keystore.h b/src/keystore.h index 789c16c..4fb2523 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -44,8 +44,8 @@ public: } }; -typedef std::map > KeyMap; -typedef std::map ScriptMap; +using KeyMap = std::map>; +using ScriptMap = std::map; /** Basic key store, that keeps keys in an address->secret map */ class CBasicKeyStore : public CKeyStore @@ -94,7 +94,7 @@ public: virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const; }; -typedef std::map > > CryptedKeyMap; +using CryptedKeyMap = std::map>>; /** Keystore which keeps the private keys encrypted. * It derives from the basic key store, which is used if no encryption is active. diff --git a/src/main.h b/src/main.h index 584cbae..3ea03d5 100644 --- a/src/main.h +++ b/src/main.h @@ -475,7 +475,7 @@ public: } }; -typedef std::map MapPrevTx; +using MapPrevTx = std::map; /** The basic transaction that is broadcasted on the network and contained in * blocks. A transaction can contain multiple inputs and outputs. diff --git a/src/miner.cpp b/src/miner.cpp index 570a558..f6e4dc9 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -50,7 +50,7 @@ uint64_t nLastBlockSize = 0; int64_t nLastCoinStakeSearchInterval = 0; // We want to sort transactions by priority and fee, so: -typedef std::tuple TxPriority; +using TxPriority = std::tuple; class TxPriorityCompare { bool byFee; diff --git a/src/script.h b/src/script.h index b6f6069..b8d4c63 100644 --- a/src/script.h +++ b/src/script.h @@ -16,7 +16,7 @@ #include "keystore.h" #include "bignum.h" -typedef std::vector valtype; +using valtype = std::vector; class CTransaction; @@ -51,7 +51,7 @@ public: * * CScriptID: TX_SCRIPTHASH destination * A CTxDestination is the internal data type encoded in a CTrianglesAddress */ -typedef std::variant CTxDestination; +using CTxDestination = std::variant; const char* GetTxnOutputType(TxnOutType t); diff --git a/src/serialize.h b/src/serialize.h index c9fc9d6..9420d63 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -59,12 +59,11 @@ enum unsigned int GetSerializeSize(int nType, int nVersion) const \ { \ CSerActionGetSerializeSize ser_action; \ - const bool fGetSize = true; \ - const bool fWrite = false; \ - const bool fRead = false; \ + [[maybe_unused]] const bool fGetSize = true; \ + [[maybe_unused]] const bool fWrite = false; \ + [[maybe_unused]] const bool fRead = false; \ unsigned int nSerSize = 0; \ ser_streamplaceholder s; \ - assert(fGetSize||fWrite||fRead); /* suppress warning */ \ s.nType = nType; \ s.nVersion = nVersion; \ {statements} \ @@ -74,22 +73,20 @@ enum void Serialize(Stream& s, int nType, int nVersion) const \ { \ CSerActionSerialize ser_action; \ - const bool fGetSize = false; \ - const bool fWrite = true; \ - const bool fRead = false; \ - unsigned int nSerSize = 0; \ - assert(fGetSize||fWrite||fRead); /* suppress warning */ \ + [[maybe_unused]] const bool fGetSize = false; \ + [[maybe_unused]] const bool fWrite = true; \ + [[maybe_unused]] const bool fRead = false; \ + [[maybe_unused]] unsigned int nSerSize = 0; \ {statements} \ } \ template \ void Unserialize(Stream& s, int nType, int nVersion) \ { \ CSerActionUnserialize ser_action; \ - const bool fGetSize = false; \ - const bool fWrite = false; \ - const bool fRead = true; \ - unsigned int nSerSize = 0; \ - assert(fGetSize||fWrite||fRead); /* suppress warning */ \ + [[maybe_unused]] const bool fGetSize = false; \ + [[maybe_unused]] const bool fWrite = false; \ + [[maybe_unused]] const bool fRead = true; \ + [[maybe_unused]] unsigned int nSerSize = 0; \ {statements} \ } @@ -705,7 +702,7 @@ struct ser_streamplaceholder -typedef std::vector > CSerializeData; +using CSerializeData = std::vector>; /** Double ended buffer combining vector and stream-like interfaces. * diff --git a/src/sync.cpp b/src/sync.cpp index 41c7c70..b5f7518 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -46,7 +46,7 @@ private: int sourceLine; }; -typedef std::vector< std::pair > LockStack; +using LockStack = std::vector>; static std::mutex dd_mutex; static std::map, LockStack> lockorders; diff --git a/src/sync.h b/src/sync.h index 0232d80..7a960c1 100644 --- a/src/sync.h +++ b/src/sync.h @@ -9,10 +9,10 @@ #include /** Recursive mutex: supports recursive locking, but no waiting */ -typedef std::recursive_mutex CCriticalSection; +using CCriticalSection = std::recursive_mutex; /** Plain mutex: supports waiting but not recursive locking */ -typedef std::mutex CWaitableCriticalSection; +using CWaitableCriticalSection = std::mutex; #ifdef DEBUG_LOCKORDER void EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false); diff --git a/src/wallet.h b/src/wallet.h index 32f0ec4..058f4e4 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -29,7 +29,7 @@ class COutput; class CCoinControl; //typedef std::map StealthKeyMetaMap; -typedef std::map mapValue_t; +using mapValue_t = std::map; /** (client) version numbers for particular wallet features */ enum class WalletFeature : int @@ -359,8 +359,6 @@ public: }; -typedef std::map mapValue_t; - static void ReadOrderPos(int64_t& nOrderPos, mapValue_t& mapValue) {