csn1: Extend CSN_SERIALIZE to allow 0 bit of length
Port of wireshark.git 2f024256bf337400ef3a82fa75e6d48d5707e059. From c6ee558d3bb00bfd25cca7c534448bf60df3c7cf Mon Sep 17 00:00:00 2001 From: Sylvain Munaut <tnt@246tNt.com> Date: Sat, 4 Feb 2012 10:24:01 +0100 Subject: [PATCH 6/6] packet-csn: Extend CSN_SERIALIZE to allow 0 bit of length In some coding there is no 'length' field at the top of a serialized block, or it's more complex than a single field, in which case we have to rely on the serialize decoder to consume the correct number of bits. We extend the CSN_SERIALIZE processing so that if a '0 bit' length field is specified, then the length is not displayed and the consumed bits by the serialize function is taken as the length at posteriori. The processing keeps the same behavior for any length > 0. Change-Id: I9fadc99218594447001f7bb9943f4514b9877799
This commit is contained in:
parent
c0b4f4a633
commit
98e4c53cad
11
src/csn1.cpp
11
src/csn1.cpp
|
@ -548,15 +548,20 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, unsig
|
|||
bit_offset += length_len;
|
||||
remaining_bits_len -= length_len;
|
||||
|
||||
csnStreamInit(&arT, bit_offset, length);
|
||||
csnStreamInit(&arT, bit_offset, length > 0 ? length : remaining_bits_len);
|
||||
arT.direction = 1;
|
||||
LOGPC(DCSN1, LOGL_NOTICE, "ptr = %p | offset = %d | ", (void *)data, (int)pDescr->offset);
|
||||
Status = serialize(&arT, vector, readIndex, pvDATA(data, pDescr->offset));
|
||||
|
||||
if (Status >= 0)
|
||||
{
|
||||
remaining_bits_len -= length;
|
||||
bit_offset += length;
|
||||
if (length > 0) {
|
||||
remaining_bits_len -= length;
|
||||
bit_offset += length;
|
||||
} else {
|
||||
remaining_bits_len = arT.remaining_bits_len;
|
||||
bit_offset = arT.bit_offset;
|
||||
}
|
||||
pDescr++;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue