Skip to content

Conversation

@mstr0bl
Copy link

@mstr0bl mstr0bl commented Oct 7, 2020

The relevant modifications are referred to as "macdis" and "c4enc"

case MBNG_EVENT_ENC_MODE_C4ENC:
if( item->value != 0x00 ) {
if(item->value < 0x40){
switch(item->value){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a switch() statement it would be better to use range checks here in case values are processed which are not explicitly mentioned here (for whatever reason…)

E.g.:
if( item->value <= 1 ) incrementer = 1;
else if( item->value <=4 ) incrementer = 2;
else if( item->value <=8 ) incrementer= 4;

}
else{
switch(item->value){
case 0x41: incrementer = -1; break;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here: range checks would be better

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about mbng_enc.c line 223 onwards?

case MBNG_EVENT_ENC_MODE_C4ENC: if(event_incrementer > 0){ switch(event_incrementer){ case 1: item.value = 0x01; break; case 2: item.value = 0x04; break; case 4: item.value = 0x08; break;
And so on..

Is a range check more efficient in that case too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants