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

View file

@ -1113,16 +1113,19 @@ uint8_t ReportDescParserBase::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
if(!pcntdn) if(!pcntdn)
return enErrorIncomplete; return enErrorIncomplete;
// fall through
case 1: case 1:
//USBTRACE2("\r\niSz:",itemSize); //USBTRACE2("\r\niSz:",itemSize);
theBuffer.valueSize = itemSize; theBuffer.valueSize = itemSize;
valParser.Initialize(&theBuffer); valParser.Initialize(&theBuffer);
itemParseState = 2; itemParseState = 2;
// fall through
case 2: case 2:
if(!valParser.Parse(pp, pcntdn)) if(!valParser.Parse(pp, pcntdn))
return enErrorIncomplete; return enErrorIncomplete;
itemParseState = 3; itemParseState = 3;
// fall through
case 3: case 3:
{ {
uint8_t data = *((uint8_t*)varBuffer); uint8_t data = *((uint8_t*)varBuffer);
@ -1448,14 +1451,17 @@ uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
if(!pcntdn) if(!pcntdn)
return enErrorIncomplete; return enErrorIncomplete;
// fall through
case 1: case 1:
theBuffer.valueSize = itemSize; theBuffer.valueSize = itemSize;
valParser.Initialize(&theBuffer); valParser.Initialize(&theBuffer);
itemParseState = 2; itemParseState = 2;
// fall through
case 2: case 2:
if(!valParser.Parse(pp, pcntdn)) if(!valParser.Parse(pp, pcntdn))
return enErrorIncomplete; return enErrorIncomplete;
itemParseState = 3; itemParseState = 3;
// fall through
case 3: case 3:
{ {
uint8_t data = *((uint8_t*)varBuffer); 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; pBuf->valueSize = lenSize;
theParser.Initialize(pBuf); theParser.Initialize(pBuf);
nStage = 1; nStage = 1;
// fall through
case 1: case 1:
if(!theParser.Parse(pp, pcntdn)) 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)); arLen = (pBuf->valueSize >= 4) ? *((uint32_t*)pBuf->pValue) : (uint32_t)(*((uint16_t*)pBuf->pValue));
arLenCntdn = arLen; arLenCntdn = arLen;
nStage = 2; nStage = 2;
// fall through
case 2: case 2:
pBuf->valueSize = valSize; pBuf->valueSize = valSize;
theParser.Initialize(pBuf); theParser.Initialize(pBuf);
nStage = 3; nStage = 3;
// fall through
case 3: case 3:
for(; arLenCntdn; arLenCntdn--) { for(; arLenCntdn; arLenCntdn--) {

View file

@ -79,6 +79,7 @@ public:
case 0: case 0:
countDown = bytes_to_skip; countDown = bytes_to_skip;
nStage++; nStage++;
// fall through
case 1: case 1:
for(; countDown && (*pcntdn); countDown--, (*pp)++, (*pcntdn)--); 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; break;
case 3 : case 3 :
buf[wptr] = (nCable << 4) | 0x7; //x7 SysEx ends with following three bytes. buf[wptr] = (nCable << 4) | 0x7; //x7 SysEx ends with following three bytes.
// fall through
default : default :
wptr++; wptr++;
buf[wptr++] = *(dataptr++); buf[wptr++] = *(dataptr++);