From 0e2dbe742462ade60c2a5613266ea46dff14d14e Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 8 Sep 2018 11:18:10 +0200 Subject: [PATCH] chg: code cleanup --- client/cmdanalyse.c | 12 ++++++------ client/cmddata.c | 8 ++++---- client/cmdflashmem.c | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/client/cmdanalyse.c b/client/cmdanalyse.c index 490dda9d3..f756a44c0 100644 --- a/client/cmdanalyse.c +++ b/client/cmdanalyse.c @@ -244,8 +244,8 @@ int CmdAnalyseLfsr(const char *Cmd){ } int CmdAnalyseLCR(const char *Cmd) { uint8_t data[50]; - char cmdp = param_getchar(Cmd, 0); - if (strlen(Cmd) == 0|| cmdp == 'h' || cmdp == 'H') return usage_analyse_lcr(); + char cmdp = tolower(param_getchar(Cmd, 0)); + if (strlen(Cmd) == 0|| cmdp == 'h') return usage_analyse_lcr(); int len = 0; switch (param_gethex_to_eol(Cmd, 0, data, sizeof(data), &len)) { @@ -265,8 +265,8 @@ int CmdAnalyseLCR(const char *Cmd) { } int CmdAnalyseCRC(const char *Cmd) { - char cmdp = param_getchar(Cmd, 0); - if (strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') return usage_analyse_crc(); + char cmdp = tolower(param_getchar(Cmd, 0)); + if (strlen(Cmd) == 0 || cmdp == 'h') return usage_analyse_crc(); int len = strlen(Cmd); if ( len & 1 ) return usage_analyse_crc(); @@ -867,8 +867,8 @@ int CmdAnalyseNuid(const char *Cmd){ uint8_t nuid[4] = {0}; uint8_t uid[7] = {0}; int len = 0; - char cmdp = param_getchar(Cmd, 0); - if (strlen(Cmd) == 0|| cmdp == 'h' || cmdp == 'H') return usage_analyse_nuid(); + char cmdp = tolower(param_getchar(Cmd, 0)); + if (strlen(Cmd) == 0|| cmdp == 'h') return usage_analyse_nuid(); /* selftest UID 040D681AB52281 -> NUID 8F430FEF */ if (cmdp == 't' || cmdp == 'T') { diff --git a/client/cmddata.c b/client/cmddata.c index 61e182ca3..7d8cef081 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -701,8 +701,8 @@ int ASKbiphaseDemod(const char *Cmd, bool verbose) //by marshmellow - see ASKbiphaseDemod int Cmdaskbiphdemod(const char *Cmd) { - char cmdp = param_getchar(Cmd, 0); - if (strlen(Cmd) > 25 || cmdp == 'h' || cmdp == 'H') return usage_data_rawdemod_ab(); + char cmdp = tolower(param_getchar(Cmd, 0)); + if (strlen(Cmd) > 25 || cmdp == 'h') return usage_data_rawdemod_ab(); return ASKbiphaseDemod(Cmd, true); } @@ -710,8 +710,8 @@ int Cmdaskbiphdemod(const char *Cmd) //by marshmellow - see ASKDemod int Cmdaskrawdemod(const char *Cmd) { - char cmdp = param_getchar(Cmd, 0); - if (strlen(Cmd) > 25 || cmdp == 'h' || cmdp == 'H') return usage_data_rawdemod_ar(); + char cmdp = tolower(param_getchar(Cmd, 0)); + if (strlen(Cmd) > 25 || cmdp == 'h') return usage_data_rawdemod_ar(); return ASKDemod(Cmd, true, false, 0); } diff --git a/client/cmdflashmem.c b/client/cmdflashmem.c index 43230218f..d6d27e6fc 100644 --- a/client/cmdflashmem.c +++ b/client/cmdflashmem.c @@ -139,10 +139,10 @@ int CmdFlashMemRead(const char *Cmd) { int CmdFlashmemSpiBaudrate(const char *Cmd) { - char ctmp = param_getchar(Cmd, 0); - if (strlen(Cmd) < 1 || ctmp == 'h' || ctmp == 'H') return usage_flashmem_spibaud(); + char ctmp = tolower(param_getchar(Cmd, 0)); + if (strlen(Cmd) < 1 || ctmp == 'h') return usage_flashmem_spibaud(); uint32_t baudrate = param_get32ex(Cmd, 0, 0, 10); - baudrate = baudrate*1000000; + baudrate = baudrate * 1000000; if (baudrate != FLASH_BAUD && baudrate != FLASH_MINBAUD ) return usage_flashmem_spibaud(); UsbCommand c = {CMD_FLASHMEM_SET_SPIBAUDRATE, {baudrate, 0, 0}}; SendCommand(&c);