projects
/
asdcplib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Commit fixes found in porting.
[asdcplib.git]
/
src
/
KLV.cpp
diff --git
a/src/KLV.cpp
b/src/KLV.cpp
index f4a1580e51848d34bd0982e97ae2a19cf42e672a..29a1c81639db14d3a600a98ed88db586203f4093 100755
(executable)
--- a/
src/KLV.cpp
+++ b/
src/KLV.cpp
@@
-88,7
+88,8
@@
ASDCP::KLVPacket::InitFromBuffer(const byte_t* buf, ui32_t buf_len)
if ( ! Kumu::read_BER(buf + SMPTE_UL_LENGTH, &tmp_size) )
return RESULT_FAIL;
if ( ! Kumu::read_BER(buf + SMPTE_UL_LENGTH, &tmp_size) )
return RESULT_FAIL;
- m_ValueLength = tmp_size;
+ assert (tmp_size <= 0xFFFFFFFFL);
+ m_ValueLength = (ui32_t) tmp_size;
m_KLLength = SMPTE_UL_LENGTH + Kumu::BER_length(buf + SMPTE_UL_LENGTH);
m_KeyStart = buf;
m_ValueStart = buf + m_KLLength;
m_KLLength = SMPTE_UL_LENGTH + Kumu::BER_length(buf + SMPTE_UL_LENGTH);
m_KeyStart = buf;
m_ValueStart = buf + m_KLLength;
@@
-134,12
+135,12
@@
ASDCP::KLVPacket::Dump(FILE* stream, bool show_hex)
if ( m_KeyStart != 0 )
{
assert(m_ValueStart);
if ( m_KeyStart != 0 )
{
assert(m_ValueStart);
-
- for ( ui32_t i = 0; i < SMPTE_UL_LENGTH; i++ )
-
fprintf(stream, "%02x.", m_KeyStart[i]
);
+ UL TmpUL(m_KeyStart);
+ char buf[64];
+
fprintf(stream, "%s", TmpUL.EncodeString(buf, 64)
);
const MDDEntry* Entry = Dict::FindUL(m_KeyStart);
const MDDEntry* Entry = Dict::FindUL(m_KeyStart);
- fprintf(stream, "
\b len: %7l
u (%s)\n", m_ValueLength, (Entry ? Entry->name : "Unknown"));
+ fprintf(stream, "
len: %7
u (%s)\n", m_ValueLength, (Entry ? Entry->name : "Unknown"));
if ( show_hex && m_ValueLength < 1000 )
Kumu::hexdump(m_ValueStart, Kumu::xmin(m_ValueLength, (ui32_t)64), stream);
if ( show_hex && m_ValueLength < 1000 )
Kumu::hexdump(m_ValueStart, Kumu::xmin(m_ValueLength, (ui32_t)64), stream);
@@
-181,7
+182,7
@@
ASDCP::KLVFilePacket::InitFromFile(const Kumu::FileReader& Reader)
if ( read_count < (SMPTE_UL_LENGTH + 1) )
{
if ( read_count < (SMPTE_UL_LENGTH + 1) )
{
- DefaultLogSink().Error("Short read of Key and Length got %
l
u\n", read_count);
+ DefaultLogSink().Error("Short read of Key and Length got %u\n", read_count);
return RESULT_READFAIL;
}
return RESULT_READFAIL;
}
@@
-208,7
+209,8
@@
ASDCP::KLVFilePacket::InitFromFile(const Kumu::FileReader& Reader)
ui32_t remainder = 0;
ui32_t ber_len = Kumu::BER_length(tmp_data + SMPTE_UL_LENGTH);
m_KLLength = SMPTE_UL_LENGTH + ber_len;
ui32_t remainder = 0;
ui32_t ber_len = Kumu::BER_length(tmp_data + SMPTE_UL_LENGTH);
m_KLLength = SMPTE_UL_LENGTH + ber_len;
- m_ValueLength = tmp_size;
+ assert(tmp_size <= 0xFFFFFFFFL);
+ m_ValueLength = (ui32_t) tmp_size;
ui32_t packet_length = m_ValueLength + m_KLLength;
result = m_Buffer.Capacity(packet_length);
ui32_t packet_length = m_ValueLength + m_KLLength;
result = m_Buffer.Capacity(packet_length);
@@
-238,7
+240,7
@@
ASDCP::KLVFilePacket::InitFromFile(const Kumu::FileReader& Reader)
{
if ( read_count < tmp_read_size )
{
{
if ( read_count < tmp_read_size )
{
- DefaultLogSink().Error("Short read of packet body, expecting %
lu, got %l
u\n",
+ DefaultLogSink().Error("Short read of packet body, expecting %
u, got %
u\n",
m_Buffer.Size(), read_count);
return RESULT_READFAIL;
}
m_Buffer.Size(), read_count);
return RESULT_READFAIL;
}
@@
-252,7
+254,7
@@
ASDCP::KLVFilePacket::InitFromFile(const Kumu::FileReader& Reader)
if ( read_count != remainder )
{
if ( read_count != remainder )
{
- DefaultLogSink().Error("Short read of packet body, expecting %
lu, got %l
u\n",
+ DefaultLogSink().Error("Short read of packet body, expecting %
u, got %
u\n",
remainder+tmp_read_size, read_count+tmp_read_size);
result = RESULT_READFAIL;
}
remainder+tmp_read_size, read_count+tmp_read_size);
result = RESULT_READFAIL;
}