Skip to content

Commit db654ef

Browse files
committed
[C++]: make usable. aeron-io#643.
1 parent a178510 commit db654ef

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,17 @@ class IrDecoder
5353
{
5454
}
5555

56-
int decode(char *buffer, std::uint64_t length)
56+
int decode(char *irBuffer, std::uint64_t length)
5757
{
5858
m_length = length;
59+
if (m_length == 0)
60+
{
61+
return -1;
62+
}
63+
std::unique_ptr<char[]> buffer(new char[m_length]);
64+
m_buffer = std::move(buffer);
65+
std::memcpy(m_buffer.get(), irBuffer, m_length);
66+
5967
return decodeIr();
6068
}
6169

@@ -81,7 +89,7 @@ class IrDecoder
8189
return -1;
8290
}
8391

84-
return decode(m_buffer.get(), m_length);
92+
return decodeIr();
8593
}
8694

8795
std::shared_ptr<std::vector<Token>> header()

0 commit comments

Comments
 (0)