From badf9a302783d3acf9c0dbb56c60781ca4b2a4cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20D=C3=A9saulniers?= <sim.desaulniers@gmail.com> Date: Thu, 21 Apr 2016 13:42:08 -0400 Subject: [PATCH] replaced tabs with spaces in multiple files. --- CMakeLists.txt | 114 +++++++++++++++---------------- include/opendht/log.h | 84 +++++++++++------------ include/opendht/network_engine.h | 4 +- include/opendht/node.h | 10 +-- include/opendht/scheduler.h | 18 ++--- include/opendht/value.h | 8 +-- python/CMakeLists.txt | 4 +- tools/CMakeLists.txt | 2 +- 8 files changed, 122 insertions(+), 122 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c33631b..b1c2ad31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,94 +24,94 @@ set (CMAKE_CXX_FLAGS "-DMSGPACK_DISABLE_LEGACY_NIL -DMSGPACK_DISABLE_LEGACY_CONV find_package (GnuTLS 3.1 REQUIRED) find_package (Msgpack 1.2 REQUIRED) if (OPENDHT_TOOLS) - find_package (Readline 6 REQUIRED) + find_package (Readline 6 REQUIRED) endif () list (APPEND opendht_SOURCES - src/utils.cpp - src/infohash.cpp - src/crypto.cpp - src/default_types.cpp - src/node.cpp - src/value.cpp - src/dht.cpp - src/network_engine.cpp - src/securedht.cpp - src/dhtrunner.cpp - src/argon2/argon2.c - src/argon2/core.c - src/argon2/blake2/blake2b.c - src/argon2/thread.c - src/argon2/encoding.c - src/argon2/ref.c + src/utils.cpp + src/infohash.cpp + src/crypto.cpp + src/default_types.cpp + src/node.cpp + src/value.cpp + src/dht.cpp + src/network_engine.cpp + src/securedht.cpp + src/dhtrunner.cpp + src/argon2/argon2.c + src/argon2/core.c + src/argon2/blake2/blake2b.c + src/argon2/thread.c + src/argon2/encoding.c + src/argon2/ref.c ) list (APPEND opendht_HEADERS - include/opendht/utils.h - include/opendht/rng.h - include/opendht/crypto.h - include/opendht/infohash.h - include/opendht/default_types.h - include/opendht/node.h - include/opendht/value.h - include/opendht/dht.h - include/opendht/network_engine.h - include/opendht/scheduler.h - include/opendht/securedht.h - include/opendht/log.h - include/opendht.h + include/opendht/utils.h + include/opendht/rng.h + include/opendht/crypto.h + include/opendht/infohash.h + include/opendht/default_types.h + include/opendht/node.h + include/opendht/value.h + include/opendht/dht.h + include/opendht/network_engine.h + include/opendht/scheduler.h + include/opendht/securedht.h + include/opendht/log.h + include/opendht.h ) configure_file ( - opendht.pc.in - opendht.pc - @ONLY + opendht.pc.in + opendht.pc + @ONLY ) include_directories ( - ./ - include/ - include/opendht/ - ${CMAKE_CURRENT_BINARY_DIR}/include/ + ./ + include/ + include/opendht/ + ${CMAKE_CURRENT_BINARY_DIR}/include/ ) if (OPENDHT_DEBUG) - set(CMAKE_BUILD_TYPE Debug) + set(CMAKE_BUILD_TYPE Debug) else () - set(CMAKE_BUILD_TYPE Release) + set(CMAKE_BUILD_TYPE Release) endif () if (NOT DEFINED CMAKE_INSTALL_LIBDIR) - set(CMAKE_INSTALL_LIBDIR lib) + set(CMAKE_INSTALL_LIBDIR lib) endif () if (OPENDHT_STATIC) - add_library (opendht-static STATIC - ${opendht_SOURCES} - ${opendht_HEADERS} - ) - set_target_properties (opendht-static PROPERTIES OUTPUT_NAME "opendht") - target_link_libraries(opendht-static gnutls nettle) - install (TARGETS opendht-static DESTINATION ${CMAKE_INSTALL_LIBDIR}) + add_library (opendht-static STATIC + ${opendht_SOURCES} + ${opendht_HEADERS} + ) + set_target_properties (opendht-static PROPERTIES OUTPUT_NAME "opendht") + target_link_libraries(opendht-static gnutls nettle) + install (TARGETS opendht-static DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif () if (OPENDHT_SHARED) - add_library (opendht SHARED - ${opendht_SOURCES} - ${opendht_HEADERS} - ) - set_target_properties (opendht PROPERTIES IMPORT_SUFFIX "_import.lib") - #set_target_properties (opendht PROPERTIES SOVERSION 1 VERSION 1.0.0) - target_link_libraries(opendht gnutls nettle) - install (TARGETS opendht DESTINATION ${CMAKE_INSTALL_LIBDIR}) + add_library (opendht SHARED + ${opendht_SOURCES} + ${opendht_HEADERS} + ) + set_target_properties (opendht PROPERTIES IMPORT_SUFFIX "_import.lib") + #set_target_properties (opendht PROPERTIES SOVERSION 1 VERSION 1.0.0) + target_link_libraries(opendht gnutls nettle) + install (TARGETS opendht DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif () if (OPENDHT_TOOLS) - add_subdirectory(tools) + add_subdirectory(tools) endif () if (OPENDHT_PYTHON) - add_subdirectory(python) + add_subdirectory(python) endif () install (DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX}) diff --git a/include/opendht/log.h b/include/opendht/log.h index 0838ed6d..5a47e870 100644 --- a/include/opendht/log.h +++ b/include/opendht/log.h @@ -32,26 +32,26 @@ namespace log { * Terminal colors for logging */ namespace Color { - enum Code { - FG_RED = 31, - FG_GREEN = 32, - FG_YELLOW = 33, - FG_BLUE = 34, - FG_DEFAULT = 39, - BG_RED = 41, - BG_GREEN = 42, - BG_BLUE = 44, - BG_DEFAULT = 49 - }; - class Modifier { - const Code code; - public: - constexpr Modifier(Code pCode) : code(pCode) {} - friend std::ostream& - operator<<(std::ostream& os, const Modifier& mod) { - return os << "\033[" << mod.code << 'm'; - } - }; + enum Code { + FG_RED = 31, + FG_GREEN = 32, + FG_YELLOW = 33, + FG_BLUE = 34, + FG_DEFAULT = 39, + BG_RED = 41, + BG_GREEN = 42, + BG_BLUE = 44, + BG_DEFAULT = 49 + }; + class Modifier { + const Code code; + public: + constexpr Modifier(Code pCode) : code(pCode) {} + friend std::ostream& + operator<<(std::ostream& os, const Modifier& mod) { + return os << "\033[" << mod.code << 'm'; + } + }; } constexpr const Color::Modifier def(Color::FG_DEFAULT); @@ -63,44 +63,44 @@ constexpr const Color::Modifier yellow(Color::FG_YELLOW); */ void printLog(std::ostream& s, char const* m, va_list args) { - static constexpr int BUF_SZ = 8192; - char buffer[BUF_SZ]; - int ret = vsnprintf(buffer, sizeof(buffer), m, args); - if (ret < 0) - return; - s.write(buffer, std::min(ret, BUF_SZ)); - if (ret >= BUF_SZ) - s << "[[TRUNCATED]]"; - s.put('\n'); + static constexpr int BUF_SZ = 8192; + char buffer[BUF_SZ]; + int ret = vsnprintf(buffer, sizeof(buffer), m, args); + if (ret < 0) + return; + s.write(buffer, std::min(ret, BUF_SZ)); + if (ret >= BUF_SZ) + s << "[[TRUNCATED]]"; + s.put('\n'); } void enableLogging(dht::DhtRunner& dht) { - dht.setLoggers( - [](char const* m, va_list args){ std::cerr << red; printLog(std::cerr, m, args); std::cerr << def; }, - [](char const* m, va_list args){ std::cout << yellow; printLog(std::cout, m, args); std::cout << def; }, - [](char const* m, va_list args){ printLog(std::cout, m, args); } - ); + dht.setLoggers( + [](char const* m, va_list args){ std::cerr << red; printLog(std::cerr, m, args); std::cerr << def; }, + [](char const* m, va_list args){ std::cout << yellow; printLog(std::cout, m, args); std::cout << def; }, + [](char const* m, va_list args){ printLog(std::cout, m, args); } + ); } void enableFileLogging(dht::DhtRunner& dht, const std::string& path) { - auto logfile = std::make_shared<std::fstream>(); - logfile->open(path, std::ios::out); + auto logfile = std::make_shared<std::fstream>(); + logfile->open(path, std::ios::out); - dht.setLoggers( - [=](char const* m, va_list args){ printLog(*logfile, m, args); }, - [=](char const* m, va_list args){ printLog(*logfile, m, args); }, - [=](char const* m, va_list args){ printLog(*logfile, m, args); } - ); + dht.setLoggers( + [=](char const* m, va_list args){ printLog(*logfile, m, args); }, + [=](char const* m, va_list args){ printLog(*logfile, m, args); }, + [=](char const* m, va_list args){ printLog(*logfile, m, args); } + ); } void disableLogging(dht::DhtRunner& dht) { - dht.setLoggers(dht::NOLOG, dht::NOLOG, dht::NOLOG); + dht.setLoggers(dht::NOLOG, dht::NOLOG, dht::NOLOG); } } /* log */ diff --git a/include/opendht/network_engine.h b/include/opendht/network_engine.h index 5243ed7e..0448bfa5 100644 --- a/include/opendht/network_engine.h +++ b/include/opendht/network_engine.h @@ -446,7 +446,7 @@ private: bool rateLimit(); - void pinged(Node&); + void pinged(Node&); void requestStep(std::shared_ptr<Request> req) { if (req->completed or req->cancelled) @@ -464,7 +464,7 @@ private: send((char*)req->msg.data(), req->msg.size(), (req->node->reply_time >= now - UDP_REPLY_TIME) ? 0 : MSG_CONFIRM, (sockaddr*)&req->node->ss, req->node->sslen); - pinged(*req->node); + pinged(*req->node); ++req->attempt_count; req->last_try = now; std::weak_ptr<Request> wreq = req; diff --git a/include/opendht/node.h b/include/opendht/node.h index 7dea8344..d1a8ed46 100644 --- a/include/opendht/node.h +++ b/include/opendht/node.h @@ -35,7 +35,7 @@ struct NodeExport { }; struct Node { - friend class NetworkEngine; + friend class NetworkEngine; InfoHash id {}; sockaddr_storage ss; @@ -78,10 +78,10 @@ struct Node { Answer should be true if the message was an aswer to a request we made*/ void received(time_point now, bool answer); - /** - * Resets the state of the node so it's not expired anymore. - */ - void reset() { pinged = 0; } + /** + * Resets the state of the node so it's not expired anymore. + */ + void reset() { pinged = 0; } friend std::ostream& operator<< (std::ostream& s, const Node& h); diff --git a/include/opendht/scheduler.h b/include/opendht/scheduler.h index a79ad1e6..558e3c70 100644 --- a/include/opendht/scheduler.h +++ b/include/opendht/scheduler.h @@ -39,7 +39,7 @@ public: struct Job { bool done; bool cancelled; - time_point time; + time_point time; std::function<void()> do_; }; @@ -52,8 +52,8 @@ public: * @return pointer to the newly scheduled job. */ std::shared_ptr<Scheduler::Job> add(time_point time, std::function<void()> job_func) { - auto scheduled_time = std::max(time, now); /* This should prevent running an auto rescheduling job forever - before the Scheduler::run method ends. */ + auto scheduled_time = std::max(time, now); /* This should prevent running an auto rescheduling job forever + before the Scheduler::run method ends. */ auto job = std::make_shared<Job>(Job {false, false, scheduled_time, std::move(job_func)}); timers.emplace(std::move(scheduled_time), job); return job; @@ -83,12 +83,12 @@ public: syncTime(); while (not timers.empty()) { auto timer = timers.begin(); - /* - * Running jobs scheduled before "now" prevents run+rescheduling - * loops before this method ends. It is garanteed by the fact that a - * job will at least be scheduled for "now" and not before. - */ - if (not (timer->first < now)) + /* + * Running jobs scheduled before "now" prevents run+rescheduling + * loops before this method ends. It is garanteed by the fact that a + * job will at least be scheduled for "now" and not before. + */ + if (not (timer->first < now)) break; auto& job = timer->second; diff --git a/include/opendht/value.h b/include/opendht/value.h index 4d55984e..30ddf551 100644 --- a/include/opendht/value.h +++ b/include/opendht/value.h @@ -194,10 +194,10 @@ struct Value }; template <typename Derived, typename Base=SerializableBase> - class Serializable : public Base - { - public: - using Base::Base; + class Serializable : public Base + { + public: + using Base::Base; virtual const ValueType& getType() const { return Derived::TYPE; diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 80fe4b07..cd175475 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -5,7 +5,7 @@ set(CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) configure_file(setup.py.in setup.py) add_custom_target(python ALL - COMMAND python3 setup.py build - DEPENDS opendht opendht_cpp.pxd opendht.pyx) + COMMAND python3 setup.py build + DEPENDS opendht opendht_cpp.pxd opendht.pyx) install(CODE "execute_process(COMMAND python3 setup.py install WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})") diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 8cccce26..b4f21563 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -18,7 +18,7 @@ else () endif () if (NOT DEFINED CMAKE_INSTALL_BINDIR) - set(CMAKE_INSTALL_BINDIR bin) + set(CMAKE_INSTALL_BINDIR bin) endif () install (TARGETS dhtnode dhtscanner dhtchat RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -- GitLab