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

mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/main by this push:
     new 2d3029dda [C++] g++ (GCC) 14.2.1 20240910 fails to compile due to 
-Werror=conversion (#3166)
2d3029dda is described below

commit 2d3029ddae1ade2769bcb8b30e597db25dd56d1f
Author: hexagonhill <[email protected]>
AuthorDate: Mon Sep 23 11:18:54 2024 +0000

    [C++] g++ (GCC) 14.2.1 20240910 fails to compile due to -Werror=conversion 
(#3166)
    
    * Fix error: conversion from ‘boost::crc_optimal<32, 79764919, 4294967295, 
4294967295, true, true>::value_type’ {aka ‘long unsigned int’} to ‘uint32_t’ 
{aka ‘unsigned int’} may change value [-Werror=conversion]
    
    * Fix error: ‘find_if’ is not a member of ‘std’;
    
    * Fix error: no matching function for call to 
‘find(std::vector<std::__cxx11::basic_string<char> >::const_iterator, 
std::vector<std::__cxx11::basic_string<char> >::const_iterator, const 
std::string&)’
---
 lang/c++/impl/DataFile.cc       | 4 ++--
 lang/c++/impl/Node.cc           | 1 +
 lang/c++/impl/parsing/Symbol.hh | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lang/c++/impl/DataFile.cc b/lang/c++/impl/DataFile.cc
index 66281ae98..8fb4a1aba 100644
--- a/lang/c++/impl/DataFile.cc
+++ b/lang/c++/impl/DataFile.cc
@@ -183,7 +183,7 @@ void DataFileWriterBase::sync() {
         crc.process_bytes(reinterpret_cast<const char *>(temp.data()),
                           temp.size());
         // For Snappy, add the CRC32 checksum
-        int32_t checksum = crc();
+        auto checksum = crc();
 
         // Now compress
         size_t compressed_size = snappy::Compress(
@@ -408,7 +408,7 @@ void DataFileReaderBase::readDataBlock() {
                 "Snappy Compression reported an error when decompressing");
         }
         crc.process_bytes(uncompressed.c_str(), uncompressed.size());
-        uint32_t c = crc();
+        auto c = crc();
         if (checksum != c) {
             throw Exception(
                 "Checksum did not match for Snappy compression: Expected: {}, 
computed: {}",
diff --git a/lang/c++/impl/Node.cc b/lang/c++/impl/Node.cc
index bde556bf3..fd9ee9d6d 100644
--- a/lang/c++/impl/Node.cc
+++ b/lang/c++/impl/Node.cc
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+#include <algorithm>
 #include <cmath>
 #include <unordered_set>
 
diff --git a/lang/c++/impl/parsing/Symbol.hh b/lang/c++/impl/parsing/Symbol.hh
index c8760c34d..bbba58e6a 100644
--- a/lang/c++/impl/parsing/Symbol.hh
+++ b/lang/c++/impl/parsing/Symbol.hh
@@ -19,6 +19,7 @@
 #ifndef avro_parsing_Symbol_hh__
 #define avro_parsing_Symbol_hh__
 
+#include <algorithm>
 #include <map>
 #include <set>
 #include <sstream>

Reply via email to