From 6ccbc16e74b132ee7fb770637be680bb4dac55a3 Mon Sep 17 00:00:00 2001 From: gornekich Date: Wed, 29 May 2024 16:53:12 +0100 Subject: [PATCH] mf plus: code clean up --- lib/nfc/protocols/mf_plus/mf_plus.h | 6 ++---- lib/nfc/protocols/mf_plus/mf_plus_i.c | 2 +- lib/nfc/protocols/mf_plus/mf_plus_poller.c | 5 ++--- lib/nfc/protocols/mf_plus/mf_plus_poller_i.c | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/nfc/protocols/mf_plus/mf_plus.h b/lib/nfc/protocols/mf_plus/mf_plus.h index 828d1c070..31559ffdc 100644 --- a/lib/nfc/protocols/mf_plus/mf_plus.h +++ b/lib/nfc/protocols/mf_plus/mf_plus.h @@ -2,13 +2,11 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif -#define MF_PLUS_UID_SIZE (7) +#define MF_PLUS_UID_SIZE_MAX (7) #define MF_PLUS_BATCH_SIZE (5) #define MF_PLUS_CMD_GET_VERSION (0x60) @@ -71,7 +69,7 @@ typedef struct { uint8_t sw_storage; uint8_t sw_proto; - uint8_t uid[MF_PLUS_UID_SIZE]; + uint8_t uid[MF_PLUS_UID_SIZE_MAX]; uint8_t batch[MF_PLUS_BATCH_SIZE]; uint8_t prod_week; uint8_t prod_year; diff --git a/lib/nfc/protocols/mf_plus/mf_plus_i.c b/lib/nfc/protocols/mf_plus/mf_plus_i.c index 89bd9dcf7..ca19b458b 100644 --- a/lib/nfc/protocols/mf_plus/mf_plus_i.c +++ b/lib/nfc/protocols/mf_plus/mf_plus_i.c @@ -420,4 +420,4 @@ bool mf_plus_size_save(const MfPlusSize* data, FlipperFormat* ff) { furi_string_free(size_string); return true; -} \ No newline at end of file +} diff --git a/lib/nfc/protocols/mf_plus/mf_plus_poller.c b/lib/nfc/protocols/mf_plus/mf_plus_poller.c index a5ba70817..2cd3a57ca 100644 --- a/lib/nfc/protocols/mf_plus/mf_plus_poller.c +++ b/lib/nfc/protocols/mf_plus/mf_plus_poller.c @@ -139,13 +139,12 @@ static void mf_plus_poller_set_callback( } static NfcCommand mf_plus_poller_run(NfcGenericEvent event, void* context) { + furi_assert(context); furi_assert(event.protocol = NfcProtocolIso14443_4a); + furi_assert(event.event_data); MfPlusPoller* instance = context; - furi_assert(instance); - const Iso14443_4aPollerEvent* iso14443_4a_event = event.event_data; - furi_assert(iso14443_4a_event); NfcCommand command = NfcCommandContinue; diff --git a/lib/nfc/protocols/mf_plus/mf_plus_poller_i.c b/lib/nfc/protocols/mf_plus/mf_plus_poller_i.c index abc97b82e..3750abf42 100644 --- a/lib/nfc/protocols/mf_plus/mf_plus_poller_i.c +++ b/lib/nfc/protocols/mf_plus/mf_plus_poller_i.c @@ -55,7 +55,7 @@ MfPlusError mf_plus_poller_read_version(MfPlusPoller* instance, MfPlusVersion* d bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_PLUS_CMD_GET_VERSION); - MfPlusError error; + MfPlusError error = MfPlusErrorNone; do { error =