From e77686f7a8cb5dd78b97d8d82308528535d541ac Mon Sep 17 00:00:00 2001 From: Paul Dreik Date: Sun, 22 Aug 2021 20:18:11 +0200 Subject: [PATCH] clang format using clang format 11 --- test/fuzzing/chrono-duration.cc | 7 ++++--- test/fuzzing/float.cc | 8 ++++---- test/fuzzing/fuzzer-common.h | 8 ++++---- test/fuzzing/named-arg.cc | 5 +++-- test/fuzzing/one-arg.cc | 11 ++++++----- test/fuzzing/two-args.cc | 3 ++- 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/test/fuzzing/chrono-duration.cc b/test/fuzzing/chrono-duration.cc index 11a0505a..d66068d9 100644 --- a/test/fuzzing/chrono-duration.cc +++ b/test/fuzzing/chrono-duration.cc @@ -1,9 +1,10 @@ // Copyright (c) 2019, Paul Dreik // For the license information refer to format.h. -#include #include +#include + #include "fuzzer-common.h" template @@ -31,7 +32,7 @@ void invoke_outer(const uint8_t* data, size_t size, int period) { data += fixed_size; size -= fixed_size; - // data is already allocated separately in libFuzzer so reading past the end + // data is already allocated separately in libFuzzer so reading past the end // will most likely be detected anyway. const auto format_str = fmt::string_view(as_chars(data), size); @@ -86,7 +87,7 @@ void invoke_outer(const uint8_t* data, size_t size, int period) { } extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - if (size <= 4) return 0; + if (size <= 4) return 0; const auto representation = data[0]; const auto period = data[1]; diff --git a/test/fuzzing/float.cc b/test/fuzzing/float.cc index 073e4bcd..b3780e1d 100644 --- a/test/fuzzing/float.cc +++ b/test/fuzzing/float.cc @@ -1,11 +1,12 @@ // A fuzzer for floating-point formatter. // For the license information refer to format.h. +#include + #include #include -#include #include -#include +#include #include "fuzzer-common.h" @@ -24,8 +25,7 @@ void check_round_trip(fmt::string_view format_str, double value) { char* ptr = nullptr; if (std::strtod(buffer.data(), &ptr) != value) throw std::runtime_error("round trip failure"); - if (ptr + 1 != buffer.end()) - throw std::runtime_error("unparsed output"); + if (ptr + 1 != buffer.end()) throw std::runtime_error("unparsed output"); } extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { diff --git a/test/fuzzing/fuzzer-common.h b/test/fuzzing/fuzzer-common.h index 635a5d99..e2e01409 100644 --- a/test/fuzzing/fuzzer-common.h +++ b/test/fuzzing/fuzzer-common.h @@ -4,12 +4,12 @@ #ifndef FUZZER_COMMON_H #define FUZZER_COMMON_H -#include // std::uint8_t -#include // memcpy -#include - #include +#include // std::uint8_t +#include // memcpy +#include + // One can format to either a string, or a buffer. The latter is faster, but // one may be interested in formatting to a string instead to verify it works // as intended. To avoid a combinatoric explosion, select this at compile time diff --git a/test/fuzzing/named-arg.cc b/test/fuzzing/named-arg.cc index ffd8e903..97085dab 100644 --- a/test/fuzzing/named-arg.cc +++ b/test/fuzzing/named-arg.cc @@ -1,10 +1,11 @@ // Copyright (c) 2019, Paul Dreik // For the license information refer to format.h. +#include + #include #include #include -#include #include "fuzzer-common.h" @@ -25,7 +26,7 @@ void invoke_fmt(const uint8_t* data, size_t size, unsigned arg_name_size) { try { #if FMT_FUZZ_FORMAT_TO_STRING std::string message = - fmt::format(format_str.get(), fmt::arg(arg_name.data(), value)); + fmt::format(format_str.get(), fmt::arg(arg_name.data(), value)); #else fmt::memory_buffer out; fmt::format_to(out, format_str.get(), fmt::arg(arg_name.data(), value)); diff --git a/test/fuzzing/one-arg.cc b/test/fuzzing/one-arg.cc index df173432..90cec716 100644 --- a/test/fuzzing/one-arg.cc +++ b/test/fuzzing/one-arg.cc @@ -1,17 +1,18 @@ // Copyright (c) 2019, Paul Dreik // For the license information refer to format.h. +#include + #include #include -#include #include "fuzzer-common.h" -template -const T* from_repr(const Repr& r) { return &r; } +template const T* from_repr(const Repr& r) { + return &r; +} -template <> -const std::tm* from_repr(const std::time_t& t) { +template <> const std::tm* from_repr(const std::time_t& t) { return std::localtime(&t); } diff --git a/test/fuzzing/two-args.cc b/test/fuzzing/two-args.cc index 4d7d3453..979320c2 100644 --- a/test/fuzzing/two-args.cc +++ b/test/fuzzing/two-args.cc @@ -1,10 +1,11 @@ // Copyright (c) 2019, Paul Dreik // For the license information refer to format.h. +#include + #include #include #include -#include #include "fuzzer-common.h"