From c1410ef8a8547bd81f8ebb4b844ec0bd4c040068 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 8 Feb 2024 14:55:05 +0000 Subject: [PATCH] Fix formatting using clang-format Signed-off-by: Steffen Vogel --- include/villas/node.hpp | 4 ++-- include/villas/nodes/redis.hpp | 4 ++-- include/villas/nodes/redis_helpers.hpp | 13 ++++++++----- include/villas/nodes/rtp.hpp | 2 +- include/villas/nodes/webrtc/peer_connection.hpp | 2 +- include/villas/nodes/websocket.hpp | 4 ++-- include/villas/path.hpp | 7 +++---- include/villas/super_node.hpp | 4 +++- lib/api/response.cpp | 13 +++++++------ lib/hooks/lua.cpp | 2 +- lib/node_compat.cpp | 2 +- lib/nodes/opal.cpp | 2 +- lib/nodes/rtp.cpp | 4 ++-- lib/sample.cpp | 2 +- 14 files changed, 35 insertions(+), 30 deletions(-) diff --git a/include/villas/node.hpp b/include/villas/node.hpp index c920adc49..4c54eee06 100644 --- a/include/villas/node.hpp +++ b/include/villas/node.hpp @@ -7,9 +7,9 @@ #pragma once +#include #include #include -#include #include #include #include @@ -266,7 +266,7 @@ public: return os; } - json_t *toJson() const; + virtual json_t *toJson() const; static bool isValidName(const std::string &name); diff --git a/include/villas/nodes/redis.hpp b/include/villas/nodes/redis.hpp index 33710dcab..b88872a5d 100644 --- a/include/villas/nodes/redis.hpp +++ b/include/villas/nodes/redis.hpp @@ -26,7 +26,8 @@ namespace node { enum class RedisMode { KEY, HASH, CHANNEL }; -inline std::ostream &operator<<(std::ostream &os, const enum villas::node::RedisMode &m) { +inline std::ostream &operator<<(std::ostream &os, + const enum villas::node::RedisMode &m) { switch (m) { case villas::node::RedisMode::KEY: os << "key"; @@ -44,7 +45,6 @@ inline std::ostream &operator<<(std::ostream &os, const enum villas::node::Redis return os; } - class RedisConnection { public: diff --git a/include/villas/nodes/redis_helpers.hpp b/include/villas/nodes/redis_helpers.hpp index 3cc5b2a39..0cef4d2aa 100644 --- a/include/villas/nodes/redis_helpers.hpp +++ b/include/villas/nodes/redis_helpers.hpp @@ -8,8 +8,8 @@ #pragma once #include -#include #include +#include #include #include #include @@ -62,7 +62,8 @@ inline bool operator==(const tls::TlsOptions &o1, const tls::TlsOptions &o2) { #endif // REDISPP_WITH_TLS } -inline bool operator==(const ConnectionOptions &o1, const ConnectionOptions &o2) { +inline bool operator==(const ConnectionOptions &o1, + const ConnectionOptions &o2) { return o1.type == o2.type && o1.host == o2.host && o1.port == o2.port && o1.path == o2.path && o1.user == o2.user && o1.password == o2.password && o1.db == o2.db && @@ -95,7 +96,7 @@ std::ostream &operator<<(std::ostream &os, const TlsOptions &t) { return os; } -} +} // namespace tls #endif // REDISPP_WITH_TLS inline std::ostream &operator<<(std::ostream &os, const ConnectionType &t) { @@ -141,12 +142,14 @@ inline std::ostream &operator<<(std::ostream &os, const ConnectionOptions &o) { namespace villas { namespace node { #ifdef REDISPP_WITH_URI -inline sw::redis::ConnectionOptions make_redis_connection_options(char const *uri) { +inline sw::redis::ConnectionOptions +make_redis_connection_options(char const *uri) { auto u = sw::redis::Uri{uri}; return u.connection_options(); } #else -inline sw::redis::ConnectionOptions make_redis_connection_options(char const *uri) { +inline sw::redis::ConnectionOptions +make_redis_connection_options(char const *uri) { return sw::redis::ConnectionOptions{uri}; } #endif diff --git a/include/villas/nodes/rtp.hpp b/include/villas/nodes/rtp.hpp index e5a44745a..919b82ca2 100644 --- a/include/villas/nodes/rtp.hpp +++ b/include/villas/nodes/rtp.hpp @@ -21,8 +21,8 @@ #include extern "C" { -#include #include +#include } namespace villas { diff --git a/include/villas/nodes/webrtc/peer_connection.hpp b/include/villas/nodes/webrtc/peer_connection.hpp index 26c180971..0d71e5144 100644 --- a/include/villas/nodes/webrtc/peer_connection.hpp +++ b/include/villas/nodes/webrtc/peer_connection.hpp @@ -9,10 +9,10 @@ #pragma once +#include #include #include #include -#include #include #include #include diff --git a/include/villas/nodes/websocket.hpp b/include/villas/nodes/websocket.hpp index 06698353d..aec7a4bfb 100644 --- a/include/villas/nodes/websocket.hpp +++ b/include/villas/nodes/websocket.hpp @@ -7,8 +7,8 @@ #pragma once -#include #include +#include #include #include #include @@ -76,7 +76,7 @@ struct websocket_connection { } buffers; friend std::ostream &operator<<(std::ostream &os, - const struct websocket_connection &c) { + const struct websocket_connection &c) { if (c.wsi) { char name[128]; diff --git a/include/villas/path.hpp b/include/villas/path.hpp index 81d46c024..d58b9a8da 100644 --- a/include/villas/path.hpp +++ b/include/villas/path.hpp @@ -9,14 +9,15 @@ #include +#include #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -26,7 +27,6 @@ #include #include #include -#include // Forward declarations struct pollfd; @@ -185,6 +185,5 @@ public: #ifndef FMT_LEGACY_OSTREAM_FORMATTER template <> -class fmt::formatter - : public fmt::ostream_formatter {}; +class fmt::formatter : public fmt::ostream_formatter {}; #endif diff --git a/include/villas/super_node.hpp b/include/villas/super_node.hpp index 861825d75..709966938 100644 --- a/include/villas/super_node.hpp +++ b/include/villas/super_node.hpp @@ -129,7 +129,9 @@ public: const uuid_t &getUuid() const { return uuid; } - struct timespec getStartTime() const { return started; } + struct timespec getStartTime() const { + return started; + } #ifdef WITH_API Api *getApi() { return &api; } diff --git a/lib/api/response.cpp b/lib/api/response.cpp index 62914191e..4bb44e809 100644 --- a/lib/api/response.cpp +++ b/lib/api/response.cpp @@ -13,12 +13,13 @@ using namespace villas::node::api; Response::Response(Session *s, int c, const std::string &ct, const Buffer &b) : session(s), logger(logging.get("api:response")), buffer(b), code(c), - contentType(ct), - headers{{"Server:", HTTP_USER_AGENT}, - {"Access-Control-Allow-Origin:", "*"}, - {"Access-Control-Allow-Methods:", "GET, POST, OPTIONS"}, - {"Access-Control-Allow-Headers:", "Content-Type"}, - {"Access-Control-Max-Age:", "86400"}} {} + contentType(ct), headers{ + {"Server:", HTTP_USER_AGENT}, + {"Access-Control-Allow-Origin:", "*"}, + {"Access-Control-Allow-Methods:", + "GET, POST, OPTIONS"}, + {"Access-Control-Allow-Headers:", "Content-Type"}, + {"Access-Control-Max-Age:", "86400"}} {} int Response::writeBody(struct lws *wsi) { int ret; diff --git a/lib/hooks/lua.cpp b/lib/hooks/lua.cpp index 6bf5875ae..d9e7c9518 100644 --- a/lib/hooks/lua.cpp +++ b/lib/hooks/lua.cpp @@ -10,9 +10,9 @@ #include extern "C" { +#include #include #include -#include }; #include diff --git a/lib/node_compat.cpp b/lib/node_compat.cpp index 589fde594..2537ea145 100644 --- a/lib/node_compat.cpp +++ b/lib/node_compat.cpp @@ -60,7 +60,7 @@ NodeCompat::~NodeCompat() { int ret __attribute__((unused)); ret = _vt->destroy ? _vt->destroy(this) : 0; - delete[] (char *)_vd; + delete[](char *) _vd; } int NodeCompat::prepare() { diff --git a/lib/nodes/opal.cpp b/lib/nodes/opal.cpp index d0d224ce4..d922ebf0b 100644 --- a/lib/nodes/opal.cpp +++ b/lib/nodes/opal.cpp @@ -24,9 +24,9 @@ extern "C" { /* Define RTLAB before including OpalPrint.h for messages to be sent * to the OpalDisplay. Otherwise stdout will be used. */ #define RTLAB -#include #include #include +#include } // Private static storage diff --git a/lib/nodes/rtp.cpp b/lib/nodes/rtp.cpp index 27de3c0e7..5722581de 100644 --- a/lib/nodes/rtp.cpp +++ b/lib/nodes/rtp.cpp @@ -15,12 +15,12 @@ #include extern "C" { -#include #include -#include #include #include +#include #include +#include #include #undef ALIGN_MASK } diff --git a/lib/sample.cpp b/lib/sample.cpp index c8d81f9ba..9632c1a85 100644 --- a/lib/sample.cpp +++ b/lib/sample.cpp @@ -76,7 +76,7 @@ void villas::node::sample_free(struct Sample *s) { if (p) pool_put(p, s); else - delete[] (char *)s; + delete[](char *) s; } int villas::node::sample_alloc_many(struct Pool *p, struct Sample *smps[],