From 2d3029ddae1ade2769bcb8b30e597db25dd56d1f Mon Sep 17 00:00:00 2001 From: hexagonhill <72534304+hexagonhill@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:18:54 +0000 Subject: [PATCH] [C++] g++ (GCC) 14.2.1 20240910 fails to compile due to -Werror=conversion (#3166) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 >::const_iterator, std::vector >::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 66281ae9820..8fb4a1abaa7 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(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 bde556bf314..fd9ee9d6dcf 100644 --- a/lang/c++/impl/Node.cc +++ b/lang/c++/impl/Node.cc @@ -16,6 +16,7 @@ * limitations under the License. */ +#include #include #include diff --git a/lang/c++/impl/parsing/Symbol.hh b/lang/c++/impl/parsing/Symbol.hh index c8760c34dfa..bbba58e6a0e 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 #include #include #include