Apply clang-format

This commit is contained in:
Victor Zverovich 2020-07-09 09:04:46 -07:00
parent b998e0f30b
commit 60c43e8703
7 changed files with 33 additions and 40 deletions

View File

@ -242,26 +242,23 @@ template <> FMT_FUNC int count_digits<4>(detail::fallback_uintptr n) {
template <typename T> template <typename T>
const typename basic_data<T>::digit_pair basic_data<T>::digits[] = { const typename basic_data<T>::digit_pair basic_data<T>::digits[] = {
{'0', '0'}, {'0', '1'}, {'0', '2'}, {'0', '3'}, {'0', '4'}, {'0', '0'}, {'0', '1'}, {'0', '2'}, {'0', '3'}, {'0', '4'}, {'0', '5'},
{'0', '5'}, {'0', '6'}, {'0', '7'}, {'0', '8'}, {'0', '9'}, {'0', '6'}, {'0', '7'}, {'0', '8'}, {'0', '9'}, {'1', '0'}, {'1', '1'},
{'1', '0'}, {'1', '1'}, {'1', '2'}, {'1', '3'}, {'1', '4'}, {'1', '2'}, {'1', '3'}, {'1', '4'}, {'1', '5'}, {'1', '6'}, {'1', '7'},
{'1', '5'}, {'1', '6'}, {'1', '7'}, {'1', '8'}, {'1', '9'}, {'1', '8'}, {'1', '9'}, {'2', '0'}, {'2', '1'}, {'2', '2'}, {'2', '3'},
{'2', '0'}, {'2', '1'}, {'2', '2'}, {'2', '3'}, {'2', '4'}, {'2', '4'}, {'2', '5'}, {'2', '6'}, {'2', '7'}, {'2', '8'}, {'2', '9'},
{'2', '5'}, {'2', '6'}, {'2', '7'}, {'2', '8'}, {'2', '9'}, {'3', '0'}, {'3', '1'}, {'3', '2'}, {'3', '3'}, {'3', '4'}, {'3', '5'},
{'3', '0'}, {'3', '1'}, {'3', '2'}, {'3', '3'}, {'3', '4'}, {'3', '6'}, {'3', '7'}, {'3', '8'}, {'3', '9'}, {'4', '0'}, {'4', '1'},
{'3', '5'}, {'3', '6'}, {'3', '7'}, {'3', '8'}, {'3', '9'}, {'4', '2'}, {'4', '3'}, {'4', '4'}, {'4', '5'}, {'4', '6'}, {'4', '7'},
{'4', '0'}, {'4', '1'}, {'4', '2'}, {'4', '3'}, {'4', '4'}, {'4', '8'}, {'4', '9'}, {'5', '0'}, {'5', '1'}, {'5', '2'}, {'5', '3'},
{'4', '5'}, {'4', '6'}, {'4', '7'}, {'4', '8'}, {'4', '9'}, {'5', '4'}, {'5', '5'}, {'5', '6'}, {'5', '7'}, {'5', '8'}, {'5', '9'},
{'5', '0'}, {'5', '1'}, {'5', '2'}, {'5', '3'}, {'5', '4'}, {'6', '0'}, {'6', '1'}, {'6', '2'}, {'6', '3'}, {'6', '4'}, {'6', '5'},
{'5', '5'}, {'5', '6'}, {'5', '7'}, {'5', '8'}, {'5', '9'}, {'6', '6'}, {'6', '7'}, {'6', '8'}, {'6', '9'}, {'7', '0'}, {'7', '1'},
{'6', '0'}, {'6', '1'}, {'6', '2'}, {'6', '3'}, {'6', '4'}, {'7', '2'}, {'7', '3'}, {'7', '4'}, {'7', '5'}, {'7', '6'}, {'7', '7'},
{'6', '5'}, {'6', '6'}, {'6', '7'}, {'6', '8'}, {'6', '9'}, {'7', '8'}, {'7', '9'}, {'8', '0'}, {'8', '1'}, {'8', '2'}, {'8', '3'},
{'7', '0'}, {'7', '1'}, {'7', '2'}, {'7', '3'}, {'7', '4'}, {'8', '4'}, {'8', '5'}, {'8', '6'}, {'8', '7'}, {'8', '8'}, {'8', '9'},
{'7', '5'}, {'7', '6'}, {'7', '7'}, {'7', '8'}, {'7', '9'}, {'9', '0'}, {'9', '1'}, {'9', '2'}, {'9', '3'}, {'9', '4'}, {'9', '5'},
{'8', '0'}, {'8', '1'}, {'8', '2'}, {'8', '3'}, {'8', '4'}, {'9', '6'}, {'9', '7'}, {'9', '8'}, {'9', '9'}};
{'8', '5'}, {'8', '6'}, {'8', '7'}, {'8', '8'}, {'8', '9'},
{'9', '0'}, {'9', '1'}, {'9', '2'}, {'9', '3'}, {'9', '4'},
{'9', '5'}, {'9', '6'}, {'9', '7'}, {'9', '8'}, {'9', '9'}};
template <typename T> template <typename T>
const char basic_data<T>::hex_digits[] = "0123456789abcdef"; const char basic_data<T>::hex_digits[] = "0123456789abcdef";

View File

@ -346,8 +346,7 @@ long getpagesize();
class direct_buffered_file; class direct_buffered_file;
template <typename S, typename... Args> template <typename S, typename... Args>
void print(direct_buffered_file& f, const S& format_str, void print(direct_buffered_file& f, const S& format_str, const Args&... args);
const Args&... args);
// A buffered file with a direct buffer access and no synchronization. // A buffered file with a direct buffer access and no synchronization.
class direct_buffered_file { class direct_buffered_file {
@ -370,9 +369,7 @@ class direct_buffered_file {
direct_buffered_file(cstring_view path, int oflag) direct_buffered_file(cstring_view path, int oflag)
: file_(path, oflag), pos_(0) {} : file_(path, oflag), pos_(0) {}
~direct_buffered_file() { ~direct_buffered_file() { flush(); }
flush();
}
void close() { void close() {
flush(); flush();

View File

@ -375,8 +375,8 @@ struct check_custom {
void grow(size_t) {} void grow(size_t) {}
} buffer; } buffer;
fmt::format_parse_context parse_ctx(""); fmt::format_parse_context parse_ctx("");
fmt::format_context ctx{ fmt::format_context ctx{fmt::detail::buffer_appender<char>(buffer),
fmt::detail::buffer_appender<char>(buffer), fmt::format_args()}; fmt::format_args()};
h.format(parse_ctx, ctx); h.format(parse_ctx, ctx);
EXPECT_EQ("test", std::string(buffer.data, buffer.size())); EXPECT_EQ("test", std::string(buffer.data, buffer.size()));
return test_result(); return test_result();

View File

@ -24,8 +24,7 @@ class custom_arg_formatter
custom_arg_formatter(fmt::format_context& ctx, custom_arg_formatter(fmt::format_context& ctx,
fmt::format_parse_context* parse_ctx, fmt::format_parse_context* parse_ctx,
fmt::format_specs* s = nullptr, fmt::format_specs* s = nullptr, const char* = nullptr)
const char* = nullptr)
: base(ctx, parse_ctx, s) {} : base(ctx, parse_ctx, s) {}
using base::operator(); using base::operator();

View File

@ -288,8 +288,8 @@ TEST(BufferedFileTest, Fileno) {
} }
TEST(DirectBufferedFileTest, Print) { TEST(DirectBufferedFileTest, Print) {
fmt::direct_buffered_file out( fmt::direct_buffered_file out("test-file",
"test-file", fmt::file::WRONLY | fmt::file::CREATE); fmt::file::WRONLY | fmt::file::CREATE);
fmt::print(out, "The answer is {}.\n", 42); fmt::print(out, "The answer is {}.\n", 42);
out.close(); out.close();
file in("test-file", file::RDONLY); file in("test-file", file::RDONLY);
@ -298,8 +298,8 @@ TEST(DirectBufferedFileTest, Print) {
TEST(DirectBufferedFileTest, BufferBoundary) { TEST(DirectBufferedFileTest, BufferBoundary) {
auto str = std::string(4096, 'x'); auto str = std::string(4096, 'x');
fmt::direct_buffered_file out( fmt::direct_buffered_file out("test-file",
"test-file", fmt::file::WRONLY | fmt::file::CREATE); fmt::file::WRONLY | fmt::file::CREATE);
fmt::print(out, "{}", str); fmt::print(out, "{}", str);
fmt::print(out, "{}", str); fmt::print(out, "{}", str);
out.close(); out.close();

View File

@ -75,8 +75,8 @@ struct test_arg_formatter
TEST(OStreamTest, CustomArg) { TEST(OStreamTest, CustomArg) {
fmt::memory_buffer buffer; fmt::memory_buffer buffer;
fmt::format_context ctx( fmt::format_context ctx(fmt::detail::buffer_appender<char>{buffer},
fmt::detail::buffer_appender<char>{buffer}, fmt::format_args()); fmt::format_args());
fmt::format_specs spec; fmt::format_specs spec;
test_arg_formatter af(ctx, spec); test_arg_formatter af(ctx, spec);
fmt::visit_format_arg( fmt::visit_format_arg(