From f4423d2dac2cb9b852c30934e2ab33240fe65f9c Mon Sep 17 00:00:00 2001 From: mjpt777 Date: Mon, 29 Jan 2024 12:00:31 +0000 Subject: [PATCH] [C++] Fix warnings. --- sbe-tool/src/main/cpp/otf/IrDecoder.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sbe-tool/src/main/cpp/otf/IrDecoder.h b/sbe-tool/src/main/cpp/otf/IrDecoder.h index 6374fecdd2..0b5c048669 100644 --- a/sbe-tool/src/main/cpp/otf/IrDecoder.h +++ b/sbe-tool/src/main/cpp/otf/IrDecoder.h @@ -48,8 +48,7 @@ namespace sbe { namespace otf { class IrDecoder { public: - IrDecoder() : - m_length(0) + IrDecoder() { } @@ -142,7 +141,7 @@ class IrDecoder // OS specifics static long long getFileSize(const char *filename) { - struct stat fileStat; + struct stat fileStat{}; if (::stat(filename, &fileStat) != 0) { @@ -165,7 +164,7 @@ class IrDecoder int fd = fileno(fptr); while (remaining > 0) { - unsigned int bytes = static_cast(4098 < remaining ? 4098 : remaining); + auto bytes = static_cast(4098 < remaining ? 4098 : remaining); long long sz = ::read(fd, buffer + (length - remaining), bytes); remaining -= sz; if (sz < 0) @@ -183,8 +182,8 @@ class IrDecoder std::shared_ptr> m_headerTokens; std::vector>> m_messages; std::unique_ptr m_buffer; - std::uint64_t m_length; - int m_id; + std::uint64_t m_length = 0; + int m_id = 0; int decodeIr() { @@ -232,10 +231,10 @@ class IrDecoder tokenCodec.wrapForDecode( m_buffer.get(), offset, tokenCodec.sbeBlockLength(), tokenCodec.sbeSchemaVersion(), m_length); - Signal signal = static_cast(tokenCodec.signal()); - PrimitiveType type = static_cast(tokenCodec.primitiveType()); - Presence presence = static_cast(tokenCodec.presence()); - ByteOrder byteOrder = static_cast(tokenCodec.byteOrder()); + auto signal = static_cast(tokenCodec.signal()); + auto type = static_cast(tokenCodec.primitiveType()); + auto presence = static_cast(tokenCodec.presence()); + auto byteOrder = static_cast(tokenCodec.byteOrder()); std::int32_t tokenOffset = tokenCodec.tokenOffset(); std::int32_t tokenSize = tokenCodec.tokenSize(); std::int32_t id = tokenCodec.fieldId();