diff --git a/reverse_migrate.py b/reverse_migrate.py new file mode 100644 index 000000000..598ba16d8 --- /dev/null +++ b/reverse_migrate.py @@ -0,0 +1,53 @@ +import os + +def replace_in_file(file_path): + """Replace occurrences of 'from xrpl' with 'from xahau' in the given file.""" + try: + with open(file_path, "r") as file: + content = file.read() + + # Replace the text + new_content = ( + content.replace("xrpld/app/", "ripple/app/") + .replace("xrpld/core/", "ripple/core/") + .replace("xrpld/nodestore/", "ripple/nodestore/") + .replace("xrpl/basics/", "ripple/basics/") + .replace("xrpl/protocol/", "ripple/protocol/") + .replace("xrpl/json/", "ripple/json/") + .replace("xrpld/overlay/", "ripple/overlay/") + .replace("xrpl/resource/", "ripple/resource/") + .replace("xrpl/crypto/", "ripple/crypto/") + .replace("xrpl/beast/", "ripple/beast/") + .replace("xrpld/shamap/", "ripple/shamap/") + .replace("xrpld/rpc/", "ripple/rpc/") + .replace("xrpld/perflog/", "ripple/perflog/") + .replace("xrpld/nodestore/detail/", "ripple/nodestore/impl/") + .replace("xrpld/ledger/", "ripple/ledger/") + .replace("xrpld/app/misc/detail/AccountTxPaging.h", "ripple/app/misc/impl/AccountTxPaging.h") + .replace("xrpld/perflog/PerfLog.h", "ripple/basics/PerfLog.h") + .replace("xrpld/rpc/detail/RPCHelpers.h", "ripple/rpc/impl/RPCHelpers.h") + .replace("xrpld/protocol/RPCErr.h", "ripple/net/RPCErr.h") + ) + + # Write the changes back to the file + with open(file_path, "w") as file: + file.write(new_content) + print(f"Updated: {file_path}") + + except Exception as e: + print(f"Error processing file {file_path}: {e}") + + +def search_and_replace_in_folders(folder_paths): + """Search for Python files in the given list of folders and replace text.""" + for folder_path in folder_paths: + for root, dirs, files in os.walk(folder_path): + for file in files: + if file.endswith(".cpp") or file.endswith(".h"): + file_path = os.path.join(root, file) + replace_in_file(file_path) + + +if __name__ == "__main__": + folder_list = ["src/ripple", "src/test"] + search_and_replace_in_folders(folder_list) \ No newline at end of file diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index a6f800f22..7c90d4879 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -47,30 +47,34 @@ #include #include #include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include #include #include #include #include #include #include +#include #include #include +#include +#include +#include +#include +#include #include #include #include #include #include +#include +#include +#include +#include #include #include diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index d7c0767d0..6cd348e1f 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -29,7 +30,7 @@ #include #include #include -#include +// #include #include #include #include @@ -37,35 +38,40 @@ #include #include #include -#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include #include #include #include #include +#include +#include #include #include #include +#include +#include +#include #include #include -#include -#include +#include +#include +#include +// #include +#include +#include +#include +#include #include #include #include #include +#include +#include #include #include diff --git a/src/ripple/basics/TaggedCache.ipp b/src/ripple/basics/TaggedCache.ipp index ebf70f9af..26c8d2f11 100644 --- a/src/ripple/basics/TaggedCache.ipp +++ b/src/ripple/basics/TaggedCache.ipp @@ -20,7 +20,7 @@ #ifndef RIPPLE_BASICS_TAGGEDCACHE_IPP_INCLUDED #define RIPPLE_BASICS_TAGGEDCACHE_IPP_INCLUDED -#include +#include namespace ripple { diff --git a/src/ripple/beast/container/detail/aged_ordered_container.h b/src/ripple/beast/container/detail/aged_ordered_container.h index 23534a26b..10dca962b 100644 --- a/src/ripple/beast/container/detail/aged_ordered_container.h +++ b/src/ripple/beast/container/detail/aged_ordered_container.h @@ -145,111 +145,78 @@ private: }; // VFALCO TODO This should only be enabled for maps. - class pair_value_compare - : public beast::detail::empty_base_optimization -#ifdef _LIBCPP_VERSION - , - public std::binary_function -#endif + class pair_value_compare : public Compare { public: -#ifndef _LIBCPP_VERSION using first_argument = value_type; using second_argument = value_type; using result_type = bool; -#endif bool operator()(value_type const& lhs, value_type const& rhs) const { - return this->member()(lhs.first, rhs.first); + return Compare::operator()(lhs.first, rhs.first); } pair_value_compare() { } - pair_value_compare(pair_value_compare const& other) - : beast::detail::empty_base_optimization(other) + pair_value_compare(pair_value_compare const& other) : Compare(other) { } private: friend aged_ordered_container; - pair_value_compare(Compare const& compare) - : beast::detail::empty_base_optimization(compare) + pair_value_compare(Compare const& compare) : Compare(compare) { } }; // Compares value_type against element, used in insert_check // VFALCO TODO hoist to remove template argument dependencies - class KeyValueCompare - : public beast::detail::empty_base_optimization -#ifdef _LIBCPP_VERSION - , - public std::binary_function -#endif + class KeyValueCompare : public Compare { public: -#ifndef _LIBCPP_VERSION using first_argument = Key; using second_argument = element; using result_type = bool; -#endif KeyValueCompare() = default; - KeyValueCompare(Compare const& compare) - : beast::detail::empty_base_optimization(compare) + KeyValueCompare(Compare const& compare) : Compare(compare) { } - // VFALCO NOTE WE might want only to enable these overloads - // if Compare has is_transparent -#if 0 - template - bool operator() (K const& k, element const& e) const - { - return this->member() (k, extract (e.value)); - } - - template - bool operator() (element const& e, K const& k) const - { - return this->member() (extract (e.value), k); - } -#endif - bool operator()(Key const& k, element const& e) const { - return this->member()(k, extract(e.value)); + return Compare::operator()(k, extract(e.value)); } bool operator()(element const& e, Key const& k) const { - return this->member()(extract(e.value), k); + return Compare::operator()(extract(e.value), k); } bool operator()(element const& x, element const& y) const { - return this->member()(extract(x.value), extract(y.value)); + return Compare::operator()(extract(x.value), extract(y.value)); } Compare& compare() { - return beast::detail::empty_base_optimization::member(); + return *this; } Compare const& compare() const { - return beast::detail::empty_base_optimization::member(); + return *this; } }; diff --git a/src/ripple/beast/container/detail/aged_unordered_container.h b/src/ripple/beast/container/detail/aged_unordered_container.h index 920e6196b..fcdccd2a6 100644 --- a/src/ripple/beast/container/detail/aged_unordered_container.h +++ b/src/ripple/beast/container/detail/aged_unordered_container.h @@ -148,115 +148,84 @@ private: }; // VFALCO TODO hoist to remove template argument dependencies - class ValueHash : private beast::detail::empty_base_optimization -#ifdef _LIBCPP_VERSION - , - public std::unary_function -#endif + class ValueHash : public Hash { public: -#ifndef _LIBCPP_VERSION using argument_type = element; using result_type = size_t; -#endif ValueHash() { } - ValueHash(Hash const& h) - : beast::detail::empty_base_optimization(h) + ValueHash(Hash const& h) : Hash(h) { } std::size_t operator()(element const& e) const { - return this->member()(extract(e.value)); + return Hash::operator()(extract(e.value)); } Hash& hash_function() { - return this->member(); + return *this; } Hash const& hash_function() const { - return this->member(); + return *this; } }; // Compares value_type against element, used in find/insert_check // VFALCO TODO hoist to remove template argument dependencies - class KeyValueEqual - : private beast::detail::empty_base_optimization -#ifdef _LIBCPP_VERSION - , - public std::binary_function -#endif + class KeyValueEqual : public KeyEqual { public: -#ifndef _LIBCPP_VERSION using first_argument_type = Key; using second_argument_type = element; using result_type = bool; -#endif KeyValueEqual() { } - KeyValueEqual(KeyEqual const& keyEqual) - : beast::detail::empty_base_optimization(keyEqual) + KeyValueEqual(KeyEqual const& keyEqual) : KeyEqual(keyEqual) { } - // VFALCO NOTE WE might want only to enable these overloads - // if KeyEqual has is_transparent -#if 0 - template - bool operator() (K const& k, element const& e) const - { - return this->member() (k, extract (e.value)); - } - - template - bool operator() (element const& e, K const& k) const - { - return this->member() (extract (e.value), k); - } -#endif - bool operator()(Key const& k, element const& e) const { - return this->member()(k, extract(e.value)); + return KeyEqual::operator()(k, extract(e.value)); } bool operator()(element const& e, Key const& k) const { - return this->member()(extract(e.value), k); + return KeyEqual::operator()(extract(e.value), k); } bool operator()(element const& lhs, element const& rhs) const { - return this->member()(extract(lhs.value), extract(rhs.value)); + return KeyEqual::operator()(extract(lhs.value), extract(rhs.value)); } KeyEqual& key_eq() { - return this->member(); + return *this; } KeyEqual const& key_eq() const { - return this->member(); + return *this; } }; diff --git a/src/ripple/ledger/impl/CachedView.cpp b/src/ripple/ledger/impl/CachedView.cpp index 9c40560d9..dc3fedcc2 100644 --- a/src/ripple/ledger/impl/CachedView.cpp +++ b/src/ripple/ledger/impl/CachedView.cpp @@ -17,7 +17,7 @@ */ //============================================================================== -#include +#include #include #include #include diff --git a/src/ripple/nodestore/impl/DatabaseNodeImp.cpp b/src/ripple/nodestore/impl/DatabaseNodeImp.cpp index d964a6c85..12c3cfad6 100644 --- a/src/ripple/nodestore/impl/DatabaseNodeImp.cpp +++ b/src/ripple/nodestore/impl/DatabaseNodeImp.cpp @@ -17,7 +17,7 @@ */ //============================================================================== -#include +#include #include #include diff --git a/src/ripple/peerfinder/impl/Bootcache.h b/src/ripple/peerfinder/impl/Bootcache.h index eb6455879..b48f248ae 100644 --- a/src/ripple/peerfinder/impl/Bootcache.h +++ b/src/ripple/peerfinder/impl/Bootcache.h @@ -91,17 +91,10 @@ private: using value_type = map_type::value_type; struct Transform -#ifdef _LIBCPP_VERSION - : std::unary_function< - map_type::right_map::const_iterator::value_type const&, - beast::IP::Endpoint const&> -#endif { -#ifndef _LIBCPP_VERSION using first_argument_type = map_type::right_map::const_iterator::value_type const&; using result_type = beast::IP::Endpoint const&; -#endif explicit Transform() = default; diff --git a/src/ripple/peerfinder/impl/Livecache.h b/src/ripple/peerfinder/impl/Livecache.h index 12e2373fa..8ecd68e84 100644 --- a/src/ripple/peerfinder/impl/Livecache.h +++ b/src/ripple/peerfinder/impl/Livecache.h @@ -69,14 +69,9 @@ public: public: // Iterator transformation to extract the endpoint from Element struct Transform -#ifdef _LIBCPP_VERSION - : public std::unary_function -#endif { -#ifndef _LIBCPP_VERSION using first_argument = Element; using result_type = Endpoint; -#endif explicit Transform() = default; @@ -239,15 +234,9 @@ public: template struct Transform -#ifdef _LIBCPP_VERSION - : public std:: - unary_function> -#endif { -#ifndef _LIBCPP_VERSION using first_argument = typename lists_type::value_type; using result_type = Hop; -#endif explicit Transform() = default; diff --git a/src/ripple/rpc/handlers/GetCounts.cpp b/src/ripple/rpc/handlers/GetCounts.cpp index 0f034e282..07466a6b1 100644 --- a/src/ripple/rpc/handlers/GetCounts.cpp +++ b/src/ripple/rpc/handlers/GetCounts.cpp @@ -23,15 +23,16 @@ #include #include #include -#include -#include -#include #include #include #include +#include +#include +#include #include -#include #include +#include +#include namespace ripple { diff --git a/src/ripple/shamap/FullBelowCache.h b/src/ripple/shamap/FullBelowCache.h index 9622da448..0d276f2fe 100644 --- a/src/ripple/shamap/FullBelowCache.h +++ b/src/ripple/shamap/FullBelowCache.h @@ -21,6 +21,7 @@ #define RIPPLE_SHAMAP_FULLBELOWCACHE_H_INCLUDED #include +#include #include #include #include diff --git a/src/ripple/shamap/impl/SHAMapInnerNode.cpp b/src/ripple/shamap/impl/SHAMapInnerNode.cpp index 6ea6f47eb..1cac616b0 100644 --- a/src/ripple/shamap/impl/SHAMapInnerNode.cpp +++ b/src/ripple/shamap/impl/SHAMapInnerNode.cpp @@ -398,7 +398,7 @@ SHAMapInnerNode::canonicalizeChild( void SHAMapInnerNode::invariants(bool is_root) const { - unsigned count = 0; + [[maybe_unused]] unsigned count = 0; auto [numAllocated, hashes, children] = hashesAndChildren_.getHashesAndChildren(); diff --git a/src/test/basics/KeyCache_test.cpp b/src/test/basics/KeyCache_test.cpp index 599cba63c..b7cbe64d2 100644 --- a/src/test/basics/KeyCache_test.cpp +++ b/src/test/basics/KeyCache_test.cpp @@ -17,6 +17,7 @@ */ //============================================================================== +#include #include #include #include diff --git a/src/test/basics/TaggedCache_test.cpp b/src/test/basics/TaggedCache_test.cpp index 7abd9166b..840c591e7 100644 --- a/src/test/basics/TaggedCache_test.cpp +++ b/src/test/basics/TaggedCache_test.cpp @@ -17,6 +17,7 @@ */ //============================================================================== +#include #include #include #include