Browse Source

Update contrib/libs/apache/avro to 1.11.0

robot-contrib 2 years ago
parent
commit
4d56ab79e5

+ 7 - 0
contrib/libs/apache/avro/CMakeLists.linux.txt

@@ -10,6 +10,13 @@
 add_library(libs-apache-avro)
 target_compile_options(libs-apache-avro PRIVATE
   -DAVRO_SOURCE
+  -DBOOST_ALL_NO_LIB
+  -DBOOST_ATOMIC_DYN_LINK
+  -DBOOST_FILESYSTEM_DYN_LINK
+  -DBOOST_IOSTREAMS_DYN_LINK
+  -DBOOST_PROGRAM_OPTIONS_DYN_LINK
+  -DBOOST_REGEX_DYN_LINK
+  -DBOOST_SYSTEM_DYN_LINK
   -DSNAPPY_CODEC_AVAILABLE
   -Wno-everything
 )

+ 30 - 27
contrib/libs/apache/avro/api/AvroTraits.hh

@@ -21,7 +21,7 @@
 
 #include "Config.hh"
 #include "Types.hh"
-#include <stdint.h>
+#include <cstdint>
 #include <type_traits>
 
 /** @file
@@ -34,13 +34,13 @@ namespace avro {
  * Define an is_serializable trait for types we can serialize natively.
  * New types will need to define the trait as well.
  */
-template <typename T>
-struct is_serializable : public std::false_type{};
+template<typename T>
+struct is_serializable : public std::false_type {};
 
-template <typename T>
-struct is_promotable : public std::false_type{};
+template<typename T>
+struct is_promotable : public std::false_type {};
 
-template <typename T>
+template<typename T>
 struct type_to_avro {
     static const Type type = AVRO_NUM_TYPES;
 };
@@ -52,16 +52,18 @@ struct type_to_avro {
  * is_defined<T>::value will be true or false depending on whether T is a
  * complete type or not respectively.
  */
-template <class T>
+template<class T>
 struct is_defined {
 
     typedef char yes[1];
 
     typedef char no[2];
 
-    template <class U> static yes& test(char(*)[sizeof(U)]) { throw 0; };
+    template<class U>
+    static yes &test(char (*)[sizeof(U)]) { throw 0; };
 
-    template <class U> static no& test(...) { throw 0; };
+    template<class U>
+    static no &test(...) { throw 0; };
 
     static const bool value = sizeof(test<T>(0)) == sizeof(yes);
 };
@@ -72,34 +74,36 @@ struct is_defined {
  * is_not_defined<T>::value will be true or false depending on whether T is an
  * incomplete type or not respectively.
  */
-template <class T>
+template<class T>
 struct is_not_defined {
 
     typedef char yes[1];
 
     typedef char no[2];
 
-    template <class U> static yes& test(char(*)[sizeof(U)]) { throw 0; };
+    template<class U>
+    static yes &test(char (*)[sizeof(U)]) { throw 0; };
 
-    template <class U> static no& test(...) { throw 0; };
+    template<class U>
+    static no &test(...) { throw 0; };
 
     static const bool value = sizeof(test<T>(0)) == sizeof(no);
 };
 
-#define DEFINE_PRIMITIVE(CTYPE, AVROTYPE) \
-template <> \
-struct is_serializable<CTYPE> : public std::true_type{}; \
-\
-template <> \
-struct type_to_avro<CTYPE> { \
-    static const Type type = AVROTYPE; \
-};
-
-#define DEFINE_PROMOTABLE_PRIMITIVE(CTYPE, AVROTYPE) \
-template <> \
-struct is_promotable<CTYPE> : public std::true_type{}; \
-\
-DEFINE_PRIMITIVE(CTYPE, AVROTYPE)
+#define DEFINE_PRIMITIVE(CTYPE, AVROTYPE)                     \
+    template<>                                                \
+    struct is_serializable<CTYPE> : public std::true_type {}; \
+                                                              \
+    template<>                                                \
+    struct type_to_avro<CTYPE> {                              \
+        static const Type type = AVROTYPE;                    \
+    };
+
+#define DEFINE_PROMOTABLE_PRIMITIVE(CTYPE, AVROTYPE)        \
+    template<>                                              \
+    struct is_promotable<CTYPE> : public std::true_type {}; \
+                                                            \
+    DEFINE_PRIMITIVE(CTYPE, AVROTYPE)
 
 DEFINE_PROMOTABLE_PRIMITIVE(int32_t, AVRO_INT)
 DEFINE_PROMOTABLE_PRIMITIVE(int64_t, AVRO_LONG)
@@ -110,7 +114,6 @@ DEFINE_PRIMITIVE(Null, AVRO_NULL)
 DEFINE_PRIMITIVE(std::string, AVRO_STRING)
 DEFINE_PRIMITIVE(std::vector<uint8_t>, AVRO_BYTES)
 
-
 } // namespace avro
 
 #endif

+ 8 - 8
contrib/libs/apache/avro/api/Compiler.hh

@@ -20,7 +20,7 @@
 #define avro_Compiler_hh__
 
 #include "Config.hh"
-#include <stdint.h>
+#include <cstdint>
 #include <istream>
 
 namespace avro {
@@ -34,7 +34,7 @@ class AVRO_DECL InputStream;
 
 class AVRO_DECL ValidSchema;
 
-/// Given a stream comtaining a JSON schema, compiles the schema to a
+/// Given a stream containing a JSON schema, compiles the schema to a
 /// ValidSchema object.  Throws if the schema cannot be compiled to a valid
 /// schema
 
@@ -46,17 +46,17 @@ AVRO_DECL void compileJsonSchema(std::istream &is, ValidSchema &schema);
 ///
 
 AVRO_DECL bool compileJsonSchema(std::istream &is, ValidSchema &schema,
-    std::string &error);
+                                 std::string &error);
 
-AVRO_DECL ValidSchema compileJsonSchemaFromStream(InputStream& is);
+AVRO_DECL ValidSchema compileJsonSchemaFromStream(InputStream &is);
 
-AVRO_DECL ValidSchema compileJsonSchemaFromMemory(const uint8_t* input, size_t len);
+AVRO_DECL ValidSchema compileJsonSchemaFromMemory(const uint8_t *input, size_t len);
 
-AVRO_DECL ValidSchema compileJsonSchemaFromString(const char* input);
+AVRO_DECL ValidSchema compileJsonSchemaFromString(const char *input);
 
-AVRO_DECL ValidSchema compileJsonSchemaFromString(const std::string& input);
+AVRO_DECL ValidSchema compileJsonSchemaFromString(const std::string &input);
 
-AVRO_DECL ValidSchema compileJsonSchemaFromFile(const char* filename);
+AVRO_DECL ValidSchema compileJsonSchemaFromFile(const char *filename);
 
 } // namespace avro
 

+ 8 - 10
contrib/libs/apache/avro/api/Config.hh

@@ -19,27 +19,25 @@
 #ifndef avro_Config_hh
 #define avro_Config_hh
 
-// Windows DLL suport
+// Windows DLL support
 
 #ifdef _WIN32
-#pragma warning (disable: 4275 4251)
+#pragma warning(disable : 4275 4251)
 
 #if defined(AVRO_DYN_LINK)
 #ifdef AVRO_SOURCE
-# define AVRO_DECL __declspec(dllexport)
+#define AVRO_DECL __declspec(dllexport)
 #else
-# define AVRO_DECL __declspec(dllimport)
-#endif  // AVRO_SOURCE
-#endif  // AVRO_DYN_LINK
+#define AVRO_DECL __declspec(dllimport)
+#endif // AVRO_SOURCE
+#endif // AVRO_DYN_LINK
 
 #include <intsafe.h>
-typedef SSIZE_T ssize_t;
-
-#endif  // _WIN32
+using ssize_t = SSIZE_T;
+#endif // _WIN32
 
 #ifndef AVRO_DECL
 #define AVRO_DECL
 #endif
 
 #endif
-

+ 46 - 50
contrib/libs/apache/avro/api/DataFile.hh

@@ -21,10 +21,10 @@
 
 #include "Config.hh"
 #include "Encoder.hh"
-#include "buffer/Buffer.hh"
-#include "ValidSchema.hh"
 #include "Specific.hh"
 #include "Stream.hh"
+#include "ValidSchema.hh"
+#include "buffer/Buffer.hh"
 
 #include <map>
 #include <string>
@@ -38,11 +38,11 @@ namespace avro {
 
 /** Specify type of compression to use when writing data files. */
 enum Codec {
-  NULL_CODEC,
-  DEFLATE_CODEC,
+    NULL_CODEC,
+    DEFLATE_CODEC,
 
 #ifdef SNAPPY_CODEC_AVAILABLE
-  SNAPPY_CODEC
+    SNAPPY_CODEC
 #endif
 
 };
@@ -70,16 +70,16 @@ class AVRO_DECL DataFileWriterBase : boost::noncopyable {
     const DataFileSync sync_;
     int64_t objectCount_;
 
-    typedef std::map<std::string, std::vector<uint8_t> > Metadata;
+    typedef std::map<std::string, std::vector<uint8_t>> Metadata;
 
     Metadata metadata_;
     int64_t lastSync_;
 
-    static std::unique_ptr<OutputStream> makeStream(const char* filename);
+    static std::unique_ptr<OutputStream> makeStream(const char *filename);
     static DataFileSync makeSync();
 
     void writeHeader();
-    void setMetadata(const std::string& key, const std::string& value);
+    void setMetadata(const std::string &key, const std::string &value);
 
     /**
      * Generates a sync marker in the file.
@@ -95,7 +95,7 @@ public:
     /**
      * Returns the current encoder for this writer.
      */
-    Encoder& encoder() const { return *encoderPtr_; }
+    Encoder &encoder() const { return *encoderPtr_; }
 
     /**
      * Returns true if the buffer has sufficient data for a sync to be
@@ -106,7 +106,7 @@ public:
     /**
      * Returns the byte offset (within the current file) of the start of the current block being written.
      */
-    uint64_t getCurrentBlockStart();
+    uint64_t getCurrentBlockStart() const;
 
     /**
      * Increments the object count.
@@ -117,10 +117,10 @@ public:
     /**
      * Constructs a data file writer with the given sync interval and name.
      */
-    DataFileWriterBase(const char* filename, const ValidSchema& schema,
-        size_t syncInterval, Codec codec = NULL_CODEC);
+    DataFileWriterBase(const char *filename, const ValidSchema &schema,
+                       size_t syncInterval, Codec codec = NULL_CODEC);
     DataFileWriterBase(std::unique_ptr<OutputStream> outputStream,
-                       const ValidSchema& schema, size_t syncInterval, Codec codec);
+                       const ValidSchema &schema, size_t syncInterval, Codec codec);
 
     ~DataFileWriterBase();
     /**
@@ -132,7 +132,7 @@ public:
     /**
      * Returns the schema for this data file.
      */
-    const ValidSchema& schema() const { return schema_; }
+    const ValidSchema &schema() const { return schema_; }
 
     /**
      * Flushes any unwritten data into the file.
@@ -143,25 +143,24 @@ public:
 /**
  *  An Avro datafile that can store objects of type T.
  */
-template <typename T>
+template<typename T>
 class DataFileWriter : boost::noncopyable {
     std::unique_ptr<DataFileWriterBase> base_;
+
 public:
     /**
      * Constructs a new data file.
      */
-    DataFileWriter(const char* filename, const ValidSchema& schema,
-        size_t syncInterval = 16 * 1024, Codec codec = NULL_CODEC) :
-        base_(new DataFileWriterBase(filename, schema, syncInterval, codec)) { }
+    DataFileWriter(const char *filename, const ValidSchema &schema,
+                   size_t syncInterval = 16 * 1024, Codec codec = NULL_CODEC) : base_(new DataFileWriterBase(filename, schema, syncInterval, codec)) {}
 
-    DataFileWriter(std::unique_ptr<OutputStream> outputStream, const ValidSchema& schema,
-        size_t syncInterval = 16 * 1024, Codec codec = NULL_CODEC) :
-        base_(new DataFileWriterBase(std::move(outputStream), schema, syncInterval, codec)) { }
+    DataFileWriter(std::unique_ptr<OutputStream> outputStream, const ValidSchema &schema,
+                   size_t syncInterval = 16 * 1024, Codec codec = NULL_CODEC) : base_(new DataFileWriterBase(std::move(outputStream), schema, syncInterval, codec)) {}
 
     /**
      * Writes the given piece of data into the file.
      */
-    void write(const T& datum) {
+    void write(const T &datum) {
         base_->syncIfNeeded();
         avro::encode(base_->encoder(), datum);
         base_->incr();
@@ -172,7 +171,6 @@ public:
      */
     uint64_t getCurrentBlockStart() { return base_->getCurrentBlockStart(); }
 
-
     /**
      * Closes the current file. Once closed this datafile object cannot be
      * used for writing any more.
@@ -182,7 +180,7 @@ public:
     /**
      * Returns the schema for this data file.
      */
-    const ValidSchema& schema() const { return base_->schema(); }
+    const ValidSchema &schema() const { return base_->schema(); }
 
     /**
      * Flushes any unwritten data into the file.
@@ -200,17 +198,17 @@ class AVRO_DECL DataFileReaderBase : boost::noncopyable {
     int64_t objectCount_;
     bool eof_;
     Codec codec_;
-    int64_t blockStart_;
-    int64_t blockEnd_;
+    int64_t blockStart_{};
+    int64_t blockEnd_{};
 
     ValidSchema readerSchema_;
     ValidSchema dataSchema_;
     DecoderPtr dataDecoder_;
     std::unique_ptr<InputStream> dataStream_;
-    typedef std::map<std::string, std::vector<uint8_t> > Metadata;
+    typedef std::map<std::string, std::vector<uint8_t>> Metadata;
 
     Metadata metadata_;
-    DataFileSync sync_;
+    DataFileSync sync_{};
 
     // for compressed buffer
     std::unique_ptr<boost::iostreams::filtering_istream> os_;
@@ -220,11 +218,12 @@ class AVRO_DECL DataFileReaderBase : boost::noncopyable {
 
     void readDataBlock();
     void doSeek(int64_t position);
+
 public:
     /**
      * Returns the current decoder for this reader.
      */
-    Decoder& decoder() { return *dataDecoder_; }
+    Decoder &decoder() { return *dataDecoder_; }
 
     /**
      * Returns true if and only if there is more to read.
@@ -242,9 +241,9 @@ public:
      * This function should be called exactly once after constructing
      * the DataFileReaderBase object.
      */
-    DataFileReaderBase(const char* filename);
+    explicit DataFileReaderBase(const char *filename);
 
-    DataFileReaderBase(std::unique_ptr<InputStream> inputStream);
+    explicit DataFileReaderBase(std::unique_ptr<InputStream> inputStream);
 
     /**
      * Initializes the reader so that the reader and writer schemas
@@ -259,17 +258,17 @@ public:
      * This must be called exactly once after constructing the
      * DataFileReaderBase object.
      */
-    void init(const ValidSchema& readerSchema);
+    void init(const ValidSchema &readerSchema);
 
     /**
      * Returns the schema for this object.
      */
-    const ValidSchema& readerSchema() { return readerSchema_; }
+    const ValidSchema &readerSchema() { return readerSchema_; }
 
     /**
      * Returns the schema stored with the data file.
      */
-    const ValidSchema& dataSchema() { return dataSchema_; }
+    const ValidSchema &dataSchema() { return dataSchema_; }
 
     /**
      * Closes the reader. No further operation is possible on this reader.
@@ -297,27 +296,26 @@ public:
     /**
      * Return the last synchronization point before our current position.
      */
-    int64_t previousSync();
+    int64_t previousSync() const;
 };
 
 /**
  * Reads the contents of data file one after another.
  */
-template <typename T>
+template<typename T>
 class DataFileReader : boost::noncopyable {
     std::unique_ptr<DataFileReaderBase> base_;
+
 public:
     /**
      * Constructs the reader for the given file and the reader is
      * expected to use the given schema.
      */
-    DataFileReader(const char* filename, const ValidSchema& readerSchema) :
-        base_(new DataFileReaderBase(filename)) {
+    DataFileReader(const char *filename, const ValidSchema &readerSchema) : base_(new DataFileReaderBase(filename)) {
         base_->init(readerSchema);
     }
 
-    DataFileReader(std::unique_ptr<InputStream> inputStream, const ValidSchema& readerSchema) :
-        base_(new DataFileReaderBase(std::move(inputStream))) {
+    DataFileReader(std::unique_ptr<InputStream> inputStream, const ValidSchema &readerSchema) : base_(new DataFileReaderBase(std::move(inputStream))) {
         base_->init(readerSchema);
     }
 
@@ -325,13 +323,11 @@ public:
      * Constructs the reader for the given file and the reader is
      * expected to use the schema that is used with data.
      */
-    DataFileReader(const char* filename) :
-        base_(new DataFileReaderBase(filename)) {
+    explicit DataFileReader(const char *filename) : base_(new DataFileReaderBase(filename)) {
         base_->init();
     }
 
-    DataFileReader(std::unique_ptr<InputStream> inputStream) :
-        base_(new DataFileReaderBase(std::move(inputStream))) {
+    explicit DataFileReader(std::unique_ptr<InputStream> inputStream) : base_(new DataFileReaderBase(std::move(inputStream))) {
         base_->init();
     }
 
@@ -344,7 +340,7 @@ public:
      * The schema present in the data file will be used for reading
      * from this reader.
      */
-    DataFileReader(std::unique_ptr<DataFileReaderBase> base) : base_(std::move(base)) {
+    explicit DataFileReader(std::unique_ptr<DataFileReaderBase> base) : base_(std::move(base)) {
         base_->init();
     }
 
@@ -358,7 +354,7 @@ public:
      * from this reader.
      */
     DataFileReader(std::unique_ptr<DataFileReaderBase> base,
-        const ValidSchema& readerSchema) : base_(std::move(base)) {
+                   const ValidSchema &readerSchema) : base_(std::move(base)) {
         base_->init(readerSchema);
     }
 
@@ -367,7 +363,7 @@ public:
      * \return true if an object has been successfully read into \p datum and
      * false if there are no more entries in the file.
      */
-    bool read(T& datum) {
+    bool read(T &datum) {
         if (base_->hasMore()) {
             base_->decr();
             avro::decode(base_->decoder(), datum);
@@ -379,12 +375,12 @@ public:
     /**
      * Returns the schema for this object.
      */
-    const ValidSchema& readerSchema() { return base_->readerSchema(); }
+    const ValidSchema &readerSchema() { return base_->readerSchema(); }
 
     /**
      * Returns the schema stored with the data file.
      */
-    const ValidSchema& dataSchema() { return base_->dataSchema(); }
+    const ValidSchema &dataSchema() { return base_->dataSchema(); }
 
     /**
      * Closes the reader. No further operation is possible on this reader.
@@ -415,5 +411,5 @@ public:
     int64_t previousSync() { return base_->previousSync(); }
 };
 
-}   // namespace avro
+} // namespace avro
 #endif

+ 19 - 20
contrib/libs/apache/avro/api/Decoder.hh

@@ -20,13 +20,13 @@
 #define avro_Decoder_hh__
 
 #include "Config.hh"
-#include <stdint.h>
+#include <cstdint>
+#include <memory>
 #include <string>
 #include <vector>
-#include <memory>
 
-#include "ValidSchema.hh"
 #include "Stream.hh"
+#include "ValidSchema.hh"
 
 /// \file
 ///
@@ -47,11 +47,11 @@ namespace avro {
  */
 class AVRO_DECL Decoder {
 public:
-    virtual ~Decoder() { };
+    virtual ~Decoder() = default;
     /// All future decoding will come from is, which should be valid
     /// until replaced by another call to init() or this Decoder is
     /// destructed.
-    virtual void init(InputStream& is) = 0;
+    virtual void init(InputStream &is) = 0;
 
     /// Decodes a null from the current stream.
     virtual void decodeNull() = 0;
@@ -81,12 +81,12 @@ public:
     /**
      * Decodes a UTF-8 string from the stream and assigns it to value.
      */
-    virtual void decodeString(std::string& value) = 0;
+    virtual void decodeString(std::string &value) = 0;
 
     /// Skips a string on the current stream.
     virtual void skipString() = 0;
 
-    /// Decodes arbitray binary data from the current stream.
+    /// Decodes arbitrary binary data from the current stream.
     std::vector<uint8_t> decodeBytes() {
         std::vector<uint8_t> result;
         decodeBytes(result);
@@ -95,7 +95,7 @@ public:
 
     /// Decodes arbitrary binary data from the current stream and puts it
     /// in value.
-    virtual void decodeBytes(std::vector<uint8_t>& value) = 0;
+    virtual void decodeBytes(std::vector<uint8_t> &value) = 0;
 
     /// Skips bytes on the current stream.
     virtual void skipBytes() = 0;
@@ -116,9 +116,9 @@ public:
      * Decodes a fixed from the current stream.
      * \param[in] n The size (byte count) of the fixed being read.
      * \param[out] value The value that receives the fixed. The vector will
-     * be size-adjusted based on the fixed's size.
+     * be size-adjusted based on the fixed schema's size.
      */
-    virtual void decodeFixed(size_t n, std::vector<uint8_t>& value) = 0;
+    virtual void decodeFixed(size_t n, std::vector<uint8_t> &value) = 0;
 
     /// Skips fixed length binary on the current stream.
     virtual void skipFixed(size_t n) = 0;
@@ -174,7 +174,7 @@ public:
 /**
  * Shared pointer to Decoder.
  */
-typedef std::shared_ptr<Decoder> DecoderPtr;
+using DecoderPtr = std::shared_ptr<Decoder>;
 
 /**
  * ResolvingDecoder is derived from \ref Decoder, with an additional
@@ -187,13 +187,13 @@ public:
     /// order in the schema because the writer's field order could
     /// be different. In order to avoid buffering and later use,
     /// we return the values in the writer's field order.
-    virtual const std::vector<size_t>& fieldOrder() = 0;
+    virtual const std::vector<size_t> &fieldOrder() = 0;
 };
 
 /**
  * Shared pointer to ResolvingDecoder.
  */
-typedef std::shared_ptr<ResolvingDecoder> ResolvingDecoderPtr;
+using ResolvingDecoderPtr = std::shared_ptr<ResolvingDecoder>;
 /**
  *  Returns an decoder that can decode binary Avro standard.
  */
@@ -203,13 +203,13 @@ AVRO_DECL DecoderPtr binaryDecoder();
  *  Returns an decoder that validates sequence of calls to an underlying
  *  Decoder against the given schema.
  */
-AVRO_DECL DecoderPtr validatingDecoder(const ValidSchema& schema,
-    const DecoderPtr& base);
+AVRO_DECL DecoderPtr validatingDecoder(const ValidSchema &schema,
+                                       const DecoderPtr &base);
 
 /**
  *  Returns an decoder that can decode Avro standard for JSON.
  */
-AVRO_DECL DecoderPtr jsonDecoder(const ValidSchema& schema);
+AVRO_DECL DecoderPtr jsonDecoder(const ValidSchema &schema);
 
 /**
  *  Returns a decoder that decodes avro data from base written according to
@@ -217,10 +217,9 @@ AVRO_DECL DecoderPtr jsonDecoder(const ValidSchema& schema);
  *  The client uses the decoder as if the data were written using readerSchema.
  *  // FIXME: Handle out of order fields.
  */
-AVRO_DECL ResolvingDecoderPtr resolvingDecoder(const ValidSchema& writer,
-    const ValidSchema& reader, const DecoderPtr& base);
-
+AVRO_DECL ResolvingDecoderPtr resolvingDecoder(const ValidSchema &writer,
+                                               const ValidSchema &reader, const DecoderPtr &base);
 
-}   // namespace avro
+} // namespace avro
 
 #endif

+ 18 - 18
contrib/libs/apache/avro/api/Encoder.hh

@@ -20,18 +20,18 @@
 #define avro_Encoder_hh__
 
 #include "Config.hh"
-#include <stdint.h>
+#include <cstdint>
+#include <memory>
 #include <string>
 #include <vector>
-#include <memory>
 
-#include "ValidSchema.hh"
 #include "Stream.hh"
+#include "ValidSchema.hh"
 
 /// \file
 ///
 /// Low level support for encoding avro values.
-/// This class has two types of funtions.  One type of functions support
+/// This class has two types of functions.  One type of functions support
 /// the writing of leaf values (for example, encodeLong and
 /// encodeString).  These functions have analogs in Decoder.
 ///
@@ -46,16 +46,16 @@ namespace avro {
 
 /**
  * The abstract base class for all Avro encoders. The implementations
- * differ in the method of encoding (binary vresus JSON) or in capabilities
+ * differ in the method of encoding (binary versus JSON) or in capabilities
  * such as ability to verify the order of invocation of different functions.
  */
 class AVRO_DECL Encoder {
 public:
-    virtual ~Encoder() { };
+    virtual ~Encoder() = default;
     /// All future encodings will go to os, which should be valid until
     /// it is reset with another call to init() or the encoder is
     /// destructed.
-    virtual void init(OutputStream& os) = 0;
+    virtual void init(OutputStream &os) = 0;
 
     /// Flushes any data in internal buffers.
     virtual void flush() = 0;
@@ -83,10 +83,10 @@ public:
     virtual void encodeDouble(double d) = 0;
 
     /// Encodes a UTF-8 string to the current stream.
-    virtual void encodeString(const std::string& s) = 0;
+    virtual void encodeString(const std::string &s) = 0;
 
     /**
-     * Encodes aribtray binary data into tthe current stream as Avro "bytes"
+     * Encodes arbitrary binary data into the current stream as Avro "bytes"
      * data type.
      * \param bytes Where the data is
      * \param len Number of bytes at \p bytes.
@@ -94,11 +94,11 @@ public:
     virtual void encodeBytes(const uint8_t *bytes, size_t len) = 0;
 
     /**
-     * Encodes aribtray binary data into tthe current stream as Avro "bytes"
+     * Encodes arbitrary binary data into the current stream as Avro "bytes"
      * data type.
      * \param bytes The data.
      */
-    void encodeBytes(const std::vector<uint8_t>& bytes) {
+    void encodeBytes(const std::vector<uint8_t> &bytes) {
         uint8_t b = 0;
         encodeBytes(bytes.empty() ? &b : bytes.data(), bytes.size());
     }
@@ -111,7 +111,7 @@ public:
      * \param bytes The fixed, the length of which is taken as the size
      * of fixed.
      */
-    void encodeFixed(const std::vector<uint8_t>& bytes) {
+    void encodeFixed(const std::vector<uint8_t> &bytes) {
         encodeFixed(bytes.data(), bytes.size());
     }
 
@@ -144,7 +144,7 @@ public:
 /**
  * Shared pointer to Encoder.
  */
-typedef std::shared_ptr<Encoder> EncoderPtr;
+using EncoderPtr = std::shared_ptr<Encoder>;
 
 /**
  *  Returns an encoder that can encode binary Avro standard.
@@ -155,19 +155,19 @@ AVRO_DECL EncoderPtr binaryEncoder();
  *  Returns an encoder that validates sequence of calls to an underlying
  *  Encoder against the given schema.
  */
-AVRO_DECL EncoderPtr validatingEncoder(const ValidSchema& schema,
-    const EncoderPtr& base);
+AVRO_DECL EncoderPtr validatingEncoder(const ValidSchema &schema,
+                                       const EncoderPtr &base);
 
 /**
  *  Returns an encoder that encodes Avro standard for JSON.
  */
-AVRO_DECL EncoderPtr jsonEncoder(const ValidSchema& schema);
+AVRO_DECL EncoderPtr jsonEncoder(const ValidSchema &schema);
 
 /**
  *  Returns an encoder that encodes Avro standard for pretty printed JSON.
  */
-AVRO_DECL EncoderPtr jsonPrettyEncoder(const ValidSchema& schema);
+AVRO_DECL EncoderPtr jsonPrettyEncoder(const ValidSchema &schema);
 
-}   // namespace avro
+} // namespace avro
 
 #endif

+ 5 - 11
contrib/libs/apache/avro/api/Exception.hh

@@ -20,25 +20,19 @@
 #define avro_Exception_hh__
 
 #include "Config.hh"
-#include <stdexcept>
 #include <boost/format.hpp>
+#include <stdexcept>
 
 namespace avro {
 
 /// Wrapper for std::runtime_error that provides convenience constructor
 /// for boost::format objects
 
-class AVRO_DECL Exception : public virtual std::runtime_error
-{
-  public:
-
-    Exception(const std::string &msg) :
-        std::runtime_error(msg)
-    { }
+class AVRO_DECL Exception : public virtual std::runtime_error {
+public:
+    explicit Exception(const std::string &msg) : std::runtime_error(msg) {}
 
-    Exception(const boost::format &msg) :
-        std::runtime_error( boost::str(msg))
-    { }
+    explicit Exception(const boost::format &msg) : std::runtime_error(boost::str(msg)) {}
 };
 
 } // namespace avro

+ 28 - 25
contrib/libs/apache/avro/api/Generic.hh

@@ -22,10 +22,10 @@
 #include <boost/utility.hpp>
 
 #include "Config.hh"
-#include "Types.hh"
-#include "Encoder.hh"
 #include "Decoder.hh"
+#include "Encoder.hh"
 #include "GenericDatum.hh"
+#include "Types.hh"
 
 namespace avro {
 /**
@@ -36,25 +36,26 @@ class AVRO_DECL GenericReader : boost::noncopyable {
     const bool isResolving_;
     const DecoderPtr decoder_;
 
-    static void read(GenericDatum& datum, Decoder& d, bool isResolving);
+    static void read(GenericDatum &datum, Decoder &d, bool isResolving);
+
 public:
     /**
      * Constructs a reader for the given schema using the given decoder.
      */
-    GenericReader(const ValidSchema& s, const DecoderPtr& decoder);
+    GenericReader(ValidSchema s, const DecoderPtr &decoder);
 
     /**
      * Constructs a reader for the given reader's schema \c readerSchema
      * using the given
      * decoder which holds data matching writer's schema \c writerSchema.
      */
-    GenericReader(const ValidSchema& writerSchema,
-        const ValidSchema& readerSchema, const DecoderPtr& decoder);
+    GenericReader(const ValidSchema &writerSchema,
+                  const ValidSchema &readerSchema, const DecoderPtr &decoder);
 
     /**
      * Reads a value off the decoder.
      */
-    void read(GenericDatum& datum) const;
+    void read(GenericDatum &datum) const;
 
     /**
      * Drains any residual bytes in the input stream (e.g. because
@@ -67,15 +68,14 @@ public:
     /**
      * Reads a generic datum from the stream, using the given schema.
      */
-    static void read(Decoder& d, GenericDatum& g);
+    static void read(Decoder &d, GenericDatum &g);
 
     /**
      * Reads a generic datum from the stream, using the given schema.
      */
-    static void read(Decoder& d, GenericDatum& g, const ValidSchema& s);
+    static void read(Decoder &d, GenericDatum &g, const ValidSchema &s);
 };
 
-
 /**
  * A utility class to write generic datum to encoders.
  */
@@ -83,48 +83,51 @@ class AVRO_DECL GenericWriter : boost::noncopyable {
     const ValidSchema schema_;
     const EncoderPtr encoder_;
 
-    static void write(const GenericDatum& datum, Encoder& e);
+    static void write(const GenericDatum &datum, Encoder &e);
+
 public:
     /**
      * Constructs a writer for the given schema using the given encoder.
      */
-    GenericWriter(const ValidSchema& s, const EncoderPtr& encoder);
+    GenericWriter(ValidSchema s, EncoderPtr encoder);
 
     /**
      * Writes a value onto the encoder.
      */
-    void write(const GenericDatum& datum) const;
+    void write(const GenericDatum &datum) const;
 
     /**
      * Writes a generic datum on to the stream.
      */
-    static void write(Encoder& e, const GenericDatum& g);
+    static void write(Encoder &e, const GenericDatum &g);
 
     /**
      * Writes a generic datum on to the stream, using the given schema.
      * Retained for backward compatibility.
      */
-    static void write(Encoder& e, const GenericDatum& g, const ValidSchema&) {
+    static void write(Encoder &e, const GenericDatum &g, const ValidSchema &) {
         write(e, g);
     }
 };
 
-template <typename T> struct codec_traits;
+template<typename T>
+struct codec_traits;
 
 /**
  * Specialization of codec_traits for Generic datum along with its schema.
  * This is maintained for compatibility with old code. Please use the
  * cleaner codec_traits<GenericDatum> instead.
  */
-template <> struct codec_traits<std::pair<ValidSchema, GenericDatum> > {
+template<>
+struct codec_traits<std::pair<ValidSchema, GenericDatum>> {
     /** Encodes */
-    static void encode(Encoder& e,
-        const std::pair<ValidSchema, GenericDatum>& p) {
+    static void encode(Encoder &e,
+                       const std::pair<ValidSchema, GenericDatum> &p) {
         GenericWriter::write(e, p.second, p.first);
     }
 
     /** Decodes */
-    static void decode(Decoder& d, std::pair<ValidSchema, GenericDatum>& p) {
+    static void decode(Decoder &d, std::pair<ValidSchema, GenericDatum> &p) {
         GenericReader::read(d, p.second, p.first);
     }
 };
@@ -132,18 +135,18 @@ template <> struct codec_traits<std::pair<ValidSchema, GenericDatum> > {
 /**
  * Specialization of codec_traits for GenericDatum.
  */
-template <> struct codec_traits<GenericDatum> {
+template<>
+struct codec_traits<GenericDatum> {
     /** Encodes */
-    static void encode(Encoder& e, const GenericDatum& g) {
+    static void encode(Encoder &e, const GenericDatum &g) {
         GenericWriter::write(e, g);
     }
 
     /** Decodes */
-    static void decode(Decoder& d, GenericDatum& g) {
+    static void decode(Decoder &d, GenericDatum &g) {
         GenericReader::read(d, g);
     }
 };
 
-}   // namespace avro
+} // namespace avro
 #endif
-

+ 105 - 77
contrib/libs/apache/avro/api/GenericDatum.hh

@@ -19,10 +19,10 @@
 #ifndef avro_GenericDatum_hh__
 #define avro_GenericDatum_hh__
 
-#include <stdint.h>
-#include <vector>
+#include <cstdint>
 #include <map>
 #include <string>
+#include <vector>
 
 #if __cplusplus >= 201703L
 #include <any>
@@ -54,7 +54,7 @@ namespace avro {
  * \li Avro <tt>array</tt> maps to C++ class <tt>GenericArray</tt>.
  * \li Avro <tt>map</tt> maps to C++ class <tt>GenericMap</tt>.
  * \li There is no C++ type corresponding to Avro <tt>union</tt>. The
- * object should have the C++ type corresponing to one of the constituent
+ * object should have the C++ type corresponding to one of the constituent
  * types of the union.
  *
  */
@@ -68,17 +68,18 @@ protected:
     boost::any value_;
 #endif
 
-    GenericDatum(Type t)
-        : type_(t), logicalType_(LogicalType::NONE) { }
+    explicit GenericDatum(Type t)
+        : type_(t), logicalType_(LogicalType::NONE) {}
 
     GenericDatum(Type t, LogicalType logicalType)
-        : type_(t), logicalType_(logicalType) { }
+        : type_(t), logicalType_(logicalType) {}
+
+    template<typename T>
+    GenericDatum(Type t, LogicalType logicalType, const T &v)
+        : type_(t), logicalType_(logicalType), value_(v) {}
 
-    template <typename T>
-    GenericDatum(Type t, LogicalType logicalType, const T& v)
-        : type_(t), logicalType_(logicalType), value_(v) { }
+    void init(const NodePtr &schema);
 
-    void init(const NodePtr& schema);
 public:
     /**
      * The avro data type this datum holds.
@@ -95,7 +96,8 @@ public:
      * T The type for the value. This must correspond to the
      * avro type returned by type().
      */
-    template<typename T> const T& value() const;
+    template<typename T>
+    const T &value() const;
 
     /**
      * Returns the reference to the value held by this datum, which
@@ -106,7 +108,8 @@ public:
      * T The type for the value. This must correspond to the
      * avro type returned by type().
      */
-    template<typename T> T& value();
+    template<typename T>
+    T &value();
 
     /**
      * Returns true if and only if this datum is a union.
@@ -126,36 +129,49 @@ public:
     void selectBranch(size_t branch);
 
     /// Makes a new AVRO_NULL datum.
-    GenericDatum() : type_(AVRO_NULL), logicalType_(LogicalType::NONE) { }
+    GenericDatum() : type_(AVRO_NULL), logicalType_(LogicalType::NONE) {}
 
     /// Makes a new AVRO_BOOL datum whose value is of type bool.
+    /// We don't make this explicit constructor because we want to allow automatic conversion
+    // NOLINTNEXTLINE(google-explicit-constructor)
     GenericDatum(bool v)
-        : type_(AVRO_BOOL), logicalType_(LogicalType::NONE), value_(v) { }
+        : type_(AVRO_BOOL), logicalType_(LogicalType::NONE), value_(v) {}
 
     /// Makes a new AVRO_INT datum whose value is of type int32_t.
+    /// We don't make this explicit constructor because we want to allow automatic conversion
+    // NOLINTNEXTLINE(google-explicit-constructor)
     GenericDatum(int32_t v)
-        : type_(AVRO_INT), logicalType_(LogicalType::NONE), value_(v) { }
+        : type_(AVRO_INT), logicalType_(LogicalType::NONE), value_(v) {}
 
     /// Makes a new AVRO_LONG datum whose value is of type int64_t.
+    /// We don't make this explicit constructor because we want to allow automatic conversion
+    // NOLINTNEXTLINE(google-explicit-constructor)
     GenericDatum(int64_t v)
-        : type_(AVRO_LONG), logicalType_(LogicalType::NONE), value_(v) { }
+        : type_(AVRO_LONG), logicalType_(LogicalType::NONE), value_(v) {}
 
     /// Makes a new AVRO_FLOAT datum whose value is of type float.
+    /// We don't make this explicit constructor because we want to allow automatic conversion
+    // NOLINTNEXTLINE(google-explicit-constructor)
     GenericDatum(float v)
-        : type_(AVRO_FLOAT), logicalType_(LogicalType::NONE), value_(v) { }
+        : type_(AVRO_FLOAT), logicalType_(LogicalType::NONE), value_(v) {}
 
     /// Makes a new AVRO_DOUBLE datum whose value is of type double.
+    /// We don't make this explicit constructor because we want to allow automatic conversion
+    // NOLINTNEXTLINE(google-explicit-constructor)
     GenericDatum(double v)
-        : type_(AVRO_DOUBLE), logicalType_(LogicalType::NONE), value_(v) { }
+        : type_(AVRO_DOUBLE), logicalType_(LogicalType::NONE), value_(v) {}
 
     /// Makes a new AVRO_STRING datum whose value is of type std::string.
-    GenericDatum(const std::string& v)
-        : type_(AVRO_STRING), logicalType_(LogicalType::NONE), value_(v) { }
+    /// We don't make this explicit constructor because we want to allow automatic conversion
+    // NOLINTNEXTLINE(google-explicit-constructor)
+    GenericDatum(const std::string &v)
+        : type_(AVRO_STRING), logicalType_(LogicalType::NONE), value_(v) {}
 
     /// Makes a new AVRO_BYTES datum whose value is of type
     /// std::vector<uint8_t>.
-    GenericDatum(const std::vector<uint8_t>& v) :
-        type_(AVRO_BYTES), logicalType_(LogicalType::NONE), value_(v) { }
+    /// We don't make this explicit constructor because we want to allow automatic conversion
+    // NOLINTNEXTLINE(google-explicit-constructor)
+    GenericDatum(const std::vector<uint8_t> &v) : type_(AVRO_BYTES), logicalType_(LogicalType::NONE), value_(v) {}
 
     /**
      * Constructs a datum corresponding to the given avro type.
@@ -163,7 +179,9 @@ public:
      * data type.
      * \param schema The schema that defines the avro type.
      */
-    GenericDatum(const NodePtr& schema);
+    /// We don't make this explicit constructor because we want to allow automatic conversion
+    // NOLINTNEXTLINE(google-explicit-constructor)
+    GenericDatum(const NodePtr &schema);
 
     /**
      * Constructs a datum corresponding to the given avro type and set
@@ -172,8 +190,7 @@ public:
      * \param v The value for this type.
      */
     template<typename T>
-    GenericDatum(const NodePtr& schema, const T& v) :
-        type_(schema->type()), logicalType_(schema->logicalType()) {
+    GenericDatum(const NodePtr &schema, const T &v) : type_(schema->type()), logicalType_(schema->logicalType()) {
         init(schema);
 #if __cplusplus >= 201703L
         *std::any_cast<T>(&value_) = v;
@@ -188,7 +205,7 @@ public:
      * data type.
      * \param schema The schema that defines the avro type.
      */
-    GenericDatum(const ValidSchema& schema);
+    explicit GenericDatum(const ValidSchema &schema);
 };
 
 /**
@@ -196,18 +213,19 @@ public:
  */
 class AVRO_DECL GenericContainer {
     NodePtr schema_;
-    static void assertType(const NodePtr& schema, Type type);
+    static void assertType(const NodePtr &schema, Type type);
+
 protected:
     /**
      * Constructs a container corresponding to the given schema.
      */
-    GenericContainer(Type type, const NodePtr& s) : schema_(s) {
+    GenericContainer(Type type, const NodePtr &s) : schema_(s) {
         assertType(s, type);
     }
 
 public:
     /// Returns the schema for this object
-    const NodePtr& schema() const {
+    const NodePtr &schema() const {
         return schema_;
     }
 };
@@ -225,8 +243,7 @@ public:
      * and the given value. The schema should be of Avro type union
      * and the value should correspond to one of the branches of the union.
      */
-    GenericUnion(const NodePtr& schema) :
-        GenericContainer(AVRO_UNION, schema), curBranch_(schema->leaves()) {
+    explicit GenericUnion(const NodePtr &schema) : GenericContainer(AVRO_UNION, schema), curBranch_(schema->leaves()) {
         selectBranch(0);
     }
 
@@ -250,7 +267,7 @@ public:
      * Returns the datum corresponding to the currently selected branch
      * in this union.
      */
-    GenericDatum& datum() {
+    GenericDatum &datum() {
         return datum_;
     }
 
@@ -258,7 +275,7 @@ public:
      * Returns the datum corresponding to the currently selected branch
      * in this union.
      */
-    const GenericDatum& datum() const {
+    const GenericDatum &datum() const {
         return datum_;
     }
 };
@@ -268,12 +285,13 @@ public:
  */
 class AVRO_DECL GenericRecord : public GenericContainer {
     std::vector<GenericDatum> fields_;
+
 public:
     /**
      * Constructs a generic record corresponding to the given schema \p schema,
      * which should be of Avro type record.
      */
-    GenericRecord(const NodePtr& schema);
+    explicit GenericRecord(const NodePtr &schema);
 
     /**
      * Returns the number of fields in the current record.
@@ -285,7 +303,7 @@ public:
     /**
      * Returns index of the field with the given name \p name
      */
-    size_t fieldIndex(const std::string& name) const {
+    size_t fieldIndex(const std::string &name) const {
         size_t index = 0;
         if (!schema()->nameIndex(name, index)) {
             throw Exception("Invalid field name: " + name);
@@ -297,7 +315,7 @@ public:
      * Returns true if a field with the given name \p name is located in this r
      * false otherwise
      */
-    bool hasField(const std::string& name) const {
+    bool hasField(const std::string &name) const {
         size_t index = 0;
         return schema()->nameIndex(name, index);
     }
@@ -305,7 +323,7 @@ public:
     /**
      * Returns the field with the given name \p name.
      */
-    const GenericDatum& field(const std::string& name) const {
+    const GenericDatum &field(const std::string &name) const {
         return fieldAt(fieldIndex(name));
     }
 
@@ -313,14 +331,14 @@ public:
      * Returns the reference to the field with the given name \p name,
      * which can be used to change the contents.
      */
-    GenericDatum& field(const std::string& name) {
+    GenericDatum &field(const std::string &name) {
         return fieldAt(fieldIndex(name));
     }
 
     /**
      * Returns the field at the given position \p pos.
      */
-    const GenericDatum& fieldAt(size_t pos) const {
+    const GenericDatum &fieldAt(size_t pos) const {
         return fields_[pos];
     }
 
@@ -328,14 +346,14 @@ public:
      * Returns the reference to the field at the given position \p pos,
      * which can be used to change the contents.
      */
-    GenericDatum& fieldAt(size_t pos) {
+    GenericDatum &fieldAt(size_t pos) {
         return fields_[pos];
     }
 
     /**
      * Replaces the field at the given position \p pos with \p v.
      */
-    void setFieldAt(size_t pos, const GenericDatum& v) {
+    void setFieldAt(size_t pos, const GenericDatum &v) {
         // assertSameType(v, schema()->leafAt(pos));
         fields_[pos] = v;
     }
@@ -355,22 +373,23 @@ public:
      * Constructs a generic array corresponding to the given schema \p schema,
      * which should be of Avro type array.
      */
-    GenericArray(const NodePtr& schema) : GenericContainer(AVRO_ARRAY, schema) {
+    explicit GenericArray(const NodePtr &schema) : GenericContainer(AVRO_ARRAY, schema) {
     }
 
     /**
      * Returns the contents of this array.
      */
-    const Value& value() const {
+    const Value &value() const {
         return value_;
     }
 
     /**
      * Returns the reference to the contents of this array.
      */
-    Value& value() {
+    Value &value() {
         return value_;
     }
+
 private:
     Value value_;
 };
@@ -383,28 +402,29 @@ public:
     /**
      * The contents type for the map.
      */
-    typedef std::vector<std::pair<std::string, GenericDatum> > Value;
+    typedef std::vector<std::pair<std::string, GenericDatum>> Value;
 
     /**
      * Constructs a generic map corresponding to the given schema \p schema,
      * which should be of Avro type map.
      */
-    GenericMap(const NodePtr& schema) : GenericContainer(AVRO_MAP, schema) {
+    explicit GenericMap(const NodePtr &schema) : GenericContainer(AVRO_MAP, schema) {
     }
 
     /**
      * Returns the contents of this map.
      */
-    const Value& value() const {
+    const Value &value() const {
         return value_;
     }
 
     /**
      * Returns the reference to the contents of this map.
      */
-    Value& value() {
+    Value &value() {
         return value_;
     }
+
 private:
     Value value_;
 };
@@ -415,7 +435,7 @@ private:
 class AVRO_DECL GenericEnum : public GenericContainer {
     size_t value_;
 
-    static size_t index(const NodePtr& schema, const std::string& symbol) {
+    static size_t index(const NodePtr &schema, const std::string &symbol) {
         size_t result;
         if (schema->nameIndex(symbol, result)) {
             return result;
@@ -428,19 +448,17 @@ public:
      * Constructs a generic enum corresponding to the given schema \p schema,
      * which should be of Avro type enum.
      */
-    GenericEnum(const NodePtr& schema) :
-        GenericContainer(AVRO_ENUM, schema), value_(0) {
+    explicit GenericEnum(const NodePtr &schema) : GenericContainer(AVRO_ENUM, schema), value_(0) {
     }
 
-    GenericEnum(const NodePtr& schema, const std::string& symbol) :
-        GenericContainer(AVRO_ENUM, schema), value_(index(schema, symbol)) {
+    GenericEnum(const NodePtr &schema, const std::string &symbol) : GenericContainer(AVRO_ENUM, schema), value_(index(schema, symbol)) {
     }
 
     /**
      * Returns the symbol corresponding to the cardinal \p n. If the
      * value for \p n is not within the limits an exception is thrown.
      */
-    const std::string& symbol(size_t n) {
+    const std::string &symbol(size_t n) {
         if (n < schema()->names()) {
             return schema()->nameAt(n);
         }
@@ -451,14 +469,14 @@ public:
      * Returns the cardinal for the given symbol \c symbol. If the symbol
      * is not defined for this enum and exception is thrown.
      */
-    size_t index(const std::string& symbol) const {
+    size_t index(const std::string &symbol) const {
         return index(schema(), symbol);
     }
 
     /**
      * Set the value for this enum corresponding to the given symbol \c symbol.
      */
-    size_t set(const std::string& symbol) {
+    size_t set(const std::string &symbol) {
         return value_ = index(symbol);
     }
 
@@ -483,7 +501,7 @@ public:
     /**
      * Returns the symbol for the current value of this enum.
      */
-    const std::string& symbol() const {
+    const std::string &symbol() const {
         return schema()->nameAt(value_);
     }
 };
@@ -493,29 +511,29 @@ public:
  */
 class AVRO_DECL GenericFixed : public GenericContainer {
     std::vector<uint8_t> value_;
+
 public:
     /**
      * Constructs a generic enum corresponding to the given schema \p schema,
      * which should be of Avro type fixed.
      */
-    GenericFixed(const NodePtr& schema) : GenericContainer(AVRO_FIXED, schema) {
+    explicit GenericFixed(const NodePtr &schema) : GenericContainer(AVRO_FIXED, schema) {
         value_.resize(schema->fixedSize());
     }
 
-    GenericFixed(const NodePtr& schema, const std::vector<uint8_t>& v) :
-        GenericContainer(AVRO_FIXED, schema), value_(v) { }
+    GenericFixed(const NodePtr &schema, const std::vector<uint8_t> &v);
 
     /**
      * Returns the contents of this fixed.
      */
-    const std::vector<uint8_t>& value() const {
+    const std::vector<uint8_t> &value() const {
         return value_;
     }
 
     /**
      * Returns the reference to the contents of this fixed.
      */
-    std::vector<uint8_t>& value() {
+    std::vector<uint8_t> &value() {
         return value_;
     }
 };
@@ -523,36 +541,46 @@ public:
 inline Type GenericDatum::type() const {
     return (type_ == AVRO_UNION) ?
 #if __cplusplus >= 201703L
-        std::any_cast<GenericUnion>(&value_)->datum().type() :
+                                 std::any_cast<GenericUnion>(&value_)->datum().type()
+                                 :
 #else
-        boost::any_cast<GenericUnion>(&value_)->datum().type() :
+                                 boost::any_cast<GenericUnion>(&value_)->datum().type()
+                                 :
 #endif
-        type_;
+                                 type_;
 }
 
 inline LogicalType GenericDatum::logicalType() const {
-    return logicalType_;
+    return (type_ == AVRO_UNION) ?
+#if __cplusplus >= 201703L
+        std::any_cast<GenericUnion>(&value_)->datum().logicalType() :
+#else
+        boost::any_cast<GenericUnion>(&value_)->datum().logicalType() :
+#endif
+        logicalType_;
 }
 
-template<typename T> T& GenericDatum::value() {
+template<typename T>
+T &GenericDatum::value() {
     return (type_ == AVRO_UNION) ?
 #if __cplusplus >= 201703L
-        std::any_cast<GenericUnion>(&value_)->datum().value<T>() :
-        *std::any_cast<T>(&value_);
+                                 std::any_cast<GenericUnion>(&value_)->datum().value<T>()
+                                 : *std::any_cast<T>(&value_);
 #else
-        boost::any_cast<GenericUnion>(&value_)->datum().value<T>() :
-        *boost::any_cast<T>(&value_);
+                                 boost::any_cast<GenericUnion>(&value_)->datum().value<T>()
+                                 : *boost::any_cast<T>(&value_);
 #endif
 }
 
-template<typename T> const T& GenericDatum::value() const {
+template<typename T>
+const T &GenericDatum::value() const {
     return (type_ == AVRO_UNION) ?
 #if __cplusplus >= 201703L
-        std::any_cast<GenericUnion>(&value_)->datum().value<T>() :
-        *std::any_cast<T>(&value_);
+                                 std::any_cast<GenericUnion>(&value_)->datum().value<T>()
+                                 : *std::any_cast<T>(&value_);
 #else
-        boost::any_cast<GenericUnion>(&value_)->datum().value<T>() :
-        *boost::any_cast<T>(&value_);
+                                 boost::any_cast<GenericUnion>(&value_)->datum().value<T>()
+                                 : *boost::any_cast<T>(&value_);
 #endif
 }
 
@@ -572,5 +600,5 @@ inline void GenericDatum::selectBranch(size_t branch) {
 #endif
 }
 
-}   // namespace avro
+} // namespace avro
 #endif // avro_GenericDatum_hh__

Some files were not shown because too many files changed in this diff