diff --git a/.clang-format b/.clang-format index 9100396885..7b0fda27c9 100644 --- a/.clang-format +++ b/.clang-format @@ -94,3 +94,4 @@ SpacesInSquareBrackets: false Standard: Cpp11 TabWidth: 8 UseTab: Never +QualifierAlignment: Right \ No newline at end of file diff --git a/include/xrpl/basics/BasicConfig.h b/include/xrpl/basics/BasicConfig.h index 2e3478644e..dcd96e7738 100644 --- a/include/xrpl/basics/BasicConfig.h +++ b/include/xrpl/basics/BasicConfig.h @@ -367,7 +367,7 @@ get(Section const& section, } inline std::string -get(Section const& section, std::string const& name, const char* defaultValue) +get(Section const& section, std::string const& name, char const* defaultValue) { try { diff --git a/include/xrpl/basics/CompressionAlgorithms.h b/include/xrpl/basics/CompressionAlgorithms.h index 19db3568d6..4d6cf21cd8 100644 --- a/include/xrpl/basics/CompressionAlgorithms.h +++ b/include/xrpl/basics/CompressionAlgorithms.h @@ -55,7 +55,7 @@ lz4Compress(void const* in, std::size_t inSize, BufferFactory&& bf) auto compressed = bf(outCapacity); auto compressedSize = LZ4_compress_default( - reinterpret_cast(in), + reinterpret_cast(in), reinterpret_cast(compressed), inSize, outCapacity); @@ -89,7 +89,7 @@ lz4Decompress( Throw("lz4Decompress: integer overflow (output)"); if (LZ4_decompress_safe( - reinterpret_cast(in), + reinterpret_cast(in), reinterpret_cast(decompressed), inSize, decompressedSize) != decompressedSize) diff --git a/include/xrpl/basics/Expected.h b/include/xrpl/basics/Expected.h index 9abc7c8432..9afb160d9d 100644 --- a/include/xrpl/basics/Expected.h +++ b/include/xrpl/basics/Expected.h @@ -93,7 +93,7 @@ public: { } - constexpr const E& + constexpr E const& value() const& { return val_; @@ -111,7 +111,7 @@ public: return std::move(val_); } - constexpr const E&& + constexpr E const&& value() const&& { return std::move(val_); diff --git a/include/xrpl/basics/TaggedCache.h b/include/xrpl/basics/TaggedCache.h index 64570ae061..99c91fe393 100644 --- a/include/xrpl/basics/TaggedCache.h +++ b/include/xrpl/basics/TaggedCache.h @@ -115,7 +115,7 @@ public: sweep(); bool - del(const key_type& key, bool valid); + del(key_type const& key, bool valid); public: /** Replace aliased objects with originals. @@ -134,20 +134,20 @@ public: template bool canonicalize( - const key_type& key, + key_type const& key, SharedPointerType& data, R&& replaceCallback); bool canonicalize_replace_cache( - const key_type& key, + key_type const& key, SharedPointerType const& data); bool - canonicalize_replace_client(const key_type& key, SharedPointerType& data); + canonicalize_replace_client(key_type const& key, SharedPointerType& data); SharedPointerType - fetch(const key_type& key); + fetch(key_type const& key); /** Insert the element into the container. If the key already exists, nothing happens. @@ -168,7 +168,7 @@ public: // simply return an iterator. // bool - retrieve(const key_type& key, T& data); + retrieve(key_type const& key, T& data); mutex_type& peekMutex(); @@ -322,10 +322,10 @@ private: std::string m_name; // Desired number of cache entries (0 = ignore) - const int m_target_size; + int const m_target_size; // Desired maximum cache age - const clock_type::duration m_target_age; + clock_type::duration const m_target_age; // Number of items cached int m_cache_count; diff --git a/include/xrpl/basics/TaggedCache.ipp b/include/xrpl/basics/TaggedCache.ipp index 0108061680..16a3f7587a 100644 --- a/include/xrpl/basics/TaggedCache.ipp +++ b/include/xrpl/basics/TaggedCache.ipp @@ -365,7 +365,7 @@ TaggedCache< SharedPointerType, Hash, KeyEqual, - Mutex>::del(const key_type& key, bool valid) + Mutex>::del(key_type const& key, bool valid) { // Remove from cache, if !valid, remove from map too. Returns true if // removed from cache @@ -414,7 +414,7 @@ TaggedCache< KeyEqual, Mutex>:: canonicalize( - const key_type& key, + key_type const& key, SharedPointerType& data, R&& replaceCallback) { @@ -509,7 +509,7 @@ TaggedCache< KeyEqual, Mutex>:: canonicalize_replace_cache( - const key_type& key, + key_type const& key, SharedPointerType const& data) { return canonicalize( @@ -535,7 +535,7 @@ TaggedCache< Hash, KeyEqual, Mutex>:: - canonicalize_replace_client(const key_type& key, SharedPointerType& data) + canonicalize_replace_client(key_type const& key, SharedPointerType& data) { return canonicalize(key, data, []() { return false; }); } @@ -558,7 +558,7 @@ TaggedCache< SharedPointerType, Hash, KeyEqual, - Mutex>::fetch(const key_type& key) + Mutex>::fetch(key_type const& key) { std::lock_guard l(m_mutex); auto ret = initialFetch(key, l); @@ -656,7 +656,7 @@ TaggedCache< SharedPointerType, Hash, KeyEqual, - Mutex>::retrieve(const key_type& key, T& data) + Mutex>::retrieve(key_type const& key, T& data) { // retrieve the value of the stored data auto entry = fetch(key); diff --git a/include/xrpl/basics/base_uint.h b/include/xrpl/basics/base_uint.h index 4b93330ef2..d36bf74c54 100644 --- a/include/xrpl/basics/base_uint.h +++ b/include/xrpl/basics/base_uint.h @@ -374,7 +374,7 @@ public: } base_uint& - operator^=(const base_uint& b) + operator^=(base_uint const& b) { for (int i = 0; i < WIDTH; i++) data_[i] ^= b.data_[i]; @@ -383,7 +383,7 @@ public: } base_uint& - operator&=(const base_uint& b) + operator&=(base_uint const& b) { for (int i = 0; i < WIDTH; i++) data_[i] &= b.data_[i]; @@ -392,7 +392,7 @@ public: } base_uint& - operator|=(const base_uint& b) + operator|=(base_uint const& b) { for (int i = 0; i < WIDTH; i++) data_[i] |= b.data_[i]; @@ -415,11 +415,11 @@ public: return *this; } - const base_uint + base_uint const operator++(int) { // postfix operator - const base_uint ret = *this; + base_uint const ret = *this; ++(*this); return ret; @@ -441,11 +441,11 @@ public: return *this; } - const base_uint + base_uint const operator--(int) { // postfix operator - const base_uint ret = *this; + base_uint const ret = *this; --(*this); return ret; @@ -466,7 +466,7 @@ public: } base_uint& - operator+=(const base_uint& b) + operator+=(base_uint const& b) { std::uint64_t carry = 0; @@ -511,7 +511,7 @@ public: } [[nodiscard]] constexpr bool - parseHex(const char* str) + parseHex(char const* str) { return parseHex(std::string_view{str}); } diff --git a/include/xrpl/basics/comparators.h b/include/xrpl/basics/comparators.h index ce782dcd39..0e5f11e9e5 100644 --- a/include/xrpl/basics/comparators.h +++ b/include/xrpl/basics/comparators.h @@ -43,7 +43,7 @@ struct less using result_type = bool; constexpr bool - operator()(const T& left, const T& right) const + operator()(T const& left, T const& right) const { return std::less()(left, right); } @@ -55,7 +55,7 @@ struct equal_to using result_type = bool; constexpr bool - operator()(const T& left, const T& right) const + operator()(T const& left, T const& right) const { return std::equal_to()(left, right); } diff --git a/include/xrpl/basics/partitioned_unordered_map.h b/include/xrpl/basics/partitioned_unordered_map.h index a378011520..4e503ad0fa 100644 --- a/include/xrpl/basics/partitioned_unordered_map.h +++ b/include/xrpl/basics/partitioned_unordered_map.h @@ -52,7 +52,7 @@ template < typename Value, typename Hash, typename Pred = std::equal_to, - typename Alloc = std::allocator>> + typename Alloc = std::allocator>> class partitioned_unordered_map { std::size_t partitions_; diff --git a/include/xrpl/basics/tagged_integer.h b/include/xrpl/basics/tagged_integer.h index b826b87db1..471fa8eb1e 100644 --- a/include/xrpl/basics/tagged_integer.h +++ b/include/xrpl/basics/tagged_integer.h @@ -76,13 +76,13 @@ public: } bool - operator<(const tagged_integer& rhs) const noexcept + operator<(tagged_integer const& rhs) const noexcept { return m_value < rhs.m_value; } bool - operator==(const tagged_integer& rhs) const noexcept + operator==(tagged_integer const& rhs) const noexcept { return m_value == rhs.m_value; } @@ -144,14 +144,14 @@ public: } tagged_integer& - operator<<=(const tagged_integer& rhs) noexcept + operator<<=(tagged_integer const& rhs) noexcept { m_value <<= rhs.m_value; return *this; } tagged_integer& - operator>>=(const tagged_integer& rhs) noexcept + operator>>=(tagged_integer const& rhs) noexcept { m_value >>= rhs.m_value; return *this; diff --git a/include/xrpl/beast/utility/temp_dir.h b/include/xrpl/beast/utility/temp_dir.h index bbb7afc7b4..074b7461a4 100644 --- a/include/xrpl/beast/utility/temp_dir.h +++ b/include/xrpl/beast/utility/temp_dir.h @@ -37,9 +37,9 @@ class temp_dir public: #if !GENERATING_DOCS - temp_dir(const temp_dir&) = delete; + temp_dir(temp_dir const&) = delete; temp_dir& - operator=(const temp_dir&) = delete; + operator=(temp_dir const&) = delete; #endif /// Construct a temporary directory. diff --git a/include/xrpl/json/json_reader.h b/include/xrpl/json/json_reader.h index 27d608f850..81866819a5 100644 --- a/include/xrpl/json/json_reader.h +++ b/include/xrpl/json/json_reader.h @@ -39,7 +39,7 @@ class Reader { public: using Char = char; - using Location = const Char*; + using Location = Char const*; /** \brief Constructs a Reader allowing all features * for parsing. @@ -64,7 +64,7 @@ public: * error occurred. */ bool - parse(const char* beginDoc, const char* endDoc, Value& root); + parse(char const* beginDoc, char const* endDoc, Value& root); /// \brief Parse from input stream. /// \see Json::operator>>(std::istream&, Json::Value&). @@ -133,7 +133,7 @@ private: using Errors = std::deque; bool - expectToken(TokenType type, Token& token, const char* message); + expectToken(TokenType type, Token& token, char const* message); bool readToken(Token& token); void diff --git a/include/xrpl/json/json_value.h b/include/xrpl/json/json_value.h index 91d29c28d6..3431ab7744 100644 --- a/include/xrpl/json/json_value.h +++ b/include/xrpl/json/json_value.h @@ -61,24 +61,24 @@ enum ValueType { class StaticString { public: - constexpr explicit StaticString(const char* czstring) : str_(czstring) + constexpr explicit StaticString(char const* czstring) : str_(czstring) { } constexpr - operator const char*() const + operator char const*() const { return str_; } - constexpr const char* + constexpr char const* c_str() const { return str_; } private: - const char* str_; + char const* str_; }; inline bool @@ -156,10 +156,10 @@ public: using Int = Json::Int; using ArrayIndex = UInt; - static const Value null; - static const Int minInt; - static const Int maxInt; - static const UInt maxUInt; + static Value const null; + static Int const minInt; + static Int const maxInt; + static UInt const maxUInt; private: class CZString @@ -171,24 +171,24 @@ private: duplicateOnCopy }; CZString(int index); - CZString(const char* cstr, DuplicationPolicy allocate); - CZString(const CZString& other); + CZString(char const* cstr, DuplicationPolicy allocate); + CZString(CZString const& other); ~CZString(); CZString& - operator=(const CZString& other) = delete; + operator=(CZString const& other) = delete; bool - operator<(const CZString& other) const; + operator<(CZString const& other) const; bool - operator==(const CZString& other) const; + operator==(CZString const& other) const; int index() const; - const char* + char const* c_str() const; bool isStaticString() const; private: - const char* cstr_; + char const* cstr_; int index_; }; @@ -215,7 +215,7 @@ public: Value(Int value); Value(UInt value); Value(double value); - Value(const char* value); + Value(char const* value); /** \brief Constructs a value from a static string. * Like other value string constructor but do not duplicate the string for @@ -227,10 +227,10 @@ public: * Json::Value aValue( StaticString("some text") ); * \endcode */ - Value(const StaticString& value); + Value(StaticString const& value); Value(std::string const& value); Value(bool value); - Value(const Value& other); + Value(Value const& other); ~Value(); Value& @@ -247,7 +247,7 @@ public: ValueType type() const; - const char* + char const* asCString() const; /** Returns the unquoted string value. */ std::string @@ -317,12 +317,12 @@ public: /// Access an array element (zero based index ) /// (You may need to say 'value[0u]' to get your compiler to distinguish /// this from the operator[] which takes a string.) - const Value& + Value const& operator[](UInt index) const; /// If the array contains at least index+1 elements, returns the element /// value, otherwise returns defaultValue. Value - get(UInt index, const Value& defaultValue) const; + get(UInt index, Value const& defaultValue) const; /// Return true if index < size(). bool isValidIndex(UInt index) const; @@ -330,25 +330,25 @@ public: /// /// Equivalent to jsonvalue[jsonvalue.size()] = value; Value& - append(const Value& value); + append(Value const& value); Value& append(Value&& value); /// Access an object value by name, create a null member if it does not /// exist. Value& - operator[](const char* key); + operator[](char const* key); /// Access an object value by name, returns null if there is no member with /// that name. - const Value& - operator[](const char* key) const; + Value const& + operator[](char const* key) const; /// Access an object value by name, create a null member if it does not /// exist. Value& operator[](std::string const& key); /// Access an object value by name, returns null if there is no member with /// that name. - const Value& + Value const& operator[](std::string const& key) const; /** \brief Access an object value by name, create a null member if it does not exist. @@ -364,14 +364,14 @@ public: * \endcode */ Value& - operator[](const StaticString& key); + operator[](StaticString const& key); /// Return the member named key if it exist, defaultValue otherwise. Value - get(const char* key, const Value& defaultValue) const; + get(char const* key, Value const& defaultValue) const; /// Return the member named key if it exist, defaultValue otherwise. Value - get(std::string const& key, const Value& defaultValue) const; + get(std::string const& key, Value const& defaultValue) const; /// \brief Remove and return the named member. /// @@ -380,14 +380,14 @@ public: /// \pre type() is objectValue or nullValue /// \post type() is unchanged Value - removeMember(const char* key); + removeMember(char const* key); /// Same as removeMember(const char*) Value removeMember(std::string const& key); /// Return true if the object has a member named key. bool - isMember(const char* key) const; + isMember(char const* key) const; /// Return true if the object has a member named key. bool isMember(std::string const& key) const; @@ -414,13 +414,13 @@ public: end(); friend bool - operator==(const Value&, const Value&); + operator==(Value const&, Value const&); friend bool - operator<(const Value&, const Value&); + operator<(Value const&, Value const&); private: Value& - resolveReference(const char* key, bool isStatic); + resolveReference(char const* key, bool isStatic); private: union ValueHolder @@ -437,31 +437,31 @@ private: }; bool -operator==(const Value&, const Value&); +operator==(Value const&, Value const&); inline bool -operator!=(const Value& x, const Value& y) +operator!=(Value const& x, Value const& y) { return !(x == y); } bool -operator<(const Value&, const Value&); +operator<(Value const&, Value const&); inline bool -operator<=(const Value& x, const Value& y) +operator<=(Value const& x, Value const& y) { return !(y < x); } inline bool -operator>(const Value& x, const Value& y) +operator>(Value const& x, Value const& y) { return y < x; } inline bool -operator>=(const Value& x, const Value& y) +operator>=(Value const& x, Value const& y) { return !(x < y); } @@ -482,11 +482,11 @@ public: virtual ~ValueAllocator() = default; virtual char* - makeMemberName(const char* memberName) = 0; + makeMemberName(char const* memberName) = 0; virtual void releaseMemberName(char* memberName) = 0; virtual char* - duplicateStringValue(const char* value, unsigned int length = unknown) = 0; + duplicateStringValue(char const* value, unsigned int length = unknown) = 0; virtual void releaseStringValue(char* value) = 0; }; @@ -503,16 +503,16 @@ public: ValueIteratorBase(); - explicit ValueIteratorBase(const Value::ObjectValues::iterator& current); + explicit ValueIteratorBase(Value::ObjectValues::iterator const& current); bool - operator==(const SelfType& other) const + operator==(SelfType const& other) const { return isEqual(other); } bool - operator!=(const SelfType& other) const + operator!=(SelfType const& other) const { return !isEqual(other); } @@ -528,7 +528,7 @@ public: /// Return the member name of the referenced Value. "" if it is not an /// objectValue. - const char* + char const* memberName() const; protected: @@ -542,13 +542,13 @@ protected: decrement(); difference_type - computeDistance(const SelfType& other) const; + computeDistance(SelfType const& other) const; bool - isEqual(const SelfType& other) const; + isEqual(SelfType const& other) const; void - copy(const SelfType& other); + copy(SelfType const& other); private: Value::ObjectValues::iterator current_; @@ -566,8 +566,8 @@ class ValueConstIterator : public ValueIteratorBase public: using size_t = unsigned int; using difference_type = int; - using reference = const Value&; - using pointer = const Value*; + using reference = Value const&; + using pointer = Value const*; using SelfType = ValueConstIterator; ValueConstIterator() = default; @@ -575,11 +575,11 @@ public: private: /*! \internal Use by Value to create an iterator. */ - explicit ValueConstIterator(const Value::ObjectValues::iterator& current); + explicit ValueConstIterator(Value::ObjectValues::iterator const& current); public: SelfType& - operator=(const ValueIteratorBase& other); + operator=(ValueIteratorBase const& other); SelfType operator++(int) @@ -632,17 +632,17 @@ public: using SelfType = ValueIterator; ValueIterator() = default; - ValueIterator(const ValueConstIterator& other); - ValueIterator(const ValueIterator& other); + ValueIterator(ValueConstIterator const& other); + ValueIterator(ValueIterator const& other); private: /*! \internal Use by Value to create an iterator. */ - explicit ValueIterator(const Value::ObjectValues::iterator& current); + explicit ValueIterator(Value::ObjectValues::iterator const& current); public: SelfType& - operator=(const SelfType& other); + operator=(SelfType const& other); SelfType operator++(int) diff --git a/include/xrpl/json/json_writer.h b/include/xrpl/json/json_writer.h index 1b4ff15508..7e21e766e3 100644 --- a/include/xrpl/json/json_writer.h +++ b/include/xrpl/json/json_writer.h @@ -39,7 +39,7 @@ public: { } virtual std::string - write(const Value& root) = 0; + write(Value const& root) = 0; }; /** \brief Outputs a Value in JSON format @@ -60,11 +60,11 @@ public: public: // overridden from Writer std::string - write(const Value& root) override; + write(Value const& root) override; private: void - writeValue(const Value& value); + writeValue(Value const& value); std::string document_; }; @@ -101,15 +101,15 @@ public: // overridden from Writer * JSON document that represents the root value. */ std::string - write(const Value& root) override; + write(Value const& root) override; private: void - writeValue(const Value& value); + writeValue(Value const& value); void - writeArrayValue(const Value& value); + writeArrayValue(Value const& value); bool - isMultineArray(const Value& value); + isMultineArray(Value const& value); void pushValue(std::string const& value); void @@ -168,15 +168,15 @@ public: * return a value. */ void - write(std::ostream& out, const Value& root); + write(std::ostream& out, Value const& root); private: void - writeValue(const Value& value); + writeValue(Value const& value); void - writeArrayValue(const Value& value); + writeArrayValue(Value const& value); bool - isMultineArray(const Value& value); + isMultineArray(Value const& value); void pushValue(std::string const& value); void @@ -207,12 +207,12 @@ valueToString(double value); std::string valueToString(bool value); std::string -valueToQuotedString(const char* value); +valueToQuotedString(char const* value); /// \brief Output using the StyledStreamWriter. /// \see Json::operator>>() std::ostream& -operator<<(std::ostream&, const Value& root); +operator<<(std::ostream&, Value const& root); //------------------------------------------------------------------------------ diff --git a/include/xrpl/json/to_string.h b/include/xrpl/json/to_string.h index 5f692a415e..5b20293f06 100644 --- a/include/xrpl/json/to_string.h +++ b/include/xrpl/json/to_string.h @@ -37,7 +37,7 @@ pretty(Value const&); /** Output using the StyledStreamWriter. @see Json::operator>>(). */ std::ostream& -operator<<(std::ostream&, const Value& root); +operator<<(std::ostream&, Value const& root); } // namespace Json diff --git a/include/xrpl/protocol/FeeUnits.h b/include/xrpl/protocol/FeeUnits.h index 0cbf1b608a..c6949a434c 100644 --- a/include/xrpl/protocol/FeeUnits.h +++ b/include/xrpl/protocol/FeeUnits.h @@ -336,7 +336,7 @@ public: // Output Fees as just their numeric value. template std::basic_ostream& -operator<<(std::basic_ostream& os, const TaggedFee& q) +operator<<(std::basic_ostream& os, TaggedFee const& q) { return os << q.value(); } diff --git a/include/xrpl/protocol/MultiApiJson.h b/include/xrpl/protocol/MultiApiJson.h index 15743e856b..1e35bdbda2 100644 --- a/include/xrpl/protocol/MultiApiJson.h +++ b/include/xrpl/protocol/MultiApiJson.h @@ -80,7 +80,7 @@ struct MultiApiJson } void - set(const char* key, auto const& v) + set(char const* key, auto const& v) requires std::constructible_from { for (auto& a : this->val) @@ -91,7 +91,7 @@ struct MultiApiJson enum IsMemberResult : int { none = 0, some, all }; [[nodiscard]] IsMemberResult - isMember(const char* key) const + isMember(char const* key) const { int count = 0; for (auto& a : this->val) diff --git a/include/xrpl/protocol/Permissions.h b/include/xrpl/protocol/Permissions.h index eb2c733313..8ba53d94d7 100644 --- a/include/xrpl/protocol/Permissions.h +++ b/include/xrpl/protocol/Permissions.h @@ -67,9 +67,9 @@ public: static Permission const& getInstance(); - Permission(const Permission&) = delete; + Permission(Permission const&) = delete; Permission& - operator=(const Permission&) = delete; + operator=(Permission const&) = delete; std::optional getGranularValue(std::string const& name) const; @@ -85,7 +85,7 @@ public: // for tx level permission, permission value is equal to tx type plus one uint32_t - txToPermissionType(const TxType& type) const; + txToPermissionType(TxType const& type) const; // tx type value is permission value minus one TxType diff --git a/include/xrpl/protocol/Quality.h b/include/xrpl/protocol/Quality.h index 6783fbf6da..f1a3a58224 100644 --- a/include/xrpl/protocol/Quality.h +++ b/include/xrpl/protocol/Quality.h @@ -113,8 +113,8 @@ public: // have lower unsigned integer representations. using value_type = std::uint64_t; - static const int minTickSize = 3; - static const int maxTickSize = 16; + static int const minTickSize = 3; + static int const maxTickSize = 16; private: // This has the same representation as STAmount, see the comment on the diff --git a/include/xrpl/protocol/SField.h b/include/xrpl/protocol/SField.h index 01909b1986..04d4dc82fc 100644 --- a/include/xrpl/protocol/SField.h +++ b/include/xrpl/protocol/SField.h @@ -182,22 +182,22 @@ public: private_access_tag_t, SerializedTypeID tid, int fv, - const char* fn, + char const* fn, int meta = sMD_Default, IsSigning signing = IsSigning::yes); explicit SField(private_access_tag_t, int fc); - static const SField& + static SField const& getField(int fieldCode); - static const SField& + static SField const& getField(std::string const& fieldName); - static const SField& + static SField const& getField(int type, int value) { return getField(field_code(type, value)); } - static const SField& + static SField const& getField(SerializedTypeID type, int value) { return getField(field_code(type, value)); @@ -284,19 +284,19 @@ public: } bool - operator==(const SField& f) const + operator==(SField const& f) const { return fieldCode == f.fieldCode; } bool - operator!=(const SField& f) const + operator!=(SField const& f) const { return fieldCode != f.fieldCode; } static int - compare(const SField& f1, const SField& f2); + compare(SField const& f1, SField const& f2); static std::map const& getKnownCodeToField() diff --git a/include/xrpl/protocol/STAccount.h b/include/xrpl/protocol/STAccount.h index 537a336e5d..422a01defa 100644 --- a/include/xrpl/protocol/STAccount.h +++ b/include/xrpl/protocol/STAccount.h @@ -58,7 +58,7 @@ public: add(Serializer& s) const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; bool isDefault() const override; diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index 23e4c5e5b5..518edacf0b 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -62,20 +62,20 @@ private: public: using value_type = STAmount; - static const int cMinOffset = -96; - static const int cMaxOffset = 80; + static int const cMinOffset = -96; + static int const cMaxOffset = 80; // Maximum native value supported by the code - static const std::uint64_t cMinValue = 1000000000000000ull; - static const std::uint64_t cMaxValue = 9999999999999999ull; - static const std::uint64_t cMaxNative = 9000000000000000000ull; + static std::uint64_t const cMinValue = 1000000000000000ull; + static std::uint64_t const cMaxValue = 9999999999999999ull; + static std::uint64_t const cMaxNative = 9000000000000000000ull; // Max native value on network. - static const std::uint64_t cMaxNativeN = 100000000000000000ull; - static const std::uint64_t cIssuedCurrency = 0x8000000000000000ull; - static const std::uint64_t cPositive = 0x4000000000000000ull; - static const std::uint64_t cMPToken = 0x2000000000000000ull; - static const std::uint64_t cValueMask = ~(cPositive | cMPToken); + static std::uint64_t const cMaxNativeN = 100000000000000000ull; + static std::uint64_t const cIssuedCurrency = 0x8000000000000000ull; + static std::uint64_t const cPositive = 0x4000000000000000ull; + static std::uint64_t const cMPToken = 0x2000000000000000ull; + static std::uint64_t const cValueMask = ~(cPositive | cMPToken); static std::uint64_t const uRateOne; @@ -274,7 +274,7 @@ public: add(Serializer& s) const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; bool isDefault() const override; diff --git a/include/xrpl/protocol/STArray.h b/include/xrpl/protocol/STArray.h index 7fa2ecad83..8f1e2dd0ee 100644 --- a/include/xrpl/protocol/STArray.h +++ b/include/xrpl/protocol/STArray.h @@ -128,13 +128,13 @@ public: add(Serializer& s) const override; void - sort(bool (*compare)(const STObject& o1, const STObject& o2)); + sort(bool (*compare)(STObject const& o1, STObject const& o2)); bool - operator==(const STArray& s) const; + operator==(STArray const& s) const; bool - operator!=(const STArray& s) const; + operator!=(STArray const& s) const; iterator erase(iterator pos); @@ -152,7 +152,7 @@ public: getSType() const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; bool isDefault() const override; @@ -275,13 +275,13 @@ STArray::swap(STArray& a) noexcept } inline bool -STArray::operator==(const STArray& s) const +STArray::operator==(STArray const& s) const { return v_ == s.v_; } inline bool -STArray::operator!=(const STArray& s) const +STArray::operator!=(STArray const& s) const { return v_ != s.v_; } diff --git a/include/xrpl/protocol/STBase.h b/include/xrpl/protocol/STBase.h index e0f28e03de..8d0aaabe48 100644 --- a/include/xrpl/protocol/STBase.h +++ b/include/xrpl/protocol/STBase.h @@ -129,16 +129,16 @@ class STBase public: virtual ~STBase() = default; STBase(); - STBase(const STBase&) = default; + STBase(STBase const&) = default; STBase& - operator=(const STBase& t); + operator=(STBase const& t); explicit STBase(SField const& n); bool - operator==(const STBase& t) const; + operator==(STBase const& t) const; bool - operator!=(const STBase& t) const; + operator!=(STBase const& t) const; template D& @@ -197,7 +197,7 @@ private: //------------------------------------------------------------------------------ std::ostream& -operator<<(std::ostream& out, const STBase& t); +operator<<(std::ostream& out, STBase const& t); template D& diff --git a/include/xrpl/protocol/STBitString.h b/include/xrpl/protocol/STBitString.h index bf4ce84a3f..7d41637c89 100644 --- a/include/xrpl/protocol/STBitString.h +++ b/include/xrpl/protocol/STBitString.h @@ -45,8 +45,8 @@ public: STBitString() = default; STBitString(SField const& n); - STBitString(const value_type& v); - STBitString(SField const& n, const value_type& v); + STBitString(value_type const& v); + STBitString(SField const& n, value_type const& v); STBitString(SerialIter& sit, SField const& name); SerializedTypeID @@ -56,7 +56,7 @@ public: getText() const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; void add(Serializer& s) const override; @@ -93,12 +93,12 @@ inline STBitString::STBitString(SField const& n) : STBase(n) } template -inline STBitString::STBitString(const value_type& v) : value_(v) +inline STBitString::STBitString(value_type const& v) : value_(v) { } template -inline STBitString::STBitString(SField const& n, const value_type& v) +inline STBitString::STBitString(SField const& n, value_type const& v) : STBase(n), value_(v) { } @@ -160,9 +160,9 @@ STBitString::getText() const template bool -STBitString::isEquivalent(const STBase& t) const +STBitString::isEquivalent(STBase const& t) const { - const STBitString* v = dynamic_cast(&t); + STBitString const* v = dynamic_cast(&t); return v && (value_ == v->value_); } diff --git a/include/xrpl/protocol/STBlob.h b/include/xrpl/protocol/STBlob.h index cfe4ab5af5..80832b2688 100644 --- a/include/xrpl/protocol/STBlob.h +++ b/include/xrpl/protocol/STBlob.h @@ -63,7 +63,7 @@ public: add(Serializer& s) const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; bool isDefault() const override; diff --git a/include/xrpl/protocol/STCurrency.h b/include/xrpl/protocol/STCurrency.h index 3383137fb3..90a6589048 100644 --- a/include/xrpl/protocol/STCurrency.h +++ b/include/xrpl/protocol/STCurrency.h @@ -65,7 +65,7 @@ public: add(Serializer& s) const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; bool isDefault() const override; diff --git a/include/xrpl/protocol/STInteger.h b/include/xrpl/protocol/STInteger.h index 68e25be1c9..b259638774 100644 --- a/include/xrpl/protocol/STInteger.h +++ b/include/xrpl/protocol/STInteger.h @@ -54,7 +54,7 @@ public: isDefault() const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; STInteger& operator=(value_type const& v); @@ -127,9 +127,9 @@ STInteger::isDefault() const template inline bool -STInteger::isEquivalent(const STBase& t) const +STInteger::isEquivalent(STBase const& t) const { - const STInteger* v = dynamic_cast(&t); + STInteger const* v = dynamic_cast(&t); return v && (value_ == v->value_); } diff --git a/include/xrpl/protocol/STIssue.h b/include/xrpl/protocol/STIssue.h index 08812c15ae..c729854e1b 100644 --- a/include/xrpl/protocol/STIssue.h +++ b/include/xrpl/protocol/STIssue.h @@ -71,7 +71,7 @@ public: add(Serializer& s) const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; bool isDefault() const override; diff --git a/include/xrpl/protocol/STLedgerEntry.h b/include/xrpl/protocol/STLedgerEntry.h index 96b37af0b9..3609a04d4b 100644 --- a/include/xrpl/protocol/STLedgerEntry.h +++ b/include/xrpl/protocol/STLedgerEntry.h @@ -35,7 +35,7 @@ class STLedgerEntry final : public STObject, public CountedObject public: using pointer = std::shared_ptr; - using ref = const std::shared_ptr&; + using ref = std::shared_ptr const&; /** Create an empty object with the given key and type. */ explicit STLedgerEntry(Keylet const& k); diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index b89a415ebe..2efa828267 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -99,8 +99,8 @@ public: STObject& operator=(STObject&& other); - STObject(const SOTemplate& type, SField const& name); - STObject(const SOTemplate& type, SerialIter& sit, SField const& name); + STObject(SOTemplate const& type, SField const& name); + STObject(SOTemplate const& type, SerialIter& sit, SField const& name); STObject(SerialIter& sit, SField const& name, int depth = 0); STObject(SerialIter&& sit, SField const& name); explicit STObject(SField const& name); @@ -121,7 +121,7 @@ public: reserve(std::size_t n); void - applyTemplate(const SOTemplate& type); + applyTemplate(SOTemplate const& type); void applyTemplateFromSField(SField const&); @@ -130,7 +130,7 @@ public: isFree() const; void - set(const SOTemplate&); + set(SOTemplate const&); bool set(SerialIter& u, int depth = 0); @@ -139,7 +139,7 @@ public: getSType() const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; bool isDefault() const override; @@ -183,13 +183,13 @@ public: uint256 getSigningHash(HashPrefix prefix) const; - const STBase& + STBase const& peekAtIndex(int offset) const; STBase& getIndex(int offset); - const STBase* + STBase const* peekAtPIndex(int offset) const; STBase* @@ -201,13 +201,13 @@ public: SField const& getFieldSType(int index) const; - const STBase& + STBase const& peekAtField(SField const& field) const; STBase& getField(SField const& field); - const STBase* + STBase const* peekAtPField(SField const& field) const; STBase* @@ -241,11 +241,11 @@ public: getFieldAmount(SField const& field) const; STPathSet const& getFieldPathSet(SField const& field) const; - const STVector256& + STVector256 const& getFieldV256(SField const& field) const; - const STArray& + STArray const& getFieldArray(SField const& field) const; - const STCurrency& + STCurrency const& getFieldCurrency(SField const& field) const; STNumber const& getFieldNumber(SField const& field) const; @@ -409,12 +409,12 @@ public: delField(int index); bool - hasMatchingEntry(const STBase&); + hasMatchingEntry(STBase const&); bool - operator==(const STObject& o) const; + operator==(STObject const& o) const; bool - operator!=(const STObject& o) const; + operator!=(STObject const& o) const; class FieldErr; @@ -970,7 +970,7 @@ STObject::getCount() const return v_.size(); } -inline const STBase& +inline STBase const& STObject::peekAtIndex(int offset) const { return v_[offset].get(); @@ -982,7 +982,7 @@ STObject::getIndex(int offset) return v_[offset].get(); } -inline const STBase* +inline STBase const* STObject::peekAtPIndex(int offset) const { return &v_[offset].get(); @@ -1117,7 +1117,7 @@ STObject::setFieldH160(SField const& field, base_uint<160, Tag> const& v) } inline bool -STObject::operator!=(const STObject& o) const +STObject::operator!=(STObject const& o) const { return !(*this == o); } @@ -1126,7 +1126,7 @@ template V STObject::getFieldByValue(SField const& field) const { - const STBase* rf = peekAtPField(field); + STBase const* rf = peekAtPField(field); if (!rf) throwFieldNotFound(field); @@ -1136,7 +1136,7 @@ STObject::getFieldByValue(SField const& field) const if (id == STI_NOTPRESENT) return V(); // optional field not present - const T* cf = dynamic_cast(rf); + T const* cf = dynamic_cast(rf); if (!cf) Throw("Wrong field type"); @@ -1153,7 +1153,7 @@ template V const& STObject::getFieldByConstRef(SField const& field, V const& empty) const { - const STBase* rf = peekAtPField(field); + STBase const* rf = peekAtPField(field); if (!rf) throwFieldNotFound(field); @@ -1163,7 +1163,7 @@ STObject::getFieldByConstRef(SField const& field, V const& empty) const if (id == STI_NOTPRESENT) return empty; // optional field not present - const T* cf = dynamic_cast(rf); + T const* cf = dynamic_cast(rf); if (!cf) Throw("Wrong field type"); diff --git a/include/xrpl/protocol/STPathSet.h b/include/xrpl/protocol/STPathSet.h index 7605a2283c..c56dd43e7f 100644 --- a/include/xrpl/protocol/STPathSet.h +++ b/include/xrpl/protocol/STPathSet.h @@ -106,10 +106,10 @@ public: getIssuerID() const; bool - operator==(const STPathElement& t) const; + operator==(STPathElement const& t) const; bool - operator!=(const STPathElement& t) const; + operator!=(STPathElement const& t) const; private: static std::size_t @@ -164,7 +164,7 @@ public: STPathElement& operator[](int i); - const STPathElement& + STPathElement const& operator[](int i) const; void @@ -196,7 +196,7 @@ public: assembleAdd(STPath const& base, STPathElement const& tail); bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; bool isDefault() const override; @@ -375,7 +375,7 @@ STPathElement::getIssuerID() const } inline bool -STPathElement::operator==(const STPathElement& t) const +STPathElement::operator==(STPathElement const& t) const { return (mType & typeAccount) == (t.mType & typeAccount) && hash_value_ == t.hash_value_ && mAccountID == t.mAccountID && @@ -383,7 +383,7 @@ STPathElement::operator==(const STPathElement& t) const } inline bool -STPathElement::operator!=(const STPathElement& t) const +STPathElement::operator!=(STPathElement const& t) const { return !operator==(t); } @@ -455,7 +455,7 @@ STPath::operator[](int i) return mPath[i]; } -inline const STPathElement& +inline STPathElement const& STPath::operator[](int i) const { return mPath[i]; diff --git a/include/xrpl/protocol/STVector256.h b/include/xrpl/protocol/STVector256.h index d81ddf977f..bc22ebdc7f 100644 --- a/include/xrpl/protocol/STVector256.h +++ b/include/xrpl/protocol/STVector256.h @@ -50,7 +50,7 @@ public: Json::Value getJson(JsonOptions) const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; bool isDefault() const override; @@ -62,7 +62,7 @@ public: operator=(std::vector&& v); void - setValue(const STVector256& v); + setValue(STVector256 const& v); /** Retrieve a copy of the vector we contain */ explicit @@ -153,7 +153,7 @@ STVector256::operator=(std::vector&& v) } inline void -STVector256::setValue(const STVector256& v) +STVector256::setValue(STVector256 const& v) { mValue = v.mValue; } diff --git a/include/xrpl/protocol/STXChainBridge.h b/include/xrpl/protocol/STXChainBridge.h index 813bcc4443..4435857a51 100644 --- a/include/xrpl/protocol/STXChainBridge.h +++ b/include/xrpl/protocol/STXChainBridge.h @@ -107,7 +107,7 @@ public: add(Serializer& s) const override; bool - isEquivalent(const STBase& t) const override; + isEquivalent(STBase const& t) const override; bool isDefault() const override; diff --git a/include/xrpl/protocol/Serializer.h b/include/xrpl/protocol/Serializer.h index 5724a19f57..9c77aa4111 100644 --- a/include/xrpl/protocol/Serializer.h +++ b/include/xrpl/protocol/Serializer.h @@ -139,9 +139,9 @@ public: int addRaw(Slice slice); int - addRaw(const void* ptr, int len); + addRaw(void const* ptr, int len); int - addRaw(const Serializer& s); + addRaw(Serializer const& s); int addVL(Blob const& vector); @@ -151,7 +151,7 @@ public: int addVL(Iter begin, Iter end, int len); int - addVL(const void* ptr, int len); + addVL(void const* ptr, int len); // disassemble functions bool @@ -161,7 +161,7 @@ public: bool getInteger(Integer& number, int offset) { - static const auto bytes = sizeof(Integer); + static auto const bytes = sizeof(Integer); if ((offset + bytes) > mData.size()) return false; number = 0; @@ -220,7 +220,7 @@ public: { return mData.size(); } - const void* + void const* getDataPtr() const { return mData.data(); @@ -238,7 +238,7 @@ public: std::string getString() const { - return std::string(static_cast(getDataPtr()), size()); + return std::string(static_cast(getDataPtr()), size()); } void erase() @@ -296,12 +296,12 @@ public: return v != mData; } bool - operator==(const Serializer& v) const + operator==(Serializer const& v) const { return v.mData == mData; } bool - operator!=(const Serializer& v) const + operator!=(Serializer const& v) const { return v.mData != mData; } diff --git a/include/xrpl/protocol/XRPAmount.h b/include/xrpl/protocol/XRPAmount.h index 1d6cae9ecf..332735dc6f 100644 --- a/include/xrpl/protocol/XRPAmount.h +++ b/include/xrpl/protocol/XRPAmount.h @@ -267,7 +267,7 @@ XRPAmount::decimalXRP() const // Output XRPAmount as just the drops value. template std::basic_ostream& -operator<<(std::basic_ostream& os, const XRPAmount& q) +operator<<(std::basic_ostream& os, XRPAmount const& q) { return os << q.drops(); } diff --git a/include/xrpl/protocol/detail/token_errors.h b/include/xrpl/protocol/detail/token_errors.h index 23a46bd1c5..0ae2728024 100644 --- a/include/xrpl/protocol/detail/token_errors.h +++ b/include/xrpl/protocol/detail/token_errors.h @@ -50,7 +50,7 @@ class TokenCodecErrcCategory : public std::error_category { public: // Return a short descriptive name for the category - virtual const char* + virtual char const* name() const noexcept override final { return "TokenCodecError"; @@ -86,7 +86,7 @@ public: }; } // namespace detail -inline const ripple::detail::TokenCodecErrcCategory& +inline ripple::detail::TokenCodecErrcCategory const& TokenCodecErrcCategory() { static ripple::detail::TokenCodecErrcCategory c; diff --git a/include/xrpl/protocol/json_get_or_throw.h b/include/xrpl/protocol/json_get_or_throw.h index 5277ee8648..c59b5a71a3 100644 --- a/include/xrpl/protocol/json_get_or_throw.h +++ b/include/xrpl/protocol/json_get_or_throw.h @@ -20,7 +20,7 @@ struct JsonMissingKeyError : std::exception JsonMissingKeyError(Json::StaticString const& k) : key{k.c_str()} { } - const char* + char const* what() const noexcept override { if (msg.empty()) @@ -40,7 +40,7 @@ struct JsonTypeMismatchError : std::exception : key{k.c_str()}, expectedType{std::move(et)} { } - const char* + char const* what() const noexcept override { if (msg.empty()) diff --git a/src/libxrpl/basics/Archive.cpp b/src/libxrpl/basics/Archive.cpp index 2ddbc8200c..e60b2f12cf 100644 --- a/src/libxrpl/basics/Archive.cpp +++ b/src/libxrpl/basics/Archive.cpp @@ -94,7 +94,7 @@ extractTarLz4( if (archive_entry_size(entry) > 0) { - const void* buf; + void const* buf; size_t sz; la_int64_t offset; while (true) diff --git a/src/libxrpl/basics/FileUtilities.cpp b/src/libxrpl/basics/FileUtilities.cpp index c0456b0556..291eb43c7b 100644 --- a/src/libxrpl/basics/FileUtilities.cpp +++ b/src/libxrpl/basics/FileUtilities.cpp @@ -63,7 +63,7 @@ getFileContents( return {}; } - const std::string result{ + std::string const result{ std::istreambuf_iterator{fileStream}, std::istreambuf_iterator{}}; diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index 186a363b41..f43288b57b 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -469,7 +469,7 @@ Number::operator/=(Number const& y) } // Shift by 10^17 gives greatest precision while not overflowing uint128_t // or the cast back to int64_t - const uint128_t f = 100'000'000'000'000'000; + uint128_t const f = 100'000'000'000'000'000; mantissa_ = static_cast(uint128_t(nm) * f / uint128_t(dm)); exponent_ = ne - de - 17; mantissa_ *= np * dp; diff --git a/src/libxrpl/basics/StringUtilities.cpp b/src/libxrpl/basics/StringUtilities.cpp index 5008730718..3cf3df209e 100644 --- a/src/libxrpl/basics/StringUtilities.cpp +++ b/src/libxrpl/basics/StringUtilities.cpp @@ -89,13 +89,13 @@ parseUrl(parsedURL& pUrl, std::string const& strUrl) boost::algorithm::to_lower(pUrl.scheme); pUrl.username = smMatch[2]; pUrl.password = smMatch[3]; - const std::string domain = smMatch[4]; + std::string const domain = smMatch[4]; // We need to use Endpoint to parse the domain to // strip surrounding brackets from IPv6 addresses, // e.g. [::1] => ::1. - const auto result = beast::IP::Endpoint::from_string_checked(domain); + auto const result = beast::IP::Endpoint::from_string_checked(domain); pUrl.domain = result ? result->address().to_string() : domain; - const std::string port = smMatch[5]; + std::string const port = smMatch[5]; if (!port.empty()) { pUrl.port = beast::lexicalCast(port); diff --git a/src/libxrpl/basics/UptimeClock.cpp b/src/libxrpl/basics/UptimeClock.cpp index 42ba479fae..7b61a5397e 100644 --- a/src/libxrpl/basics/UptimeClock.cpp +++ b/src/libxrpl/basics/UptimeClock.cpp @@ -67,7 +67,7 @@ UptimeClock::time_point UptimeClock::now() { // start the update thread on first use - static const auto init = start_clock(); + static auto const init = start_clock(); // Return the number of seconds since rippled start return time_point{duration{now_}}; diff --git a/src/libxrpl/json/Writer.cpp b/src/libxrpl/json/Writer.cpp index 94c7344788..369763da09 100644 --- a/src/libxrpl/json/Writer.cpp +++ b/src/libxrpl/json/Writer.cpp @@ -34,7 +34,7 @@ namespace Json { namespace { -std::map jsonSpecialCharacterEscape = { +std::map jsonSpecialCharacterEscape = { {'"', "\\\""}, {'\\', "\\\\"}, {'/', "\\/"}, @@ -47,13 +47,13 @@ std::map jsonSpecialCharacterEscape = { static size_t const jsonEscapeLength = 2; // All other JSON punctuation. -const char closeBrace = '}'; -const char closeBracket = ']'; -const char colon = ':'; -const char comma = ','; -const char openBrace = '{'; -const char openBracket = '['; -const char quote = '"'; +char const closeBrace = '}'; +char const closeBracket = ']'; +char const colon = ':'; +char const comma = ','; +char const openBrace = '{'; +char const openBracket = '['; +char const quote = '"'; static auto const integralFloatsBecomeInts = false; diff --git a/src/libxrpl/json/json_reader.cpp b/src/libxrpl/json/json_reader.cpp index 6818d73ded..9bad898bee 100644 --- a/src/libxrpl/json/json_reader.cpp +++ b/src/libxrpl/json/json_reader.cpp @@ -78,8 +78,8 @@ bool Reader::parse(std::string const& document, Value& root) { document_ = document; - const char* begin = document_.c_str(); - const char* end = begin + document_.length(); + char const* begin = document_.c_str(); + char const* end = begin + document_.length(); return parse(begin, end, root); } @@ -99,7 +99,7 @@ Reader::parse(std::istream& sin, Value& root) } bool -Reader::parse(const char* beginDoc, const char* endDoc, Value& root) +Reader::parse(char const* beginDoc, char const* endDoc, Value& root) { begin_ = beginDoc; end_ = endDoc; @@ -193,7 +193,7 @@ Reader::skipCommentTokens(Token& token) } bool -Reader::expectToken(TokenType type, Token& token, const char* message) +Reader::expectToken(TokenType type, Token& token, char const* message) { readToken(token); @@ -629,7 +629,7 @@ bool Reader::decodeDouble(Token& token) { double value = 0; - const int bufferSize = 32; + int const bufferSize = 32; int count; int length = int(token.end_ - token.start_); // Sanity check to avoid buffer overflow exploits. @@ -939,7 +939,7 @@ Reader::getFormatedErrorMessages() const itError != errors_.end(); ++itError) { - const ErrorInfo& error = *itError; + ErrorInfo const& error = *itError; formattedMessage += "* " + getLocationLineAndColumn(error.token_.start_) + "\n"; formattedMessage += " " + error.message_ + "\n"; diff --git a/src/libxrpl/json/json_value.cpp b/src/libxrpl/json/json_value.cpp index 709b425d63..86a8ed5aee 100644 --- a/src/libxrpl/json/json_value.cpp +++ b/src/libxrpl/json/json_value.cpp @@ -31,10 +31,10 @@ namespace Json { -const Value Value::null; -const Int Value::minInt = Int(~(UInt(-1) / 2)); -const Int Value::maxInt = Int(UInt(-1) / 2); -const UInt Value::maxUInt = UInt(-1); +Value const Value::null; +Int const Value::minInt = Int(~(UInt(-1) / 2)); +Int const Value::maxInt = Int(UInt(-1) / 2); +UInt const Value::maxUInt = UInt(-1); class DefaultValueAllocator : public ValueAllocator { @@ -42,7 +42,7 @@ public: virtual ~DefaultValueAllocator() = default; char* - makeMemberName(const char* memberName) override + makeMemberName(char const* memberName) override { return duplicateStringValue(memberName); } @@ -54,7 +54,7 @@ public: } char* - duplicateStringValue(const char* value, unsigned int length = unknown) + duplicateStringValue(char const* value, unsigned int length = unknown) override { //@todo investigate this old optimization @@ -110,14 +110,14 @@ Value::CZString::CZString(int index) : cstr_(0), index_(index) { } -Value::CZString::CZString(const char* cstr, DuplicationPolicy allocate) +Value::CZString::CZString(char const* cstr, DuplicationPolicy allocate) : cstr_( allocate == duplicate ? valueAllocator()->makeMemberName(cstr) : cstr) , index_(allocate) { } -Value::CZString::CZString(const CZString& other) +Value::CZString::CZString(CZString const& other) : cstr_( other.index_ != noDuplication && other.cstr_ != 0 ? valueAllocator()->makeMemberName(other.cstr_) @@ -136,7 +136,7 @@ Value::CZString::~CZString() } bool -Value::CZString::operator<(const CZString& other) const +Value::CZString::operator<(CZString const& other) const { if (cstr_ && other.cstr_) return strcmp(cstr_, other.cstr_) < 0; @@ -145,7 +145,7 @@ Value::CZString::operator<(const CZString& other) const } bool -Value::CZString::operator==(const CZString& other) const +Value::CZString::operator==(CZString const& other) const { if (cstr_ && other.cstr_) return strcmp(cstr_, other.cstr_) == 0; @@ -159,7 +159,7 @@ Value::CZString::index() const return index_; } -const char* +char const* Value::CZString::c_str() const { return cstr_; @@ -232,7 +232,7 @@ Value::Value(double value) : type_(realValue) value_.real_ = value; } -Value::Value(const char* value) : type_(stringValue), allocated_(true) +Value::Value(char const* value) : type_(stringValue), allocated_(true) { value_.string_ = valueAllocator()->duplicateStringValue(value); } @@ -243,7 +243,7 @@ Value::Value(std::string const& value) : type_(stringValue), allocated_(true) value.c_str(), (unsigned int)value.length()); } -Value::Value(const StaticString& value) : type_(stringValue), allocated_(false) +Value::Value(StaticString const& value) : type_(stringValue), allocated_(false) { value_.string_ = const_cast(value.c_str()); } @@ -253,7 +253,7 @@ Value::Value(bool value) : type_(booleanValue) value_.bool_ = value; } -Value::Value(const Value& other) : type_(other.type_) +Value::Value(Value const& other) : type_(other.type_) { switch (type_) { @@ -370,7 +370,7 @@ integerCmp(Int i, UInt ui) } bool -operator<(const Value& x, const Value& y) +operator<(Value const& x, Value const& y) { if (auto signum = x.type_ - y.type_) { @@ -419,7 +419,7 @@ operator<(const Value& x, const Value& y) } bool -operator==(const Value& x, const Value& y) +operator==(Value const& x, Value const& y) { if (x.type_ != y.type_) { @@ -464,7 +464,7 @@ operator==(const Value& x, const Value& y) return 0; // unreachable } -const char* +char const* Value::asCString() const { XRPL_ASSERT(type_ == stringValue, "Json::Value::asCString : valid type"); @@ -795,7 +795,7 @@ Value::operator[](UInt index) return (*it).second; } -const Value& +Value const& Value::operator[](UInt index) const { XRPL_ASSERT( @@ -815,13 +815,13 @@ Value::operator[](UInt index) const } Value& -Value::operator[](const char* key) +Value::operator[](char const* key) { return resolveReference(key, false); } Value& -Value::resolveReference(const char* key, bool isStatic) +Value::resolveReference(char const* key, bool isStatic) { XRPL_ASSERT( type_ == nullValue || type_ == objectValue, @@ -844,9 +844,9 @@ Value::resolveReference(const char* key, bool isStatic) } Value -Value::get(UInt index, const Value& defaultValue) const +Value::get(UInt index, Value const& defaultValue) const { - const Value* value = &((*this)[index]); + Value const* value = &((*this)[index]); return value == &null ? defaultValue : *value; } @@ -856,8 +856,8 @@ Value::isValidIndex(UInt index) const return index < size(); } -const Value& -Value::operator[](const char* key) const +Value const& +Value::operator[](char const* key) const { XRPL_ASSERT( type_ == nullValue || type_ == objectValue, @@ -881,20 +881,20 @@ Value::operator[](std::string const& key) return (*this)[key.c_str()]; } -const Value& +Value const& Value::operator[](std::string const& key) const { return (*this)[key.c_str()]; } Value& -Value::operator[](const StaticString& key) +Value::operator[](StaticString const& key) { return resolveReference(key, true); } Value& -Value::append(const Value& value) +Value::append(Value const& value) { return (*this)[size()] = value; } @@ -906,20 +906,20 @@ Value::append(Value&& value) } Value -Value::get(const char* key, const Value& defaultValue) const +Value::get(char const* key, Value const& defaultValue) const { - const Value* value = &((*this)[key]); + Value const* value = &((*this)[key]); return value == &null ? defaultValue : *value; } Value -Value::get(std::string const& key, const Value& defaultValue) const +Value::get(std::string const& key, Value const& defaultValue) const { return get(key.c_str(), defaultValue); } Value -Value::removeMember(const char* key) +Value::removeMember(char const* key) { XRPL_ASSERT( type_ == nullValue || type_ == objectValue, @@ -946,12 +946,12 @@ Value::removeMember(std::string const& key) } bool -Value::isMember(const char* key) const +Value::isMember(char const* key) const { if (type_ != objectValue) return false; - const Value* value = &((*this)[key]); + Value const* value = &((*this)[key]); return value != &null; } diff --git a/src/libxrpl/json/json_valueiterator.cpp b/src/libxrpl/json/json_valueiterator.cpp index 20dedf2bb2..9f65a48a0d 100644 --- a/src/libxrpl/json/json_valueiterator.cpp +++ b/src/libxrpl/json/json_valueiterator.cpp @@ -37,7 +37,7 @@ ValueIteratorBase::ValueIteratorBase() : current_(), isNull_(true) } ValueIteratorBase::ValueIteratorBase( - const Value::ObjectValues::iterator& current) + Value::ObjectValues::iterator const& current) : current_(current), isNull_(false) { } @@ -61,7 +61,7 @@ ValueIteratorBase::decrement() } ValueIteratorBase::difference_type -ValueIteratorBase::computeDistance(const SelfType& other) const +ValueIteratorBase::computeDistance(SelfType const& other) const { // Iterator for null value are initialized using the default // constructor, which initialize current_ to the default @@ -89,7 +89,7 @@ ValueIteratorBase::computeDistance(const SelfType& other) const } bool -ValueIteratorBase::isEqual(const SelfType& other) const +ValueIteratorBase::isEqual(SelfType const& other) const { if (isNull_) { @@ -100,7 +100,7 @@ ValueIteratorBase::isEqual(const SelfType& other) const } void -ValueIteratorBase::copy(const SelfType& other) +ValueIteratorBase::copy(SelfType const& other) { current_ = other.current_; } @@ -108,7 +108,7 @@ ValueIteratorBase::copy(const SelfType& other) Value ValueIteratorBase::key() const { - const Value::CZString czstring = (*current_).first; + Value::CZString const czstring = (*current_).first; if (czstring.c_str()) { @@ -124,7 +124,7 @@ ValueIteratorBase::key() const UInt ValueIteratorBase::index() const { - const Value::CZString czstring = (*current_).first; + Value::CZString const czstring = (*current_).first; if (!czstring.c_str()) return czstring.index(); @@ -132,10 +132,10 @@ ValueIteratorBase::index() const return Value::UInt(-1); } -const char* +char const* ValueIteratorBase::memberName() const { - const char* name = (*current_).first.c_str(); + char const* name = (*current_).first.c_str(); return name ? name : ""; } @@ -148,13 +148,13 @@ ValueIteratorBase::memberName() const // ////////////////////////////////////////////////////////////////// ValueConstIterator::ValueConstIterator( - const Value::ObjectValues::iterator& current) + Value::ObjectValues::iterator const& current) : ValueIteratorBase(current) { } ValueConstIterator& -ValueConstIterator::operator=(const ValueIteratorBase& other) +ValueConstIterator::operator=(ValueIteratorBase const& other) { copy(other); return *this; @@ -168,23 +168,23 @@ ValueConstIterator::operator=(const ValueIteratorBase& other) // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// -ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current) +ValueIterator::ValueIterator(Value::ObjectValues::iterator const& current) : ValueIteratorBase(current) { } -ValueIterator::ValueIterator(const ValueConstIterator& other) +ValueIterator::ValueIterator(ValueConstIterator const& other) : ValueIteratorBase(other) { } -ValueIterator::ValueIterator(const ValueIterator& other) +ValueIterator::ValueIterator(ValueIterator const& other) : ValueIteratorBase(other) { } ValueIterator& -ValueIterator::operator=(const SelfType& other) +ValueIterator::operator=(SelfType const& other) { copy(other); return *this; diff --git a/src/libxrpl/json/json_writer.cpp b/src/libxrpl/json/json_writer.cpp index a830f2855f..fabc697358 100644 --- a/src/libxrpl/json/json_writer.cpp +++ b/src/libxrpl/json/json_writer.cpp @@ -40,7 +40,7 @@ isControlCharacter(char ch) } static bool -containsControlCharacter(const char* str) +containsControlCharacter(char const* str) { while (*str) { @@ -117,7 +117,7 @@ valueToString(bool value) } std::string -valueToQuotedString(const char* value) +valueToQuotedString(char const* value) { // Not sure how to handle unicode... if (strpbrk(value, "\"\\\b\f\n\r\t") == nullptr && @@ -132,7 +132,7 @@ valueToQuotedString(const char* value) result.reserve(maxsize); // to avoid lots of mallocs result += "\""; - for (const char* c = value; *c != 0; ++c) + for (char const* c = value; *c != 0; ++c) { switch (*c) { @@ -197,7 +197,7 @@ valueToQuotedString(const char* value) // ////////////////////////////////////////////////////////////////// std::string -FastWriter::write(const Value& root) +FastWriter::write(Value const& root) { document_ = ""; writeValue(root); @@ -205,7 +205,7 @@ FastWriter::write(const Value& root) } void -FastWriter::writeValue(const Value& value) +FastWriter::writeValue(Value const& value) { switch (value.type()) { @@ -281,7 +281,7 @@ StyledWriter::StyledWriter() : rightMargin_(74), indentSize_(3) } std::string -StyledWriter::write(const Value& root) +StyledWriter::write(Value const& root) { document_ = ""; addChildValues_ = false; @@ -292,7 +292,7 @@ StyledWriter::write(const Value& root) } void -StyledWriter::writeValue(const Value& value) +StyledWriter::writeValue(Value const& value) { switch (value.type()) { @@ -338,7 +338,7 @@ StyledWriter::writeValue(const Value& value) while (true) { std::string const& name = *it; - const Value& childValue = value[name]; + Value const& childValue = value[name]; writeWithIndent(valueToQuotedString(name.c_str())); document_ += " : "; writeValue(childValue); @@ -358,7 +358,7 @@ StyledWriter::writeValue(const Value& value) } void -StyledWriter::writeArrayValue(const Value& value) +StyledWriter::writeArrayValue(Value const& value) { unsigned size = value.size(); @@ -377,7 +377,7 @@ StyledWriter::writeArrayValue(const Value& value) while (true) { - const Value& childValue = value[index]; + Value const& childValue = value[index]; if (hasChildValue) writeWithIndent(childValues_[index]); @@ -417,7 +417,7 @@ StyledWriter::writeArrayValue(const Value& value) } bool -StyledWriter::isMultineArray(const Value& value) +StyledWriter::isMultineArray(Value const& value) { int size = value.size(); bool isMultiLine = size * 3 >= rightMargin_; @@ -425,7 +425,7 @@ StyledWriter::isMultineArray(const Value& value) for (int index = 0; index < size && !isMultiLine; ++index) { - const Value& childValue = value[index]; + Value const& childValue = value[index]; isMultiLine = isMultiLine || ((childValue.isArray() || childValue.isObject()) && childValue.size() > 0); @@ -507,7 +507,7 @@ StyledStreamWriter::StyledStreamWriter(std::string indentation) } void -StyledStreamWriter::write(std::ostream& out, const Value& root) +StyledStreamWriter::write(std::ostream& out, Value const& root) { document_ = &out; addChildValues_ = false; @@ -518,7 +518,7 @@ StyledStreamWriter::write(std::ostream& out, const Value& root) } void -StyledStreamWriter::writeValue(const Value& value) +StyledStreamWriter::writeValue(Value const& value) { switch (value.type()) { @@ -564,7 +564,7 @@ StyledStreamWriter::writeValue(const Value& value) while (true) { std::string const& name = *it; - const Value& childValue = value[name]; + Value const& childValue = value[name]; writeWithIndent(valueToQuotedString(name.c_str())); *document_ << " : "; writeValue(childValue); @@ -584,7 +584,7 @@ StyledStreamWriter::writeValue(const Value& value) } void -StyledStreamWriter::writeArrayValue(const Value& value) +StyledStreamWriter::writeArrayValue(Value const& value) { unsigned size = value.size(); @@ -603,7 +603,7 @@ StyledStreamWriter::writeArrayValue(const Value& value) while (true) { - const Value& childValue = value[index]; + Value const& childValue = value[index]; if (hasChildValue) writeWithIndent(childValues_[index]); @@ -643,7 +643,7 @@ StyledStreamWriter::writeArrayValue(const Value& value) } bool -StyledStreamWriter::isMultineArray(const Value& value) +StyledStreamWriter::isMultineArray(Value const& value) { int size = value.size(); bool isMultiLine = size * 3 >= rightMargin_; @@ -651,7 +651,7 @@ StyledStreamWriter::isMultineArray(const Value& value) for (int index = 0; index < size && !isMultiLine; ++index) { - const Value& childValue = value[index]; + Value const& childValue = value[index]; isMultiLine = isMultiLine || ((childValue.isArray() || childValue.isObject()) && childValue.size() > 0); @@ -726,7 +726,7 @@ StyledStreamWriter::unindent() } std::ostream& -operator<<(std::ostream& sout, const Value& root) +operator<<(std::ostream& sout, Value const& root) { Json::StyledStreamWriter writer; writer.write(sout, root); diff --git a/src/libxrpl/protocol/Feature.cpp b/src/libxrpl/protocol/Feature.cpp index 3065bdf41c..eeeee1c185 100644 --- a/src/libxrpl/protocol/Feature.cpp +++ b/src/libxrpl/protocol/Feature.cpp @@ -139,27 +139,27 @@ class FeatureCollections { if (i >= features.size()) LogicError("Invalid FeatureBitset index"); - const auto& sequence = features.get(); + auto const& sequence = features.get(); return sequence[i]; } size_t getIndex(Feature const& feature) const { - const auto& sequence = features.get(); + auto const& sequence = features.get(); auto const it_to = sequence.iterator_to(feature); return it_to - sequence.begin(); } Feature const* getByFeature(uint256 const& feature) const { - const auto& feature_index = features.get(); + auto const& feature_index = features.get(); auto const feature_it = feature_index.find(feature); return feature_it == feature_index.end() ? nullptr : &*feature_it; } Feature const* getByName(std::string const& name) const { - const auto& name_index = features.get(); + auto const& name_index = features.get(); auto const name_it = name_index.find(name); return name_it == name_index.end() ? nullptr : &*name_it; } @@ -240,7 +240,7 @@ FeatureCollections::getRegisteredFeature(std::string const& name) const } void -check(bool condition, const char* logicErrorMessage) +check(bool condition, char const* logicErrorMessage) { if (!condition) LogicError(logicErrorMessage); @@ -437,9 +437,13 @@ featureToName(uint256 const& f) uint256 const feature##name = registerFeature(#name, supported, vote); #define XRPL_FIX(name, supported, vote) \ uint256 const fix##name = registerFeature("fix" #name, supported, vote); -#define XRPL_RETIRE(name) \ - [[deprecated("The referenced amendment has been retired"), maybe_unused]] \ + +// clang-format off +#define XRPL_RETIRE(name) \ + [[deprecated("The referenced amendment has been retired")]] \ + [[maybe_unused]] \ uint256 const retired##name = retireFeature(#name); +// clang-format on #include @@ -455,7 +459,7 @@ featureToName(uint256 const& f) // // Use initialization of one final static variable to set // featureCollections::readOnly. -[[maybe_unused]] static const bool readOnlySet = +[[maybe_unused]] static bool const readOnlySet = featureCollections.registrationIsDone(); } // namespace ripple diff --git a/src/libxrpl/protocol/LedgerFormats.cpp b/src/libxrpl/protocol/LedgerFormats.cpp index 9755eedf3b..94c6d65c88 100644 --- a/src/libxrpl/protocol/LedgerFormats.cpp +++ b/src/libxrpl/protocol/LedgerFormats.cpp @@ -29,7 +29,7 @@ namespace ripple { LedgerFormats::LedgerFormats() { // Fields shared by all ledger formats: - static const std::initializer_list commonFields{ + static std::initializer_list const commonFields{ {sfLedgerIndex, soeOPTIONAL}, {sfLedgerEntryType, soeREQUIRED}, {sfFlags, soeREQUIRED}, diff --git a/src/libxrpl/protocol/Quality.cpp b/src/libxrpl/protocol/Quality.cpp index f7a970a3b9..18649db561 100644 --- a/src/libxrpl/protocol/Quality.cpp +++ b/src/libxrpl/protocol/Quality.cpp @@ -183,7 +183,7 @@ Quality Quality::round(int digits) const { // Modulus for mantissa - static const std::uint64_t mod[17] = { + static std::uint64_t const mod[17] = { /* 0 */ 10000000000000000, /* 1 */ 1000000000000000, /* 2 */ 100000000000000, diff --git a/src/libxrpl/protocol/SField.cpp b/src/libxrpl/protocol/SField.cpp index b59e2a2b69..1ffce099b8 100644 --- a/src/libxrpl/protocol/SField.cpp +++ b/src/libxrpl/protocol/SField.cpp @@ -87,7 +87,7 @@ SField::SField( private_access_tag_t, SerializedTypeID tid, int fv, - const char* fn, + char const* fn, int meta, IsSigning signing) : fieldCode(field_code(tid, fv)) diff --git a/src/libxrpl/protocol/STAccount.cpp b/src/libxrpl/protocol/STAccount.cpp index ba9a2d1919..7229c85240 100644 --- a/src/libxrpl/protocol/STAccount.cpp +++ b/src/libxrpl/protocol/STAccount.cpp @@ -106,7 +106,7 @@ STAccount::add(Serializer& s) const } bool -STAccount::isEquivalent(const STBase& t) const +STAccount::isEquivalent(STBase const& t) const { auto const* const tPtr = dynamic_cast(&t); return tPtr && (default_ == tPtr->default_) && (value_ == tPtr->value_); diff --git a/src/libxrpl/protocol/STAmount.cpp b/src/libxrpl/protocol/STAmount.cpp index e0815fbef3..f02042bc2c 100644 --- a/src/libxrpl/protocol/STAmount.cpp +++ b/src/libxrpl/protocol/STAmount.cpp @@ -90,13 +90,13 @@ setSTAmountCanonicalizeSwitchover(bool v) *getStaticSTAmountCanonicalizeSwitchover() = v; } -static const std::uint64_t tenTo14 = 100000000000000ull; -static const std::uint64_t tenTo14m1 = tenTo14 - 1; -static const std::uint64_t tenTo17 = tenTo14 * 1000; +static std::uint64_t const tenTo14 = 100000000000000ull; +static std::uint64_t const tenTo14m1 = tenTo14 - 1; +static std::uint64_t const tenTo17 = tenTo14 * 1000; //------------------------------------------------------------------------------ static std::int64_t -getInt64Value(STAmount const& amount, bool valid, const char* error) +getInt64Value(STAmount const& amount, bool valid, char const* error) { if (!valid) Throw(error); @@ -680,9 +680,9 @@ STAmount::add(Serializer& s) const } bool -STAmount::isEquivalent(const STBase& t) const +STAmount::isEquivalent(STBase const& t) const { - const STAmount* v = dynamic_cast(&t); + STAmount const* v = dynamic_cast(&t); return v && (*v == *this); } @@ -1065,7 +1065,7 @@ amountFromJsonNoThrow(STAmount& result, Json::Value const& jvSource) result = amountFromJson(sfGeneric, jvSource); return true; } - catch (const std::exception& e) + catch (std::exception const& e) { JLOG(debugLog().warn()) << "amountFromJsonNoThrow: caught: " << e.what(); diff --git a/src/libxrpl/protocol/STArray.cpp b/src/libxrpl/protocol/STArray.cpp index 0c5b4e198c..bbc890ffda 100644 --- a/src/libxrpl/protocol/STArray.cpp +++ b/src/libxrpl/protocol/STArray.cpp @@ -181,9 +181,9 @@ STArray::getSType() const } bool -STArray::isEquivalent(const STBase& t) const +STArray::isEquivalent(STBase const& t) const { - auto v = dynamic_cast(&t); + auto v = dynamic_cast(&t); return v != nullptr && v_ == v->v_; } @@ -194,7 +194,7 @@ STArray::isDefault() const } void -STArray::sort(bool (*compare)(const STObject&, const STObject&)) +STArray::sort(bool (*compare)(STObject const&, STObject const&)) { std::sort(v_.begin(), v_.end(), compare); } diff --git a/src/libxrpl/protocol/STBase.cpp b/src/libxrpl/protocol/STBase.cpp index 86e52a1f73..417b7e2302 100644 --- a/src/libxrpl/protocol/STBase.cpp +++ b/src/libxrpl/protocol/STBase.cpp @@ -40,7 +40,7 @@ STBase::STBase(SField const& n) : fName(&n) } STBase& -STBase::operator=(const STBase& t) +STBase::operator=(STBase const& t) { if (!fName->isUseful()) fName = t.fName; @@ -48,13 +48,13 @@ STBase::operator=(const STBase& t) } bool -STBase::operator==(const STBase& t) const +STBase::operator==(STBase const& t) const { return (getSType() == t.getSType()) && isEquivalent(t); } bool -STBase::operator!=(const STBase& t) const +STBase::operator!=(STBase const& t) const { return (getSType() != t.getSType()) || !isEquivalent(t); } @@ -116,7 +116,7 @@ STBase::add(Serializer& s) const } bool -STBase::isEquivalent(const STBase& t) const +STBase::isEquivalent(STBase const& t) const { XRPL_ASSERT( getSType() == STI_NOTPRESENT, @@ -154,7 +154,7 @@ STBase::addFieldID(Serializer& s) const //------------------------------------------------------------------------------ std::ostream& -operator<<(std::ostream& out, const STBase& t) +operator<<(std::ostream& out, STBase const& t) { return out << t.getFullText(); } diff --git a/src/libxrpl/protocol/STBlob.cpp b/src/libxrpl/protocol/STBlob.cpp index 33245a1e16..3d62cb5ee4 100644 --- a/src/libxrpl/protocol/STBlob.cpp +++ b/src/libxrpl/protocol/STBlob.cpp @@ -71,9 +71,9 @@ STBlob::add(Serializer& s) const } bool -STBlob::isEquivalent(const STBase& t) const +STBlob::isEquivalent(STBase const& t) const { - const STBlob* v = dynamic_cast(&t); + STBlob const* v = dynamic_cast(&t); return v && (value_ == v->value_); } diff --git a/src/libxrpl/protocol/STCurrency.cpp b/src/libxrpl/protocol/STCurrency.cpp index a17ed2e0d2..68186bbfda 100644 --- a/src/libxrpl/protocol/STCurrency.cpp +++ b/src/libxrpl/protocol/STCurrency.cpp @@ -72,9 +72,9 @@ STCurrency::add(Serializer& s) const } bool -STCurrency::isEquivalent(const STBase& t) const +STCurrency::isEquivalent(STBase const& t) const { - const STCurrency* v = dynamic_cast(&t); + STCurrency const* v = dynamic_cast(&t); return v && (*v == *this); } diff --git a/src/libxrpl/protocol/STIssue.cpp b/src/libxrpl/protocol/STIssue.cpp index 8483b8cfe3..821e17f6a7 100644 --- a/src/libxrpl/protocol/STIssue.cpp +++ b/src/libxrpl/protocol/STIssue.cpp @@ -128,9 +128,9 @@ STIssue::add(Serializer& s) const } bool -STIssue::isEquivalent(const STBase& t) const +STIssue::isEquivalent(STBase const& t) const { - const STIssue* v = dynamic_cast(&t); + STIssue const* v = dynamic_cast(&t); return v && (*v == *this); } diff --git a/src/libxrpl/protocol/STObject.cpp b/src/libxrpl/protocol/STObject.cpp index d0873561e3..9c23898a74 100644 --- a/src/libxrpl/protocol/STObject.cpp +++ b/src/libxrpl/protocol/STObject.cpp @@ -153,7 +153,7 @@ STObject::operator=(STObject&& other) } void -STObject::set(const SOTemplate& type) +STObject::set(SOTemplate const& type) { v_.clear(); v_.reserve(type.size()); @@ -169,7 +169,7 @@ STObject::set(const SOTemplate& type) } void -STObject::applyTemplate(const SOTemplate& type) +STObject::applyTemplate(SOTemplate const& type) { auto throwFieldErr = [](std::string const& field, char const* description) { std::stringstream ss; @@ -296,9 +296,9 @@ STObject::set(SerialIter& sit, int depth) } bool -STObject::hasMatchingEntry(const STBase& t) +STObject::hasMatchingEntry(STBase const& t) { - const STBase* o = peekAtPField(t.getFName()); + STBase const* o = peekAtPField(t.getFName()); if (!o) return false; @@ -357,9 +357,9 @@ STObject::getText() const } bool -STObject::isEquivalent(const STBase& t) const +STObject::isEquivalent(STBase const& t) const { - const STObject* v = dynamic_cast(&t); + STObject const* v = dynamic_cast(&t); if (!v) return false; @@ -425,7 +425,7 @@ STObject::getFieldIndex(SField const& field) const return -1; } -const STBase& +STBase const& STObject::peekAtField(SField const& field) const { int index = getFieldIndex(field); @@ -453,7 +453,7 @@ STObject::getFieldSType(int index) const return v_[index]->getFName(); } -const STBase* +STBase const* STObject::peekAtPField(SField const& field) const { int index = getFieldIndex(field); @@ -536,7 +536,7 @@ STObject::isFlag(std::uint32_t f) const std::uint32_t STObject::getFlags(void) const { - const STUInt32* t = dynamic_cast(peekAtPField(sfFlags)); + STUInt32 const* t = dynamic_cast(peekAtPField(sfFlags)); if (!t) return 0; @@ -574,7 +574,7 @@ STObject::makeFieldAbsent(SField const& field) if (index == -1) throwFieldNotFound(field); - const STBase& f = peekAtIndex(index); + STBase const& f = peekAtIndex(index); if (f.getSType() == STI_NOTPRESENT) return; @@ -675,14 +675,14 @@ STObject::getFieldPathSet(SField const& field) const return getFieldByConstRef(field, empty); } -const STVector256& +STVector256 const& STObject::getFieldV256(SField const& field) const { static STVector256 const empty{}; return getFieldByConstRef(field, empty); } -const STArray& +STArray const& STObject::getFieldArray(SField const& field) const { static STArray const empty{}; @@ -835,7 +835,7 @@ STObject::getJson(JsonOptions options) const } bool -STObject::operator==(const STObject& obj) const +STObject::operator==(STObject const& obj) const { // This is not particularly efficient, and only compares data elements // with binary representations diff --git a/src/libxrpl/protocol/STParsedJSON.cpp b/src/libxrpl/protocol/STParsedJSON.cpp index e7568c6818..1437ed922b 100644 --- a/src/libxrpl/protocol/STParsedJSON.cpp +++ b/src/libxrpl/protocol/STParsedJSON.cpp @@ -851,7 +851,7 @@ parseLeaf( return ret; } -static const int maxDepth = 64; +static int const maxDepth = 64; // Forward declaration since parseObject() and parseArray() call each other. static std::optional @@ -1037,7 +1037,8 @@ parseArray( Json::Value const objectFields(json[i][objectName]); std::stringstream ss; - ss << json_name << "." << "[" << i << "]." << objectName; + ss << json_name << "." + << "[" << i << "]." << objectName; auto ret = parseObject( ss.str(), objectFields, nameField, depth + 1, error); diff --git a/src/libxrpl/protocol/STPathSet.cpp b/src/libxrpl/protocol/STPathSet.cpp index d2bd20cfe8..1252ca7c6c 100644 --- a/src/libxrpl/protocol/STPathSet.cpp +++ b/src/libxrpl/protocol/STPathSet.cpp @@ -145,9 +145,9 @@ STPathSet::assembleAdd(STPath const& base, STPathElement const& tail) } bool -STPathSet::isEquivalent(const STBase& t) const +STPathSet::isEquivalent(STBase const& t) const { - const STPathSet* v = dynamic_cast(&t); + STPathSet const* v = dynamic_cast(&t); return v && (value == v->value); } diff --git a/src/libxrpl/protocol/STVector256.cpp b/src/libxrpl/protocol/STVector256.cpp index 50b022d294..3612b0cc4d 100644 --- a/src/libxrpl/protocol/STVector256.cpp +++ b/src/libxrpl/protocol/STVector256.cpp @@ -86,9 +86,9 @@ STVector256::add(Serializer& s) const } bool -STVector256::isEquivalent(const STBase& t) const +STVector256::isEquivalent(STBase const& t) const { - const STVector256* v = dynamic_cast(&t); + STVector256 const* v = dynamic_cast(&t); return v && (mValue == v->mValue); } diff --git a/src/libxrpl/protocol/STXChainBridge.cpp b/src/libxrpl/protocol/STXChainBridge.cpp index 1499d790cb..fb192d82d6 100644 --- a/src/libxrpl/protocol/STXChainBridge.cpp +++ b/src/libxrpl/protocol/STXChainBridge.cpp @@ -197,9 +197,9 @@ STXChainBridge::getSType() const } bool -STXChainBridge::isEquivalent(const STBase& t) const +STXChainBridge::isEquivalent(STBase const& t) const { - const STXChainBridge* v = dynamic_cast(&t); + STXChainBridge const* v = dynamic_cast(&t); return v && (*v == *this); } diff --git a/src/libxrpl/protocol/Serializer.cpp b/src/libxrpl/protocol/Serializer.cpp index 339e25db1d..b8a68d28b8 100644 --- a/src/libxrpl/protocol/Serializer.cpp +++ b/src/libxrpl/protocol/Serializer.cpp @@ -101,7 +101,7 @@ Serializer::addRaw(Slice slice) } int -Serializer::addRaw(const Serializer& s) +Serializer::addRaw(Serializer const& s) { int ret = mData.size(); mData.insert(mData.end(), s.begin(), s.end()); @@ -109,10 +109,10 @@ Serializer::addRaw(const Serializer& s) } int -Serializer::addRaw(const void* ptr, int len) +Serializer::addRaw(void const* ptr, int len) { int ret = mData.size(); - mData.insert(mData.end(), (const char*)ptr, ((const char*)ptr) + len); + mData.insert(mData.end(), (char const*)ptr, ((char const*)ptr) + len); return ret; } @@ -208,7 +208,7 @@ Serializer::addVL(Slice const& slice) } int -Serializer::addVL(const void* ptr, int len) +Serializer::addVL(void const* ptr, int len) { int ret = addEncoded(len); diff --git a/src/libxrpl/protocol/TxFormats.cpp b/src/libxrpl/protocol/TxFormats.cpp index a23475553d..5edffeb666 100644 --- a/src/libxrpl/protocol/TxFormats.cpp +++ b/src/libxrpl/protocol/TxFormats.cpp @@ -29,7 +29,7 @@ namespace ripple { TxFormats::TxFormats() { // Fields shared by all txFormats: - static const std::initializer_list commonFields{ + static std::initializer_list const commonFields{ {sfTransactionType, soeREQUIRED}, {sfFlags, soeOPTIONAL}, {sfSourceTag, soeOPTIONAL}, diff --git a/src/test/app/AMMExtended_test.cpp b/src/test/app/AMMExtended_test.cpp index a9d0514e3c..d7caed9601 100644 --- a/src/test/app/AMMExtended_test.cpp +++ b/src/test/app/AMMExtended_test.cpp @@ -3845,7 +3845,7 @@ private: int const signerListOwners{features[featureMultiSignReserve] ? 2 : 5}; env.require(owners(alice, signerListOwners + 0)); - const msig ms{becky, bogie}; + msig const ms{becky, bogie}; // Multisign all AMM transactions AMM ammAlice( diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index a0be79913b..87988315f4 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -1323,14 +1323,14 @@ private: // equal asset deposit: unit test to exercise the rounding-down of // LPTokens in the AMMHelpers.cpp: adjustLPTokens calculations // The LPTokens need to have 16 significant digits and a fractional part - for (const Number deltaLPTokens : + for (Number const deltaLPTokens : {Number{UINT64_C(100000'0000000009), -10}, Number{UINT64_C(100000'0000000001), -10}}) { testAMM([&](AMM& ammAlice, Env& env) { // initial LPToken balance IOUAmount const initLPToken = ammAlice.getLPTokensBalance(); - const IOUAmount newLPTokens{ + IOUAmount const newLPTokens{ deltaLPTokens.mantissa(), deltaLPTokens.exponent()}; // carol performs a two-asset deposit @@ -1349,17 +1349,17 @@ private: // fraction of newLPTokens/(existing LPToken balance). The // existing LPToken balance is 1e7 - const Number fr = deltaLPTokens / 1e7; + Number const fr = deltaLPTokens / 1e7; // The below equations are based on Equation 1, 2 from XLS-30d // specification, Section: 2.3.1.2 - const Number deltaXRP = fr * 1e10; - const Number deltaUSD = fr * 1e4; + Number const deltaXRP = fr * 1e10; + Number const deltaUSD = fr * 1e4; - const STAmount depositUSD = + STAmount const depositUSD = STAmount{USD, deltaUSD.mantissa(), deltaUSD.exponent()}; - const STAmount depositXRP = + STAmount const depositXRP = STAmount{XRP, deltaXRP.mantissa(), deltaXRP.exponent()}; // initial LPTokens (1e7) + newLPTokens @@ -6682,11 +6682,11 @@ private: testcase("swapRounding"); using namespace jtx; - const STAmount xrpPool{XRP, UINT64_C(51600'000981)}; - const STAmount iouPool{USD, UINT64_C(803040'9987141784), -10}; + STAmount const xrpPool{XRP, UINT64_C(51600'000981)}; + STAmount const iouPool{USD, UINT64_C(803040'9987141784), -10}; - const STAmount xrpBob{XRP, UINT64_C(1092'878933)}; - const STAmount iouBob{ + STAmount const xrpBob{XRP, UINT64_C(1092'878933)}; + STAmount const iouBob{ USD, UINT64_C(3'988035892323031), -28}; // 3.9...e-13 testAMM( diff --git a/src/test/app/AccountDelete_test.cpp b/src/test/app/AccountDelete_test.cpp index c903f95f77..4ae18d9d28 100644 --- a/src/test/app/AccountDelete_test.cpp +++ b/src/test/app/AccountDelete_test.cpp @@ -927,7 +927,7 @@ public: Account const carol{"carol"}; Account const daria{"daria"}; - const char credType[] = "abcd"; + char const credType[] = "abcd"; Env env{*this}; env.fund(XRP(100000), alice, becky, carol, daria); @@ -1193,7 +1193,7 @@ public: Account const becky{"becky"}; Account const carol{"carol"}; - const char credType[] = "abcd"; + char const credType[] = "abcd"; Env env{*this}; env.fund(XRP(100000), alice, becky, carol); @@ -1237,7 +1237,7 @@ public: Account const becky{"becky"}; Account const carol{"carol"}; - const char credType[] = "abcd"; + char const credType[] = "abcd"; Env env{*this}; env.fund(XRP(100000), alice, becky, carol); diff --git a/src/test/app/Credentials_test.cpp b/src/test/app/Credentials_test.cpp index 24e656672d..87946c13bb 100644 --- a/src/test/app/Credentials_test.cpp +++ b/src/test/app/Credentials_test.cpp @@ -60,8 +60,8 @@ struct Credentials_test : public beast::unit_test::suite { using namespace test::jtx; - const char credType[] = "abcde"; - const char uri[] = "uri"; + char const credType[] = "abcde"; + char const uri[] = "uri"; Account const issuer{"issuer"}; Account const subject{"subject"}; @@ -209,7 +209,7 @@ struct Credentials_test : public beast::unit_test::suite { using namespace test::jtx; - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const issuer{"issuer"}; Account const subject{"subject"}; @@ -458,7 +458,7 @@ struct Credentials_test : public beast::unit_test::suite { using namespace test::jtx; - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const issuer{"issuer"}; Account const subject{"subject"}; @@ -616,7 +616,7 @@ struct Credentials_test : public beast::unit_test::suite { using namespace jtx; - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const issuer{"issuer"}; Account const subject{"subject"}; Account const other{"other"}; @@ -726,7 +726,7 @@ struct Credentials_test : public beast::unit_test::suite } { - const char credType2[] = "efghi"; + char const credType2[] = "efghi"; testcase("CredentialsAccept fail, expired credentials."); auto jv = credentials::create(subject, issuer, credType2); @@ -797,7 +797,7 @@ struct Credentials_test : public beast::unit_test::suite { using namespace test::jtx; - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const issuer{"issuer"}; Account const subject{"subject"}; Account const other{"other"}; @@ -842,7 +842,7 @@ struct Credentials_test : public beast::unit_test::suite } { - const char credType2[] = "fghij"; + char const credType2[] = "fghij"; env(credentials::create(subject, issuer, credType2)); env.close(); @@ -944,7 +944,7 @@ struct Credentials_test : public beast::unit_test::suite { using namespace test::jtx; - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const issuer{"issuer"}; Account const subject{"subject"}; @@ -972,7 +972,7 @@ struct Credentials_test : public beast::unit_test::suite { using namespace test::jtx; - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const issuer{"issuer"}; Account const subject{"subject"}; @@ -1069,7 +1069,7 @@ struct Credentials_test : public beast::unit_test::suite std::string("Test flag, fix ") + (enabled ? "enabled" : "disabled")); - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const issuer{"issuer"}; Account const subject{"subject"}; diff --git a/src/test/app/DID_test.cpp b/src/test/app/DID_test.cpp index 34aa54f234..c885ed0861 100644 --- a/src/test/app/DID_test.cpp +++ b/src/test/app/DID_test.cpp @@ -149,7 +149,7 @@ struct DID_test : public beast::unit_test::suite BEAST_EXPECT(ownerCount(env, alice) == 0); // uri is too long - const std::string longString(257, 'a'); + std::string const longString(257, 'a'); env(did::set(alice), did::uri(longString), ter(temMALFORMED)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 0); diff --git a/src/test/app/DepositAuth_test.cpp b/src/test/app/DepositAuth_test.cpp index 18f7b410b7..c8dc3c00eb 100644 --- a/src/test/app/DepositAuth_test.cpp +++ b/src/test/app/DepositAuth_test.cpp @@ -664,7 +664,7 @@ struct DepositPreauth_test : public beast::unit_test::suite { // becky setup depositpreauth with credentials - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const carol{"carol"}; env.fund(XRP(5000), carol); env.close(); @@ -820,7 +820,7 @@ struct DepositPreauth_test : public beast::unit_test::suite { using namespace jtx; - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const issuer{"issuer"}; Account const alice{"alice"}; Account const bob{"bob"}; @@ -993,7 +993,7 @@ struct DepositPreauth_test : public beast::unit_test::suite { // create another valid credential - const char credType2[] = "fghij"; + char const credType2[] = "fghij"; env(credentials::create(alice, issuer, credType2)); env.close(); env(credentials::accept(alice, issuer, credType2)); @@ -1025,7 +1025,7 @@ struct DepositPreauth_test : public beast::unit_test::suite { using namespace jtx; - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const issuer{"issuer"}; Account const alice{"alice"}; Account const bob{"bob"}; @@ -1196,8 +1196,8 @@ struct DepositPreauth_test : public beast::unit_test::suite testExpiredCreds() { using namespace jtx; - const char credType[] = "abcde"; - const char credType2[] = "fghijkl"; + char const credType[] = "abcde"; + char const credType2[] = "fghijkl"; Account const issuer{"issuer"}; Account const alice{"alice"}; Account const bob{"bob"}; diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index 2b7bf4619a..1129019aab 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -1551,7 +1551,7 @@ struct Escrow_test : public beast::unit_test::suite Account const dillon{"dillon "}; Account const zelda{"zelda"}; - const char credType[] = "abcde"; + char const credType[] = "abcde"; { // Credentials amendment not enabled @@ -1657,7 +1657,7 @@ struct Escrow_test : public beast::unit_test::suite env.close(); { - const char credType2[] = "fghijk"; + char const credType2[] = "fghijk"; env(credentials::create(bob, zelda, credType2)); env.close(); diff --git a/src/test/app/FeeVote_test.cpp b/src/test/app/FeeVote_test.cpp index bf293a93fb..1cf2e67f83 100644 --- a/src/test/app/FeeVote_test.cpp +++ b/src/test/app/FeeVote_test.cpp @@ -76,7 +76,7 @@ class FeeVote_test : public beast::unit_test::suite setup.owner_reserve == static_cast(-1234)); } { - const auto big64 = std::to_string( + auto const big64 = std::to_string( static_cast( std::numeric_limits::max()) + 1); diff --git a/src/test/app/LedgerReplay_test.cpp b/src/test/app/LedgerReplay_test.cpp index 15f51889bb..76ab5b3218 100644 --- a/src/test/app/LedgerReplay_test.cpp +++ b/src/test/app/LedgerReplay_test.cpp @@ -312,11 +312,11 @@ public: { } void - addTxQueue(const uint256&) override + addTxQueue(uint256 const&) override { } void - removeTxQueue(const uint256&) override + removeTxQueue(uint256 const&) override { } bool @@ -414,7 +414,7 @@ struct TestPeerSet : public PeerSet } } - const std::set& + std::set const& getPeerIds() const override { static std::set emptyPeers; diff --git a/src/test/app/MPToken_test.cpp b/src/test/app/MPToken_test.cpp index a20ce56c6d..0f29e22dd9 100644 --- a/src/test/app/MPToken_test.cpp +++ b/src/test/app/MPToken_test.cpp @@ -1328,7 +1328,7 @@ class MPToken_test : public beast::unit_test::suite Account const diana("diana"); Account const dpIssuer("dpIssuer"); // holder - const char credType[] = "abcde"; + char const credType[] = "abcde"; { Env env(*this); diff --git a/src/test/app/PayChan_test.cpp b/src/test/app/PayChan_test.cpp index f2fcf344da..7cb1542453 100644 --- a/src/test/app/PayChan_test.cpp +++ b/src/test/app/PayChan_test.cpp @@ -886,7 +886,7 @@ struct PayChan_test : public beast::unit_test::suite using namespace jtx; using namespace std::literals::chrono_literals; - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const alice("alice"); Account const bob("bob"); diff --git a/src/test/app/PermissionedDomains_test.cpp b/src/test/app/PermissionedDomains_test.cpp index 65f75897ae..e33a88fa08 100644 --- a/src/test/app/PermissionedDomains_test.cpp +++ b/src/test/app/PermissionedDomains_test.cpp @@ -285,7 +285,7 @@ class PermissionedDomains_test : public beast::unit_test::suite Env env(*this, withFeature_); env.set_parse_failure_expected(true); - const int accNum = 12; + int const accNum = 12; Account const alice[accNum] = { "alice", "alice2", diff --git a/src/test/app/SHAMapStore_test.cpp b/src/test/app/SHAMapStore_test.cpp index d3b5917434..1e0ec4bcf0 100644 --- a/src/test/app/SHAMapStore_test.cpp +++ b/src/test/app/SHAMapStore_test.cpp @@ -72,21 +72,21 @@ class SHAMapStore_test : public beast::unit_test::suite env.app().getRelationalDatabase().getLedgerInfoByIndex(seq); if (!oinfo) return false; - const LedgerInfo& info = oinfo.value(); + LedgerInfo const& info = oinfo.value(); - const std::string outHash = to_string(info.hash); - const LedgerIndex outSeq = info.seq; - const std::string outParentHash = to_string(info.parentHash); - const std::string outDrops = to_string(info.drops); - const std::uint64_t outCloseTime = + std::string const outHash = to_string(info.hash); + LedgerIndex const outSeq = info.seq; + std::string const outParentHash = to_string(info.parentHash); + std::string const outDrops = to_string(info.drops); + std::uint64_t const outCloseTime = info.closeTime.time_since_epoch().count(); - const std::uint64_t outParentCloseTime = + std::uint64_t const outParentCloseTime = info.parentCloseTime.time_since_epoch().count(); - const std::uint64_t outCloseTimeResolution = + std::uint64_t const outCloseTimeResolution = info.closeTimeResolution.count(); - const std::uint64_t outCloseFlags = info.closeFlags; - const std::string outAccountHash = to_string(info.accountHash); - const std::string outTxHash = to_string(info.txHash); + std::uint64_t const outCloseFlags = info.closeFlags; + std::string const outAccountHash = to_string(info.accountHash); + std::string const outTxHash = to_string(info.txHash); auto const& ledger = json[jss::result][jss::ledger]; return outHash == ledger[jss::ledger_hash].asString() && @@ -124,7 +124,7 @@ class SHAMapStore_test : public beast::unit_test::suite void ledgerCheck(jtx::Env& env, int const rows, int const first) { - const auto [actualRows, actualFirst, actualLast] = + auto const [actualRows, actualFirst, actualLast] = dynamic_cast(&env.app().getRelationalDatabase()) ->getLedgerCountMinMax(); diff --git a/src/test/app/SetTrust_test.cpp b/src/test/app/SetTrust_test.cpp index c99a1dafa1..9b4048bf9c 100644 --- a/src/test/app/SetTrust_test.cpp +++ b/src/test/app/SetTrust_test.cpp @@ -469,7 +469,7 @@ public: auto& tx1 = createQuality ? txWithQuality : txWithoutQuality; auto& tx2 = createQuality ? txWithoutQuality : txWithQuality; - auto check_quality = [&](const bool exists) { + auto check_quality = [&](bool const exists) { Json::Value jv; jv["account"] = toAcct.human(); auto const lines = env.rpc("json", "account_lines", to_string(jv)); diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index 2ce05095fc..7b69cee1ce 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -177,7 +177,7 @@ class TxQPosNegFlows_test : public beast::unit_test::suite auto calcMedFeeLevel(FeeLevel64 const feeLevel1, FeeLevel64 const feeLevel2) { - const FeeLevel64 expectedMedFeeLevel = + FeeLevel64 const expectedMedFeeLevel = (feeLevel1 + feeLevel2 + FeeLevel64{1}) / 2; return std::max(expectedMedFeeLevel, minEscalationFeeLevel).fee(); @@ -382,7 +382,7 @@ public: ////////////////////////////////////////////////////////////// constexpr auto largeFeeMultiplier = 700; - const auto largeFee = baseFee * largeFeeMultiplier; + auto const largeFee = baseFee * largeFeeMultiplier; // Stuff the ledger and queue so we can verify that // stuff gets kicked out. @@ -878,7 +878,7 @@ public: env(noop(alice), json(R"({"LastLedgerSequence":8})"), queued); constexpr auto largeFeeMultiplier = 700; - const auto largeFee = baseFee * largeFeeMultiplier; + auto const largeFee = baseFee * largeFeeMultiplier; // Queue items with higher fees to force the previous // txn to wait. @@ -928,7 +928,7 @@ public: BEAST_EXPECT(env.seq(alice) == 3); constexpr auto anotherLargeFeeMultiplier = 800; - const auto anotherLargeFee = baseFee * anotherLargeFeeMultiplier; + auto const anotherLargeFee = baseFee * anotherLargeFeeMultiplier; // Keep alice's transaction waiting. // clang-format off env(noop(bob), fee(anotherLargeFee), queued); diff --git a/src/test/app/ValidatorKeys_test.cpp b/src/test/app/ValidatorKeys_test.cpp index 7c8584698e..427ada132c 100644 --- a/src/test/app/ValidatorKeys_test.cpp +++ b/src/test/app/ValidatorKeys_test.cpp @@ -35,13 +35,13 @@ namespace test { class ValidatorKeys_test : public beast::unit_test::suite { // Used with [validation_seed] - const std::string seed = "shUwVw52ofnCUX5m7kPTKzJdr4HEH"; + std::string const seed = "shUwVw52ofnCUX5m7kPTKzJdr4HEH"; // Used with [validation_token] - const std::string tokenSecretStr = + std::string const tokenSecretStr = "paQmjZ37pKKPMrgadBLsuf9ab7Y7EUNzh27LQrZqoexpAs31nJi"; - const std::vector tokenBlob = { + std::vector const tokenBlob = { " " "eyJ2YWxpZGF0aW9uX3NlY3JldF9rZXkiOiI5ZWQ0NWY4NjYyNDFjYzE4YTI3NDdiNT\n", " \tQzODdjMDYyNTkwNzk3MmY0ZTcxOTAyMzFmYWE5Mzc0NTdmYTlkYWY2IiwibWFuaWZl " @@ -56,7 +56,7 @@ class ValidatorKeys_test : public beast::unit_test::suite "NmluOEhBU1FLUHVnQkQ2N2tNYVJGR3ZtcEFUSGxHS0pkdkRGbFdQWXk1QXFEZWRGdj\n", "VUSmEydzBpMjFlcTNNWXl3TFZKWm5GT3I3QzBrdzJBaVR6U0NqSXpkaXRROD0ifQ==\n"}; - const std::string tokenManifest = + std::string const tokenManifest = "JAAAAAFxIe1FtwmimvGtH2iCcMJqC9gVFKilGfw1/vCxHXXLplc2GnMhAkE1agqXxBwD" "wDbID6OMSYuM0FDAlpAgNk8SKFn7MO2fdkcwRQIhAOngu9sAKqXYouJ+l2V0W+sAOkVB" "+ZRS6PShlJAfUsXfAiBsVJGesaadOJc/aAZokS1vymGmVrlHPKWX3Yywu6in8HASQKPu" @@ -64,7 +64,7 @@ class ValidatorKeys_test : public beast::unit_test::suite "2AiTzSCjIzditQ8="; // Manifest does not match private key - const std::vector invalidTokenBlob = { + std::vector const invalidTokenBlob = { "eyJtYW5pZmVzdCI6IkpBQUFBQVZ4SWUyOVVBdzViZFJudHJ1elVkREk4aDNGV1JWZl\n", "k3SXVIaUlKQUhJd3MxdzZzM01oQWtsa1VXQWR2RnFRVGRlSEpvS1pNY0hlS0RzOExo\n", "b3d3bDlHOEdkVGNJbmFka1l3UkFJZ0h2Q01lQU1aSzlqQnV2aFhlaFRLRzVDQ3BBR1\n", diff --git a/src/test/app/ValidatorList_test.cpp b/src/test/app/ValidatorList_test.cpp index 819340bfa4..a3b62bd4f7 100644 --- a/src/test/app/ValidatorList_test.cpp +++ b/src/test/app/ValidatorList_test.cpp @@ -551,7 +551,7 @@ private: auto const version, std::vector> const& expected) { - const auto available = trustedKeys->getAvailable(hexPublic); + auto const available = trustedKeys->getAvailable(hexPublic); BEAST_EXPECT(!version || available); if (available) @@ -621,7 +621,7 @@ private: auto const publisherSecret = randomSecretKey(); auto const publisherPublic = derivePublicKey(KeyType::ed25519, publisherSecret); - const auto hexPublic = + auto const hexPublic = strHex(publisherPublic.begin(), publisherPublic.end()); auto const pubSigningKeys1 = randomKeyPair(KeyType::secp256k1); auto const manifest1 = base64_encode(makeManifestString( @@ -1005,7 +1005,7 @@ private: auto const publisherSecret = randomSecretKey(); auto const publisherPublic = derivePublicKey(KeyType::ed25519, publisherSecret); - const auto hexPublic = + auto const hexPublic = strHex(publisherPublic.begin(), publisherPublic.end()); auto const pubSigningKeys1 = randomKeyPair(KeyType::secp256k1); auto const manifest = base64_encode(makeManifestString( @@ -1057,7 +1057,7 @@ private: // unknown public key auto const badSecret = randomSecretKey(); auto const badPublic = derivePublicKey(KeyType::ed25519, badSecret); - const auto hexBad = strHex(badPublic.begin(), badPublic.end()); + auto const hexBad = strHex(badPublic.begin(), badPublic.end()); auto const available = trustedKeys->getAvailable(hexBad, 1); BEAST_EXPECT(!available); diff --git a/src/test/app/ValidatorSite_test.cpp b/src/test/app/ValidatorSite_test.cpp index f7db0463c1..7a7511e6f0 100644 --- a/src/test/app/ValidatorSite_test.cpp +++ b/src/test/app/ValidatorSite_test.cpp @@ -39,7 +39,7 @@ namespace ripple { namespace test { namespace detail { -constexpr const char* +constexpr char const* realValidatorContents() { return R"vl({ diff --git a/src/test/app/XChain_test.cpp b/src/test/app/XChain_test.cpp index 32a37f5e27..85cd636b3d 100644 --- a/src/test/app/XChain_test.cpp +++ b/src/test/app/XChain_test.cpp @@ -316,7 +316,7 @@ struct BalanceTransfer return std::all_of( reward_accounts.begin(), reward_accounts.end(), - [&](const balance& b) { return b.diff() == reward; }); + [&](balance const& b) { return b.diff() == reward; }); } bool @@ -4582,8 +4582,8 @@ private: { public: SmBase( - const std::shared_ptr& chainstate, - const BridgeDef& bridge) + std::shared_ptr const& chainstate, + BridgeDef const& bridge) : bridge_(bridge), st_(chainstate) { } @@ -4613,7 +4613,7 @@ private: } protected: - const BridgeDef& bridge_; + BridgeDef const& bridge_; std::shared_ptr st_; }; @@ -4624,8 +4624,8 @@ private: using Base = SmBase; SmCreateAccount( - const std::shared_ptr& chainstate, - const BridgeDef& bridge, + std::shared_ptr const& chainstate, + BridgeDef const& bridge, AccountCreate create) : Base(chainstate, bridge) , sm_state(st_initial) @@ -4756,8 +4756,8 @@ private: using Base = SmBase; SmTransfer( - const std::shared_ptr& chainstate, - const BridgeDef& bridge, + std::shared_ptr const& chainstate, + BridgeDef const& bridge, Transfer xfer) : Base(chainstate, bridge) , xfer(std::move(xfer)) @@ -4926,7 +4926,7 @@ private: void xfer( uint64_t time, - const std::shared_ptr& chainstate, + std::shared_ptr const& chainstate, BridgeDef const& bridge, Transfer transfer) { @@ -4936,7 +4936,7 @@ private: void ac(uint64_t time, - const std::shared_ptr& chainstate, + std::shared_ptr const& chainstate, BridgeDef const& bridge, AccountCreate ac) { diff --git a/src/test/app/tx/apply_test.cpp b/src/test/app/tx/apply_test.cpp index 63fecde65f..44a2c10b4e 100644 --- a/src/test/app/tx/apply_test.cpp +++ b/src/test/app/tx/apply_test.cpp @@ -40,7 +40,7 @@ public: testFullyCanonicalSigs() { // Construct a payments w/out a fully-canonical tx - const std::string non_fully_canonical_tx = + std::string const non_fully_canonical_tx = "12000022000000002400000001201B00497D9C6140000000000F6950684000000" "00000000C732103767C7B2C13AD90050A4263745E4BAB2B975417FA22E87780E1" "506DDAF21139BE74483046022100E95670988A34C4DB0FA73A8BFD6383872AF43" diff --git a/src/test/basics/FileUtilities_test.cpp b/src/test/basics/FileUtilities_test.cpp index b78173f35f..4b4cbe70c8 100644 --- a/src/test/basics/FileUtilities_test.cpp +++ b/src/test/basics/FileUtilities_test.cpp @@ -34,7 +34,7 @@ public: using namespace ripple::test::detail; using namespace boost::system; - constexpr const char* expectedContents = + constexpr char const* expectedContents = "This file is very short. That's all we need."; FileDirGuard file( diff --git a/src/test/basics/PerfLog_test.cpp b/src/test/basics/PerfLog_test.cpp index 7ec62a1701..05678e699d 100644 --- a/src/test/basics/PerfLog_test.cpp +++ b/src/test/basics/PerfLog_test.cpp @@ -776,7 +776,7 @@ public: // Verify values in jss::total are what we expect. Json::Value const& total{jobQueue[jss::total]}; - const int finished = jobs.size() * 2; + int const finished = jobs.size() * 2; BEAST_EXPECT(jsonToUint64(total[jss::queued]) == jobs.size()); BEAST_EXPECT(jsonToUint64(total[jss::started]) == finished); BEAST_EXPECT(jsonToUint64(total[jss::finished]) == finished); diff --git a/src/test/basics/mulDiv_test.cpp b/src/test/basics/mulDiv_test.cpp index 47332fd45b..61521577d9 100644 --- a/src/test/basics/mulDiv_test.cpp +++ b/src/test/basics/mulDiv_test.cpp @@ -28,8 +28,8 @@ struct mulDiv_test : beast::unit_test::suite void run() override { - const auto max = std::numeric_limits::max(); - const std::uint64_t max32 = std::numeric_limits::max(); + auto const max = std::numeric_limits::max(); + std::uint64_t const max32 = std::numeric_limits::max(); auto result = mulDiv(85, 20, 5); BEAST_EXPECT(result && *result == 340); diff --git a/src/test/consensus/ByzantineFailureSim_test.cpp b/src/test/consensus/ByzantineFailureSim_test.cpp index b979943477..887a060a5b 100644 --- a/src/test/consensus/ByzantineFailureSim_test.cpp +++ b/src/test/consensus/ByzantineFailureSim_test.cpp @@ -68,8 +68,8 @@ class ByzantineFailureSim_test : public beast::unit_test::suite for (TrustGraph::ForkInfo const& fi : sim.trustGraph.forkablePairs(0.8)) { - std::cout << "Can fork " << PeerGroup{fi.unlA} << " " << " " - << PeerGroup{fi.unlB} << " overlap " << fi.overlap + std::cout << "Can fork " << PeerGroup{fi.unlA} << " " + << " " << PeerGroup{fi.unlB} << " overlap " << fi.overlap << " required " << fi.required << "\n"; }; diff --git a/src/test/core/SociDB_test.cpp b/src/test/core/SociDB_test.cpp index 8f2a3c6646..9a3666f072 100644 --- a/src/test/core/SociDB_test.cpp +++ b/src/test/core/SociDB_test.cpp @@ -320,7 +320,7 @@ public: { soci::session s; sc.open(s); - const char* dbInit[] = { + char const* dbInit[] = { "BEGIN TRANSACTION;", "CREATE TABLE Ledgers ( \ LedgerHash CHARACTER(64) PRIMARY KEY, \ diff --git a/src/test/csf/Peer.h b/src/test/csf/Peer.h index 678924112e..1cb2d03cc6 100644 --- a/src/test/csf/Peer.h +++ b/src/test/csf/Peer.h @@ -553,11 +553,11 @@ struct Peer ConsensusCloseTimes const& rawCloseTimes, ConsensusMode const& mode, Json::Value&& consensusJson, - const bool validating) + bool const validating) { schedule(delays.ledgerAccept, [=, this]() { - const bool proposing = mode == ConsensusMode::proposing; - const bool consensusFail = result.state == ConsensusState::MovedOn; + bool const proposing = mode == ConsensusMode::proposing; + bool const consensusFail = result.state == ConsensusState::MovedOn; TxSet const acceptedTxs = injectTxs(prevLedger, result.txns); Ledger const newLedger = oracle.accept( diff --git a/src/test/csf/Tx.h b/src/test/csf/Tx.h index 066aee2268..7f37d60d70 100644 --- a/src/test/csf/Tx.h +++ b/src/test/csf/Tx.h @@ -188,7 +188,7 @@ private: // Helper functions for debug printing inline std::ostream& -operator<<(std::ostream& o, const Tx& t) +operator<<(std::ostream& o, Tx const& t) { return o << t.id(); } diff --git a/src/test/csf/collectors.h b/src/test/csf/collectors.h index 0494178ae9..7b91863cbd 100644 --- a/src/test/csf/collectors.h +++ b/src/test/csf/collectors.h @@ -720,4 +720,4 @@ struct JumpCollector } // namespace test } // namespace ripple -#endif +#endif \ No newline at end of file diff --git a/src/test/csf/ledgers.h b/src/test/csf/ledgers.h index a02adb9c87..45e255ffd5 100644 --- a/src/test/csf/ledgers.h +++ b/src/test/csf/ledgers.h @@ -151,7 +151,7 @@ private: }; // Single common genesis instance - static const Instance genesis; + static Instance const genesis; Ledger(ID id, Instance const* i) : id_{id}, instance_{i} { diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index 399b176677..ef26ebf2ee 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -72,7 +72,7 @@ noripple(Account const& account, Args const&... args) inline FeatureBitset supported_amendments() { - static const FeatureBitset ids = [] { + static FeatureBitset const ids = [] { auto const& sa = ripple::detail::supportedAmendments(); std::vector feats; feats.reserve(sa.size()); diff --git a/src/test/jtx/TrustedPublisherServer.h b/src/test/jtx/TrustedPublisherServer.h index 6138673484..54538032f5 100644 --- a/src/test/jtx/TrustedPublisherServer.h +++ b/src/test/jtx/TrustedPublisherServer.h @@ -220,8 +220,9 @@ public: getList_ = [blob = blob, sig, manifest, version](int interval) { // Build the contents of a version 1 format UNL file std::stringstream l; - l << "{\"blob\":\"" << blob << "\"" << ",\"signature\":\"" << sig - << "\"" << ",\"manifest\":\"" << manifest << "\"" + l << "{\"blob\":\"" << blob << "\"" + << ",\"signature\":\"" << sig << "\"" + << ",\"manifest\":\"" << manifest << "\"" << ",\"refresh_interval\": " << interval << ",\"version\":" << version << '}'; return l.str(); @@ -256,14 +257,15 @@ public: std::stringstream l; for (auto const& info : blobInfo) { - l << "{\"blob\":\"" << info.blob << "\"" << ",\"signature\":\"" - << info.signature << "\"},"; + l << "{\"blob\":\"" << info.blob << "\"" + << ",\"signature\":\"" << info.signature << "\"},"; } std::string blobs = l.str(); blobs.pop_back(); l.str(std::string()); l << "{\"blobs_v2\": [ " << blobs << "],\"manifest\":\"" << manifest - << "\"" << ",\"refresh_interval\": " << interval + << "\"" + << ",\"refresh_interval\": " << interval << ",\"version\":" << (version + 1) << '}'; return l.str(); }; diff --git a/src/test/jtx/deposit.h b/src/test/jtx/deposit.h index 9bd73d383d..a09979b7ac 100644 --- a/src/test/jtx/deposit.h +++ b/src/test/jtx/deposit.h @@ -44,7 +44,7 @@ struct AuthorizeCredentials std::string credType; auto - operator<=>(const AuthorizeCredentials&) const = default; + operator<=>(AuthorizeCredentials const&) const = default; Json::Value toJson() const diff --git a/src/test/jtx/envconfig.h b/src/test/jtx/envconfig.h index bb1716fffb..f22c5743e7 100644 --- a/src/test/jtx/envconfig.h +++ b/src/test/jtx/envconfig.h @@ -32,7 +32,7 @@ namespace test { extern std::atomic envUseIPv4; -inline const char* +inline char const* getEnvLocalhostAddr() { return envUseIPv4 ? "127.0.0.1" : "::1"; diff --git a/src/test/jtx/impl/amount.cpp b/src/test/jtx/impl/amount.cpp index 9134122da9..a1dbd25652 100644 --- a/src/test/jtx/impl/amount.cpp +++ b/src/test/jtx/impl/amount.cpp @@ -54,7 +54,7 @@ PrettyAmount::operator AnyAmount() const template static std::string -to_places(const T d, std::uint8_t places) +to_places(T const d, std::uint8_t places) { assert(places <= std::numeric_limits::digits10); diff --git a/src/test/jtx/impl/mpt.cpp b/src/test/jtx/impl/mpt.cpp index 51490ad21e..c8ff167221 100644 --- a/src/test/jtx/impl/mpt.cpp +++ b/src/test/jtx/impl/mpt.cpp @@ -83,7 +83,7 @@ MPTTester::MPTTester(Env& env, Account const& issuer, MPTInit const& arg) } void -MPTTester::create(const MPTCreate& arg) +MPTTester::create(MPTCreate const& arg) { if (id_) Throw("MPT can't be reused"); @@ -413,7 +413,7 @@ MPTTester::getFlags(std::optional const& holder) const } MPT -MPTTester::operator[](const std::string& name) +MPTTester::operator[](std::string const& name) { return MPT(name, issuanceID()); } diff --git a/src/test/jtx/xchain_bridge.h b/src/test/jtx/xchain_bridge.h index 8ff19bd508..1b3841358f 100644 --- a/src/test/jtx/xchain_bridge.h +++ b/src/test/jtx/xchain_bridge.h @@ -196,12 +196,12 @@ struct XChainBridgeObjects STAmount const split_reward_quorum; // 250,000 drops STAmount const split_reward_everyone; // 200,000 drops - const STAmount tiny_reward; // 37 drops - const STAmount tiny_reward_split; // 9 drops - const STAmount tiny_reward_remainder; // 1 drops + STAmount const tiny_reward; // 37 drops + STAmount const tiny_reward_split; // 9 drops + STAmount const tiny_reward_remainder; // 1 drops - const STAmount one_xrp; - const STAmount xrp_dust; + STAmount const one_xrp; + STAmount const xrp_dust; static constexpr int drop_per_xrp = 1000000; diff --git a/src/test/overlay/reduce_relay_test.cpp b/src/test/overlay/reduce_relay_test.cpp index 9fc105262b..18aebbe194 100644 --- a/src/test/overlay/reduce_relay_test.cpp +++ b/src/test/overlay/reduce_relay_test.cpp @@ -179,11 +179,11 @@ public: { } void - addTxQueue(const uint256&) override + addTxQueue(uint256 const&) override { } void - removeTxQueue(const uint256&) override + removeTxQueue(uint256 const&) override { } }; @@ -196,7 +196,7 @@ public: typedef std::milli period; typedef std::chrono::duration duration; typedef std::chrono::time_point time_point; - inline static const bool is_steady = false; + inline static bool const is_steady = false; static void advance(duration d) noexcept @@ -890,11 +890,12 @@ class reduce_relay_test : public beast::unit_test::suite protected: void - printPeers(const std::string& msg, std::uint16_t validator = 0) + printPeers(std::string const& msg, std::uint16_t validator = 0) { auto peers = network_.overlay().getPeers(network_.validator(validator)); - std::cout << msg << " " << "num peers " - << (int)network_.overlay().getNumPeers() << std::endl; + std::cout << msg << " " + << "num peers " << (int)network_.overlay().getNumPeers() + << std::endl; for (auto& [k, v] : peers) std::cout << k << ":" << (int)std::get(v) << " "; @@ -1125,7 +1126,7 @@ protected: } void - doTest(const std::string& msg, bool log, std::function f) + doTest(std::string const& msg, bool log, std::function f) { testcase(msg); f(log); diff --git a/src/test/overlay/tx_reduce_relay_test.cpp b/src/test/overlay/tx_reduce_relay_test.cpp index 07ff2bb14a..7a6b36ecd2 100644 --- a/src/test/overlay/tx_reduce_relay_test.cpp +++ b/src/test/overlay/tx_reduce_relay_test.cpp @@ -41,7 +41,7 @@ public: private: void - doTest(const std::string& msg, bool log, std::function f) + doTest(std::string const& msg, bool log, std::function f) { testcase(msg); f(log); @@ -131,7 +131,7 @@ private: sendTx_++; } void - addTxQueue(const uint256& hash) override + addTxQueue(uint256 const& hash) override { queueTx_++; } diff --git a/src/test/protocol/MultiApiJson_test.cpp b/src/test/protocol/MultiApiJson_test.cpp index a5c37d257c..9105607ba4 100644 --- a/src/test/protocol/MultiApiJson_test.cpp +++ b/src/test/protocol/MultiApiJson_test.cpp @@ -45,7 +45,7 @@ Overload(Ts...) -> Overload; struct MultiApiJson_test : beast::unit_test::suite { static auto - makeJson(const char* key, int val) + makeJson(char const* key, int val) { Json::Value obj1(Json::objectValue); obj1[key] = val; @@ -80,7 +80,7 @@ struct MultiApiJson_test : beast::unit_test::suite testcase("forApiVersions, forAllApiVersions"); // Some static data for test inputs - static const int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, + static int const primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}; static_assert(std::size(primes) > RPC::apiMaximumValidVersion); @@ -205,7 +205,7 @@ struct MultiApiJson_test : beast::unit_test::suite return !requires { forAllApiVersions( std::forward(v).visit(), // - [](auto, auto, const char*) {}, + [](auto, auto, char const*) {}, 1); // parameter type mismatch }; }(std::as_const(s1))); @@ -256,7 +256,7 @@ struct MultiApiJson_test : beast::unit_test::suite Json::Value const&, std::integral_constant, int, - const char*) {}, + char const*) {}, 0, ""); }; diff --git a/src/test/protocol/STAccount_test.cpp b/src/test/protocol/STAccount_test.cpp index 034e0e9e08..9476a47c5e 100644 --- a/src/test/protocol/STAccount_test.cpp +++ b/src/test/protocol/STAccount_test.cpp @@ -91,7 +91,7 @@ struct STAccount_test : public beast::unit_test::suite { // Construct from a VL that is not exactly 160 bits. Serializer s; - const std::uint8_t bits128[]{ + std::uint8_t const bits128[]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; s.addVL(bits128, sizeof(bits128)); SerialIter sit(s.slice()); diff --git a/src/test/protocol/STAmount_test.cpp b/src/test/protocol/STAmount_test.cpp index 1836fa8595..712c91000e 100644 --- a/src/test/protocol/STAmount_test.cpp +++ b/src/test/protocol/STAmount_test.cpp @@ -300,7 +300,7 @@ public: unexpected(!to_currency(c, "USD"), "create USD currency"); unexpected(to_string(c) != "USD", "check USD currency"); - const std::string cur = "015841551A748AD2C1F76FF6ECB0CCCD00000000"; + std::string const cur = "015841551A748AD2C1F76FF6ECB0CCCD00000000"; unexpected(!to_currency(c, cur), "create custom currency"); unexpected(to_string(c) != cur, "check custom currency"); } diff --git a/src/test/protocol/TER_test.cpp b/src/test/protocol/TER_test.cpp index a43fd8758a..0107f1c7d2 100644 --- a/src/test/protocol/TER_test.cpp +++ b/src/test/protocol/TER_test.cpp @@ -149,7 +149,7 @@ struct TER_test : public beast::unit_test::suite terRETRY, tesSUCCESS, tecCLAIM); - static const int hiIndex{ + static int const hiIndex{ std::tuple_size::value - 1}; // Verify that enums cannot be converted to other enum types. @@ -277,7 +277,7 @@ struct TER_test : public beast::unit_test::suite tecCLAIM, NotTEC{telLOCAL_ERROR}, TER{tecCLAIM}); - static const int hiIndex{std::tuple_size::value - 1}; + static int const hiIndex{std::tuple_size::value - 1}; // Verify that all types in the ters tuple can be compared with all // the other types in ters. diff --git a/src/test/rpc/DepositAuthorized_test.cpp b/src/test/rpc/DepositAuthorized_test.cpp index 8162528ec2..647f9e25ed 100644 --- a/src/test/rpc/DepositAuthorized_test.cpp +++ b/src/test/rpc/DepositAuthorized_test.cpp @@ -339,7 +339,7 @@ public: using namespace jtx; - const char credType[] = "abcde"; + char const credType[] = "abcde"; Account const alice{"alice"}; Account const becky{"becky"}; @@ -477,7 +477,7 @@ public: } { - static const std::vector credIds = { + static std::vector const credIds = { "18004829F915654A81B11C4AB8218D96FED67F209B58328A72314FB6EA288B" "E4", "28004829F915654A81B11C4AB8218D96FED67F209B58328A72314FB6EA288B" @@ -571,7 +571,7 @@ public: testcase("deposit_authorized with expired credentials"); // check expired credentials - const char credType2[] = "fghijk"; + char const credType2[] = "fghijk"; std::uint32_t const x = env.current() ->info() .parentCloseTime.time_since_epoch() diff --git a/src/test/rpc/Feature_test.cpp b/src/test/rpc/Feature_test.cpp index bc789f9a74..40de395a71 100644 --- a/src/test/rpc/Feature_test.cpp +++ b/src/test/rpc/Feature_test.cpp @@ -519,7 +519,7 @@ class Feature_test : public beast::unit_test::suite using namespace test::jtx; Env env{*this, FeatureBitset(featureMultiSignReserve)}; - constexpr const char* featureName = "MultiSignReserve"; + constexpr char const* featureName = "MultiSignReserve"; auto jrr = env.rpc("feature", featureName)[jss::result]; if (!BEAST_EXPECTS(jrr[jss::status] == jss::success, "status")) @@ -570,7 +570,7 @@ class Feature_test : public beast::unit_test::suite using namespace test::jtx; Env env{*this}; - constexpr const char* featureName = "NonFungibleTokensV1"; + constexpr char const* featureName = "NonFungibleTokensV1"; auto jrr = env.rpc("feature", featureName)[jss::result]; if (!BEAST_EXPECTS(jrr[jss::status] == jss::success, "status")) diff --git a/src/test/rpc/Handler_test.cpp b/src/test/rpc/Handler_test.cpp index 4883cf664f..8eb0c8d01d 100644 --- a/src/test/rpc/Handler_test.cpp +++ b/src/test/rpc/Handler_test.cpp @@ -84,7 +84,7 @@ class Handler_test : public beast::unit_test::suite } } - const double mean_squared = (sum * sum) / (j * j); + double const mean_squared = (sum * sum) / (j * j); return std::make_tuple( clock::duration{static_cast(sum / j)}, clock::duration{ @@ -100,7 +100,7 @@ class Handler_test : public beast::unit_test::suite std::random_device dev; std::ranlux48 prng(dev()); - std::vector names = + std::vector names = test::jtx::make_vector(ripple::RPC::getHandlerNames()); std::uniform_int_distribution distr{0, names.size() - 1}; diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index 465d6c6631..cb6f6d45e2 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -253,7 +253,7 @@ class LedgerEntry_test : public beast::unit_test::suite Account const issuer{"issuer"}; Account const alice{"alice"}; Account const bob{"bob"}; - const char credType[] = "abcde"; + char const credType[] = "abcde"; env.fund(XRP(5000), issuer, alice, bob); env.close(); @@ -692,7 +692,7 @@ class LedgerEntry_test : public beast::unit_test::suite Account const issuer{"issuer"}; Account const alice{"alice"}; Account const bob{"bob"}; - const char credType[] = "abcde"; + char const credType[] = "abcde"; env.fund(XRP(5000), issuer, alice, bob); env.close(); @@ -885,7 +885,7 @@ class LedgerEntry_test : public beast::unit_test::suite { // Failed, authorized_credentials is too long - static const std::string_view credTypes[] = { + static std::string_view const credTypes[] = { "cred1", "cred2", "cred3", diff --git a/src/test/rpc/LedgerRPC_test.cpp b/src/test/rpc/LedgerRPC_test.cpp index 4e8d2964ca..5b26f43161 100644 --- a/src/test/rpc/LedgerRPC_test.cpp +++ b/src/test/rpc/LedgerRPC_test.cpp @@ -563,11 +563,11 @@ class LedgerRPC_test : public beast::unit_test::suite env.close(); jrr = env.rpc("json", "ledger", to_string(jv))[jss::result]; - const std::string txid0 = [&]() { + std::string const txid0 = [&]() { auto const& parentHash = env.current()->info().parentHash; if (BEAST_EXPECT(jrr[jss::queue_data].size() == 2)) { - const std::string txid1 = [&]() { + std::string const txid1 = [&]() { auto const& txj = jrr[jss::queue_data][1u]; BEAST_EXPECT(txj[jss::account] == alice.human()); BEAST_EXPECT(txj[jss::fee_level] == "256"); @@ -589,7 +589,7 @@ class LedgerRPC_test : public beast::unit_test::suite auto const& tx = txj[jss::tx]; BEAST_EXPECT(tx[jss::Account] == alice.human()); BEAST_EXPECT(tx[jss::TransactionType] == jss::OfferCreate); - const auto txid0 = tx[jss::hash].asString(); + auto const txid0 = tx[jss::hash].asString(); uint256 tx0, tx1; BEAST_EXPECT(tx0.parseHex(txid0)); BEAST_EXPECT(tx1.parseHex(txid1)); @@ -665,7 +665,7 @@ class LedgerRPC_test : public beast::unit_test::suite jv[jss::binary] = false; jrr = env.rpc("json", "ledger", to_string(jv))[jss::result]; - const std::string txid2 = [&]() { + std::string const txid2 = [&]() { if (BEAST_EXPECT(jrr[jss::queue_data].size() == 1)) { auto const& txj = jrr[jss::queue_data][0u]; diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index 8438ef533d..be0f32b5ce 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -5840,7 +5840,7 @@ static RPCCallTestData const rpcCallTestArray[] = { }; std::string -updateAPIVersionString(const char* const req, unsigned apiVersion) +updateAPIVersionString(char const* const req, unsigned apiVersion) { std::string const version_str = std::to_string(apiVersion); static auto const place_holder = "%API_VER%"; @@ -5883,7 +5883,7 @@ public: std::vector const args{ rpcCallTest.args.begin(), rpcCallTest.args.end()}; - const char* const expVersioned = + char const* const expVersioned = (apiVersion - RPC::apiMinimumSupportedVersion) < rpcCallTest.exp.size() ? rpcCallTest.exp[apiVersion - RPC::apiMinimumSupportedVersion] diff --git a/src/test/rpc/Transaction_test.cpp b/src/test/rpc/Transaction_test.cpp index 0a5821499a..577f731200 100644 --- a/src/test/rpc/Transaction_test.cpp +++ b/src/test/rpc/Transaction_test.cpp @@ -55,11 +55,11 @@ class Transaction_test : public beast::unit_test::suite using namespace test::jtx; using std::to_string; - const char* COMMAND = jss::tx.c_str(); - const char* BINARY = jss::binary.c_str(); - const char* NOT_FOUND = RPC::get_error_info(rpcTXN_NOT_FOUND).token; - const char* INVALID = RPC::get_error_info(rpcINVALID_LGR_RANGE).token; - const char* EXCESSIVE = + char const* COMMAND = jss::tx.c_str(); + char const* BINARY = jss::binary.c_str(); + char const* NOT_FOUND = RPC::get_error_info(rpcTXN_NOT_FOUND).token; + char const* INVALID = RPC::get_error_info(rpcINVALID_LGR_RANGE).token; + char const* EXCESSIVE = RPC::get_error_info(rpcEXCESSIVE_LGR_RANGE).token; Env env{*this, features}; @@ -135,7 +135,7 @@ class Transaction_test : public beast::unit_test::suite BEAST_EXPECT(!result[jss::result][jss::searched_all].asBool()); } - const auto deletedLedger = (startLegSeq + endLegSeq) / 2; + auto const deletedLedger = (startLegSeq + endLegSeq) / 2; { // Remove one of the ledgers from the database directly dynamic_cast(&env.app().getRelationalDatabase()) @@ -305,11 +305,11 @@ class Transaction_test : public beast::unit_test::suite using namespace test::jtx; using std::to_string; - const char* COMMAND = jss::tx.c_str(); - const char* BINARY = jss::binary.c_str(); - const char* NOT_FOUND = RPC::get_error_info(rpcTXN_NOT_FOUND).token; - const char* INVALID = RPC::get_error_info(rpcINVALID_LGR_RANGE).token; - const char* EXCESSIVE = + char const* COMMAND = jss::tx.c_str(); + char const* BINARY = jss::binary.c_str(); + char const* NOT_FOUND = RPC::get_error_info(rpcTXN_NOT_FOUND).token; + char const* INVALID = RPC::get_error_info(rpcINVALID_LGR_RANGE).token; + char const* EXCESSIVE = RPC::get_error_info(rpcEXCESSIVE_LGR_RANGE).token; Env env{*this, makeNetworkConfig(11111)}; @@ -393,7 +393,7 @@ class Transaction_test : public beast::unit_test::suite BEAST_EXPECT(!result[jss::result][jss::searched_all].asBool()); } - const auto deletedLedger = (startLegSeq + endLegSeq) / 2; + auto const deletedLedger = (startLegSeq + endLegSeq) / 2; { // Remove one of the ledgers from the database directly dynamic_cast(&env.app().getRelationalDatabase()) diff --git a/src/test/rpc/ValidatorInfo_test.cpp b/src/test/rpc/ValidatorInfo_test.cpp index 4904923e0b..78ff267e57 100644 --- a/src/test/rpc/ValidatorInfo_test.cpp +++ b/src/test/rpc/ValidatorInfo_test.cpp @@ -63,7 +63,7 @@ public: testcase("Lookup"); using namespace jtx; - const std::vector tokenBlob = { + std::vector const tokenBlob = { " " "eyJ2YWxpZGF0aW9uX3NlY3JldF9rZXkiOiI5ZWQ0NWY4NjYyNDFjYzE4YTI3NDdiNT" "\n", diff --git a/src/test/unit_test/multi_runner.h b/src/test/unit_test/multi_runner.h index 653bbead06..08512d1882 100644 --- a/src/test/unit_test/multi_runner.h +++ b/src/test/unit_test/multi_runner.h @@ -152,10 +152,10 @@ class multi_runner_base print_results(S& s); }; - static constexpr const char* shared_mem_name_ = "RippledUnitTestSharedMem"; + static constexpr char const* shared_mem_name_ = "RippledUnitTestSharedMem"; // name of the message queue a multi_runner_child will use to communicate // with multi_runner_parent - static constexpr const char* message_queue_name_ = + static constexpr char const* message_queue_name_ = "RippledUnitTestMessageQueue"; // `inner_` will be created in shared memory diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 0a5cee4121..292ba7d483 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -319,8 +319,8 @@ RCLConsensus::Adaptor::onClose( NetClock::time_point const& closeTime, ConsensusMode mode) -> Result { - const bool wrongLCL = mode == ConsensusMode::wrongLedger; - const bool proposing = mode == ConsensusMode::proposing; + bool const wrongLCL = mode == ConsensusMode::wrongLedger; + bool const proposing = mode == ConsensusMode::proposing; notify(protocol::neCLOSING_LEDGER, ledger, !wrongLCL); @@ -437,7 +437,7 @@ RCLConsensus::Adaptor::onAccept( ConsensusCloseTimes const& rawCloseTimes, ConsensusMode const& mode, Json::Value&& consensusJson, - const bool validating) + bool const validating) { app_.getJobQueue().addJob( jtACCEPT, @@ -474,9 +474,9 @@ RCLConsensus::Adaptor::doAccept( bool closeTimeCorrect; - const bool proposing = mode == ConsensusMode::proposing; - const bool haveCorrectLCL = mode != ConsensusMode::wrongLedger; - const bool consensusFail = result.state == ConsensusState::MovedOn; + bool const proposing = mode == ConsensusMode::proposing; + bool const haveCorrectLCL = mode != ConsensusMode::wrongLedger; + bool const consensusFail = result.state == ConsensusState::MovedOn; auto consensusCloseTime = result.position.closeTime(); @@ -1020,7 +1020,7 @@ RCLConsensus::Adaptor::preStartRound( } } - const bool synced = app_.getOPs().getOperatingMode() == OperatingMode::FULL; + bool const synced = app_.getOPs().getOperatingMode() == OperatingMode::FULL; if (validating_) { @@ -1105,8 +1105,8 @@ RCLConsensus::startRound( } RclConsensusLogger::RclConsensusLogger( - const char* label, - const bool validating, + char const* label, + bool const validating, beast::Journal j) : j_(j) { diff --git a/src/xrpld/app/consensus/RCLConsensus.h b/src/xrpld/app/consensus/RCLConsensus.h index 735c67fd01..38481d2363 100644 --- a/src/xrpld/app/consensus/RCLConsensus.h +++ b/src/xrpld/app/consensus/RCLConsensus.h @@ -328,7 +328,7 @@ class RCLConsensus ConsensusCloseTimes const& rawCloseTimes, ConsensusMode const& mode, Json::Value&& consensusJson, - const bool validating); + bool const validating); /** Process the accepted ledger that was a result of simulation/force accept. @@ -556,7 +556,7 @@ class RclConsensusLogger public: explicit RclConsensusLogger( - const char* label, + char const* label, bool validating, beast::Journal j); ~RclConsensusLogger(); diff --git a/src/xrpld/app/ledger/BuildLedger.h b/src/xrpld/app/ledger/BuildLedger.h index 0805db6c8d..2ec571773c 100644 --- a/src/xrpld/app/ledger/BuildLedger.h +++ b/src/xrpld/app/ledger/BuildLedger.h @@ -53,7 +53,7 @@ std::shared_ptr buildLedger( std::shared_ptr const& parent, NetClock::time_point closeTime, - const bool closeTimeCorrect, + bool const closeTimeCorrect, NetClock::duration closeResolution, Application& app, CanonicalTXSet& txns, diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index c4965cded2..3cdf0ab1a7 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -1102,7 +1102,7 @@ finishLoadByIndexOrHash( std::tuple, std::uint32_t, uint256> getLatestLedger(Application& app) { - const std::optional info = + std::optional const info = app.getRelationalDatabase().getNewestLedgerInfo(); if (!info) return {std::shared_ptr(), {}, {}}; diff --git a/src/xrpld/app/ledger/LedgerHistory.cpp b/src/xrpld/app/ledger/LedgerHistory.cpp index bf866abf3f..ccec209bd4 100644 --- a/src/xrpld/app/ledger/LedgerHistory.cpp +++ b/src/xrpld/app/ledger/LedgerHistory.cpp @@ -65,7 +65,7 @@ LedgerHistory::insert( std::unique_lock sl(m_ledgers_by_hash.peekMutex()); - const bool alreadyHad = m_ledgers_by_hash.canonicalize_replace_cache( + bool const alreadyHad = m_ledgers_by_hash.canonicalize_replace_cache( ledger->info().hash, ledger); if (validated) mLedgersByIndex[ledger->info().seq] = ledger->info().hash; @@ -225,30 +225,30 @@ log_metadata_difference( { JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different result and index!"; - JLOG(j.debug()) - << " Built:" << " Result: " << builtMetaData->getResult() - << " Index: " << builtMetaData->getIndex(); - JLOG(j.debug()) - << " Valid:" << " Result: " << validMetaData->getResult() - << " Index: " << validMetaData->getIndex(); + JLOG(j.debug()) << " Built:" + << " Result: " << builtMetaData->getResult() + << " Index: " << builtMetaData->getIndex(); + JLOG(j.debug()) << " Valid:" + << " Result: " << validMetaData->getResult() + << " Index: " << validMetaData->getIndex(); } else if (result_diff) { JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different result!"; - JLOG(j.debug()) - << " Built:" << " Result: " << builtMetaData->getResult(); - JLOG(j.debug()) - << " Valid:" << " Result: " << validMetaData->getResult(); + JLOG(j.debug()) << " Built:" + << " Result: " << builtMetaData->getResult(); + JLOG(j.debug()) << " Valid:" + << " Result: " << validMetaData->getResult(); } else if (index_diff) { JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different index!"; - JLOG(j.debug()) - << " Built:" << " Index: " << builtMetaData->getIndex(); - JLOG(j.debug()) - << " Valid:" << " Index: " << validMetaData->getIndex(); + JLOG(j.debug()) << " Built:" + << " Index: " << builtMetaData->getIndex(); + JLOG(j.debug()) << " Valid:" + << " Index: " << validMetaData->getIndex(); } } else @@ -267,12 +267,12 @@ log_metadata_difference( JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different result and nodes!"; JLOG(j.debug()) - << " Built:" << " Result: " << builtMetaData->getResult() - << " Nodes:\n" + << " Built:" + << " Result: " << builtMetaData->getResult() << " Nodes:\n" << builtNodes.getJson(JsonOptions::none); JLOG(j.debug()) - << " Valid:" << " Result: " << validMetaData->getResult() - << " Nodes:\n" + << " Valid:" + << " Result: " << validMetaData->getResult() << " Nodes:\n" << validNodes.getJson(JsonOptions::none); } else if (index_diff) @@ -280,21 +280,23 @@ log_metadata_difference( JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different index and nodes!"; JLOG(j.debug()) - << " Built:" << " Index: " << builtMetaData->getIndex() - << " Nodes:\n" + << " Built:" + << " Index: " << builtMetaData->getIndex() << " Nodes:\n" << builtNodes.getJson(JsonOptions::none); JLOG(j.debug()) - << " Valid:" << " Index: " << validMetaData->getIndex() - << " Nodes:\n" + << " Valid:" + << " Index: " << validMetaData->getIndex() << " Nodes:\n" << validNodes.getJson(JsonOptions::none); } else // nodes_diff { JLOG(j.debug()) << "MISMATCH on TX " << tx << ": Different nodes!"; - JLOG(j.debug()) << " Built:" << " Nodes:\n" + JLOG(j.debug()) << " Built:" + << " Nodes:\n" << builtNodes.getJson(JsonOptions::none); - JLOG(j.debug()) << " Valid:" << " Nodes:\n" + JLOG(j.debug()) << " Valid:" + << " Nodes:\n" << validNodes.getJson(JsonOptions::none); } } @@ -351,10 +353,10 @@ LedgerHistory::handleMismatch( if (!builtLedger || !validLedger) { - JLOG(j_.error()) << "MISMATCH cannot be analyzed:" << " builtLedger: " - << to_string(built) << " -> " << builtLedger - << " validLedger: " << to_string(valid) << " -> " - << validLedger; + JLOG(j_.error()) << "MISMATCH cannot be analyzed:" + << " builtLedger: " << to_string(built) << " -> " + << builtLedger << " validLedger: " << to_string(valid) + << " -> " << validLedger; return; } diff --git a/src/xrpld/app/ledger/LedgerMaster.h b/src/xrpld/app/ledger/LedgerMaster.h index f8d726ec8e..5e0598d78b 100644 --- a/src/xrpld/app/ledger/LedgerMaster.h +++ b/src/xrpld/app/ledger/LedgerMaster.h @@ -312,7 +312,7 @@ private: // Returns true if work started. Always called with m_mutex locked. // The passed lock is a reminder to callers. bool - newPFWork(const char* name, std::unique_lock&); + newPFWork(char const* name, std::unique_lock&); Application& app_; beast::Journal m_journal; diff --git a/src/xrpld/app/ledger/OrderBookDB.cpp b/src/xrpld/app/ledger/OrderBookDB.cpp index 5d3616ce20..b8a7b54008 100644 --- a/src/xrpld/app/ledger/OrderBookDB.cpp +++ b/src/xrpld/app/ledger/OrderBookDB.cpp @@ -252,7 +252,7 @@ OrderBookDB::getBookListeners(Book const& book) void OrderBookDB::processTxn( std::shared_ptr const& ledger, - const AcceptedLedgerTx& alTx, + AcceptedLedgerTx const& alTx, MultiApiJson const& jvObj) { std::lock_guard sl(mLock); diff --git a/src/xrpld/app/ledger/OrderBookDB.h b/src/xrpld/app/ledger/OrderBookDB.h index d120f43aea..bc36f8a301 100644 --- a/src/xrpld/app/ledger/OrderBookDB.h +++ b/src/xrpld/app/ledger/OrderBookDB.h @@ -65,7 +65,7 @@ public: void processTxn( std::shared_ptr const& ledger, - const AcceptedLedgerTx& alTx, + AcceptedLedgerTx const& alTx, MultiApiJson const& jvObj); private: diff --git a/src/xrpld/app/ledger/detail/BuildLedger.cpp b/src/xrpld/app/ledger/detail/BuildLedger.cpp index 3f099cd2ea..954507a006 100644 --- a/src/xrpld/app/ledger/detail/BuildLedger.cpp +++ b/src/xrpld/app/ledger/detail/BuildLedger.cpp @@ -39,7 +39,7 @@ std::shared_ptr buildLedgerImpl( std::shared_ptr const& parent, NetClock::time_point closeTime, - const bool closeTimeCorrect, + bool const closeTimeCorrect, NetClock::duration closeResolution, Application& app, beast::Journal j, @@ -182,7 +182,7 @@ std::shared_ptr buildLedger( std::shared_ptr const& parent, NetClock::time_point closeTime, - const bool closeTimeCorrect, + bool const closeTimeCorrect, NetClock::duration closeResolution, Application& app, CanonicalTXSet& txns, diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index 88f3de5b12..78f0375b16 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -1526,7 +1526,7 @@ LedgerMaster::newOrderBookDB() */ bool LedgerMaster::newPFWork( - const char* name, + char const* name, std::unique_lock&) { if (!app_.isStopping() && mPathFindThread < 2 && diff --git a/src/xrpld/app/ledger/detail/LedgerToJson.cpp b/src/xrpld/app/ledger/detail/LedgerToJson.cpp index 5f1e47e8b3..3e4f4b8f0a 100644 --- a/src/xrpld/app/ledger/detail/LedgerToJson.cpp +++ b/src/xrpld/app/ledger/detail/LedgerToJson.cpp @@ -168,7 +168,7 @@ fillJsonTx( if (!fill.ledger.open()) txJson[jss::ledger_hash] = to_string(fill.ledger.info().hash); - const bool validated = + bool const validated = fill.context->ledgerMaster.isValidated(fill.ledger); txJson[jss::validated] = validated; if (validated) diff --git a/src/xrpld/app/ledger/detail/TimeoutCounter.cpp b/src/xrpld/app/ledger/detail/TimeoutCounter.cpp index 0961488691..e81ec6574d 100644 --- a/src/xrpld/app/ledger/detail/TimeoutCounter.cpp +++ b/src/xrpld/app/ledger/detail/TimeoutCounter.cpp @@ -100,8 +100,8 @@ TimeoutCounter::invokeOnTimer() if (!progress_) { ++timeouts_; - JLOG(journal_.debug()) - << "Timeout(" << timeouts_ << ") " << " acquiring " << hash_; + JLOG(journal_.debug()) << "Timeout(" << timeouts_ << ") " + << " acquiring " << hash_; onTimer(false, sl); } else diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 6e222858d8..5d495aaf06 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -1137,7 +1137,7 @@ public: return maxDisallowedLedger_; } - virtual const std::optional& + virtual std::optional const& trapTxID() const override { return trapTxID_; diff --git a/src/xrpld/app/main/Application.h b/src/xrpld/app/main/Application.h index 1bc4998aa1..f3cff35d4b 100644 --- a/src/xrpld/app/main/Application.h +++ b/src/xrpld/app/main/Application.h @@ -273,7 +273,7 @@ public: virtual LedgerIndex getMaxDisallowedLedger() = 0; - virtual const std::optional& + virtual std::optional const& trapTxID() const = 0; }; diff --git a/src/xrpld/app/main/GRPCServer.cpp b/src/xrpld/app/main/GRPCServer.cpp index 2ee811dc19..a4bbcda0a5 100644 --- a/src/xrpld/app/main/GRPCServer.cpp +++ b/src/xrpld/app/main/GRPCServer.cpp @@ -447,8 +447,8 @@ GRPCServerImpl::handleRpcs() if (!ok) { - JLOG(journal_.debug()) - << "Request listener cancelled. " << "Destroying object"; + JLOG(journal_.debug()) << "Request listener cancelled. " + << "Destroying object"; erase(ptr); } else diff --git a/src/xrpld/app/main/GRPCServer.h b/src/xrpld/app/main/GRPCServer.h index 2ecbd5e7da..5ed4ba8454 100644 --- a/src/xrpld/app/main/GRPCServer.h +++ b/src/xrpld/app/main/GRPCServer.h @@ -44,10 +44,10 @@ public: Processor() = default; - Processor(const Processor&) = delete; + Processor(Processor const&) = delete; Processor& - operator=(const Processor&) = delete; + operator=(Processor const&) = delete; // process a request that has arrived. Can only be called once per instance virtual void @@ -120,10 +120,10 @@ private: public: explicit GRPCServerImpl(Application& app); - GRPCServerImpl(const GRPCServerImpl&) = delete; + GRPCServerImpl(GRPCServerImpl const&) = delete; GRPCServerImpl& - operator=(const GRPCServerImpl&) = delete; + operator=(GRPCServerImpl const&) = delete; void shutdown(); @@ -214,10 +214,10 @@ private: Resource::Charge loadType, std::vector const& secureGatewayIPs); - CallData(const CallData&) = delete; + CallData(CallData const&) = delete; CallData& - operator=(const CallData&) = delete; + operator=(CallData const&) = delete; virtual void process() override; @@ -304,10 +304,10 @@ public: { } - GRPCServer(const GRPCServer&) = delete; + GRPCServer(GRPCServer const&) = delete; GRPCServer& - operator=(const GRPCServer&) = delete; + operator=(GRPCServer const&) = delete; bool start(); diff --git a/src/xrpld/app/main/Main.cpp b/src/xrpld/app/main/Main.cpp index 2fa0f68df4..e926a38563 100644 --- a/src/xrpld/app/main/Main.cpp +++ b/src/xrpld/app/main/Main.cpp @@ -115,7 +115,7 @@ adjustDescriptorLimit(int needed, beast::Journal j) } void -printHelp(const po::options_description& desc) +printHelp(po::options_description const& desc) { std::cerr << systemName() << "d [options] \n" diff --git a/src/xrpld/app/misc/AMMHelpers.h b/src/xrpld/app/misc/AMMHelpers.h index f27d542e32..97554b7e15 100644 --- a/src/xrpld/app/misc/AMMHelpers.h +++ b/src/xrpld/app/misc/AMMHelpers.h @@ -382,9 +382,9 @@ changeSpotPriceQuality( { JLOG(j.error()) << "changeSpotPriceQuality failed: " << to_string(pool.in) - << " " << to_string(pool.out) << " " << " " << quality - << " " << tfee << " " << to_string(amounts.in) << " " - << to_string(amounts.out); + << " " << to_string(pool.out) << " " + << " " << quality << " " << tfee << " " + << to_string(amounts.in) << " " << to_string(amounts.out); Throw("changeSpotPriceQuality failed"); } else diff --git a/src/xrpld/app/misc/FeeVoteImpl.cpp b/src/xrpld/app/misc/FeeVoteImpl.cpp index f9d5fbc58c..85b5791d67 100644 --- a/src/xrpld/app/misc/FeeVoteImpl.cpp +++ b/src/xrpld/app/misc/FeeVoteImpl.cpp @@ -130,7 +130,7 @@ FeeVoteImpl::doValidation( auto vote = [&v, this]( auto const current, XRPAmount target, - const char* name, + char const* name, auto const& sfield) { if (current != target) { @@ -164,7 +164,7 @@ FeeVoteImpl::doValidation( auto const current, XRPAmount target, auto const& convertCallback, - const char* name, + char const* name, auto const& sfield) { if (current != target) { diff --git a/src/xrpld/app/misc/HashRouter.cpp b/src/xrpld/app/misc/HashRouter.cpp index ac522487f5..dc87b2bce1 100644 --- a/src/xrpld/app/misc/HashRouter.cpp +++ b/src/xrpld/app/misc/HashRouter.cpp @@ -55,7 +55,7 @@ HashRouter::addSuppressionPeer(uint256 const& key, PeerShortID peer) } std::pair> -HashRouter::addSuppressionPeerWithStatus(const uint256& key, PeerShortID peer) +HashRouter::addSuppressionPeerWithStatus(uint256 const& key, PeerShortID peer) { std::lock_guard lock(mutex_); diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index b05f38f3ed..6f29f79384 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -373,7 +373,7 @@ public: std::shared_ptr& lpLedger, Book const&, AccountID const& uTakerID, - const bool bProof, + bool const bProof, unsigned int iLimit, Json::Value const& jvMarker, Json::Value& jvResult) override; @@ -397,7 +397,7 @@ private: void switchLastClosedLedger(std::shared_ptr const& newLCL); bool - checkLastClosedLedger(const Overlay::PeerSequence&, uint256& networkClosed); + checkLastClosedLedger(Overlay::PeerSequence const&, uint256& networkClosed); public: bool @@ -958,7 +958,7 @@ NetworkOPsImp::setStateTimer() void NetworkOPsImp::setTimer( boost::asio::steady_timer& timer, - const std::chrono::milliseconds& expiry_time, + std::chrono::milliseconds const& expiry_time, std::function onExpire, std::function onError) { @@ -1101,7 +1101,7 @@ NetworkOPsImp::processHeartbeatTimer() mConsensus.timerEntry(app_.timeKeeper().closeTime(), clog.ss()); CLOG(clog.ss()) << "consensus phase " << to_string(mLastConsensusPhase); - const ConsensusPhase currPhase = mConsensus.phase(); + ConsensusPhase const currPhase = mConsensus.phase(); if (mLastConsensusPhase != currPhase) { reportConsensusStateChange(currPhase); @@ -1844,7 +1844,7 @@ NetworkOPsImp::clearUNLBlocked() bool NetworkOPsImp::checkLastClosedLedger( - const Overlay::PeerSequence& peerList, + Overlay::PeerSequence const& peerList, uint256& networkClosed) { // Returns true if there's an *abnormal* ledger issue, normal changing in @@ -2066,7 +2066,7 @@ NetworkOPsImp::beginConsensus( changes.added, clog); - const ConsensusPhase currPhase = mConsensus.phase(); + ConsensusPhase const currPhase = mConsensus.phase(); if (mLastConsensusPhase != currPhase) { reportConsensusStateChange(currPhase); @@ -3315,7 +3315,7 @@ NetworkOPsImp::transJson( void NetworkOPsImp::pubValidatedTransaction( std::shared_ptr const& ledger, - const AcceptedLedgerTx& transaction, + AcceptedLedgerTx const& transaction, bool last) { auto const& stTxn = transaction.getTxn(); @@ -3460,8 +3460,8 @@ NetworkOPsImp::pubAccountTransaction( } JLOG(m_journal.trace()) - << "pubAccountTransaction: " << "proposed=" << iProposed - << ", accepted=" << iAccepted; + << "pubAccountTransaction: " + << "proposed=" << iProposed << ", accepted=" << iAccepted; if (!notify.empty() || !accountHistoryNotify.empty()) { @@ -3666,7 +3666,7 @@ void NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) { enum DatabaseType { Sqlite, None }; - static const auto databaseType = [&]() -> DatabaseType { + static auto const databaseType = [&]() -> DatabaseType { // Use a dynamic_cast to return DatabaseType::None // on failure. if (dynamic_cast(&app_.getRelationalDatabase())) @@ -3722,7 +3722,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) if (node.isFieldPresent(sfNewFields)) { - if (auto inner = dynamic_cast( + if (auto inner = dynamic_cast( node.peekAtPField(sfNewFields)); inner) { @@ -4058,7 +4058,7 @@ NetworkOPsImp::unsubAccountHistory( void NetworkOPsImp::unsubAccountHistoryInternal( std::uint64_t seq, - const AccountID& account, + AccountID const& account, bool historyOnly) { std::lock_guard sl(mSubLock); @@ -4395,8 +4395,8 @@ NetworkOPsImp::getBookPage( (jvResult[jss::offers] = Json::Value(Json::arrayValue)); std::unordered_map umBalance; - const uint256 uBookBase = getBookBase(book); - const uint256 uBookEnd = getQualityNext(uBookBase); + uint256 const uBookBase = getBookBase(book); + uint256 const uBookEnd = getQualityNext(uBookBase); uint256 uTipIndex = uBookBase; if (auto stream = m_journal.trace()) @@ -4607,7 +4607,7 @@ NetworkOPsImp::getBookPage( auto const rate = transferRate(lesActive, book.out.account); - const bool bGlobalFreeze = lesActive.isGlobalFrozen(book.out.account) || + bool const bGlobalFreeze = lesActive.isGlobalFrozen(book.out.account) || lesActive.isGlobalFrozen(book.in.account); while (iLimit-- > 0 && obIterator.nextOffer()) diff --git a/src/xrpld/app/misc/Transaction.h b/src/xrpld/app/misc/Transaction.h index 817e68817c..005ff16993 100644 --- a/src/xrpld/app/misc/Transaction.h +++ b/src/xrpld/app/misc/Transaction.h @@ -64,7 +64,7 @@ class Transaction : public std::enable_shared_from_this, { public: using pointer = std::shared_ptr; - using ref = const pointer&; + using ref = pointer const&; Transaction( std::shared_ptr const&, diff --git a/src/xrpld/app/misc/TxQ.h b/src/xrpld/app/misc/TxQ.h index 6fc61055f1..f6ac2c6861 100644 --- a/src/xrpld/app/misc/TxQ.h +++ b/src/xrpld/app/misc/TxQ.h @@ -650,7 +650,7 @@ private: * */ bool - operator()(const MaybeTx& lhs, const MaybeTx& rhs) const + operator()(MaybeTx const& lhs, MaybeTx const& rhs) const { if (lhs.feeLevel == rhs.feeLevel) return (lhs.txID ^ MaybeTx::parentHashComp) < @@ -690,7 +690,7 @@ private: /// Construct from a transaction explicit TxQAccount(std::shared_ptr const& txn); /// Construct from an account - explicit TxQAccount(const AccountID& account); + explicit TxQAccount(AccountID const& account); /// Return the number of transactions currently queued for this account std::size_t diff --git a/src/xrpld/app/misc/ValidatorList.h b/src/xrpld/app/misc/ValidatorList.h index 4e18aa5db3..4cb32282db 100644 --- a/src/xrpld/app/misc/ValidatorList.h +++ b/src/xrpld/app/misc/ValidatorList.h @@ -271,7 +271,7 @@ class ValidatorList // collection with more than 5 entries will be considered malformed. static constexpr std::size_t maxSupportedBlobs = 5; // Prefix of the file name used to store cache files. - static const std::string filePrefix_; + static std::string const filePrefix_; public: ValidatorList( diff --git a/src/xrpld/app/misc/ValidatorSite.h b/src/xrpld/app/misc/ValidatorSite.h index 88e30e28ab..58f9eaaeff 100644 --- a/src/xrpld/app/misc/ValidatorSite.h +++ b/src/xrpld/app/misc/ValidatorSite.h @@ -86,7 +86,7 @@ private: struct Resource { explicit Resource(std::string uri_); - const std::string uri; + std::string const uri; parsedURL pUrl; }; @@ -136,7 +136,7 @@ private: std::vector sites_; // time to allow for requests to complete - const std::chrono::seconds requestTimeout_; + std::chrono::seconds const requestTimeout_; public: ValidatorSite( diff --git a/src/xrpld/app/misc/detail/AMMUtils.cpp b/src/xrpld/app/misc/detail/AMMUtils.cpp index 5078049a4a..ba4c741300 100644 --- a/src/xrpld/app/misc/detail/AMMUtils.cpp +++ b/src/xrpld/app/misc/detail/AMMUtils.cpp @@ -73,7 +73,7 @@ ammHolds( auto const singleIssue = [&issue1, &issue2, &j]( Issue checkIssue, - const char* label) -> std::optional> { + char const* label) -> std::optional> { if (checkIssue == issue1) return std::make_optional(std::make_pair(issue1, issue2)); else if (checkIssue == issue2) @@ -150,8 +150,8 @@ ammLPHolds( } amount.setIssuer(ammAccount); - JLOG(j.trace()) << "ammLPHolds:" << " lpAccount=" - << to_string(lpAccount) + JLOG(j.trace()) << "ammLPHolds:" + << " lpAccount=" << to_string(lpAccount) << " amount=" << amount.getFullText(); } diff --git a/src/xrpld/app/misc/detail/AmendmentTable.cpp b/src/xrpld/app/misc/detail/AmendmentTable.cpp index ae41a2aa7e..b13e40c3ae 100644 --- a/src/xrpld/app/misc/detail/AmendmentTable.cpp +++ b/src/xrpld/app/misc/detail/AmendmentTable.cpp @@ -998,8 +998,8 @@ AmendmentTableImpl::trustChanged(hash_set const& allTrusted) void AmendmentTableImpl::injectJson( Json::Value& v, - const uint256& id, - const AmendmentState& fs, + uint256 const& id, + AmendmentState const& fs, bool isAdmin, std::lock_guard const&) const { diff --git a/src/xrpld/app/misc/detail/TxQ.cpp b/src/xrpld/app/misc/detail/TxQ.cpp index 11d81fb8ae..adf96d0e14 100644 --- a/src/xrpld/app/misc/detail/TxQ.cpp +++ b/src/xrpld/app/misc/detail/TxQ.cpp @@ -323,7 +323,7 @@ TxQ::TxQAccount::TxQAccount(std::shared_ptr const& txn) { } -TxQ::TxQAccount::TxQAccount(const AccountID& account_) : account(account_) +TxQ::TxQAccount::TxQAccount(AccountID const& account_) : account(account_) { } @@ -1504,11 +1504,11 @@ TxQ::accept(Application& app, OpenView& view) } else { - JLOG(j_.debug()) - << "Queued transaction " << candidateIter->txID - << " failed with " << transToken(txnResult) - << ". Leave in queue." << " Applied: " << didApply - << ". Flags: " << candidateIter->flags; + JLOG(j_.debug()) << "Queued transaction " << candidateIter->txID + << " failed with " << transToken(txnResult) + << ". Leave in queue." + << " Applied: " << didApply + << ". Flags: " << candidateIter->flags; if (account.retryPenalty && candidateIter->retriesRemaining > 2) candidateIter->retriesRemaining = 1; else diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index 282c3c9e19..1ddb51c9dd 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -115,7 +115,7 @@ ValidatorList::MessageWithHash::MessageWithHash( { } -const std::string ValidatorList::filePrefix_ = "cache."; +std::string const ValidatorList::filePrefix_ = "cache."; ValidatorList::ValidatorList( ManifestCache& validatorManifests, diff --git a/src/xrpld/app/paths/AMMLiquidity.h b/src/xrpld/app/paths/AMMLiquidity.h index b41e26ac84..ee745b4a8a 100644 --- a/src/xrpld/app/paths/AMMLiquidity.h +++ b/src/xrpld/app/paths/AMMLiquidity.h @@ -52,7 +52,7 @@ template class AMMLiquidity { private: - inline static const Number InitialFibSeqPct = Number(5) / 20000; + inline static Number const InitialFibSeqPct = Number(5) / 20000; AMMContext& ammContext_; AccountID const ammAccountID_; std::uint32_t const tradingFee_; diff --git a/src/xrpld/app/paths/Flow.cpp b/src/xrpld/app/paths/Flow.cpp index 66793fc74c..08f8ec3f25 100644 --- a/src/xrpld/app/paths/Flow.cpp +++ b/src/xrpld/app/paths/Flow.cpp @@ -124,8 +124,8 @@ flow( } } - const bool srcIsXRP = isXRP(srcIssue.currency); - const bool dstIsXRP = isXRP(dstIssue.currency); + bool const srcIsXRP = isXRP(srcIssue.currency); + bool const dstIsXRP = isXRP(dstIssue.currency); auto const asDeliver = toAmountSpec(deliver); diff --git a/src/xrpld/app/paths/PathRequest.cpp b/src/xrpld/app/paths/PathRequest.cpp index dc2868eaf2..ed090d25aa 100644 --- a/src/xrpld/app/paths/PathRequest.cpp +++ b/src/xrpld/app/paths/PathRequest.cpp @@ -41,7 +41,7 @@ namespace ripple { PathRequest::PathRequest( Application& app, - const std::shared_ptr& subscriber, + std::shared_ptr const& subscriber, int id, PathRequests& owner, beast::Journal journal) diff --git a/src/xrpld/app/paths/PathRequest.h b/src/xrpld/app/paths/PathRequest.h index 3fdbecf7ed..e480c2b812 100644 --- a/src/xrpld/app/paths/PathRequest.h +++ b/src/xrpld/app/paths/PathRequest.h @@ -52,8 +52,8 @@ class PathRequest final : public InfoSubRequest, public: using wptr = std::weak_ptr; using pointer = std::shared_ptr; - using ref = const pointer&; - using wref = const wptr&; + using ref = pointer const&; + using wref = wptr const&; public: // path_find semantics diff --git a/src/xrpld/app/paths/Pathfinder.cpp b/src/xrpld/app/paths/Pathfinder.cpp index 379bb07e4b..e02c3ed089 100644 --- a/src/xrpld/app/paths/Pathfinder.cpp +++ b/src/xrpld/app/paths/Pathfinder.cpp @@ -77,7 +77,7 @@ struct AccountCandidate int priority; AccountID account; - static const int highPriority = 10000; + static int const highPriority = 10000; }; bool @@ -236,7 +236,8 @@ Pathfinder::findPaths( mSource = STPathElement(account, mSrcCurrency, issuer); auto issuerString = mSrcIssuer ? to_string(*mSrcIssuer) : std::string("none"); - JLOG(j_.trace()) << "findPaths>" << " mSrcAccount=" << mSrcAccount + JLOG(j_.trace()) << "findPaths>" + << " mSrcAccount=" << mSrcAccount << " mDstAccount=" << mDstAccount << " mDstAmount=" << mDstAmount.getFullText() << " mSrcCurrency=" << mSrcCurrency @@ -582,7 +583,7 @@ Pathfinder::getBestPaths( XRPL_ASSERT( fullLiquidityPath.empty(), "ripple::Pathfinder::getBestPaths : first empty path result"); - const bool issuerIsSender = + bool const issuerIsSender = isXRP(mSrcCurrency) || (srcIssuer == mSrcAccount); std::vector extraPathRanks; @@ -943,7 +944,7 @@ addUniquePath(STPathSet& pathSet, STPath const& path) void Pathfinder::addLink( - const STPath& currentPath, // The path to build from + STPath const& currentPath, // The path to build from STPathSet& incompletePaths, // The set of partial paths we add to int addFlags, std::function const& continueCallback) diff --git a/src/xrpld/app/paths/detail/BookStep.cpp b/src/xrpld/app/paths/detail/BookStep.cpp index 5e650230fe..4024ca190d 100644 --- a/src/xrpld/app/paths/detail/BookStep.cpp +++ b/src/xrpld/app/paths/detail/BookStep.cpp @@ -190,7 +190,8 @@ protected: logStringImpl(char const* name) const { std::ostringstream ostr; - ostr << name << ": " << "\ninIss: " << book_.in.account + ostr << name << ": " + << "\ninIss: " << book_.in.account << "\noutIss: " << book_.out.account << "\ninCur: " << book_.in.currency << "\noutCur: " << book_.out.currency; diff --git a/src/xrpld/app/paths/detail/DirectStep.cpp b/src/xrpld/app/paths/detail/DirectStep.cpp index 4e5ccea3f1..4dc9cbf20d 100644 --- a/src/xrpld/app/paths/detail/DirectStep.cpp +++ b/src/xrpld/app/paths/detail/DirectStep.cpp @@ -205,7 +205,8 @@ protected: logStringImpl(char const* name) const { std::ostringstream ostr; - ostr << name << ": " << "\nSrc: " << src_ << "\nDst: " << dst_; + ostr << name << ": " + << "\nSrc: " << src_ << "\nDst: " << dst_; return ostr.str(); } diff --git a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp index 4f38a7b422..7fdfb3749d 100644 --- a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp +++ b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp @@ -132,7 +132,8 @@ protected: logStringImpl(char const* name) const { std::ostringstream ostr; - ostr << name << ": " << "\nAcc: " << acc_; + ostr << name << ": " + << "\nAcc: " << acc_; return ostr.str(); } diff --git a/src/xrpld/app/rdb/RelationalDatabase.h b/src/xrpld/app/rdb/RelationalDatabase.h index 927b08d385..25b16f04a1 100644 --- a/src/xrpld/app/rdb/RelationalDatabase.h +++ b/src/xrpld/app/rdb/RelationalDatabase.h @@ -238,8 +238,8 @@ rangeCheckedCast(C c) /* This should never happen */ UNREACHABLE("ripple::rangeCheckedCast : domain error"); JLOG(debugLog().error()) - << "rangeCheckedCast domain error:" << " value = " << c - << " min = " << std::numeric_limits::lowest() + << "rangeCheckedCast domain error:" + << " value = " << c << " min = " << std::numeric_limits::lowest() << " max: " << std::numeric_limits::max(); } diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index 019d00ed36..6a0544091b 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -1059,7 +1059,7 @@ accountTxPage( // SQL's BETWEEN uses a closed interval ([a,b]) - const char* const order = forward ? "ASC" : "DESC"; + char const* const order = forward ? "ASC" : "DESC"; if (findLedger == 0) { @@ -1074,10 +1074,10 @@ accountTxPage( } else { - const char* const compare = forward ? ">=" : "<="; - const std::uint32_t minLedger = + char const* const compare = forward ? ">=" : "<="; + std::uint32_t const minLedger = forward ? findLedger + 1 : options.minLedger; - const std::uint32_t maxLedger = + std::uint32_t const maxLedger = forward ? options.maxLedger : findLedger - 1; auto b58acct = toBase58(options.account); diff --git a/src/xrpld/app/rdb/detail/RelationalDatabase.cpp b/src/xrpld/app/rdb/detail/RelationalDatabase.cpp index 4a95134d70..72edbec79d 100644 --- a/src/xrpld/app/rdb/detail/RelationalDatabase.cpp +++ b/src/xrpld/app/rdb/detail/RelationalDatabase.cpp @@ -34,7 +34,7 @@ RelationalDatabase::init( { bool use_sqlite = false; - const Section& rdb_section{config.section(SECTION_RELATIONAL_DB)}; + Section const& rdb_section{config.section(SECTION_RELATIONAL_DB)}; if (!rdb_section.empty()) { if (boost::iequals(get(rdb_section, "backend"), "sqlite")) diff --git a/src/xrpld/app/tx/detail/CancelOffer.cpp b/src/xrpld/app/tx/detail/CancelOffer.cpp index 6d8c077a62..004ae1e8b9 100644 --- a/src/xrpld/app/tx/detail/CancelOffer.cpp +++ b/src/xrpld/app/tx/detail/CancelOffer.cpp @@ -35,8 +35,8 @@ CancelOffer::preflight(PreflightContext const& ctx) if (uTxFlags & tfUniversalMask) { - JLOG(ctx.j.trace()) - << "Malformed transaction: " << "Invalid flags set."; + JLOG(ctx.j.trace()) << "Malformed transaction: " + << "Invalid flags set."; return temINVALID_FLAG; } @@ -63,8 +63,8 @@ CancelOffer::preclaim(PreclaimContext const& ctx) if ((*sle)[sfSequence] <= offerSequence) { - JLOG(ctx.j.trace()) << "Malformed transaction: " << "Sequence " - << offerSequence << " is invalid."; + JLOG(ctx.j.trace()) << "Malformed transaction: " + << "Sequence " << offerSequence << " is invalid."; return temBAD_SEQUENCE; } diff --git a/src/xrpld/app/tx/detail/Change.cpp b/src/xrpld/app/tx/detail/Change.cpp index 760d5b3d98..1392d84c08 100644 --- a/src/xrpld/app/tx/detail/Change.cpp +++ b/src/xrpld/app/tx/detail/Change.cpp @@ -268,8 +268,8 @@ Change::applyAmendment() auto flags = ctx_.tx.getFlags(); - const bool gotMajority = (flags & tfGotMajority) != 0; - const bool lostMajority = (flags & tfLostMajority) != 0; + bool const gotMajority = (flags & tfGotMajority) != 0; + bool const lostMajority = (flags & tfLostMajority) != 0; if (gotMajority && lostMajority) return temINVALID_FLAG; @@ -279,7 +279,7 @@ Change::applyAmendment() bool found = false; if (amendmentObject->isFieldPresent(sfMajorities)) { - const STArray& oldMajorities = + STArray const& oldMajorities = amendmentObject->getFieldArray(sfMajorities); for (auto const& majority : oldMajorities) { diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/xrpld/app/tx/detail/Transactor.cpp index 390f32e02b..baba7d131e 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/xrpld/app/tx/detail/Transactor.cpp @@ -283,9 +283,9 @@ Transactor::checkFee(PreclaimContext const& ctx, XRPAmount baseFee) if (balance < feePaid) { - JLOG(ctx.j.trace()) - << "Insufficient balance:" << " balance=" << to_string(balance) - << " paid=" << to_string(feePaid); + JLOG(ctx.j.trace()) << "Insufficient balance:" + << " balance=" << to_string(balance) + << " paid=" << to_string(feePaid); if ((balance > beast::zero) && !ctx.view.open()) { diff --git a/src/xrpld/conditions/detail/error.cpp b/src/xrpld/conditions/detail/error.cpp index 10a3a43921..1ba1a48186 100644 --- a/src/xrpld/conditions/detail/error.cpp +++ b/src/xrpld/conditions/detail/error.cpp @@ -32,7 +32,7 @@ class cryptoconditions_error_category : public std::error_category public: explicit cryptoconditions_error_category() = default; - const char* + char const* name() const noexcept override { return "cryptoconditions"; diff --git a/src/xrpld/conditions/detail/utils.h b/src/xrpld/conditions/detail/utils.h index 28943bd640..93e444a17a 100644 --- a/src/xrpld/conditions/detail/utils.h +++ b/src/xrpld/conditions/detail/utils.h @@ -188,9 +188,9 @@ parseInteger(Slice& s, std::size_t count, std::error_code& ec) return v; } - const bool isSigned = std::numeric_limits::is_signed; + bool const isSigned = std::numeric_limits::is_signed; // unsigned types may have a leading zero octet - const size_t maxLength = isSigned ? sizeof(Integer) : sizeof(Integer) + 1; + size_t const maxLength = isSigned ? sizeof(Integer) : sizeof(Integer) + 1; if (count > maxLength) { ec = error::large_size; diff --git a/src/xrpld/consensus/Consensus.h b/src/xrpld/consensus/Consensus.h index 948c00a8b2..f3265cf381 100644 --- a/src/xrpld/consensus/Consensus.h +++ b/src/xrpld/consensus/Consensus.h @@ -603,7 +603,7 @@ private: Ledger_t previousLedger_; // Transaction Sets, indexed by hash of transaction tree - hash_map acquired_; + hash_map acquired_; std::optional result_; ConsensusCloseTimes rawCloseTimes_; @@ -872,7 +872,7 @@ Consensus::timerEntry( CLOG(clog) << "Set network adjusted time to " << to_string(now) << ". "; // Check we are on the proper ledger (this may change phase_) - const auto phaseOrig = phase_; + auto const phaseOrig = phase_; CLOG(clog) << "Phase " << to_string(phaseOrig) << ". "; checkLedger(clog); if (phaseOrig != phase_) @@ -1121,8 +1121,8 @@ Consensus::checkLedger(std::unique_ptr const& clog) auto netLgr = adaptor_.getPrevLedger(prevLedgerID_, previousLedger_, mode_.get()); - CLOG(clog) << "network ledgerid " << netLgr << ", " << "previous ledger " - << prevLedgerID_ << ". "; + CLOG(clog) << "network ledgerid " << netLgr << ", " + << "previous ledger " << prevLedgerID_ << ". "; if (netLgr != prevLedgerID_) { @@ -1213,7 +1213,8 @@ Consensus::phaseOpen(std::unique_ptr const& clog) adaptor_.parms().ledgerIDLE_INTERVAL, 2 * previousLedger_.closeTimeResolution()); CLOG(clog) << "idle interval set to " << idleInterval.count() - << "ms based on " << "ledgerIDLE_INTERVAL: " + << "ms based on " + << "ledgerIDLE_INTERVAL: " << adaptor_.parms().ledgerIDLE_INTERVAL.count() << ", previous ledger close time resolution: " << previousLedger_.closeTimeResolution().count() << "ms. "; @@ -1261,7 +1262,8 @@ Consensus::shouldPause( << "roundTime: " << result_->roundTime.read().count() << ", " << "max consensus time: " << parms.ledgerMAX_CONSENSUS.count() << ", " << "validators: " << totalValidators << ", " - << "laggards: " << laggards << ", " << "offline: " << offline << ", " + << "laggards: " << laggards << ", " + << "offline: " << offline << ", " << "quorum: " << quorum << ")"; if (!ahead || !laggards || !totalValidators || !adaptor_.validator() || @@ -1447,7 +1449,7 @@ Consensus::closeLedger(std::unique_ptr const& clog) if (acquired_.emplace(result_->txns.id(), result_->txns).second) adaptor_.share(result_->txns); - const auto mode = mode_.get(); + auto const mode = mode_.get(); CLOG(clog) << "closeLedger transitioned to ConsensusPhase::establish, mode: " << to_string(mode) @@ -1622,8 +1624,8 @@ Consensus::updateOurPositions( if (!haveCloseTimeConsensus_) { JLOG(j_.debug()) - << "No CT consensus:" << " Proposers:" - << currPeerPositions_.size() + << "No CT consensus:" + << " Proposers:" << currPeerPositions_.size() << " Mode:" << to_string(mode_.get()) << " Thresh:" << threshConsensus << " Pos:" << consensusCloseTime.time_since_epoch().count(); diff --git a/src/xrpld/consensus/DisputedTx.h b/src/xrpld/consensus/DisputedTx.h index 513f240829..4ed31b77ca 100644 --- a/src/xrpld/consensus/DisputedTx.h +++ b/src/xrpld/consensus/DisputedTx.h @@ -149,8 +149,7 @@ public: @return bool Whether the peer changed its vote. (A new vote counts as a change.) */ - [[nodiscard]] - bool + [[nodiscard]] bool setVote(NodeID_t const& peer, bool votesYes); /** Remove a peer's vote diff --git a/src/xrpld/core/Job.h b/src/xrpld/core/Job.h index 66048f4f21..11b0b9b72b 100644 --- a/src/xrpld/core/Job.h +++ b/src/xrpld/core/Job.h @@ -132,13 +132,13 @@ public: // These comparison operators make the jobs sort in priority order // in the job set bool - operator<(const Job& j) const; + operator<(Job const& j) const; bool - operator>(const Job& j) const; + operator>(Job const& j) const; bool - operator<=(const Job& j) const; + operator<=(Job const& j) const; bool - operator>=(const Job& j) const; + operator>=(Job const& j) const; private: JobType mType; diff --git a/src/xrpld/core/detail/Config.cpp b/src/xrpld/core/detail/Config.cpp index 60a359b580..b132987d08 100644 --- a/src/xrpld/core/detail/Config.cpp +++ b/src/xrpld/core/detail/Config.cpp @@ -158,7 +158,7 @@ static_assert( #define SECTION_DEFAULT_NAME "" IniFileSections -parseIniFile(std::string const& strInput, const bool bTrim) +parseIniFile(std::string const& strInput, bool const bTrim) { std::string strData(strInput); std::vector vLines; @@ -490,7 +490,7 @@ Config::loadFromString(std::string const& fileContents) // if the user has specified ip:port then replace : with a space. { auto replaceColons = [](std::vector& strVec) { - const static std::regex e(":([0-9]+)$"); + static std::regex const e(":([0-9]+)$"); for (auto& line : strVec) { // skip anything that might be an ipv6 address diff --git a/src/xrpld/core/detail/Job.cpp b/src/xrpld/core/detail/Job.cpp index d62f49ff49..8e9a74b535 100644 --- a/src/xrpld/core/detail/Job.cpp +++ b/src/xrpld/core/detail/Job.cpp @@ -73,7 +73,7 @@ Job::doJob() } bool -Job::operator>(const Job& j) const +Job::operator>(Job const& j) const { if (mType < j.mType) return true; @@ -85,7 +85,7 @@ Job::operator>(const Job& j) const } bool -Job::operator>=(const Job& j) const +Job::operator>=(Job const& j) const { if (mType < j.mType) return true; @@ -97,7 +97,7 @@ Job::operator>=(const Job& j) const } bool -Job::operator<(const Job& j) const +Job::operator<(Job const& j) const { if (mType < j.mType) return false; @@ -109,7 +109,7 @@ Job::operator<(const Job& j) const } bool -Job::operator<=(const Job& j) const +Job::operator<=(Job const& j) const { if (mType < j.mType) return false; diff --git a/src/xrpld/core/detail/SociDB.cpp b/src/xrpld/core/detail/SociDB.cpp index 96b1f97977..5b298dac43 100644 --- a/src/xrpld/core/detail/SociDB.cpp +++ b/src/xrpld/core/detail/SociDB.cpp @@ -311,7 +311,7 @@ protected: sqliteWALHook( void* cpId, sqlite_api::sqlite3* conn, - const char* dbName, + char const* dbName, int walSize) { if (walSize >= checkpointPageCount) diff --git a/src/xrpld/ledger/ReadView.h b/src/xrpld/ledger/ReadView.h index 53e12083f3..4c1986be4e 100644 --- a/src/xrpld/ledger/ReadView.h +++ b/src/xrpld/ledger/ReadView.h @@ -258,7 +258,7 @@ public: using digest_type = uint256; DigestAwareReadView() = default; - DigestAwareReadView(const DigestAwareReadView&) = default; + DigestAwareReadView(DigestAwareReadView const&) = default; /** Return the digest associated with the key. diff --git a/src/xrpld/ledger/View.h b/src/xrpld/ledger/View.h index bb04fa8b87..4c70f5dc48 100644 --- a/src/xrpld/ledger/View.h +++ b/src/xrpld/ledger/View.h @@ -339,7 +339,7 @@ areCompatible( ReadView const& validLedger, ReadView const& testLedger, beast::Journal::Stream& s, - const char* reason); + char const* reason); [[nodiscard]] bool areCompatible( @@ -347,7 +347,7 @@ areCompatible( LedgerIndex validIndex, ReadView const& testLedger, beast::Journal::Stream& s, - const char* reason); + char const* reason); //------------------------------------------------------------------------------ // @@ -440,14 +440,14 @@ describeOwnerDir(AccountID const& account); [[nodiscard]] TER trustCreate( ApplyView& view, - const bool bSrcHigh, + bool const bSrcHigh, AccountID const& uSrcAccountID, AccountID const& uDstAccountID, uint256 const& uIndex, // --> ripple state entry SLE::ref sleAccount, // --> the account being set. - const bool bAuth, // --> authorize account. - const bool bNoRipple, // --> others cannot ripple through - const bool bFreeze, // --> funds cannot leave + bool const bAuth, // --> authorize account. + bool const bNoRipple, // --> others cannot ripple through + bool const bFreeze, // --> funds cannot leave bool bDeepFreeze, // --> can neither receive nor send funds STAmount const& saBalance, // --> balance of account being set. // Issuer should be noAccount() diff --git a/src/xrpld/ledger/detail/RawStateTable.h b/src/xrpld/ledger/detail/RawStateTable.h index 2db37d9833..37597aa678 100644 --- a/src/xrpld/ledger/detail/RawStateTable.h +++ b/src/xrpld/ledger/detail/RawStateTable.h @@ -126,7 +126,7 @@ private: sleAction, std::less, boost::container::pmr::polymorphic_allocator< - std::pair>>; + std::pair>>; // monotonic_resource_ must outlive `items_`. Make a pointer so it may be // easily moved. std::unique_ptr diff --git a/src/xrpld/ledger/detail/View.cpp b/src/xrpld/ledger/detail/View.cpp index 2a5224ebf1..af81a6b7bb 100644 --- a/src/xrpld/ledger/detail/View.cpp +++ b/src/xrpld/ledger/detail/View.cpp @@ -381,7 +381,8 @@ accountHolds( amount.clear(Issue{currency, issuer}); } - JLOG(j.trace()) << "accountHolds:" << " account=" << to_string(account) + JLOG(j.trace()) << "accountHolds:" + << " account=" << to_string(account) << " amount=" << amount.getFullText(); return view.balanceHook(account, issuer, amount); @@ -530,7 +531,8 @@ xrpLiquid( STAmount const amount = (balance < reserve) ? STAmount{0} : balance - reserve; - JLOG(j.trace()) << "accountHolds:" << " account=" << to_string(id) + JLOG(j.trace()) << "accountHolds:" + << " account=" << to_string(id) << " amount=" << amount.getFullText() << " fullBalance=" << fullBalance.getFullText() << " balance=" << balance.getFullText() @@ -675,7 +677,7 @@ areCompatible( ReadView const& validLedger, ReadView const& testLedger, beast::Journal::Stream& s, - const char* reason) + char const* reason) { bool ret = true; @@ -739,7 +741,7 @@ areCompatible( LedgerIndex validIndex, ReadView const& testLedger, beast::Journal::Stream& s, - const char* reason) + char const* reason) { bool ret = true; @@ -932,14 +934,14 @@ describeOwnerDir(AccountID const& account) TER trustCreate( ApplyView& view, - const bool bSrcHigh, + bool const bSrcHigh, AccountID const& uSrcAccountID, AccountID const& uDstAccountID, uint256 const& uIndex, // --> ripple state entry SLE::ref sleAccount, // --> the account being set. - const bool bAuth, // --> authorize account. - const bool bNoRipple, // --> others cannot ripple through - const bool bFreeze, // --> funds cannot leave + bool const bAuth, // --> authorize account. + bool const bNoRipple, // --> others cannot ripple through + bool const bFreeze, // --> funds cannot leave bool bDeepFreeze, // --> can neither receive nor send funds STAmount const& saBalance, // --> balance of account being set. // Issuer should be noAccount() @@ -975,8 +977,8 @@ trustCreate( if (!highNode) return tecDIR_FULL; - const bool bSetDst = saLimit.getIssuer() == uDstAccountID; - const bool bSetHigh = bSrcHigh ^ bSetDst; + bool const bSetDst = saLimit.getIssuer() == uDstAccountID; + bool const bSetHigh = bSrcHigh ^ bSetDst; XRPL_ASSERT(sleAccount, "ripple::trustCreate : non-null SLE"); if (!sleAccount) diff --git a/src/xrpld/net/AutoSocket.h b/src/xrpld/net/AutoSocket.h index 7486d6128d..d06787340b 100644 --- a/src/xrpld/net/AutoSocket.h +++ b/src/xrpld/net/AutoSocket.h @@ -168,7 +168,7 @@ public: template void - async_read_some(const Seq& buffers, Handler handler) + async_read_some(Seq const& buffers, Handler handler) { if (isSecure()) mSocket->async_read_some(buffers, handler); @@ -178,7 +178,7 @@ public: template void - async_read_until(const Seq& buffers, Condition condition, Handler handler) + async_read_until(Seq const& buffers, Condition condition, Handler handler) { if (isSecure()) boost::asio::async_read_until( @@ -218,7 +218,7 @@ public: template void - async_write(const Buf& buffers, Handler handler) + async_write(Buf const& buffers, Handler handler) { if (isSecure()) boost::asio::async_write(*mSocket, buffers, handler); @@ -240,7 +240,7 @@ public: template void - async_read(const Buf& buffers, Condition cond, Handler handler) + async_read(Buf const& buffers, Condition cond, Handler handler) { if (isSecure()) boost::asio::async_read(*mSocket, buffers, cond, handler); @@ -263,7 +263,7 @@ public: template void - async_read(const Buf& buffers, Handler handler) + async_read(Buf const& buffers, Handler handler) { if (isSecure()) boost::asio::async_read(*mSocket, buffers, handler); @@ -273,7 +273,7 @@ public: template void - async_write_some(const Seq& buffers, Handler handler) + async_write_some(Seq const& buffers, Handler handler) { if (isSecure()) mSocket->async_write_some(buffers, handler); @@ -285,7 +285,7 @@ protected: void handle_autodetect( callback cbFunc, - const error_code& ec, + error_code const& ec, size_t bytesTransferred) { using namespace ripple; diff --git a/src/xrpld/net/HTTPClient.h b/src/xrpld/net/HTTPClient.h index 2a33500aa4..a11b885290 100644 --- a/src/xrpld/net/HTTPClient.h +++ b/src/xrpld/net/HTTPClient.h @@ -50,12 +50,12 @@ public: get(bool bSSL, boost::asio::io_service& io_service, std::deque deqSites, - const unsigned short port, + unsigned short const port, std::string const& strPath, std::size_t responseMax, // if no Content-Length header std::chrono::seconds timeout, std::function complete, beast::Journal& j); @@ -64,12 +64,12 @@ public: get(bool bSSL, boost::asio::io_service& io_service, std::string strSite, - const unsigned short port, + unsigned short const port, std::string const& strPath, std::size_t responseMax, // if no Content-Length header std::chrono::seconds timeout, std::function complete, beast::Journal& j); @@ -79,13 +79,13 @@ public: bool bSSL, boost::asio::io_service& io_service, std::string strSite, - const unsigned short port, + unsigned short const port, std::function< void(boost::asio::streambuf& sb, std::string const& strHost)> build, std::size_t responseMax, // if no Content-Length header std::chrono::seconds timeout, std::function complete, beast::Journal& j); diff --git a/src/xrpld/net/HTTPClientSSLContext.h b/src/xrpld/net/HTTPClientSSLContext.h index 2da5ac38de..68f91b18b0 100644 --- a/src/xrpld/net/HTTPClientSSLContext.h +++ b/src/xrpld/net/HTTPClientSSLContext.h @@ -191,7 +191,7 @@ public: private: boost::asio::ssl::context ssl_context_; beast::Journal const j_; - const bool verify_; + bool const verify_; }; } // namespace ripple diff --git a/src/xrpld/net/InfoSub.h b/src/xrpld/net/InfoSub.h index c8762c31fd..bc6c6e781c 100644 --- a/src/xrpld/net/InfoSub.h +++ b/src/xrpld/net/InfoSub.h @@ -57,7 +57,7 @@ public: // aliases. using wptr = std::weak_ptr; - using ref = const std::shared_ptr&; + using ref = std::shared_ptr const&; using Consumer = Resource::Consumer; @@ -224,7 +224,7 @@ public: clearRequest(); void - setRequest(const std::shared_ptr& req); + setRequest(std::shared_ptr const& req); std::shared_ptr const& getRequest(); diff --git a/src/xrpld/net/RPCCall.h b/src/xrpld/net/RPCCall.h index 612d80c663..4c6d25ca57 100644 --- a/src/xrpld/net/RPCCall.h +++ b/src/xrpld/net/RPCCall.h @@ -46,20 +46,20 @@ namespace RPCCall { int fromCommandLine( Config const& config, - const std::vector& vCmd, + std::vector const& vCmd, Logs& logs); void fromNetwork( boost::asio::io_service& io_service, std::string const& strIp, - const std::uint16_t iPort, + std::uint16_t const iPort, std::string const& strUsername, std::string const& strPassword, std::string const& strPath, std::string const& strMethod, Json::Value const& jvParams, - const bool bSSL, + bool const bSSL, bool quiet, Logs& logs, std::function callbackFuncP = diff --git a/src/xrpld/net/detail/HTTPClient.cpp b/src/xrpld/net/detail/HTTPClient.cpp index 0ead4cf0dc..901237e1e3 100644 --- a/src/xrpld/net/detail/HTTPClient.cpp +++ b/src/xrpld/net/detail/HTTPClient.cpp @@ -53,7 +53,7 @@ class HTTPClientImp : public std::enable_shared_from_this, public: HTTPClientImp( boost::asio::io_service& io_service, - const unsigned short port, + unsigned short const port, std::size_t maxResponseSize, beast::Journal& j) : mSocket(io_service, httpClientSSLContext->context()) @@ -95,7 +95,7 @@ public: void(boost::asio::streambuf& sb, std::string const& strHost)> build, std::chrono::seconds timeout, std::function complete) { @@ -116,7 +116,7 @@ public: std::string const& strPath, std::chrono::seconds timeout, std::function complete) { @@ -179,7 +179,7 @@ public: } void - handleDeadline(const boost::system::error_code& ecResult) + handleDeadline(boost::system::error_code const& ecResult) { if (ecResult == boost::asio::error::operation_aborted) { @@ -218,7 +218,7 @@ public: } void - handleShutdown(const boost::system::error_code& ecResult) + handleShutdown(boost::system::error_code const& ecResult) { if (ecResult) { @@ -229,7 +229,7 @@ public: void handleResolve( - const boost::system::error_code& ecResult, + boost::system::error_code const& ecResult, boost::asio::ip::tcp::resolver::iterator itrEndpoint) { if (!mShutdown) @@ -261,7 +261,7 @@ public: } void - handleConnect(const boost::system::error_code& ecResult) + handleConnect(boost::system::error_code const& ecResult) { if (!mShutdown) mShutdown = ecResult; @@ -305,7 +305,7 @@ public: } void - handleRequest(const boost::system::error_code& ecResult) + handleRequest(boost::system::error_code const& ecResult) { if (!mShutdown) mShutdown = ecResult; @@ -334,7 +334,7 @@ public: void handleWrite( - const boost::system::error_code& ecResult, + boost::system::error_code const& ecResult, std::size_t bytes_transferred) { if (!mShutdown) @@ -363,7 +363,7 @@ public: void handleHeader( - const boost::system::error_code& ecResult, + boost::system::error_code const& ecResult, std::size_t bytes_transferred) { std::string strHeader{ @@ -435,7 +435,7 @@ public: void handleData( - const boost::system::error_code& ecResult, + boost::system::error_code const& ecResult, std::size_t bytes_transferred) { if (!mShutdown) @@ -467,7 +467,7 @@ public: // Call cancel the deadline timer and invoke the completion routine. void invokeComplete( - const boost::system::error_code& ecResult, + boost::system::error_code const& ecResult, int iStatus = 0, std::string const& strData = "") { @@ -517,13 +517,13 @@ private: boost::asio::streambuf mHeader; boost::asio::streambuf mResponse; std::string mBody; - const unsigned short mPort; + unsigned short const mPort; std::size_t const maxResponseSize_; int mStatus; std::function mBuild; std::function mComplete; @@ -545,12 +545,12 @@ HTTPClient::get( bool bSSL, boost::asio::io_service& io_service, std::deque deqSites, - const unsigned short port, + unsigned short const port, std::string const& strPath, std::size_t responseMax, std::chrono::seconds timeout, std::function complete, beast::Journal& j) @@ -565,12 +565,12 @@ HTTPClient::get( bool bSSL, boost::asio::io_service& io_service, std::string strSite, - const unsigned short port, + unsigned short const port, std::string const& strPath, std::size_t responseMax, std::chrono::seconds timeout, std::function complete, beast::Journal& j) @@ -587,13 +587,13 @@ HTTPClient::request( bool bSSL, boost::asio::io_service& io_service, std::string strSite, - const unsigned short port, + unsigned short const port, std::function setRequest, std::size_t responseMax, std::chrono::seconds timeout, std::function complete, beast::Journal& j) diff --git a/src/xrpld/net/detail/InfoSub.cpp b/src/xrpld/net/detail/InfoSub.cpp index 7acd7f07a7..9f394cf08e 100644 --- a/src/xrpld/net/detail/InfoSub.cpp +++ b/src/xrpld/net/detail/InfoSub.cpp @@ -124,12 +124,12 @@ InfoSub::clearRequest() } void -InfoSub::setRequest(const std::shared_ptr& req) +InfoSub::setRequest(std::shared_ptr const& req) { request_ = req; } -const std::shared_ptr& +std::shared_ptr const& InfoSub::getRequest() { return request_; diff --git a/src/xrpld/net/detail/RPCCall.cpp b/src/xrpld/net/detail/RPCCall.cpp index 92f48f8812..dd1208aa24 100644 --- a/src/xrpld/net/detail/RPCCall.cpp +++ b/src/xrpld/net/detail/RPCCall.cpp @@ -1041,7 +1041,7 @@ private: if (jvParams.size() >= 3) { - const auto offset = jvParams.size() == 3 ? 0 : 1; + auto const offset = jvParams.size() == 3 ? 0 : 1; jvRequest[jss::min_ledger] = jvParams[1u + offset].asString(); jvRequest[jss::max_ledger] = jvParams[2u + offset].asString(); @@ -1105,7 +1105,7 @@ private: parseGatewayBalances(Json::Value const& jvParams) { unsigned int index = 0; - const unsigned int size = jvParams.size(); + unsigned int const size = jvParams.size(); Json::Value jvRequest{Json::objectValue}; @@ -1189,7 +1189,7 @@ public: struct Command { - const char* name; + char const* name; parseFuncPtr parse; int minParams; int maxParams; @@ -1351,7 +1351,7 @@ struct RPCCallImp static bool onResponse( std::function callbackFuncP, - const boost::system::error_code& ecResult, + boost::system::error_code const& ecResult, int iStatus, std::string const& strData, beast::Journal j) @@ -1614,7 +1614,7 @@ namespace RPCCall { int fromCommandLine( Config const& config, - const std::vector& vCmd, + std::vector const& vCmd, Logs& logs) { auto const result = @@ -1631,14 +1631,14 @@ void fromNetwork( boost::asio::io_service& io_service, std::string const& strIp, - const std::uint16_t iPort, + std::uint16_t const iPort, std::string const& strUsername, std::string const& strPassword, std::string const& strPath, std::string const& strMethod, Json::Value const& jvParams, - const bool bSSL, - const bool quiet, + bool const bSSL, + bool const quiet, Logs& logs, std::function callbackFuncP, std::unordered_map headers) diff --git a/src/xrpld/net/detail/RPCSub.cpp b/src/xrpld/net/detail/RPCSub.cpp index 994292e7b8..3f0c923e13 100644 --- a/src/xrpld/net/detail/RPCSub.cpp +++ b/src/xrpld/net/detail/RPCSub.cpp @@ -167,7 +167,7 @@ private: true, logs_); } - catch (const std::exception& e) + catch (std::exception const& e) { JLOG(j_.info()) << "RPCCall::fromNetwork exception: " << e.what(); diff --git a/src/xrpld/net/detail/RegisterSSLCerts.cpp b/src/xrpld/net/detail/RegisterSSLCerts.cpp index 0dbf036e01..5a710323ad 100644 --- a/src/xrpld/net/detail/RegisterSSLCerts.cpp +++ b/src/xrpld/net/detail/RegisterSSLCerts.cpp @@ -80,7 +80,7 @@ registerSSLCerts( while ((pContext = CertEnumCertificatesInStore(hStore.get(), pContext)) != NULL) { - const unsigned char* pbCertEncoded = pContext->pbCertEncoded; + unsigned char const* pbCertEncoded = pContext->pbCertEncoded; std::unique_ptr x509{ d2i_X509(NULL, &pbCertEncoded, pContext->cbCertEncoded), X509_free}; if (!x509) diff --git a/src/xrpld/nodestore/detail/DummyScheduler.cpp b/src/xrpld/nodestore/detail/DummyScheduler.cpp index 76cd89610c..9df1374189 100644 --- a/src/xrpld/nodestore/detail/DummyScheduler.cpp +++ b/src/xrpld/nodestore/detail/DummyScheduler.cpp @@ -30,12 +30,12 @@ DummyScheduler::scheduleTask(Task& task) } void -DummyScheduler::onFetch(const FetchReport& report) +DummyScheduler::onFetch(FetchReport const& report) { } void -DummyScheduler::onBatchWrite(const BatchWriteReport& report) +DummyScheduler::onBatchWrite(BatchWriteReport const& report) { } diff --git a/src/xrpld/overlay/PeerSet.h b/src/xrpld/overlay/PeerSet.h index 6fb4b65643..4ee6b8d7c0 100644 --- a/src/xrpld/overlay/PeerSet.h +++ b/src/xrpld/overlay/PeerSet.h @@ -68,7 +68,7 @@ public: std::shared_ptr const& peer) = 0; /** get the set of ids of previously added peers */ - virtual const std::set& + virtual std::set const& getPeerIds() const = 0; }; diff --git a/src/xrpld/overlay/Slot.h b/src/xrpld/overlay/Slot.h index b2db772f5b..6ae3c9a142 100644 --- a/src/xrpld/overlay/Slot.h +++ b/src/xrpld/overlay/Slot.h @@ -157,7 +157,7 @@ private: deletePeer(PublicKey const& validator, id_t id, bool erase); /** Get the time of the last peer selection round */ - const time_point& + time_point const& getLastSelected() const { return lastSelected_; diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 372ad9de53..bca2cfd8c7 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -130,7 +130,7 @@ PeerImp::PeerImp( PeerImp::~PeerImp() { - const bool inCluster{cluster()}; + bool const inCluster{cluster()}; overlay_.deletePeer(id_); overlay_.onPeerDeactivate(id_); @@ -1270,8 +1270,8 @@ PeerImp::handleTransaction( { // If we've never been in synch, there's nothing we can do // with a transaction - JLOG(p_journal_.debug()) - << "Ignoring incoming transaction: " << "Need network ledger"; + JLOG(p_journal_.debug()) << "Ignoring incoming transaction: " + << "Need network ledger"; return; } @@ -2536,7 +2536,7 @@ PeerImp::onMessage(std::shared_ptr const& m) for (int i = 0; i < packet.objects_size(); ++i) { - const protocol::TMIndexedObject& obj = packet.objects(i); + protocol::TMIndexedObject const& obj = packet.objects(i); if (obj.has_hash() && stringIsUint256Sized(obj.hash())) { @@ -2740,7 +2740,7 @@ PeerImp::addLedger( } void -PeerImp::doFetchPack(const std::shared_ptr& packet) +PeerImp::doFetchPack(std::shared_ptr const& packet) { // VFALCO TODO Invert this dependency using an observer and shared state // object. Don't queue fetch pack jobs if we're under load or we already @@ -3441,19 +3441,19 @@ PeerImp::getScore(bool haveItem) const { // Random component of score, used to break ties and avoid // overloading the "best" peer - static const int spRandomMax = 9999; + static int const spRandomMax = 9999; // Score for being very likely to have the thing we are // look for; should be roughly spRandomMax - static const int spHaveItem = 10000; + static int const spHaveItem = 10000; // Score reduction for each millisecond of latency; should // be roughly spRandomMax divided by the maximum reasonable // latency - static const int spLatency = 30; + static int const spLatency = 30; // Penalty for unknown latency; should be roughly spRandomMax - static const int spNoLatency = 8000; + static int const spNoLatency = 8000; int score = rand_int(spRandomMax); diff --git a/src/xrpld/overlay/detail/PeerImp.h b/src/xrpld/overlay/detail/PeerImp.h index 9835f4c6f4..8fbafa1ee9 100644 --- a/src/xrpld/overlay/detail/PeerImp.h +++ b/src/xrpld/overlay/detail/PeerImp.h @@ -602,7 +602,7 @@ private: std::lock_guard const& lockedRecentLock); void - doFetchPack(const std::shared_ptr& packet); + doFetchPack(std::shared_ptr const& packet); void onValidatorListMessage( diff --git a/src/xrpld/overlay/detail/PeerSet.cpp b/src/xrpld/overlay/detail/PeerSet.cpp index 909b20c307..611728839c 100644 --- a/src/xrpld/overlay/detail/PeerSet.cpp +++ b/src/xrpld/overlay/detail/PeerSet.cpp @@ -42,7 +42,7 @@ public: protocol::MessageType type, std::shared_ptr const& peer) override; - const std::set& + std::set const& getPeerIds() const override; private: @@ -117,7 +117,7 @@ PeerSetImpl::sendRequest( } } -const std::set& +std::set const& PeerSetImpl::getPeerIds() const { return peers_; @@ -171,7 +171,7 @@ public: JLOG(j_.error()) << "DummyPeerSet sendRequest should not be called"; } - const std::set& + std::set const& getPeerIds() const override { static std::set emptyPeers; diff --git a/src/xrpld/overlay/detail/TrafficCount.h b/src/xrpld/overlay/detail/TrafficCount.h index 9d1cce503b..e93163683b 100644 --- a/src/xrpld/overlay/detail/TrafficCount.h +++ b/src/xrpld/overlay/detail/TrafficCount.h @@ -246,7 +246,7 @@ public: static std::string to_string(category cat) { - static const std::unordered_map category_map = { + static std::unordered_map const category_map = { {base, "overhead"}, {cluster, "overhead_cluster"}, {overlay, "overhead_overlay"}, diff --git a/src/xrpld/overlay/detail/ZeroCopyStream.h b/src/xrpld/overlay/detail/ZeroCopyStream.h index 41d94578b0..87a5e10bc2 100644 --- a/src/xrpld/overlay/detail/ZeroCopyStream.h +++ b/src/xrpld/overlay/detail/ZeroCopyStream.h @@ -49,7 +49,7 @@ public: explicit ZeroCopyInputStream(Buffers const& buffers); bool - Next(const void** data, int* size) override; + Next(void const** data, int* size) override; void BackUp(int count) override; @@ -76,7 +76,7 @@ ZeroCopyInputStream::ZeroCopyInputStream(Buffers const& buffers) template bool -ZeroCopyInputStream::Next(const void** data, int* size) +ZeroCopyInputStream::Next(void const** data, int* size) { *data = boost::asio::buffer_cast(pos_); *size = boost::asio::buffer_size(pos_); diff --git a/src/xrpld/peerfinder/detail/Logic.h b/src/xrpld/peerfinder/detail/Logic.h index b3922f63b3..e23bbc29e1 100644 --- a/src/xrpld/peerfinder/detail/Logic.h +++ b/src/xrpld/peerfinder/detail/Logic.h @@ -1132,9 +1132,9 @@ public: } else { - JLOG(m_journal.error()) - << beast::leftw(18) << "Logic failed " << "'" << source->name() - << "' fetch, " << results.error.message(); + JLOG(m_journal.error()) << beast::leftw(18) << "Logic failed " + << "'" << source->name() << "' fetch, " + << results.error.message(); } } diff --git a/src/xrpld/perflog/PerfLog.h b/src/xrpld/perflog/PerfLog.h index 58df185e09..5212752ec7 100644 --- a/src/xrpld/perflog/PerfLog.h +++ b/src/xrpld/perflog/PerfLog.h @@ -186,9 +186,9 @@ template auto measureDurationAndLog( Func&& func, - const std::string& actionDescription, + std::string const& actionDescription, std::chrono::duration maxDelay, - const beast::Journal& journal) + beast::Journal const& journal) { auto start_time = std::chrono::high_resolution_clock::now(); diff --git a/src/xrpld/rpc/CTID.h b/src/xrpld/rpc/CTID.h index 042b79b527..be531c536a 100644 --- a/src/xrpld/rpc/CTID.h +++ b/src/xrpld/rpc/CTID.h @@ -57,12 +57,12 @@ encodeCTID(uint32_t ledgerSeq, uint32_t txnIndex, uint32_t networkID) noexcept template inline std::optional> -decodeCTID(const T ctid) noexcept +decodeCTID(T const ctid) noexcept { uint64_t ctidValue{0}; if constexpr ( std::is_same_v || std::is_same_v || - std::is_same_v || std::is_same_v) + std::is_same_v || std::is_same_v) { std::string const ctidString(ctid); diff --git a/src/xrpld/rpc/detail/Handler.cpp b/src/xrpld/rpc/detail/Handler.cpp index abdfa921bb..dd670529a5 100644 --- a/src/xrpld/rpc/detail/Handler.cpp +++ b/src/xrpld/rpc/detail/Handler.cpp @@ -224,7 +224,7 @@ private: } template - explicit HandlerTable(const Handler (&entries)[N]) + explicit HandlerTable(Handler const (&entries)[N]) { for (auto const& entry : entries) { diff --git a/src/xrpld/rpc/detail/Handler.h b/src/xrpld/rpc/detail/Handler.h index e0fb66f6fd..8c263a90ab 100644 --- a/src/xrpld/rpc/detail/Handler.h +++ b/src/xrpld/rpc/detail/Handler.h @@ -47,7 +47,7 @@ struct Handler template using Method = std::function; - const char* name_; + char const* name_; Method valueMethod_; Role role_; RPC::Condition condition_; diff --git a/src/xrpld/rpc/detail/RPCHelpers.cpp b/src/xrpld/rpc/detail/RPCHelpers.cpp index 3449a744d6..347a984d15 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCHelpers.cpp @@ -962,7 +962,7 @@ chooseLedgerEntryType(Json::Value const& params) // against the canonical name (case-insensitive) or the RPC name // (case-sensitive). auto const filter = p.asString(); - const auto iter = + auto const iter = std::ranges::find_if(types, [&filter](decltype(types.front())& t) { return boost::iequals(std::get<0>(t), filter) || std::get<1>(t) == filter; diff --git a/src/xrpld/rpc/detail/RPCHelpers.h b/src/xrpld/rpc/detail/RPCHelpers.h index 89af005292..31b9761058 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.h +++ b/src/xrpld/rpc/detail/RPCHelpers.h @@ -257,7 +257,7 @@ isAccountObjectsValidType(LedgerEntryType const& type); * @return the api version number */ unsigned int -getAPIVersionNumber(const Json::Value& value, bool betaEnabled); +getAPIVersionNumber(Json::Value const& value, bool betaEnabled); /** Return a ledger based on ledger_hash or ledger_index, or an RPC error */ diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index a5aca59657..0c84e59413 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -1027,7 +1027,7 @@ ServerHandler::processRequest( if (auto stream = m_journal.debug()) { - static const int maxSize = 10000; + static int const maxSize = 10000; if (response.size() <= maxSize) stream << "Reply: " << response; else diff --git a/src/xrpld/rpc/detail/TransactionSign.cpp b/src/xrpld/rpc/detail/TransactionSign.cpp index 3f388e636f..9387aba505 100644 --- a/src/xrpld/rpc/detail/TransactionSign.cpp +++ b/src/xrpld/rpc/detail/TransactionSign.cpp @@ -746,8 +746,7 @@ transactionFormatResultImpl(Transaction::pointer tpTrans, unsigned apiVersion) //------------------------------------------------------------------------------ -[[nodiscard]] -static XRPAmount +[[nodiscard]] static XRPAmount getTxFee(Application const& app, Config const& config, Json::Value tx) { // autofilling only needed in this function so that the `STParsedJSONObject` @@ -945,7 +944,7 @@ transactionSign( if (!preprocResult.second) return preprocResult.first; - std::shared_ptr ledger = app.openLedger().current(); + std::shared_ptr ledger = app.openLedger().current(); // Make sure the STTx makes a legitimate Transaction. std::pair txn = transactionConstructImpl(preprocResult.second, ledger->rules(), app); @@ -1101,7 +1100,7 @@ transactionSignFor( JLOG(j.debug()) << "transactionSignFor: " << jvRequest; // Verify presence of the signer's account field. - const char accountField[] = "account"; + char const accountField[] = "account"; if (!jvRequest.isMember(accountField)) return RPC::missing_field_error(accountField); diff --git a/src/xrpld/rpc/handlers/GetAggregatePrice.cpp b/src/xrpld/rpc/handlers/GetAggregatePrice.cpp index 8001071f85..33a88ba78f 100644 --- a/src/xrpld/rpc/handlers/GetAggregatePrice.cpp +++ b/src/xrpld/rpc/handlers/GetAggregatePrice.cpp @@ -108,8 +108,8 @@ iteratePriceData( return; oracle = isNew - ? &static_cast(node.peekAtField(sfNewFields)) - : &static_cast( + ? &static_cast(node.peekAtField(sfNewFields)) + : &static_cast( node.peekAtField(sfFinalFields)); break; } diff --git a/src/xrpld/rpc/handlers/GetCounts.cpp b/src/xrpld/rpc/handlers/GetCounts.cpp index 9f57f08a24..3c1d8cccdd 100644 --- a/src/xrpld/rpc/handlers/GetCounts.cpp +++ b/src/xrpld/rpc/handlers/GetCounts.cpp @@ -37,7 +37,7 @@ static void textTime( std::string& text, UptimeClock::time_point& seconds, - const char* unitName, + char const* unitName, std::chrono::seconds unitVal) { auto i = seconds.time_since_epoch() / unitVal; diff --git a/src/xrpld/rpc/handlers/LedgerEntry.cpp b/src/xrpld/rpc/handlers/LedgerEntry.cpp index ade9b9578b..d2f188aef3 100644 --- a/src/xrpld/rpc/handlers/LedgerEntry.cpp +++ b/src/xrpld/rpc/handlers/LedgerEntry.cpp @@ -959,7 +959,7 @@ doLedgerEntry(RPC::JsonContext& context) try { bool found = false; - for (const auto& ledgerEntry : ledgerEntryParsers) + for (auto const& ledgerEntry : ledgerEntryParsers) { if (context.params.isMember(ledgerEntry.fieldName)) { diff --git a/src/xrpld/rpc/handlers/ServerInfo.cpp b/src/xrpld/rpc/handlers/ServerInfo.cpp index b303402e2d..eac7f2021f 100644 --- a/src/xrpld/rpc/handlers/ServerInfo.cpp +++ b/src/xrpld/rpc/handlers/ServerInfo.cpp @@ -287,7 +287,7 @@ ServerDefinitions::ServerDefinitions() : defs_{Json::objectValue} // generate hash { - const std::string out = Json::FastWriter().write(defs_); + std::string const out = Json::FastWriter().write(defs_); defsHash_ = ripple::sha512Half(ripple::Slice{out.data(), out.size()}); defs_[jss::hash] = to_string(defsHash_); } @@ -308,7 +308,7 @@ doServerDefinitions(RPC::JsonContext& context) return RPC::invalid_field_error(jss::hash); } - static const detail::ServerDefinitions defs{}; + static detail::ServerDefinitions const defs{}; if (defs.hashMatches(hash)) { Json::Value jv = Json::objectValue; diff --git a/src/xrpld/rpc/handlers/Simulate.cpp b/src/xrpld/rpc/handlers/Simulate.cpp index 3c7340ece3..5f69c203ff 100644 --- a/src/xrpld/rpc/handlers/Simulate.cpp +++ b/src/xrpld/rpc/handlers/Simulate.cpp @@ -233,7 +233,7 @@ simulateTxn(RPC::JsonContext& context, std::shared_ptr transaction) jvResult[jss::applied] = result.applied; jvResult[jss::ledger_index] = view.seq(); - const bool isBinaryOutput = context.params.get(jss::binary, false).asBool(); + bool const isBinaryOutput = context.params.get(jss::binary, false).asBool(); // Convert the TER to human-readable values std::string token; diff --git a/src/xrpld/rpc/handlers/Subscribe.cpp b/src/xrpld/rpc/handlers/Subscribe.cpp index 35b82edb3f..deac6e18ad 100644 --- a/src/xrpld/rpc/handlers/Subscribe.cpp +++ b/src/xrpld/rpc/handlers/Subscribe.cpp @@ -330,7 +330,7 @@ doSubscribe(RPC::JsonContext& context) context.app.getLedgerMaster().getPublishedLedger(); if (lpLedger) { - const Json::Value jvMarker = Json::Value(Json::nullValue); + Json::Value const jvMarker = Json::Value(Json::nullValue); Json::Value jvOffers(Json::objectValue); auto add = [&](Json::StaticString field) { diff --git a/src/xrpld/shamap/SHAMap.h b/src/xrpld/shamap/SHAMap.h index 5771f3ec1d..33c42c2d23 100644 --- a/src/xrpld/shamap/SHAMap.h +++ b/src/xrpld/shamap/SHAMap.h @@ -513,9 +513,9 @@ private: struct MissingNodes { MissingNodes() = delete; - MissingNodes(const MissingNodes&) = delete; + MissingNodes(MissingNodes const&) = delete; MissingNodes& - operator=(const MissingNodes&) = delete; + operator=(MissingNodes const&) = delete; // basic parameters int max_; diff --git a/src/xrpld/shamap/SHAMapLeafNode.h b/src/xrpld/shamap/SHAMapLeafNode.h index c0f9422a38..383da38fd4 100644 --- a/src/xrpld/shamap/SHAMapLeafNode.h +++ b/src/xrpld/shamap/SHAMapLeafNode.h @@ -42,9 +42,9 @@ protected: SHAMapHash const& hash); public: - SHAMapLeafNode(const SHAMapLeafNode&) = delete; + SHAMapLeafNode(SHAMapLeafNode const&) = delete; SHAMapLeafNode& - operator=(const SHAMapLeafNode&) = delete; + operator=(SHAMapLeafNode const&) = delete; bool isLeaf() const final override diff --git a/src/xrpld/shamap/detail/SHAMap.cpp b/src/xrpld/shamap/detail/SHAMap.cpp index ab511f343f..d2415a2ff2 100644 --- a/src/xrpld/shamap/detail/SHAMap.cpp +++ b/src/xrpld/shamap/detail/SHAMap.cpp @@ -521,7 +521,7 @@ SHAMap::firstBelow( return belowHelper(node, stack, branch, {init, cmp, incr}); } -static const boost::intrusive_ptr no_item; +static boost::intrusive_ptr const no_item; boost::intrusive_ptr const& SHAMap::onlyBelow(SHAMapTreeNode* node) const @@ -757,7 +757,7 @@ SHAMap::delItem(uint256 const& id) { // we may have made this a node with 1 or 0 children // And, if so, we need to remove this branch - const int bc = node->getBranchCount(); + int const bc = node->getBranchCount(); if (bc == 0) { // no children below this branch diff --git a/src/xrpld/shamap/detail/SHAMapInnerNode.cpp b/src/xrpld/shamap/detail/SHAMapInnerNode.cpp index 8ec581b475..6e9d447cf6 100644 --- a/src/xrpld/shamap/detail/SHAMapInnerNode.cpp +++ b/src/xrpld/shamap/detail/SHAMapInnerNode.cpp @@ -266,7 +266,7 @@ SHAMapInnerNode::serializeWithPrefix(Serializer& s) const } std::string -SHAMapInnerNode::getString(const SHAMapNodeID& id) const +SHAMapInnerNode::getString(SHAMapNodeID const& id) const { std::string ret = SHAMapTreeNode::getString(id); auto hashes = hashesAndChildren_.getHashes(); diff --git a/src/xrpld/shamap/detail/SHAMapLeafNode.cpp b/src/xrpld/shamap/detail/SHAMapLeafNode.cpp index cdf0f80a84..10d61ff138 100644 --- a/src/xrpld/shamap/detail/SHAMapLeafNode.cpp +++ b/src/xrpld/shamap/detail/SHAMapLeafNode.cpp @@ -65,7 +65,7 @@ SHAMapLeafNode::setItem(boost::intrusive_ptr item) } std::string -SHAMapLeafNode::getString(const SHAMapNodeID& id) const +SHAMapLeafNode::getString(SHAMapNodeID const& id) const { std::string ret = SHAMapTreeNode::getString(id); diff --git a/src/xrpld/shamap/detail/SHAMapSync.cpp b/src/xrpld/shamap/detail/SHAMapSync.cpp index d43b1ff024..176c9f2a3a 100644 --- a/src/xrpld/shamap/detail/SHAMapSync.cpp +++ b/src/xrpld/shamap/detail/SHAMapSync.cpp @@ -577,7 +577,7 @@ SHAMap::addRootNode( SHAMapAddNode SHAMap::addKnownNode( - const SHAMapNodeID& node, + SHAMapNodeID const& node, Slice const& rawNode, SHAMapSyncFilter* filter) { diff --git a/src/xrpld/shamap/detail/SHAMapTreeNode.cpp b/src/xrpld/shamap/detail/SHAMapTreeNode.cpp index 6acf3f3bfc..d1e74fd6a7 100644 --- a/src/xrpld/shamap/detail/SHAMapTreeNode.cpp +++ b/src/xrpld/shamap/detail/SHAMapTreeNode.cpp @@ -179,7 +179,7 @@ SHAMapTreeNode::makeFromPrefix(Slice rawNode, SHAMapHash const& hash) } std::string -SHAMapTreeNode::getString(const SHAMapNodeID& id) const +SHAMapTreeNode::getString(SHAMapNodeID const& id) const { return to_string(id); }