Fix 'warning: this statement may fall through [-Wimplicit-fallthrough=]'

Closes #532
This commit is contained in:
Kristian Sloth Lauszus 2020-11-15 23:27:08 +01:00
parent 30931efed8
commit edc5198976
5 changed files with 15 additions and 0 deletions

View file

@ -108,12 +108,14 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
theBuffer.valueSize = 2;
valParser.Initialize(&theBuffer);
stateParseDescr = 1;
// fall through
case 1:
if(!valParser.Parse(pp, pcntdn))
return false;
dscrLen = *((uint8_t*)theBuffer.pValue);
dscrType = *((uint8_t*)theBuffer.pValue + 1);
stateParseDescr = 2;
// fall through
case 2:
// This is a sort of hack. Assuming that two bytes are all ready in the buffer
// the pointer is positioned two bytes ahead in order for the rest of descriptor
@ -122,6 +124,7 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
// in the buffer.
theBuffer.pValue = varBuffer + 2;
stateParseDescr = 3;
// fall through
case 3:
switch(dscrType) {
case USB_DESCRIPTOR_INTERFACE:
@ -135,6 +138,7 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
theBuffer.valueSize = dscrLen - 2;
valParser.Initialize(&theBuffer);
stateParseDescr = 4;
// fall through
case 4:
switch(dscrType) {
case USB_DESCRIPTOR_CONFIGURATION:

View file

@ -1113,16 +1113,19 @@ uint8_t ReportDescParserBase::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
if(!pcntdn)
return enErrorIncomplete;
// fall through
case 1:
//USBTRACE2("\r\niSz:",itemSize);
theBuffer.valueSize = itemSize;
valParser.Initialize(&theBuffer);
itemParseState = 2;
// fall through
case 2:
if(!valParser.Parse(pp, pcntdn))
return enErrorIncomplete;
itemParseState = 3;
// fall through
case 3:
{
uint8_t data = *((uint8_t*)varBuffer);
@ -1448,14 +1451,17 @@ uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
if(!pcntdn)
return enErrorIncomplete;
// fall through
case 1:
theBuffer.valueSize = itemSize;
valParser.Initialize(&theBuffer);
itemParseState = 2;
// fall through
case 2:
if(!valParser.Parse(pp, pcntdn))
return enErrorIncomplete;
itemParseState = 3;
// fall through
case 3:
{
uint8_t data = *((uint8_t*)varBuffer);

View file

@ -44,6 +44,7 @@ bool PTPListParser::Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf,
pBuf->valueSize = lenSize;
theParser.Initialize(pBuf);
nStage = 1;
// fall through
case 1:
if(!theParser.Parse(pp, pcntdn))
@ -53,11 +54,13 @@ bool PTPListParser::Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf,
arLen = (pBuf->valueSize >= 4) ? *((uint32_t*)pBuf->pValue) : (uint32_t)(*((uint16_t*)pBuf->pValue));
arLenCntdn = arLen;
nStage = 2;
// fall through
case 2:
pBuf->valueSize = valSize;
theParser.Initialize(pBuf);
nStage = 3;
// fall through
case 3:
for(; arLenCntdn; arLenCntdn--) {

View file

@ -79,6 +79,7 @@ public:
case 0:
countDown = bytes_to_skip;
nStage++;
// fall through
case 1:
for(; countDown && (*pcntdn); countDown--, (*pp)++, (*pcntdn)--);

View file

@ -589,6 +589,7 @@ uint8_t USBH_MIDI::SendSysEx(uint8_t *dataptr, uint16_t datasize, uint8_t nCable
break;
case 3 :
buf[wptr] = (nCable << 4) | 0x7; //x7 SysEx ends with following three bytes.
// fall through
default :
wptr++;
buf[wptr++] = *(dataptr++);