]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/fmt/test/fuzzing/one-arg.cc
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / fmt / test / fuzzing / one-arg.cc
index df1734324380e82ca6eb89550041cdc29f8c2ed3..af9787f81e9e447c39db997746b1f09023e732b7 100644 (file)
@@ -1,17 +1,18 @@
 // Copyright (c) 2019, Paul Dreik
 // For the license information refer to format.h.
 
+#include <fmt/chrono.h>
+
 #include <cstdint>
 #include <exception>
-#include <fmt/chrono.h>
 
 #include "fuzzer-common.h"
 
-template <typename T, typename Repr>
-const T* from_repr(const Repr& r) { return &r; }
+template <typename T, typename Repr> const T* from_repr(const Repr& r) {
+  return &r;
+}
 
-template <>
-const std::tm* from_repr<std::tm>(const std::time_t& t) {
+template <> const std::tm* from_repr<std::tm>(const std::time_t& t) {
   return std::localtime(&t);
 }
 
@@ -29,8 +30,8 @@ void invoke_fmt(const uint8_t* data, size_t size) {
 #if FMT_FUZZ_FORMAT_TO_STRING
     std::string message = fmt::format(format_str.get(), *value);
 #else
-    fmt::memory_buffer message;
-    fmt::format_to(message, format_str.get(), *value);
+    auto buf = fmt::memory_buffer();
+    fmt::format_to(std::back_inserter(buf), format_str.get(), *value);
 #endif
   } catch (std::exception&) {
   }