Move some variables inside the block where they're used.

They're not used outside a block, so move them inside the block.  Also,
they're set before they're used, so don't initialize them when they're
declared.

This should squelch some unreadVariable warnings from cppcheck.

Fix indentation of a line of code while we're at it.
This commit is contained in:
Guy Harris 2021-01-20 00:44:31 -08:00
parent 97a168747f
commit 28d89773fb
1 changed files with 5 additions and 3 deletions

View File

@ -50,9 +50,10 @@ static const guint8 crctable[256] = { /*reversed, 8-bit, poly=0x07*/
gboolean check_fcs(tvbuff_t *p, guint8 len, guint8 offset, guint8 received_fcs){
/*Init*/
guint8 FCS = 0xFF;
guint8 tmp = 0;
/*len is the number of bytes in the message, p points to message*/
while (len--) {
guint8 tmp;
tmp = FCS^tvb_get_guint8(p,offset);
offset++;
FCS=crctable[tmp];
@ -72,9 +73,10 @@ gboolean check_fcs(tvbuff_t *p, guint8 len, guint8 offset, guint8 received_fcs){
guint8 get_crc8_ieee8023_epon(tvbuff_t *p, guint8 len, guint8 offset) {
guint8 FCS = 0x00;
guint8 tmp = 0;
while (len--) {
while (len--) {
guint8 tmp;
tmp = FCS^tvb_get_guint8(p,offset);
offset++;
FCS=crctable[tmp];