CSN.1: Optimize update of remaining_bits_len dissecting CSN_UINT_ARRAY

No need to decrement it every loop. Furthermore, when more types are
supported, same line can be reused.

Change-Id: Ic61c2e839d8dcb0e035172d706978a18b16520df
Reviewed-on: https://code.wireshark.org/review/36592
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
This commit is contained in:
Pau Espin 2020-03-26 20:00:28 +01:00 committed by Pascal Quantin
parent 543c55b2c0
commit f9fdf327ce
1 changed files with 2 additions and 3 deletions

View File

@ -404,6 +404,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (remaining_bits_len >= (no_of_bits * nCount))
{
remaining_bits_len -= (no_of_bits * nCount);
if (no_of_bits <= 8)
{
pui8 = pui8DATA(data, pDescr->offset);
@ -411,7 +412,6 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
{
*pui8++ = tvb_get_bits8(tvb, bit_offset, no_of_bits);
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, *pui8, " (Count %d)", i++);
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;
} while (--nCount > 0);
}
@ -875,6 +875,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (remaining_bits_len >= (no_of_bits * nCount))
{
remaining_bits_len -= (no_of_bits * nCount);
if (no_of_bits <= 8)
{
pui8 = pui8DATA(data, pDescr->offset);
@ -884,7 +885,6 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
*pui8 = tvb_get_bits8(tvb, bit_offset, no_of_bits);
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, *pui8, " (Count %d)", i++);
pui8++;
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;
nCount--;
}
@ -897,7 +897,6 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
{
*pui16 = tvb_get_bits16(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, *pui16, " (Count %d)", i++);
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;
nCount--;
}