diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index 2a9af34..5817e7c 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -323,7 +323,7 @@ typedef enum { NMT_FELICA, NMT_DEP, NMT_ISO14443BICLASS, // HID iClass 14443B mode - NMT_END_ENUM, // dummy for sizing - always should be last + NMT_END_ENUM = NMT_ISO14443BICLASS, // dummy for sizing - always should alias last } nfc_modulation_type; /** diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 3689adb..4dc2a15 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -86,7 +86,7 @@ pn53x_init(struct nfc_device *pnd) } if (!CHIP_DATA(pnd)->supported_modulation_as_initiator) { - CHIP_DATA(pnd)->supported_modulation_as_initiator = malloc(sizeof(nfc_modulation_type) * (NMT_END_ENUM)); + CHIP_DATA(pnd)->supported_modulation_as_initiator = malloc(sizeof(nfc_modulation_type) * (NMT_END_ENUM + 1)); if (! CHIP_DATA(pnd)->supported_modulation_as_initiator) return NFC_ESOFT; int nbSupportedModulation = 0; @@ -629,8 +629,6 @@ pn53x_decode_target_data(const uint8_t *pbtRawData, size_t szRawData, pn53x_type // Should not happend... case NMT_DEP: return NFC_ECHIP; - case NMT_END_ENUM: - break; } return NFC_SUCCESS; } @@ -2355,8 +2353,6 @@ pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt) case NMT_ISO14443BICLASS: ret = pn53x_ISO14443B_ICLASS_is_present(pnd); break; - case NMT_END_ENUM: - break; } if (ret == NFC_ETGRELEASED) pn53x_current_target_free(pnd); @@ -2410,7 +2406,6 @@ pn53x_target_init(struct nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, const case NMT_ISO14443BICLASS: case NMT_JEWEL: case NMT_BARCODE: - case NMT_END_ENUM: pnd->last_error = NFC_EDEVNOTSUPP; return pnd->last_error; } @@ -2514,7 +2509,6 @@ pn53x_target_init(struct nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, const case NMT_ISO14443BICLASS: case NMT_JEWEL: case NMT_BARCODE: - case NMT_END_ENUM: pnd->last_error = NFC_EDEVNOTSUPP; return pnd->last_error; } @@ -2672,8 +2666,6 @@ pn53x_target_receive_bytes(struct nfc_device *pnd, uint8_t *pbtRx, const size_t case NMT_FELICA: abtCmd[0] = TgGetInitiatorCommand; break; - case NMT_END_ENUM: - break; } } else { abtCmd[0] = TgGetInitiatorCommand; @@ -2781,8 +2773,6 @@ pn53x_target_send_bytes(struct nfc_device *pnd, const uint8_t *pbtTx, const size case NMT_FELICA: abtCmd[0] = TgResponseToInitiator; break; - case NMT_END_ENUM: - break; } } else { abtCmd[0] = TgResponseToInitiator; @@ -3442,7 +3432,6 @@ pn53x_nm_to_pm(const nfc_modulation nm) case NMT_ISO14443B2SR: case NMT_ISO14443B2CT: case NMT_DEP: - case NMT_END_ENUM: // Nothing to do... break; } @@ -3540,7 +3529,6 @@ pn53x_nm_to_ptt(const nfc_modulation nm) case NMT_ISO14443B2CT: case NMT_BARCODE: case NMT_DEP: - case NMT_END_ENUM: // Nothing to do... break; } @@ -3601,7 +3589,6 @@ pn53x_get_supported_baud_rate(nfc_device *pnd, const nfc_mode mode, const nfc_mo case NMT_DEP: *supported_br = (nfc_baud_rate *)pn53x_dep_supported_baud_rates; break; - case NMT_END_ENUM: default: return NFC_EINVARG; } diff --git a/libnfc/nfc-internal.c b/libnfc/nfc-internal.c index e78a288..b57b97c 100644 --- a/libnfc/nfc-internal.c +++ b/libnfc/nfc-internal.c @@ -195,8 +195,6 @@ prepare_initiator_data(const nfc_modulation nm, uint8_t **ppbtInitiatorData, siz *ppbtInitiatorData = NULL; *pszInitiatorData = 0; break; - case NMT_END_ENUM: - break; } } diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 8e003c2..8c12578 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -1404,8 +1404,6 @@ str_nfc_modulation_type(const nfc_modulation_type nmt) return "Thinfilm NFC Barcode"; case NMT_DEP: return "D.E.P."; - case NMT_END_ENUM: - break; } return "???"; diff --git a/libnfc/target-subr.c b/libnfc/target-subr.c index 3bd97e4..e3f09c5 100644 --- a/libnfc/target-subr.c +++ b/libnfc/target-subr.c @@ -687,8 +687,6 @@ snprint_nfc_target(char *dst, size_t size, const nfc_target *pnt, bool verbose) case NMT_DEP: snprint_nfc_dep_info(dst + off, size - off, &pnt->nti.ndi, verbose); break; - case NMT_END_ENUM: - break; } } }