You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/08/23 12:45:53 UTC

[avro] 02/02: AVRO-3616: [C++]: Fix compilation warnings

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch avro-3616-c++-fix-compilation-warnings
in repository https://gitbox.apache.org/repos/asf/avro.git

commit 91f7a1dc14c7f881d76cbe2e7d39bcda1109575b
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Tue Aug 23 15:43:16 2022 +0300

    AVRO-3616: [C++]: Fix compilation warnings
    
    Fix the order of constructor parameters
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
 lang/c++/impl/DataFile.cc    | 10 +++++-----
 lang/c++/impl/Resolver.cc    |  2 +-
 lang/c++/impl/ValidSchema.cc |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lang/c++/impl/DataFile.cc b/lang/c++/impl/DataFile.cc
index f215f95b1..e58bc4f99 100644
--- a/lang/c++/impl/DataFile.cc
+++ b/lang/c++/impl/DataFile.cc
@@ -259,14 +259,14 @@ void DataFileWriterBase::setMetadata(const string &key, const string &value) {
     metadata_[key] = v;
 }
 
-DataFileReaderBase::DataFileReaderBase(const char *filename) : filename_(filename), codec_(NULL_CODEC), stream_(fileSeekableInputStream(filename)),
-                                                               decoder_(binaryDecoder()), objectCount_(0), eof_(false), blockStart_(-1),
-                                                               blockEnd_(-1) {
+DataFileReaderBase::DataFileReaderBase(const char *filename) : filename_(filename), stream_(fileSeekableInputStream(filename)),
+                                                               decoder_(binaryDecoder()), objectCount_(0), eof_(false),
+                                                               codec_(NULL_CODEC), blockStart_(-1), blockEnd_(-1) {
     readHeader();
 }
 
-DataFileReaderBase::DataFileReaderBase(std::unique_ptr<InputStream> inputStream) : codec_(NULL_CODEC), stream_(std::move(inputStream)),
-                                                                                   decoder_(binaryDecoder()), objectCount_(0), eof_(false) {
+DataFileReaderBase::DataFileReaderBase(std::unique_ptr<InputStream> inputStream) : stream_(std::move(inputStream)),
+                                                                                   decoder_(binaryDecoder()), objectCount_(0), eof_(false), codec_(NULL_CODEC) {
     readHeader();
 }
 
diff --git a/lang/c++/impl/Resolver.cc b/lang/c++/impl/Resolver.cc
index 919345e8a..d19a04ad7 100644
--- a/lang/c++/impl/Resolver.cc
+++ b/lang/c++/impl/Resolver.cc
@@ -710,8 +710,8 @@ NonUnionToUnionParser::NonUnionToUnionParser(ResolverFactory &factory,
                                              const NodePtr &writer,
                                              const NodePtr &reader,
                                              const CompoundLayout &offsets) : Resolver(),
-                                                                              offset_(offsets.offset()),
                                                                               choice_(0),
+                                                                              offset_(offsets.offset()),
                                                                               choiceOffset_(offsets.at(0).offset()),
                                                                               setFuncOffset_(offsets.at(1).offset()) {
 #ifndef NDEBUG
diff --git a/lang/c++/impl/ValidSchema.cc b/lang/c++/impl/ValidSchema.cc
index 63a3bbee9..ca2d9ffe0 100644
--- a/lang/c++/impl/ValidSchema.cc
+++ b/lang/c++/impl/ValidSchema.cc
@@ -70,7 +70,7 @@ static bool validate(const NodePtr &node, SymbolMap &symbolMap) {
 
     node->lock();
     auto leaves = node->leaves();
-    for (auto i = 0; i < leaves; ++i) {
+    for (long unsigned int i = 0; i < leaves; ++i) {
         const NodePtr &leaf(node->leafAt(i));
 
         if (!validate(leaf, symbolMap)) {