code formatting and clang tidy warnings fixes

This commit is contained in:
gabime
2018-08-13 10:30:02 +03:00
parent 4866f2ac05
commit 05d6960ebc
16 changed files with 29 additions and 34 deletions

View File

@@ -47,7 +47,7 @@ inline void spdlog::async_logger::sink_it_(details::log_msg &msg)
}
else
{
throw spdlog_ex("async log: thread pool doens't exist anymore");
throw spdlog_ex("async log: thread pool doesn't exist anymore");
}
}

View File

@@ -5,14 +5,14 @@
//
#include "spdlog/details/null_mutex.h"
#include "stdio.h"
#include <cstdio>
#include <mutex>
namespace spdlog {
namespace details {
struct console_stdout
{
static FILE *stream()
static std::FILE *stream()
{
return stdout;
}
@@ -26,7 +26,7 @@ struct console_stdout
struct console_stderr
{
static FILE *stream()
static std::FILE *stream()
{
return stderr;
}

View File

@@ -69,7 +69,7 @@ static const char *ampm(const tm &t)
return t.tm_hour >= 12 ? "PM" : "AM";
}
static unsigned int to12h(const tm &t)
static int to12h(const tm &t)
{
return t.tm_hour > 12 ? t.tm_hour - 12 : t.tm_hour;
}
@@ -242,7 +242,7 @@ class f_formatter SPDLOG_FINAL : public flag_formatter
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
{
auto micros = fmt_helper::time_fraction<std::chrono::microseconds>(msg.time);
fmt_helper::pad6(static_cast<int>(micros.count()), dest);
fmt_helper::pad6(static_cast<size_t>(micros.count()), dest);
}
};
@@ -745,7 +745,6 @@ private:
{
formatters_.push_back(std::move(user_chars));
}
// if(
if (++it != end)
{
handle_flag_(*it);

View File

@@ -23,7 +23,7 @@ namespace details {
class periodic_worker
{
public:
periodic_worker(std::function<void()> callback_fun, std::chrono::seconds interval)
periodic_worker(const std::function<void()> &callback_fun, std::chrono::seconds interval)
{
active_ = (interval > std::chrono::seconds::zero());
if (!active_)

View File

@@ -35,7 +35,7 @@ public:
std::lock_guard<std::mutex> lock(logger_map_mutex_);
auto logger_name = new_logger->name();
throw_if_exists_(logger_name);
loggers_[logger_name] = new_logger;
loggers_[logger_name] = std::move(new_logger);
}
void register_and_init(std::shared_ptr<logger> new_logger)
@@ -56,7 +56,7 @@ public:
new_logger->flush_on(flush_level_);
// add to registry
loggers_[logger_name] = new_logger;
loggers_[logger_name] = std::move(new_logger);
}
std::shared_ptr<logger> get(const std::string &logger_name)
@@ -126,7 +126,7 @@ public:
err_handler_ = handler;
}
void apply_all(std::function<void(std::shared_ptr<logger>)> fun)
void apply_all(const std::function<void(const std::shared_ptr<logger>)> &fun)
{
std::lock_guard<std::mutex> lock(logger_map_mutex_);
for (auto &l : loggers_)
@@ -189,11 +189,7 @@ private:
{
}
~registry()
{
/*std::lock_guard<std::mutex> lock(flusher_mutex_);
periodic_flusher_.reset();*/
}
~registry() = default;
void throw_if_exists_(const std::string &logger_name)
{

View File

@@ -122,7 +122,7 @@ public:
}
for (size_t i = 0; i < threads_n; i++)
{
threads_.emplace_back(std::bind(&thread_pool::worker_loop_, this));
threads_.emplace_back(&thread_pool::worker_loop_, this);
}
}