Skip to content

Commit f4423d2

Browse files
committed
[C++] Fix warnings.
1 parent 4269f36 commit f4423d2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

sbe-tool/src/main/cpp/otf/IrDecoder.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ namespace sbe { namespace otf {
4848
class IrDecoder
4949
{
5050
public:
51-
IrDecoder() :
52-
m_length(0)
51+
IrDecoder()
5352
{
5453
}
5554

@@ -142,7 +141,7 @@ class IrDecoder
142141
// OS specifics
143142
static long long getFileSize(const char *filename)
144143
{
145-
struct stat fileStat;
144+
struct stat fileStat{};
146145

147146
if (::stat(filename, &fileStat) != 0)
148147
{
@@ -165,7 +164,7 @@ class IrDecoder
165164
int fd = fileno(fptr);
166165
while (remaining > 0)
167166
{
168-
unsigned int bytes = static_cast<unsigned int>(4098 < remaining ? 4098 : remaining);
167+
auto bytes = static_cast<unsigned int>(4098 < remaining ? 4098 : remaining);
169168
long long sz = ::read(fd, buffer + (length - remaining), bytes);
170169
remaining -= sz;
171170
if (sz < 0)
@@ -183,8 +182,8 @@ class IrDecoder
183182
std::shared_ptr<std::vector<Token>> m_headerTokens;
184183
std::vector<std::shared_ptr<std::vector<Token>>> m_messages;
185184
std::unique_ptr<char[]> m_buffer;
186-
std::uint64_t m_length;
187-
int m_id;
185+
std::uint64_t m_length = 0;
186+
int m_id = 0;
188187

189188
int decodeIr()
190189
{
@@ -232,10 +231,10 @@ class IrDecoder
232231
tokenCodec.wrapForDecode(
233232
m_buffer.get(), offset, tokenCodec.sbeBlockLength(), tokenCodec.sbeSchemaVersion(), m_length);
234233

235-
Signal signal = static_cast<Signal>(tokenCodec.signal());
236-
PrimitiveType type = static_cast<PrimitiveType>(tokenCodec.primitiveType());
237-
Presence presence = static_cast<Presence>(tokenCodec.presence());
238-
ByteOrder byteOrder = static_cast<ByteOrder>(tokenCodec.byteOrder());
234+
auto signal = static_cast<Signal>(tokenCodec.signal());
235+
auto type = static_cast<PrimitiveType>(tokenCodec.primitiveType());
236+
auto presence = static_cast<Presence>(tokenCodec.presence());
237+
auto byteOrder = static_cast<ByteOrder>(tokenCodec.byteOrder());
239238
std::int32_t tokenOffset = tokenCodec.tokenOffset();
240239
std::int32_t tokenSize = tokenCodec.tokenSize();
241240
std::int32_t id = tokenCodec.fieldId();

0 commit comments

Comments
 (0)