mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-04-04 11:29:57 +08:00
Handle explicitly enum vals in switch [-Wswitch-enum]
This commit is contained in:
parent
b6ee94ec8e
commit
ce606b51fc
6 changed files with 43 additions and 17 deletions
|
@ -243,8 +243,7 @@ static int CmdFlashMemLoad(const char *Cmd) {
|
|||
data[1] = (keycount >> 8) & 0xFF;
|
||||
datalen += 2;
|
||||
break;
|
||||
default:
|
||||
|
||||
case DICTIONARY_NONE:
|
||||
res = loadFile(filename, "bin", data, FLASH_MEM_MAX_SIZE, &datalen);
|
||||
//int res = loadFileEML( filename, "eml", data, &datalen);
|
||||
if (res) {
|
||||
|
|
|
@ -53,9 +53,15 @@ uint8_t mifare_CRC_check(bool isResponse, uint8_t *data, uint8_t len) {
|
|||
case masNone:
|
||||
case masError:
|
||||
return iso14443A_CRC_check(isResponse, data, len);
|
||||
default:
|
||||
return 2;
|
||||
case masNt:
|
||||
case masNrAr:
|
||||
case masAt:
|
||||
case masAuthComplete:
|
||||
case masFirstData:
|
||||
case masData:
|
||||
break;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1024,7 +1030,11 @@ void annotateMifare(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, uint8
|
|||
MifareAuthState = masError;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case masNone:
|
||||
case masError:
|
||||
case masAuthComplete:
|
||||
case masFirstData:
|
||||
case masData:
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -550,9 +550,10 @@ static int CmdLFHitagReader(const char *Cmd) {
|
|||
// No additional parameters needed
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
case WHTSF_CHALLENGE:
|
||||
case WHTSF_KEY:
|
||||
case WHT2F_CRYPTO:
|
||||
return usage_hitag_reader();
|
||||
}
|
||||
}
|
||||
|
||||
c.arg[0] = htf;
|
||||
|
@ -661,9 +662,14 @@ static int CmdLFHitagWriter(const char *Cmd) {
|
|||
num_to_bytes(param_get32ex(Cmd, 3, 0, 16), 4, htd->crypto.data);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
case RHTSF_CHALLENGE:
|
||||
case RHTSF_KEY:
|
||||
case RHT2F_PASSWORD:
|
||||
case RHT2F_AUTHENTICATE:
|
||||
case RHT2F_CRYPTO:
|
||||
case RHT2F_TEST_AUTH_ATTEMPTS:
|
||||
case RHT2F_UID_ONLY:
|
||||
return usage_hitag_writer();
|
||||
}
|
||||
}
|
||||
|
||||
c.arg[0] = htf;
|
||||
|
|
|
@ -238,7 +238,11 @@ static int ndefDecodePayload(NDEFHeader_t *ndef) {
|
|||
PrintAndLogEx(NORMAL, "\ttype: %.*s", ndef->TypeLen, ndef->Type);
|
||||
PrintAndLogEx(NORMAL, "\tpayload: %.*s", ndef->PayloadLen, ndef->Payload);
|
||||
break;
|
||||
default:
|
||||
case tnfEmptyRecord:
|
||||
case tnfMIMEMediaRecord:
|
||||
case tnfExternalRecord:
|
||||
case tnfUnchangedRecord:
|
||||
case tnfUnknownRecord:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -81,7 +81,8 @@ void PrintAndLogEx(logLevel_t level, const char *fmt, ...) {
|
|||
case WARNING:
|
||||
strncpy(prefix, _CYAN_("[!]"), sizeof(prefix) - 1);
|
||||
break;
|
||||
default:
|
||||
case NORMAL:
|
||||
case INFO:
|
||||
strncpy(prefix, prefixes[level], sizeof(prefix) - 1);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ void init_table(CrcType_t crctype) {
|
|||
case CRC_KERMIT:
|
||||
generate_table(CRC16_POLY_CCITT, true);
|
||||
break;
|
||||
default:
|
||||
case CRC_NONE:
|
||||
crc_table_init = false;
|
||||
current_crc_type = CRC_NONE;
|
||||
break;
|
||||
|
@ -178,15 +178,17 @@ void compute_crc(CrcType_t ct, const uint8_t *d, size_t n, uint8_t *first, uint8
|
|||
case CRC_FELICA:
|
||||
crc = crc16_xmodem(d, n);
|
||||
break;
|
||||
//case CRC_LEGIC:
|
||||
case CRC_CCITT:
|
||||
crc = crc16_ccitt(d, n);
|
||||
break;
|
||||
case CRC_KERMIT:
|
||||
crc = crc16_kermit(d, n);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case CRC_LEGIC:
|
||||
// TODO
|
||||
return;
|
||||
case CRC_NONE:
|
||||
return;
|
||||
}
|
||||
*first = (crc & 0xFF);
|
||||
*second = ((crc >> 8) & 0xFF);
|
||||
|
@ -207,11 +209,13 @@ uint16_t Crc16ex(CrcType_t ct, const uint8_t *d, size_t n) {
|
|||
return crc16_iclass(d, n);
|
||||
case CRC_FELICA:
|
||||
return crc16_xmodem(d, n);
|
||||
//case CRC_LEGIC:
|
||||
case CRC_CCITT:
|
||||
return crc16_ccitt(d, n);
|
||||
case CRC_KERMIT:
|
||||
return crc16_kermit(d, n);
|
||||
case CRC_LEGIC:
|
||||
// TODO
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -245,9 +249,11 @@ bool check_crc(CrcType_t ct, const uint8_t *d, size_t n) {
|
|||
return (crc16_iclass(d, n) == 0);
|
||||
case CRC_FELICA:
|
||||
return (crc16_xmodem(d, n) == 0);
|
||||
//case CRC_LEGIC:
|
||||
case CRC_CCITT:
|
||||
return (crc16_ccitt(d, n) == 0);
|
||||
case CRC_LEGIC:
|
||||
// TODO
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue