Skip to content

Commit

Permalink
tidy: Replace sparse DSMCC "switch" statement with an "if" statement.
Browse files Browse the repository at this point in the history
The clang-tidy bugprone "branch clone" checker pointed out a ten item
switch statement that only processed a single value.  Replace this
"switch" statement with an "if" statement to eliminate the redundant
branch warnings.  Leave a comment with the value/name pairs that were
part of the original switch statement.

https://clang.llvm.org/extra/clang-tidy/checks/bugprone-branch-clone.html
  • Loading branch information
linuxdude42 committed Nov 27, 2019
1 parent f855c53 commit f829115
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions mythtv/libs/libmythtv/mheg/dsmccbiop.cpp
Expand Up @@ -327,32 +327,24 @@ void ModuleDescriptorData::Process(const unsigned char *data, int length)
unsigned char tag = *data++;
unsigned char len = *data++;
length -= 2;
switch (tag)

// Tags:
// case 0x01: // Type
// case 0x02: // Name
// case 0x03: // Info
// case 0x04: // Modlink
// case 0x05: // CRC
// case 0x06: // Location
// case 0x07: // DLtime
// case 0x08: // Grouplink
// case 0x09: // Compressed.
if (tag == 0x09)
{
case 0x01: // Type
break;
case 0x02: // Name
break;
case 0x03: // Info
break;
case 0x04: // Modlink
break;
case 0x05: // CRC
break;
case 0x06: // Location
break;
case 0x07: // DLtime
break;
case 0x08: // Grouplink
break;
case 0x09: // Compressed.
// Skip the method.
m_isCompressed = true;
m_originalSize = COMBINE32(data, 1);
break;
default:
break;
}

length -= len;
data += len;
}
Expand Down

0 comments on commit f829115

Please sign in to comment.