From 1c8c1d82eaf28edf3279730f66198529023a69c1 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 14 May 2020 01:01:48 +0200 Subject: [PATCH] fix coverity 267211 & 267206 logically dead code --- armsrc/hitag2.c | 32 +++++++++++++++++++------------- include/hitag.h | 3 +++ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/armsrc/hitag2.c b/armsrc/hitag2.c index 4387bdbb0..b58ca1b81 100644 --- a/armsrc/hitag2.c +++ b/armsrc/hitag2.c @@ -1397,21 +1397,23 @@ void ReaderHitag(hitag_function htf, hitag_data *htd) { uint8_t attempt_count = 0; // Tag specific configuration settings (sof, timings, etc.) - if (htf < 10) { +// TODO HTS +/* if (htf <= HTS_LAST_CMD) { // hitagS settings t_wait_1 = 204; t_wait_2 = 128; flipped_bit = 0; tag_size = 8; DBG DbpString("Configured for hitagS reader"); - } else if (htf < 20) { + } else */ + if (htf <= HT1_LAST_CMD) { // hitag1 settings t_wait_1 = 204; t_wait_2 = 128; tag_size = 256; flipped_bit = 0; DBG DbpString("Configured for hitag1 reader"); - } else if (htf < 30) { + } else if (htf <= HT2_LAST_CMD) { // hitag2 settings t_wait_1 = HITAG_T_WAIT_1_MIN; t_wait_2 = HITAG_T_WAIT_2_MIN; @@ -1721,28 +1723,32 @@ void WriterHitag(hitag_function htf, hitag_data *htd, int page) { lf_init(true, false); // Tag specific configuration settings (sof, timings, etc.) - if (htf < 10) { +// TODO HTS +/* if (htf <= HTS_LAST_CMD) { // hitagS settings t_wait_1 = 204; t_wait_2 = 128; - /*tag_size = 256;*/ + //tag_size = 256; flipped_bit = 0; tag_size = 8; DbpString("Configured for hitagS writer"); - } else if (htf < 20) { + } else */ +// TODO HT1 +/* if (htf <= HT1_LAST_CMD) { // hitag1 settings t_wait_1 = 204; t_wait_2 = 128; tag_size = 256; flipped_bit = 0; DbpString("Configured for hitag1 writer"); - } else if (htf < 30) { - // hitag2 settings - t_wait_1 = HITAG_T_WAIT_1_MIN; - t_wait_2 = HITAG_T_WAIT_2_MIN; - tag_size = 48; - DbpString("Configured for hitag2 writer"); - } + } else */ +// if (htf <= HT2_LAST_CMD) { + // hitag2 settings + t_wait_1 = HITAG_T_WAIT_1_MIN; + t_wait_2 = HITAG_T_WAIT_2_MIN; + tag_size = 48; + DbpString("Configured for hitag2 writer"); +// } uint8_t tag_modulation; size_t max_nrzs = (8 * HITAG_FRAME_LEN + 5) * 2; // up to 2 nrzs per bit diff --git a/include/hitag.h b/include/hitag.h index af90c9f88..14231bdeb 100644 --- a/include/hitag.h +++ b/include/hitag.h @@ -21,8 +21,10 @@ typedef enum { RHTSF_KEY = 02, WHTSF_CHALLENGE = 03, WHTSF_KEY = 04, + HTS_LAST_CMD = WHTSF_KEY, RHT1F_PLAIN = 11, RHT1F_AUTHENTICATE = 12, + HT1_LAST_CMD = RHT1F_AUTHENTICATE, RHT2F_PASSWORD = 21, RHT2F_AUTHENTICATE = 22, RHT2F_CRYPTO = 23, @@ -30,6 +32,7 @@ typedef enum { RHT2F_TEST_AUTH_ATTEMPTS = 25, RHT2F_UID_ONLY = 26, WHT2F_PASSWORD = 27, + HT2_LAST_CMD = WHT2F_PASSWORD, } hitag_function; typedef struct {