clang-format

This commit is contained in:
gabime
2021-11-16 23:44:35 +02:00
parent 1756c5d37f
commit dc030ec53c
29 changed files with 184 additions and 167 deletions

View File

@@ -20,7 +20,7 @@
namespace spdlog {
namespace details {
SPDLOG_INLINE file_helper::file_helper(const file_event_handlers& event_handlers)
SPDLOG_INLINE file_helper::file_helper(const file_event_handlers &event_handlers)
: event_handlers_(event_handlers)
{}

View File

@@ -17,7 +17,7 @@ class SPDLOG_API file_helper
{
public:
file_helper() = default;
explicit file_helper(const file_event_handlers& event_handlers);
explicit file_helper(const file_event_handlers &event_handlers);
file_helper(const file_helper &) = delete;
file_helper &operator=(const file_helper &) = delete;

View File

@@ -9,8 +9,8 @@
#include <spdlog/common.h>
#ifdef SPDLOG_USE_STD_FORMAT
#include <charconv>
#include <limits>
# include <charconv>
# include <limits>
#endif
// Some fmt helpers to efficiently format and pad ints and strings
@@ -89,11 +89,11 @@ inline unsigned int count_digits(T n)
return static_cast<unsigned int>(fmt::
// fmt 7.0.0 renamed the internal namespace to detail.
// See: https://github.com/fmtlib/fmt/issues/1538
#if FMT_VERSION < 70000
# if FMT_VERSION < 70000
internal
#else
# else
detail
#endif
# endif
::count_digits(static_cast<count_type>(n)));
#endif
}

View File

@@ -381,11 +381,11 @@ SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)
{
memory_buf_t buf;
wstr_to_utf8buf(filename, buf);
#ifdef SPDLOG_USE_STD_FORMAT
# ifdef SPDLOG_USE_STD_FORMAT
return buf;
#else
# else
return fmt::to_string(buf);
#endif
# endif
}
#else
SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)

View File

@@ -13,7 +13,7 @@ class logger;
struct synchronous_factory
{
template<typename Sink, typename... SinkArgs>
static std::shared_ptr<spdlog::logger> create(std::string logger_name, SinkArgs &&...args)
static std::shared_ptr<spdlog::logger> create(std::string logger_name, SinkArgs &&... args)
{
auto sink = std::make_shared<Sink>(std::forward<SinkArgs>(args)...);
auto new_logger = std::make_shared<spdlog::logger>(std::move(logger_name), std::move(sink));

View File

@@ -24,7 +24,7 @@ namespace details {
class tcp_client
{
SOCKET socket_ = INVALID_SOCKET;
static void init_winsock_()
{
WSADATA wsaData;
@@ -55,7 +55,6 @@ public:
close();
::WSACleanup();
}
bool is_connected() const
{
@@ -65,7 +64,7 @@ public:
void close()
{
::closesocket(socket_);
socket_ = INVALID_SOCKET;
socket_ = INVALID_SOCKET;
}
SOCKET fd() const
@@ -73,10 +72,9 @@ public:
return socket_;
}
// try to connect or throw on failure
void connect(const std::string &host, int port)
{
{
if (is_connected())
{
close();

View File

@@ -23,7 +23,7 @@ namespace spdlog {
namespace details {
class udp_client
{
static constexpr int TX_BUFFER_SIZE = 1024*10;
static constexpr int TX_BUFFER_SIZE = 1024 * 10;
SOCKET socket_ = INVALID_SOCKET;
sockaddr_in addr_ = {0};
@@ -64,7 +64,8 @@ public:
addr_.sin_family = PF_INET;
addr_.sin_port = htons(port);
addr_.sin_addr.s_addr = INADDR_ANY;
if (InetPton(PF_INET, TEXT(host.c_str()), &addr_.sin_addr.s_addr) != 1) {
if (InetPton(PF_INET, TEXT(host.c_str()), &addr_.sin_addr.s_addr) != 1)
{
int last_error = ::WSAGetLastError();
::WSACleanup();
throw_winsock_error_("error: Invalid address!", last_error);

View File

@@ -31,7 +31,6 @@ class udp_client
int socket_ = -1;
struct sockaddr_in sockAddr_;
void cleanup_()
{
if (socket_ != -1)
@@ -59,8 +58,9 @@ public:
sockAddr_.sin_family = AF_INET;
sockAddr_.sin_port = htons(port);
if (::inet_aton(host.c_str(), &sockAddr_.sin_addr) == 0) {
if (::inet_aton(host.c_str(), &sockAddr_.sin_addr) == 0)
{
cleanup_();
throw_spdlog_ex("error: Invalid address!");
}
@@ -85,7 +85,7 @@ public:
ssize_t toslen = 0;
socklen_t tolen = sizeof(struct sockaddr);
if ((toslen = ::sendto(socket_, data, n_bytes, 0, (struct sockaddr *)&sockAddr_, tolen)) == -1)
{
{
throw_spdlog_ex("sendto(2) failed", errno);
}
}